Skip to content

Commit 50da17d

Browse files
committed
format
1 parent 96df28b commit 50da17d

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

src/Mechanical/Rotational/sources.jl

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11

22
function PartialTorque(; name, use_support = false)
3-
@named partial_element = PartialElementaryOneFlangeAndSupport2(use_support = use_support)
4-
@unpack flange, phi_support = partial_element
5-
@variables phi(t) [description = "Angle of flange with respect to support (= flange.phi - support.phi)"]
6-
eqs = [phi ~ flange.phi - phi_support]
7-
return extend(ODESystem(eqs, t; name = name), partial_element)
3+
@named partial_element = PartialElementaryOneFlangeAndSupport2(use_support = use_support)
4+
@unpack flange, phi_support = partial_element
5+
@variables phi(t) [
6+
description = "Angle of flange with respect to support (= flange.phi - support.phi)",
7+
]
8+
eqs = [phi ~ flange.phi - phi_support]
9+
return extend(ODESystem(eqs, t; name = name), partial_element)
810
end
911

10-
1112
"""
1213
Torque(; name, use_support=false)
1314
@@ -34,21 +35,20 @@ function Torque(; name, use_support = false)
3435
return extend(ODESystem(eqs, t, [], []; name = name, systems = [tau]), partial_element)
3536
end
3637

37-
38-
3938
function ConstantTorque(; name, tau_constant, use_support = false)
40-
# NOTE: The use_support option is not specified for modelica ConstantTorque and defaults to false in the definition of PartialElementaryOneFlangeAndSupport2. If we do not set it to true, we will get a structurally singular system, and in the comment attached to the phi variable, they mention "flange.phi - support.phi", indicating that the support is used.
41-
@named partial_element = PartialTorque(; use_support)
42-
@unpack flange, phi = partial_element
43-
@parameters tau_constant=tau_constant [description = "Constant torque (if negative, torque is acting as load in positive direction of rotation)"]
44-
@variables tau(t) [description = "Accelerating torque acting at flange (= -flange.tau)"]
45-
@variables w(t) [description = "Angular velocity of flange with respect to support (= der(phi))"]
46-
eqs = [
47-
w ~ D(phi)
48-
tau ~ -flange.tau
49-
tau ~ tau_constant
50-
]
51-
return extend(ODESystem(eqs, t; name = name), partial_element)
39+
@named partial_element = PartialTorque(; use_support)
40+
@unpack flange, phi = partial_element
41+
@parameters tau_constant=tau_constant [
42+
description = "Constant torque (if negative, torque is acting as load in positive direction of rotation)",
43+
]
44+
@variables tau(t) [description = "Accelerating torque acting at flange (= -flange.tau)"]
45+
@variables w(t) [
46+
description = "Angular velocity of flange with respect to support (= der(phi))",
47+
]
48+
eqs = [w ~ D(phi)
49+
tau ~ -flange.tau
50+
tau ~ tau_constant]
51+
return extend(ODESystem(eqs, t; name = name), partial_element)
5252
end
5353

5454
"""

src/Mechanical/Rotational/utils.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Base.@doc """
1818
extend(ODESystem(Equation[], t, [], [], name = name), flange)
1919
end
2020

21-
2221
Base.@doc """
2322
InternalSupport(;name, tau)
2423
@@ -35,11 +34,9 @@ Base.@doc """
3534
@named flange = Flange()
3635
@variables phi(t)=0 [description = "Rotation angle of support $name"]
3736
# tau(t), [connect = Flow, description = "Cut torque in support $name"],)
38-
equations = [
39-
flange.tau ~ tau
40-
flange.phi ~ phi
41-
]
42-
ODESystem(equations, t, [phi], [], name = name, systems=[flange]) # NOTE: tau not included since it belongs elsewhere
37+
equations = [flange.tau ~ tau
38+
flange.phi ~ phi]
39+
ODESystem(equations, t, [phi], [], name = name, systems = [flange]) # NOTE: tau not included since it belongs elsewhere
4340
end
4441

4542
Base.@doc """

0 commit comments

Comments
 (0)