Skip to content

Commit 8e0999a

Browse files
author
Brad Carman
committed
fixed relay connection bug
1 parent 08d9c12 commit 8e0999a

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/systems/connectors.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,13 @@ function rooted_system_domain_graph(csets::AbstractVector{<:ConnectionSet})
430430
for (j, s) in enumerate(c.set)
431431
ij = (i, j)
432432
push!(id2cset, ij)
433-
n = length(id2cset)
433+
if !haskey(sys2id, nameof(s))
434+
n = length(id2cset)
435+
sys2id[nameof(s)] = n
436+
else
437+
n = sys2id[nameof(s)]
438+
end
434439
push!(cset2id′, n)
435-
sys2id[nameof(s)] = n
436440
is_domain_connector(s.sys.sys) && push!(roots, n)
437441
end
438442
push!(cset2id, cset2id′)

test/stream_connectors.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -402,31 +402,27 @@ function PipeBase(; P, R, name)
402402
end
403403

404404
function Pipe(; P, R, name)
405-
406405
pars = @parameters begin
407406
p_int = P
408-
resistance=R
407+
resistance = R
409408
end
410409

411410
vars = []
412411

413412
systems = @named begin
414-
HA = HydraulicPort(; P=p_int)
415-
HB = HydraulicPort(; P=p_int)
416-
p12 = PipeBase(; P=p_int, R=resistance)
417-
v1 = StaticVolume(; P=p_int, V=0.01)
418-
v2 = StaticVolume(; P=p_int, V=0.01)
413+
HA = HydraulicPort(; P = p_int)
414+
HB = HydraulicPort(; P = p_int)
415+
p12 = PipeBase(; P = p_int, R = resistance)
416+
v1 = StaticVolume(; P = p_int, V = 0.01)
417+
v2 = StaticVolume(; P = p_int, V = 0.01)
419418
end
420419

421-
eqs = [
422-
connect(v1.H, p12.HA, HA)
420+
eqs = [connect(v1.H, p12.HA, HA)
423421
connect(v2.H, p12.HB, HB)]
424422

425423
ODESystem(eqs, t, vars, pars; name, systems)
426424
end
427425

428-
429-
430426
function TwoFluidSystem(; name)
431427
pars = []
432428
vars = []

0 commit comments

Comments
 (0)