Skip to content

Commit 21b80b6

Browse files
committed
Merge remote-tracking branch 'origin' into hydraulic-macros
2 parents 644d620 + c6387ad commit 21b80b6

File tree

5 files changed

+41
-16
lines changed

5 files changed

+41
-16
lines changed

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ makedocs(sitename = "ModelingToolkitStandardLibrary.jl",
3131
ModelingToolkitStandardLibrary.Hydraulic,
3232
ModelingToolkitStandardLibrary.Hydraulic.IsothermalCompressible],
3333
clean = true, doctest = false, linkcheck = true,
34+
linkcheck_ignore = ["https://www.mathworks.com/help/simscape/ug/basic-principles-of-modeling-physical-networks.html#bq89sba-6"],
3435
warnonly = [:docs_block, :missing_docs, :cross_references],
3536
format = Documenter.HTML(assets = ["assets/favicon.ico"],
3637
canonical = "https://docs.sciml.ai/ModelingToolkitStandardLibrary/stable/"),

src/Electrical/Analog/ideal_components.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,9 @@ R = R_const + pos * R_ref * (1 + alpha * (port.T - T_ref))
392392

393393
@parameters begin
394394
R_ref = 1.0,
395-
[description = "Resistance at temperature T_ref when fully closed (pos=1.0)",
396-
unit = "Ω"]
397-
T_ref = 300.15, [description = "Reference temperature", unit = "K"]
398-
R_const = 1e-3, [description = "Constant resistance between p and n", unit = "Ω"]
395+
[description = "Resistance at temperature T_ref when fully closed (pos=1.0) (Ω)"]
396+
T_ref = 300.15, [description = "Reference temperature (K)"]
397+
R_const = 1e-3, [description = "Constant resistance between p and n (Ω)"]
399398
end
400399

401400
@components begin
@@ -404,13 +403,12 @@ R = R_const + pos * R_ref * (1 + alpha * (port.T - T_ref))
404403

405404
@variables begin
406405
pos(t), [description = "Position of the wiper (normally 0-1)"]
407-
R(t), [description = "Resistance", unit = "Ω"]
406+
R(t), [description = "Resistance (Ω)"]
408407
end
409408

410409
if T_dep
411410
@parameters begin
412-
alpha = 1e-3,
413-
[description = "Temperature coefficient of resistance", unit = "K^-1"]
411+
alpha = 1e-3, [description = "Temperature coefficient of resistance (K^-1)"]
414412
end
415413
@components begin
416414
port = HeatPort()

src/Hydraulic/IsothermalCompressible/components.jl

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11

22
"""
3-
Cap(; name)
3+
Cap(; p_int, name)
44
55
Caps a hydraulic port to prevent mass flow in or out.
66
7+
# Parameters:
8+
- `p_int`: [Pa] initial pressure (set by `p_int` argument)
9+
710
# Connectors:
811
- `port`: hydraulic port
912
"""
@@ -25,10 +28,13 @@ Caps a hydraulic port to prevent mass flow in or out.
2528
end
2629

2730
"""
28-
Open(; name)
31+
Open(; p_int, name)
2932
3033
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.
3134
35+
# Parameters:
36+
- `p_int`: [Pa] initial pressure (set by `p_int` argument)
37+
3238
# Connectors:
3339
- `port`: hydraulic port
3440
"""
@@ -224,11 +230,12 @@ end
224230
@deprecate Pipe Tube
225231

226232
"""
227-
FlowDivider(; n, name)
233+
FlowDivider(;p_int, n, name)
228234
229235
Reduces the flow from `port_a` to `port_b` by `n`. Useful for modeling parallel tubes efficiently by placing a `FlowDivider` on each end of a tube.
230236
231237
# Parameters:
238+
- `p_int`: [Pa] initial pressure
232239
- `n`: divide flow from `port_a` to `port_b` by `n`
233240
234241
# Connectors:
@@ -310,11 +317,14 @@ end
310317
end
311318

312319
"""
313-
Valve(reversible = false; Cd, Cd_reverse = Cd, minimum_area = 0, name)
320+
Valve(reversible = false; p_a_int, p_b_int, area_int, Cd, Cd_reverse = Cd, minimum_area = 0, name)
314321
315322
Valve with `area` input and discharge coefficient `Cd` defined by https://en.wikipedia.org/wiki/Discharge_coefficient. The `Cd_reverse` parameter allows for directional flow restriction, making it possible to define a check valve.
316323
317324
# Parameters:
325+
- `p_a_int`: [Pa] initial pressure for `port_a`
326+
- `p_b_int`: [Pa] initial pressure for `port_b`
327+
- `area_int`: [m^2] initial valve opening
318328
- `Cd`: discharge coefficient flowing from `a → b`
319329
- `Cd_reverse`: discharge coefficient flowing from `b → a`
320330
- `minimum_area`: when `reversible = false` applies a forced minimum area
@@ -513,7 +523,7 @@ See also [`FixedVolume`](@ref), [`DynamicVolume`](@ref)
513523
end
514524

