@@ -192,20 +192,17 @@ Constant length internal flow model discretized by `N` (`FixedVolume`: `N`, `Tub
192192 push! (pipe_bases, x)
193193 end
194194
195-
196- eqs = [
197- connect (pipe_bases[1 ]. port_a, port_a)
198- connect (pipe_bases[end ]. port_b, port_b)
199- ]
195+ eqs = [connect (pipe_bases[1 ]. port_a, port_a)
196+ connect (pipe_bases[end ]. port_b, port_b)]
200197
201198 volumes = []
202- for i in 1 : (N- 1 )
199+ for i in 1 : (N - 1 )
203200 x = FixedVolume (; name = Symbol (" v$i " ),
204- vol = ParentScope (area) * ParentScope (length) / (N- 1 ),
205- p_int = ParentScope (p_int) )
201+ vol = ParentScope (area) * ParentScope (length) / (N - 1 ),
202+ p_int = ParentScope (p_int))
206203 push! (volumes, x)
207204 push! (eqs,
208- connect (x. port, pipe_bases[i]. port_b, pipe_bases[i+ 1 ]. port_a))
205+ connect (x. port, pipe_bases[i]. port_b, pipe_bases[i + 1 ]. port_a))
209206 end
210207
211208 return ODESystem (eqs, t, vars, pars; name, systems = [ports; pipe_bases; volumes])
268265 end
269266
270267 vars = @variables begin
271- area (t), [guess= 0 ]
272- y (t), [guess= 0 ]
268+ area (t), [guess = 0 ]
269+ y (t), [guess = 0 ]
273270 end
274271
275272 # let
361358 dx (t), [guess = 0 ]
362359 rho (t), [guess = liquid_density (port)]
363360 m (t), [guess = 0 ]
364- vol (t)
361+ vol (t)
365362 end
366363
367364 # let
@@ -403,16 +400,15 @@ Fixed fluid volume.
403400
404401 vars = @variables begin
405402 rho (t), [guess = liquid_density (port)]
406- m (t), [guess= vol* liquid_density (port)]
407- p (t)= p_int
403+ m (t), [guess = vol * liquid_density (port)]
404+ p (t) = p_int
408405 end
409406
410407 # let
411408 dm = port. dm
412-
413409
414410 eqs = [D (m) ~ dm
415- # rho ~ full_density(port, p)
411+ # rho ~ full_density(port, p)
416412 p ~ full_pressure (port, rho) # see https://github.com/SciML/OrdinaryDiffEq.jl/issues/2561
417413 p ~ port. p
418414 m ~ rho * vol]
@@ -464,21 +460,20 @@ See also [`FixedVolume`](@ref), [`DynamicVolume`](@ref)
464460 area,
465461 direction = + 1 ,
466462 x_int,
467- name)
468-
463+ name)
469464 pars = @parameters begin
470465 area = area
471466 x_int = x_int
472467 end
473468
474469 vars = @variables begin
475- x (t)= x_int
476- dx (t), [guess= 0 ]
477- p (t), [guess= 0 ]
478- f (t), [guess= 0 ]
479- rho (t), [guess= 0 ]
480- m (t), [guess= 0 ]
481- dm (t), [guess= 0 ]
470+ x (t) = x_int
471+ dx (t), [guess = 0 ]
472+ p (t), [guess = 0 ]
473+ f (t), [guess = 0 ]
474+ rho (t), [guess = 0 ]
475+ m (t), [guess = 0 ]
476+ dm (t), [guess = 0 ]
482477 end
483478
484479 systems = @named begin
@@ -504,7 +499,6 @@ See also [`FixedVolume`](@ref), [`DynamicVolume`](@ref)
504499 # physics
505500 # rho ~ full_density(port, p)
506501 p ~ full_pressure (port, rho) # see https://github.com/SciML/OrdinaryDiffEq.jl/issues/2561
507-
508502 f ~ p * area
509503 m ~ rho * x * area]
510504
@@ -574,10 +568,7 @@ dm ────► │ │ area
574568 minimum_area = 0 ,
575569
576570 # Damping
577- d = 0 ,
578-
579- name)
580-
571+ d = 0 , name)
581572 @assert (direction == + 1 )|| (direction == - 1 ) " direction argument must be +/-1, found $direction "
582573
583574 # TODO : How to set an assert effective_length >= length ??
@@ -602,9 +593,9 @@ dm ────► │ │ area
602593 end
603594
604595 vars = @variables begin
605- x (t)= x_int
606- vol (t), [guess= x_int * area]
607- end
596+ x (t) = x_int
597+ vol (t), [guess = x_int * area]
598+ end
608599
609600 systems = @named begin
610601 port = HydraulicPort (;)
@@ -617,7 +608,7 @@ dm ────► │ │ area
617608 area,
618609 dead_volume = area * x_int,
619610 p_int,
620- x_int= 0 )
611+ x_int = 0 )
621612 end
622613
623614 ratio = (x - x_min) / (x_damp - x_min)
@@ -637,9 +628,7 @@ dm ────► │ │ area
637628 connect (port, damper. port_b)
638629 connect (moving_volume. port, damper. port_a)
639630 dx ~ flange. v * direction
640- p * area - dx* d ~ - flange. f * direction
641- ]
642-
631+ p * area - dx * d ~ - flange. f * direction]
643632
644633 return ODESystem (eqs, t, vars, pars; name, systems)
645634end
@@ -678,8 +667,8 @@ See [`Valve`](@ref) for more information.
678667 end
679668
680669 vars = @variables begin
681- x (t)= x_int
682- dx (t), [guess= 0 ]
670+ x (t) = x_int
671+ dx (t), [guess = 0 ]
683672 end
684673
685674 eqs = [D (x) ~ dx
@@ -751,10 +740,10 @@ See [`SpoolValve`](@ref) for more information.
751740 connect (vBR. port_a, port_b)
752741 connect (vBR. port_b, port_r)
753742 connect (vSA. flange, vBR. flange, mass. flange, flange)]
754-
743+
755744 initialization_eqs = [
756745 mass. s ~ x_int
757- # mass.v ~ dx_int
746+ # mass.v ~ dx_int
758747 ]
759748
760749 ODESystem (eqs, t, vars, pars; name, systems, initialization_eqs)
@@ -848,7 +837,7 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
848837 damping_volume_b = minimum_volume_b,
849838 Cd = 1e4 ,
850839 Cd_reverse = Cd,
851- d= 0 ,
840+ d = 0 ,
852841 p_a_int,
853842 p_b_int,
854843 name)
@@ -963,14 +952,14 @@ dm ────► effective area
963952
964953@mtkmodel Orifice begin
965954 @parameters begin
966- orifice_area= 0.00094
967- Cd= 0.6 # TODO Cd here is defined differently from Valve().
955+ orifice_area = 0.00094
956+ Cd = 0.6 # TODO Cd here is defined differently from Valve().
968957 # Here it follows the form Effective Orifice Area = Cd x Physical Orifice Area
969958 # The Valve component should be updated too.
970959 end
971960 @components begin
972- area = Constant (k= orifice_area)
973- valve = Valve (Cd= 1 / (Cd * Cd))
961+ area = Constant (k = orifice_area)
962+ valve = Valve (Cd = 1 / (Cd * Cd))
974963 port_a = HydraulicPort ()
975964 port_b = HydraulicPort ()
976965 end
0 commit comments