@@ -10,7 +10,7 @@ Caps a hydraulic port to prevent mass flow in or out.
1010# Connectors:
1111- `port`: hydraulic port
1212"""
13- @component function Cap (; p_int, name)
13+ @component function Cap (; name)
1414
1515 vars = @variables p (t), [guess= 0 ]
1616
@@ -553,7 +553,7 @@ dm ────► │ │ area
553553@component function DynamicVolume (N, add_inertia = true , reversible = false ;
554554 # p_int,
555555 area,
556- # x_int = 0,
556+ x_int = 0 ,
557557 x_max,
558558 x_min = 0 ,
559559 x_damp = x_min,
@@ -578,7 +578,7 @@ dm ────► │ │ area
578578 # p_int = p_int
579579 area = area
580580
581- # x_int = x_int
581+ x_int = x_int
582582 x_max = x_max
583583 x_min = x_min
584584 x_damp = x_damp
@@ -594,7 +594,7 @@ dm ────► │ │ area
594594 minimum_area = minimum_area
595595 end
596596
597- vars = @variables x (t) vol (t)
597+ vars = @variables x (t)= x_int vol (t)= x_int * area
598598
599599 ports = @named begin
600600 port = HydraulicPort (;)
@@ -621,7 +621,7 @@ dm ────► │ │ area
621621 @named moving_volume = VolumeBase (;
622622 # x_int = 0,
623623 area,
624- dead_volume = N == 0 ? area * x_min : 0 ,
624+ dead_volume = N == 0 ? area * x_int : 0 ,
625625 Χ1 = N == 0 ? 1 : 0 ,
626626 Χ2 = 1 ) # changed x_int to x_min
627627
@@ -641,7 +641,7 @@ dm ────► │ │ area
641641 volumes = []
642642 if N > 0
643643 Δx = ParentScope (x_max) / N
644- x₀ = ParentScope (x) # x_int
644+ x₀ = ParentScope (x_int)
645645
646646 for i in 1 : N
647647 length = ifelse (x₀ > Δx * i,
@@ -729,7 +729,7 @@ See [`Valve`](@ref) for more information.
729729 connect (valve. port_b, port_b)
730730 valve. area ~ x * 2 π * d]
731731
732- ODESystem (eqs, t, vars, pars; name, systems, defaults = [flange . v => 0 ] )
732+ ODESystem (eqs, t, vars, pars; name, systems)
733733end
734734
735735"""
@@ -790,7 +790,7 @@ See [`SpoolValve`](@ref) for more information.
790790 connect (vBR. port_b, port_r)
791791 connect (vSA. flange, vBR. flange, mass. flange, flange)]
792792
793- ODESystem (eqs, t, vars, pars; name, systems, defaults = [flange . v => 0 ] )
793+ ODESystem (eqs, t, vars, pars; name, systems)
794794end
795795
796796"""
@@ -861,17 +861,19 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
861861- `flange`: mechanical translational port
862862"""
863863@component function Actuator (N, add_inertia = true , reversible = false ;
864- total_length,
865864 area_a,
866865 area_b,
867866 perimeter_a = 2 * sqrt (area_a * pi ),
868867 perimeter_b = 2 * sqrt (area_b * pi ),
868+ length_a_int,
869+ length_b_int,
869870 shape_factor_a = 64 ,
870871 shape_factor_b = 64 ,
871872 head_factor_a = 1 ,
872873 head_factor_b = 1 ,
873874 m,
874875 g,
876+ x_int = 0 ,
875877 minimum_volume_a = 0 ,
876878 minimum_volume_b = 0 ,
877879 damping_volume_a = minimum_volume_a,
@@ -888,6 +890,9 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
888890 shape_factor_b = shape_factor_b
889891 head_factor_a = head_factor_a
890892 head_factor_b = head_factor_b
893+ x_int = x_int
894+ length_a_int = length_a_int
895+ length_b_int = length_b_int
891896 minimum_volume_a = minimum_volume_a
892897 minimum_volume_b = minimum_volume_b
893898 damping_volume_a = damping_volume_a
@@ -899,16 +904,17 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
899904 end
900905
901906 vars = @variables begin
902- x (t)
907+ x (t) = x_int
903908 dx (t)
904909 end
905910
906- # total_length = length_a_int + length_b_int # Need parameters to define the total length.
911+ total_length = length_a_int + length_b_int
907912
908913 # TODO : include effective_length
909914 systems = @named begin
910915 vol_a = DynamicVolume (N, add_inertia, reversible; direction = + 1 ,
911916 area = area_a,
917+ x_int = length_a_int,
912918 x_max = total_length,
913919 x_min = minimum_volume_a / area_a,
914920 x_damp = damping_volume_a / area_a,
@@ -920,6 +926,7 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
920926
921927 vol_b = DynamicVolume (N, add_inertia, reversible; direction = - 1 ,
922928 area = area_b,
929+ x_int = length_b_int,
923930 x_max = total_length,
924931 x_min = minimum_volume_b / area_b,
925932 x_damp = damping_volume_b / area_b,
@@ -929,16 +936,16 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
929936 Cd,
930937 Cd_reverse)
931938 mass = Mass (; m, g)
932- port_a = HydraulicPort (; )
933- port_b = HydraulicPort (; )
939+ port_a = HydraulicPort ()
940+ port_b = HydraulicPort ()
934941 flange = MechanicalPort ()
935942 end
936943
937944 eqs = [connect (vol_a. port, port_a)
938- connect (vol_b. port, port_b)
939- connect (vol_a. flange, vol_b. flange, mass. flange, flange)
940- D (x) ~ dx
941- dx ~ vol_a. flange. v]
945+ connect (vol_b. port, port_b)
946+ connect (vol_a. flange, vol_b. flange, mass. flange, flange)
947+ D (x) ~ dx
948+ dx ~ vol_a. flange. v]
942949
943- ODESystem (eqs, t, vars, pars; name, systems, defaults = [flange . v => 0 ] )
950+ ODESystem (eqs, t, vars, pars; name, systems)
944951end
0 commit comments