Skip to content

Commit ff8aa13

Browse files
test: add #3319 as a test
1 parent c6ffa95 commit ff8aa13

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/downstream/inversemodel.jl

+29
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,32 @@ matrices2, _ = Blocks.get_comp_sensitivity(model, :y; op) # Test that we get the
173173
@test_broken matrices1.f_x matrices2.A[1:7, 1:7]
174174
nsys = get_named_comp_sensitivity(model, :y; op) # Test that we get the same result when calling an even higher-level API
175175
@test matrices2.A nsys.A
176+
177+
@testset "Issue #3319" begin
178+
op1 = Dict(
179+
D(cm.inverse_tank.xT) => 1,
180+
cm.tank.xc => 0.65
181+
)
182+
183+
op2 = Dict(
184+
D(cm.inverse_tank.xT) => 1,
185+
cm.tank.xc => 0.45
186+
)
187+
188+
output = :y
189+
lin_fun, ssys = Blocks.get_sensitivity_function(model, output)
190+
matrices1 = linearize(ssys, lin_fun, op = op1)
191+
matrices2 = linearize(ssys, lin_fun, op = op2)
192+
S1f = ss(matrices1...)
193+
S2f = ss(matrices2...)
194+
@test S1f != S2f
195+
196+
matrices1, ssys = Blocks.get_sensitivity(model, output; op = op1)
197+
matrices2, ssys = Blocks.get_sensitivity(model, output; op = op2)
198+
S1 = ss(matrices1...)
199+
S2 = ss(matrices2...)
200+
@test S1 != S2
201+
202+
@test S1 == S1f
203+
@test S2 == S2f
204+
end

0 commit comments

Comments
 (0)