Skip to content

Commit d4a6e2c

Browse files
Merge pull request SciML#323 from roman-timo/adding-missing-docstrings-for-hydraulic-comps
added missing docstrings for hydraulic comps: Open, SpoolValve, SpoolValve2Way, Actuator
2 parents e200163 + c9bd9fd commit d4a6e2c

File tree

1 file changed

+127
-1
lines changed

1 file changed

+127
-1
lines changed

src/Hydraulic/IsothermalCompressible/components.jl

Lines changed: 127 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ Caps a hydraulic port to prevent mass flow in or out.
2525
ODESystem(eqs, t, vars, pars; name, systems)
2626
end
2727

28+
"""
29+
Open(; p_int, name)
30+
31+
Provides an "open" boundary condition for a hydraulic port such that mass flow `dm` is non-zero. This is opposite from an un-connected hydraulic port or the `Cap` boundary component which sets the mass flow `dm` to zero.
32+
33+
# Parameters:
34+
- `p_int`: [Pa] initial pressure (set by `p_int` argument)
35+
36+
# Connectors:
37+
- `port`: hydraulic port
38+
"""
2839
@component function Open(; p_int, name)
2940
pars = @parameters p_int = p_int
3041

@@ -447,6 +458,10 @@ dm ────► │ │ area
447458
└─► x (= ∫ flange.v * direction)
448459
```
449460
461+
# Features:
462+
- volume discretization with flow resistance and inertia: use `N` to control number of volume and resistance elements. Set `N=0` to turn off volume discretization. See `TubeBase` for more information about flow resistance.
463+
- minimum volume flow shutoff with damping and directional resistance. Use `reversible=false` when problem defines volume position `x` and solves for `dm` to prevent numerical instability.
464+
450465
# Parameters:
451466
## volume
452467
- `p`: [Pa] initial pressure
@@ -514,7 +529,7 @@ See also [`FixedVolume`](@ref), [`DynamicVolume`](@ref)
514529
end
515530

516531
"""
517-
DynamicVolume(N, add_inertia=true; p_int, area, x_int = 0, x_max, x_min = 0, x_damp = x_min, direction = +1, perimeter = 2 * sqrt(area * pi), shape_factor = 64, head_factor = 1, Cd = 1e2, Cd_reverse = Cd, name)
532+
DynamicVolume(N, add_inertia=true; p_int, area, x_int = 0, x_max, x_min = 0, x_damp = x_min, direction = +1, perimeter = 2 * sqrt(area * pi), shape_factor = 64, head_factor = 1, Cd = 1e2, Cd_reverse = Cd, name)
518533
519534
Volume with moving wall with `flange` connector for converting hydraulic energy to 1D mechanical. The `direction` argument aligns the mechanical port with the hydraulic port, useful when connecting two dynamic volumes together in oppsing directions to create an actuator.
520535
@@ -698,6 +713,25 @@ dm ────► │ │ area
698713
defaults = [flange.v => 0])
699714
end
700715

716+
"""
717+
SpoolValve(reversible = false; p_a_int, p_b_int, x_int, Cd, d, name)
718+
719+
Spool valve with `x` valve opening input as mechanical flange port and `d` diameter of orifice. See `Valve` for more information.
720+
721+
# Parameters:
722+
- `p_a_int`: [Pa] initial pressure for `port_a`
723+
- `p_b_int`: [Pa] initial pressure for `port_b`
724+
- `x_int`: [m] initial valve opening
725+
- `d`: [m] orifice diameter
726+
- `Cd`: discharge coefficient flowing from `a → b`
727+
728+
# Connectors:
729+
- `port_a`: hydraulic port
730+
- `port_b`: hydraulic port
731+
- `flange`: mechanical translational port
732+
733+
See [`Valve`](@ref) for more information.
734+
"""
701735
@component function SpoolValve(reversible = false; p_a_int, p_b_int, x_int, Cd, d, name)
702736
pars = @parameters begin
703737
p_a_int = p_a_int
@@ -730,6 +764,31 @@ end
730764
ODESystem(eqs, t, vars, pars; name, systems, defaults = [flange.v => 0])
731765
end
732766

767+
"""
768+
SpoolValve2Way(reversible = false; p_s_int, p_a_int, p_b_int, p_r_int, m, g, x_int, Cd, d, name)
769+
770+
2-ways spool valve with 4 ports and spool mass. Fluid flow direction S → A and B → R when `x` is positive and S → B and A → R when `x` is negative.
771+
772+
# Parameters:
773+
- `p_s_int`: [Pa] initial pressure for `port_s`
774+
- `p_a_int`: [Pa] initial pressure for `port_a`
775+
- `p_b_int`: [Pa] initial pressure for `port_b`
776+
- `p_r_int`: [Pa] initial pressure for `port_r`
777+
- `m`: [kg] mass of the spool
778+
- `g`: [m/s²] gravity field acting on the spool, positive value acts in the positive direction
779+
- `x_int`: [m] initial valve opening
780+
- `d`: [m] orifice diameter
781+
- `Cd`: discharge coefficient flowing from `s → a` and `b → r`
782+
783+
# Connectors:
784+
- `port_s`: hydraulic port
785+
- `port_a`: hydraulic port
786+
- `port_b`: hydraulic port
787+
- `port_r`: hydraulic port
788+
- `flange`: mechanical translational port
789+
790+
See [`SpoolValve`](@ref) for more information.
791+
"""
733792
@component function SpoolValve2Way(reversible = false; p_s_int, p_a_int, p_b_int, p_r_int,
734793
m, g, x_int, Cd, d, name)
735794
pars = @parameters begin
@@ -773,6 +832,73 @@ end
773832
ODESystem(eqs, t, vars, pars; name, systems, defaults = [flange.v => 0])
774833
end
775834

835+
"""
836+
Actuator(N, add_inertia = true, reversible = false;
837+
p_a_int,
838+
p_b_int,
839+
area_a,
840+
area_b,
841+
perimeter_a = 2 * sqrt(area_a * pi),
842+
perimeter_b = 2 * sqrt(area_b * pi),
843+
length_a_int,
844+
length_b_int,
845+
shape_factor_a = 64,
846+
shape_factor_b = 64,
847+
head_factor_a = 1,
848+
head_factor_b = 1,
849+
m,
850+
g,
851+
x_int = 0,
852+
minimum_volume_a = 0,
853+
minimum_volume_b = 0,
854+
damping_volume_a = minimum_volume_a,
855+
damping_volume_b = minimum_volume_b,
856+
Cd = 1e4,
857+
Cd_reverse = Cd,
858+
name)
859+
860+
Actuator made of two DynamicVolumes connected in opposite direction with body mass attached.
861+
862+
# Features:
863+
- volume discretization with flow resistance and inertia: use `N` to control number of volume and resistance elements. Set `N=0` to turn off volume discretization. See `TubeBase` for more information about flow resistance.
864+
- minimum volume flow shutoff with damping and directional resistance. Use `reversible=false` when problem defines volume position `x` and solves for `dm` to prevent numerical instability.
865+
866+
# Parameters:
867+
## volume
868+
- `p_a_int`: [Pa] initial pressure for `port_a`
869+
- `p_b_int`: [Pa] initial pressure for `port_b`
870+
- `area_a`: [m^2] moving wall area of volume `A`
871+
- `area_b`: [m^2] moving wall area of volume `B`
872+
- `length_a_int`: [m] initial wall position for `A`
873+
- `length_b_int`: [m] initial wall position for `b`
874+
875+
## mass
876+
- `m`: [kg] mass of the body
877+
- `g`: [m/s²] gravity field acting on the mass, positive value acts in the positive direction
878+
- `x_int`: [m] initial flange position
879+
880+
## flow resistance
881+
- `perimeter_a`: [m] perimeter of the cross section `A` (needed only for non-circular volumes)
882+
- `perimeter_b`: [m] perimeter of the cross section `B` (needed only for non-circular volumes)
883+
- `shape_factor_a`: shape factor of `A`, see `friction_factor` function
884+
- `shape_factor_b`: shape factor of `B`, see `friction_factor` function
885+
- `head_factor_a`: effective length multiplier for `A`, used to account for addition friction from flow development and additional friction such as pipe bends, entrance/exit lossses, etc.
886+
- `head_factor_b`: effective length multiplier for `B`, used to account for addition friction from flow development and additional friction such as pipe bends, entrance/exit lossses, etc.
887+
888+
## flow shut off and damping
889+
- `minimum_volume_a`: [m^3] minimum volume `A` that shuts off flow and prevents negative volume.
890+
- `minimum_volume_b`: [m^3] minimum volume `B` that shuts off flow and prevents negative volume.
891+
- `damping_volume_a`: [m^3] volume of `A` that initiates a linear damping region before reaching full flow shut off. Helps provide a smooth end stop.
892+
- `damping_volume_b`: [m^3] volume of `B` that initiates a linear damping region before reaching full flow shut off. Helps provide a smooth end stop.
893+
- `Cd`: discharge coefficient for flow out of the volume. *Note: area is 1m² when valve is fully open. Ensure this does not induce unwanted flow resistance.*
894+
- `Cd_reverse`: discharge coefficient for flow into the volume. Use a lower value to allow easy wall release, in some cases the wall can "stick".
895+
896+
897+
# Connectors:
898+
- `port_a`: hydraulic port
899+
- `port_b`: hydraulic port
900+
- `flange`: mechanical translational port
901+
"""
776902
@component function Actuator(N, add_inertia = true, reversible = false;
777903
p_a_int,
778904
p_b_int,

0 commit comments

Comments
 (0)