Skip to content

Commit 537fb7c

Browse files
format
1 parent 9cf1768 commit 537fb7c

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

test/components.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ include("../examples/serial_inductor.jl")
155155
sys = structural_simplify(ll_model)
156156
@test length(equations(sys)) == 2
157157
u0 = unknowns(sys) .=> 0
158-
@test_nowarn ODEProblem(sys, [], (0, 10.0), guesses = u0, warn_initialize_determined = false)
158+
@test_nowarn ODEProblem(
159+
sys, [], (0, 10.0), guesses = u0, warn_initialize_determined = false)
159160
prob = DAEProblem(sys, D.(unknowns(sys)) .=> 0, u0, (0, 0.5))
160161
sol = solve(prob, DFBDF())
161162
@test sol.retcode == SciMLBase.ReturnCode.Success

test/state_selection.jl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@ end
4545
# 1516
4646
let
4747
@connector function Fluid_port(; name, p = 101325.0, m = 0.0, T = 293.15)
48-
sts = @variables p(t) [guess=p] m(t) [guess = m, connect = Flow] T(t) [guess=T, connect = Stream]
48+
sts = @variables p(t) [guess = p] m(t) [guess = m, connect = Flow] T(t) [
49+
guess = T, connect = Stream]
4950
ODESystem(Equation[], t, sts, []; name = name)
5051
end
51-
52+
5253
#this one is for latter
5354
@connector function Heat_port(; name, Q = 0.0, T = 293.15)
54-
sts = @variables T(t) [guess=T] Q(t) [guess = Q, connect = Flow]
55+
sts = @variables T(t) [guess = T] Q(t) [guess = Q, connect = Flow]
5556
ODESystem(Equation[], t, sts, []; name = name)
5657
end
57-
58+
5859
# like ground but for fluid systems (fluid_port.m is expected to be zero in closed loop)
5960
function Compensator(; name, p = 101325.0, T_back = 273.15)
6061
@named fluid_port = Fluid_port()
@@ -63,7 +64,7 @@ let
6364
fluid_port.T ~ T_back]
6465
compose(ODESystem(eqs, t, [], ps; name = name), fluid_port)
6566
end
66-
67+
6768
function Source(; name, delta_p = 100, T_feed = 293.15)
6869
@named supply_port = Fluid_port() # expected to feed connected pipe -> m<0
6970
@named return_port = Fluid_port() # expected to receive from connected pipe -> m>0
@@ -74,7 +75,7 @@ let
7475
return_port.T ~ T_feed]
7576
compose(ODESystem(eqs, t, [], ps; name = name), [supply_port, return_port])
7677
end
77-
78+
7879
function Substation(; name, T_return = 343.15)
7980
@named supply_port = Fluid_port() # expected to receive from connected pipe -> m>0
8081
@named return_port = Fluid_port() # expected to feed connected pipe -> m<0
@@ -85,12 +86,12 @@ let
8586
return_port.T ~ T_return]
8687
compose(ODESystem(eqs, t, [], ps; name = name), [supply_port, return_port])
8788
end
88-
89+
8990
function Pipe(; name, L = 1000, d = 0.1, N = 100, rho = 1000, f = 1)
9091
@named fluid_port_a = Fluid_port()
9192
@named fluid_port_b = Fluid_port()
9293
ps = @parameters L=L d=d rho=rho f=f N=N
93-
sts = @variables v(t) [guess=0.0] dp_z(t) [guess=0.0]
94+
sts = @variables v(t) [guess = 0.0] dp_z(t) [guess = 0.0]
9495
eqs = [fluid_port_a.m ~ -fluid_port_b.m
9596
fluid_port_a.T ~ instream(fluid_port_a.T)
9697
fluid_port_b.T ~ fluid_port_a.T
@@ -114,7 +115,7 @@ let
114115
connect(return_pipe.fluid_port_a, source.return_port)]
115116
compose(ODESystem(eqs, t, [], ps; name = name), subs)
116117
end
117-
118+
118119
@named system = System(L = 10)
119120
@unpack supply_pipe, return_pipe = system
120121
sys = structural_simplify(system)
@@ -125,7 +126,7 @@ let
125126
prob1 = ODEProblem(sys, [], (0.0, 10.0), [], guesses = u0)
126127
prob2 = ODEProblem(sys, [], (0.0, 10.0), [], guesses = u0)
127128
prob3 = DAEProblem(sys, D.(unknowns(sys)) .=> 0.0, u0, (0.0, 10.0), [])
128-
@test solve(prob1, FBDF()).retcode == ReturnCode.Success
129+
@test solve(prob1, FBDF()).retcode == ReturnCode.Success
129130
#@test solve(prob2, FBDF()).retcode == ReturnCode.Success
130131
@test solve(prob3, DFBDF()).retcode == ReturnCode.Success
131132
end

test/structural_transformation/index_reduction.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ let sys = structural_simplify(pendulum2)
143143
D(y) => 0.0,
144144
D(D(y)) => 0.0,
145145
x => sqrt(2) / 2,
146-
y => sqrt(2) / 2,
146+
y => sqrt(2) / 2
147147
]
148148
p = [
149149
L => 1.0,

0 commit comments

Comments
 (0)