1+ @connector function Flange (;name)
2+ sts = @variables begin
3+ phi (t)
4+ tau (t), [connect= Flow]
5+ end
6+ ODESystem (Equation[], t, sts, [], name= name, defaults= Dict (phi=> 0.0 , tau=> 0.0 ))
7+ end
8+ Base. @doc """
9+ Flange(;name)
10+
11+ 1-dim. rotational flange of a shaft.
12+
13+ # States:
14+ - `phi`: [rad] Absolute rotation angle of flange
15+ - `tau`: [Nm] Cut torque in the flange
16+ """ Flange
17+
18+ @connector function Support (;name)
19+ sts = @variables begin
20+ phi (t)
21+ tau (t), [connect= Flow]
22+ end
23+ ODESystem (Equation[], t, sts, [], name= name, defaults= Dict (phi=> 0.0 , tau=> 0.0 ))
24+ end
25+ Base. @doc """
26+ Support(;name)
27+
28+ Support/housing of a 1-dim. rotational shaft
29+
30+ # States:
31+ - `phi`: [rad] Absolute rotation angle of the support/housing
32+ - `tau`: [Nm] Cut torque in the support/housing
33+ """ Support
34+
35+ """
36+ PartialCompliant(;name, phi_rel_start=0.0, tau_start=0.0)
37+
38+ Partial model for the compliant connection of two rotational 1-dim. shaft flanges.
39+
40+ # Parameters:
41+ - `phi_rel_start`: Initial relative rotation angle
42+ - `tau_start`: Initial torque between flanges
43+
44+ # States:
45+ - `phi_rel`: Relative rotation angle (= flange_b.phi - flange_a.phi)
46+ - `tau`: Torque between flanges (= flange_b.tau)
47+ """
48+ function PartialCompliant (;name, phi_rel_start= 0.0 , tau_start= 0.0 )
49+ @named flange_a = Flange ()
50+ @named flange_b = Flange ()
51+ sts = @variables begin
52+ phi_rel (t)= phi_rel_start
53+ tau (t)= tau_start
54+ end
55+ eqs = [
56+ phi_rel ~ flange_b. phi - flange_a. phi
57+ flange_b. tau ~ tau
58+ flange_a. tau ~ - tau
59+ ]
60+ return compose (ODESystem (eqs, t, sts, []; name= name), flange_a, flange_b)
61+ end
62+
63+ """
64+ PartialCompliantWithRelativeStates(;name, phi_rel_start=0.0, tau_start=0.0)
65+
66+ Partial model for the compliant connection of two rotational 1-dim. shaft flanges where the relative angle and speed are used as preferred states
67+
68+ # Parameters:
69+ - `phi_rel_start`: Initial relative rotation angle
70+ - `w_rel_start`: Initial relative angular velocity (= der(phi_rel))
71+ - `a_rel_start`: Initial relative angular acceleration (= der(w_rel))
72+ - `tau_start`: Initial torque between flanges
73+
74+ # States:
75+ - `phi_rel`: Relative rotation angle (= flange_b.phi - flange_a.phi)
76+ - `w_rel`: Relative angular velocity (= der(phi_rel))
77+ - `a_rel`: Relative angular acceleration (= der(w_rel))
78+ - `tau`: Torque between flanges (= flange_b.tau)
79+ """
80+ function PartialCompliantWithRelativeStates (;name, phi_rel_start= 0.0 , w_start= 0.0 , a_start= 0.0 , tau_start= 0.0 )
81+ @named flange_a = Flange ()
82+ @named flange_b = Flange ()
83+ sts = @variables begin
84+ phi_rel (t)= phi_rel_start
85+ w_rel (t)= w_start
86+ a_rel (t)= a_start
87+ tau (t)= tau_start
88+ end
89+ eqs = [
90+ phi_rel ~ flange_b. phi - flange_a. phi
91+ D (phi_rel) ~ w_rel
92+ D (w_rel) ~ a_rel
93+ flange_b. tau ~ tau
94+ flange_a. tau ~ - tau
95+ ]
96+ return compose (ODESystem (eqs, t, sts, []; name= name), flange_a, flange_b)
97+ end
98+
99+ """
100+ PartialElementaryOneFlangeAndSupport2(;name, use_support=false)
101+
102+ Partial model for a component with one rotational 1-dim. shaft flange and a support used for textual modeling, i.e., for elementary models
103+
104+ # Parameters:
105+ - `use_support`: If support flange enabled, otherwise implicitly grounded
106+
107+ # States:
108+ - `phi_support`: Absolute angle of support flange"
109+ """
110+ function PartialElementaryOneFlangeAndSupport2 (;name, use_support= false )
111+ @named flange = Flange ()
112+ sys = [flange]
113+ @variables phi_support (t)
114+ if use_support
115+ @named support = Support ()
116+ eqs = [
117+ support. phi ~ phi_support
118+ support. tau ~ - flange. tau
119+ ]
120+ push! (sys, support)
121+ else
122+ eqs = [phi_support ~ 0 ]
123+ end
124+ return compose (ODESystem (eqs, t, [phi_support], []; name= name), sys)
125+ end
126+
127+ """
128+ PartialElementaryTwoFlangesAndSupport2(;name, use_support=false)
129+
130+ Partial model for a component with two rotational 1-dim. shaft flanges and a support used for textual modeling, i.e., for elementary models
131+
132+ # Parameters:
133+ - `use_support`: If support flange enabled, otherwise implicitly grounded
134+
135+ # States:
136+ - `phi_support`: Absolute angle of support flange"
137+ """
138+ function PartialElementaryTwoFlangesAndSupport2 (;name, use_support= false )
139+ @named flange_a = Flange ()
140+ @named flange_b = Flange ()
141+ sys = [flange_a, flange_b]
142+ @variables phi_support (t)= 0.0
143+ if use_support
144+ @named support = Support ()
145+ eqs = [
146+ support. phi ~ phi_support
147+ support. tau ~ - flange_a. tau - flange_b. tau
148+ ]
149+ push! (sys, support)
150+ else
151+ eqs = [phi_support ~ 0 ]
152+ end
153+ return compose (ODESystem (eqs, t, [phi_support], []; name= name), sys)
154+ end
0 commit comments