Skip to content

Commit 34280e3

Browse files
committed
Test added representing Issue #234
1 parent cfdbbea commit 34280e3

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/Thermal/thermal.jl

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,30 @@ end
155155
zeros(length(sol[collector.port_b.Q_flow]))
156156
@test sol[collector.port_b.T] == sol[collector.port_a1.T] == sol[collector.port_a2.T]
157157
end
158+
159+
@testset "FixedHeatFlow with alpha=0.0 test" begin
160+
@mtkmodel TestModel begin
161+
162+
@components begin
163+
temp = FixedTemperature(T=300)
164+
heatflow = FixedHeatFlow(Q_flow=-1.0)
165+
wall = ThermalResistor(R=1)
166+
end
167+
168+
@equations begin
169+
connect(temp.port, wall.port_a)
170+
connect(wall.port_b, heatflow.port)
171+
end
172+
173+
end
174+
175+
@info "Building a FixedHeatFlow with alpha=0.0"
176+
@mtkbuild test_model = TestModel()
177+
prob = ODEProblem(test_model, Pair[], (0, 10.0))
178+
sol = solve(prob)
179+
180+
heat_flow = sol[test_model.heatflow.port.Q_flow]
181+
182+
@test SciMLBase.successful_retcode(sol) # Ensure the simulation is successful
183+
@test all(isapprox.(heat_flow, 1.0, rtol=1e-6)) # Heat flow value should be equal to the fixed value defined
184+
end

0 commit comments

Comments
 (0)