3
3
4
4
Flange fixed in housing at a given angle.
5
5
6
+ # Connectors:
7
+ - `flange` flange
8
+
6
9
# Parameters:
7
10
- `phi0`: [rad] Fixed offset angle of housing
8
11
"""
9
12
function Fixed (;name, phi0= 0.0 )
10
13
@named flange = Flange ()
11
- @parameters phi0= phi0
14
+ # @parameters phi0=phi0
12
15
eqs = [flange. phi ~ phi0]
13
- return compose (ODESystem (eqs, t, [], [phi0 ]; name= name), flange)
16
+ return compose (ODESystem (eqs, t, [], []; name= name), flange)
14
17
end
15
18
16
19
"""
17
20
Inertia(;name, J, phi_start=0.0, w_start=0.0, a_start=0.0)
18
21
19
22
1D-rotational component with inertia.
20
23
24
+ # States:
25
+ - `phi`: [rad] Absolute rotation angle of component
26
+ - `w`: [rad/s] Absolute angular velocity of component (= der(phi))
27
+ - `a`: [rad/s²] Absolute angular acceleration of component (= der(w))
28
+
29
+ # Connectors:
30
+ - `flange_a` Left flange
31
+ - `flange_b` Right flange
32
+
21
33
# Parameters:
22
34
- `J`: [kg·m²] Moment of inertia
23
35
- `phi_start`: [rad] Initial value of absolute rotation angle of component
24
36
- `w_start`: [rad/s] Initial value of absolute angular velocity of component
25
37
- `a_start`: [rad/s²] Initial value of absolute angular acceleration of component
26
-
27
- # States:
28
- - `phi`: [rad] Absolute rotation angle of component
29
- - `w`: [rad/s] Absolute angular velocity of component (= der(phi))
30
- - `a`: [rad/s²] Absolute angular acceleration of component (= der(w))
31
38
"""
32
39
function Inertia (;name, J, phi_start= 0.0 , w_start= 0.0 , a_start= 0.0 )
33
40
@named flange_a = Flange ()
34
41
@named flange_b = Flange ()
42
+ J > 0 || throw (ArgumentError (" Expected `J` to be positive" ))
35
43
@parameters J= J
36
44
sts = @variables begin
37
45
phi (t)= phi_start
53
61
54
62
Linear 1D rotational spring
55
63
64
+ # States:
65
+ - See [PartialCompliant](@ref)
66
+
67
+ # Connectors:
68
+ - See [PartialCompliant](@ref)
69
+
56
70
# Parameters:
57
71
- `c`: [N.m/rad] Spring constant
58
72
- `phi_rel0`: Unstretched spring angle
59
73
"""
60
74
function Spring (;name, c, phi_rel0= 0.0 )
61
75
@named partial_comp = PartialCompliant ()
62
76
@unpack phi_rel, tau = partial_comp
77
+ c > 0 || throw (ArgumentError (" Expected `c` to be positive" ))
63
78
pars = @parameters begin
64
79
c= c
65
80
phi_rel0= phi_rel0
73
88
74
89
Linear 1D rotational damper
75
90
91
+ # States:
92
+ - See [PartialCompliantWithRelativeStates](@ref)
93
+
94
+ # Connectors:
95
+ - See [PartialCompliantWithRelativeStates](@ref)
96
+
76
97
# Parameters:
77
98
- `d`: [N.m.s/rad] Damping constant
78
99
"""
79
100
function Damper (;name, d)
80
101
@named partial_comp = PartialCompliantWithRelativeStates ()
81
102
@unpack w_rel, tau = partial_comp
103
+ d > 0 || throw (ArgumentError (" Expected `d` to be positive" ))
82
104
pars = @parameters d= d
83
105
eqs = [tau ~ d* w_rel]
84
106
extend (ODESystem (eqs, t, [], pars; name= name), partial_comp)
@@ -98,6 +120,7 @@ This element characterizes any type of gear box which is fixed in the ground and
98
120
function IdealGear (;name, ratio, use_support= false )
99
121
@named partial_element = PartialElementaryTwoFlangesAndSupport2 (use_support= use_support)
100
122
@unpack phi_support, flange_a, flange_b = partial_element
123
+ ratio > 0 || throw (ArgumentError (" Expected `ratio` to be positive" ))
101
124
@parameters ratio= ratio
102
125
sts = @variables phi_a (t)= 0.0 phi_b (t)= 0.0
103
126
eqs = [
@@ -107,4 +130,70 @@ function IdealGear(;name, ratio, use_support=false)
107
130
0 ~ ratio* flange_a. tau + flange_b. tau
108
131
]
109
132
extend (ODESystem (eqs, t, sts, [ratio]; name= name), partial_element)
133
+ end
134
+
135
+ """
136
+ RotationalFriction(;name, f, tau_c, w_brk, tau_brk)
137
+
138
+ Models rotational friction with Stribeck effect, Coulomb friction and viscous friction between the two flanges.
139
+ The friction torque is a function of the relative angular velocity between flange_a and flange_b.
140
+
141
+ Friction model: "Armstrong, B. and C.C. de Wit, Friction Modeling and Compensation, The Control Handbook, CRC Press, 1995."
142
+
143
+ # States:
144
+ - see [`PartialCompliantWithRelativeStates`](@ref)
145
+
146
+ # Connectors:
147
+ - See [`PartialCompliantWithRelativeStates`](@ref)
148
+
149
+ # Parameters:
150
+ - `f`: [`N⋅m/(rad/s)`] Viscous friction coefficient
151
+ - `tau_c`: [`N⋅m`] Coulomb friction torque
152
+ - `w_brk`: [`rad/s`] Breakaway friction velocity
153
+ - `tau_brk`: [`N⋅m`] Breakaway friction torque
154
+ """
155
+ function RotationalFriction (;name, f, tau_c, w_brk, tau_brk)
156
+ @named partial_comp = PartialCompliantWithRelativeStates ()
157
+ @unpack w_rel, tau = partial_comp
158
+ w_brk > 0 || throw (ArgumentError (" Expected `w_brk` to be positive" ))
159
+ tau_brk > 0 || throw (ArgumentError (" Expected `tau_brk` to be positive" ))
160
+ tau_c > 0 || throw (ArgumentError (" Expected `tau_c` to be positive" ))
161
+ tau_c <= tau_brk || throw (ArgumentError (" `tau_brk` to be greater than `tau_c`" ))
162
+ f >= 0 || throw (ArgumentError (" Expected `f` to be not negative" ))
163
+ pars = @parameters f= f tau_c= tau_c w_brk= w_brk tau_brk= tau_brk
164
+
165
+ str_scale = sqrt (2 * exp (1 )) * (tau_brk - tau_c)
166
+ w_st = w_brk * sqrt (2 )
167
+ w_coul = w_brk / 10
168
+
169
+ eqs = [
170
+ tau ~ str_scale * (exp (- (w_rel/ w_st)^ 2 ) * w_rel / w_st) + tau_c * tanh (w_rel / w_coul) + f * w_rel # Stribeck friction + Coulomb friction + Viscous friction
171
+ ]
172
+ extend (ODESystem (eqs, t, [], pars; name= name), partial_comp)
173
+ end
174
+
175
+ """
176
+ ViscousFriction(;name, f)
177
+
178
+ Models rotational viscous friction between the two flanges.
179
+ The friction torque is a function of the relative angular velocity between flange_a and flange_b.
180
+ # States:
181
+ - see [`PartialCompliantWithRelativeStates`](@ref)
182
+
183
+ # Connectors:
184
+ - See [`PartialCompliantWithRelativeStates`](@ref)
185
+
186
+ # Parameters:
187
+ - `f`: [`N⋅m/(rad/s)`] Viscous friction coefficient
188
+ """
189
+ function ViscousFriction (;name, f)
190
+ @named partial_comp = PartialCompliantWithRelativeStates ()
191
+ @unpack w_rel, tau = partial_comp
192
+ f >= 0 || throw (ArgumentError (" Expected `f` to be not negative" ))
193
+ pars = @parameters f= f
194
+
195
+ eqs = [
196
+ tau ~ f * w_rel # Viscous friction
197
+ ]
198
+ extend (ODESystem (eqs, t, [], pars; name= name), partial_comp)
110
199
end
0 commit comments