From 3eef54d43a752f7a46a0f53689d5f557115299f9 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Tue, 9 Dec 2025 16:31:57 +0530 Subject: [PATCH 1/2] fix: avoid false positives in consistency check Alias elimination adds `~ 0` constraints for underdetermined variables --- src/systems/systemstructure.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/systems/systemstructure.jl b/src/systems/systemstructure.jl index 6d65dc9418..3c5601d055 100644 --- a/src/systems/systemstructure.jl +++ b/src/systems/systemstructure.jl @@ -1009,12 +1009,12 @@ function _mtkcompile!(state::TearingState; state = ModelingToolkit.inputs_to_parameters!(state, discrete_inputs) ModelingToolkit.markio!(state, Set(), inputs, outputs, disturbance_inputs) state = ModelingToolkit.inputs_to_parameters!(state, [inputs; disturbance_inputs]) - trivial_tearing!(state) - sys, mm = ModelingToolkit.alias_elimination!(state; fully_determined, kwargs...) if check_consistency fully_determined = ModelingToolkit.check_consistency( state, orig_inputs; nothrow = fully_determined === nothing) end + trivial_tearing!(state) + sys, mm = ModelingToolkit.alias_elimination!(state; fully_determined, kwargs...) if fully_determined && dummy_derivative sys = ModelingToolkit.dummy_derivative( sys, state; mm, check_consistency, kwargs...) From ab6e2c3254fca2d61612764a7bfdd332e87cc1e1 Mon Sep 17 00:00:00 2001 From: Aayush Sabharwal Date: Tue, 9 Dec 2025 16:32:05 +0530 Subject: [PATCH 2/2] test: add missing equation in test case --- test/stream_connectors.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/stream_connectors.jl b/test/stream_connectors.jl index 493d9996e3..8449b39466 100644 --- a/test/stream_connectors.jl +++ b/test/stream_connectors.jl @@ -494,7 +494,8 @@ function OneFluidSystem(; name) connect(source_a.H, pipe_a.HA) connect(pipe_a.HB, volume_a.H) connect(source_b.H, pipe_b.HA) - connect(pipe_b.HB, volume_b.H)] + connect(pipe_b.HB, volume_b.H) + source_a.H.dm ~ 0] System(eqs, t, vars, pars; name, systems) end