515525
"""
516-
DynamicVolume(N, add_inertia=true, reversible=false; 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)
526+
DynamicVolume(N, add_inertia=true, reversible=false; 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)
517527
518528
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.
519529
@@ -686,11 +696,14 @@ dm ────► │ │ area
686696
end
687697

688698
"""
689-
SpoolValve(reversible = false; Cd, d, name)
699+
SpoolValve(reversible = false; p_a_int, p_b_int, x_int, Cd, d, name)
690700
691701
Spool valve with `x` valve opening input as mechanical flange port and `d` diameter of orifice. See `Valve` for more information.
692702
693703
# Parameters:
704+
- `p_a_int`: [Pa] initial pressure for `port_a`
705+
- `p_b_int`: [Pa] initial pressure for `port_b`
706+
- `x_int`: [m] initial valve opening
694707
- `d`: [m] orifice diameter
695708
- `Cd`: discharge coefficient flowing from `a → b`
696709
@@ -730,13 +743,18 @@ See [`Valve`](@ref) for more information.
730743
end
731744

732745
"""
733-
SpoolValve2Way(reversible = false; m, g, Cd, d, name)
746+
SpoolValve2Way(reversible = false; p_s_int, p_a_int, p_b_int, p_r_int, m, g, x_int, Cd, d, name)
734747
735748
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.
736749
737750
# Parameters:
751+
- `p_s_int`: [Pa] initial pressure for `port_s`
752+
- `p_a_int`: [Pa] initial pressure for `port_a`
753+
- `p_b_int`: [Pa] initial pressure for `port_b`
754+
- `p_r_int`: [Pa] initial pressure for `port_r`
738755
- `m`: [kg] mass of the spool
739756
- `g`: [m/s²] gravity field acting on the spool, positive value acts in the positive direction
757+
- `x_int`: [m] initial valve opening
740758
- `d`: [m] orifice diameter
741759
- `Cd`: discharge coefficient flowing from `s → a` and `b → r`
742760
@@ -786,6 +804,8 @@ end
786804

787805
"""
788806
Actuator(N, add_inertia = true, reversible = false;
807+
p_a_int,
808+
p_b_int,
789809
area_a,
790810
area_b,
791811
perimeter_a = 2 * sqrt(area_a * pi),
@@ -815,6 +835,8 @@ Actuator made of two DynamicVolumes connected in opposite direction with body ma
815835
816836
# Parameters:
817837
## volume
838+
- `p_a_int`: [Pa] initial pressure for `port_a`
839+
- `p_b_int`: [Pa] initial pressure for `port_b`
818840
- `area_a`: [m^2] moving wall area of volume `A`
819841
- `area_b`: [m^2] moving wall area of volume `B`
820842
- `length_a_int`: [m] initial wall position for `A`

src/Hydraulic/IsothermalCompressible/sources.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
MassFlow(; name)
2+
MassFlow(; name, p_int)
33
44
Hydraulic mass flow input source
55

src/Hydraulic/IsothermalCompressible/utils.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ regPow(x, a, delta = 0.01) = x * (x * x + delta * delta)^((a - 1) / 2);
44
regRoot(x, delta = 0.01) = regPow(x, 0.5, delta)
55

66
"""
7-
HydraulicPort(; name)
7+
HydraulicPort(;p_int, name)
88
99
Connector port for hydraulic components.
1010
11+
# Arguments:
12+
13+
- `p_int`: [Pa] initial gauge pressure
14+
1115
# States:
1216
- `p`: [Pa] gauge total pressure
1317
- `dm`: [kg/s] mass flow

0 commit comments

Comments
 (0)