@@ -16,7 +16,7 @@ Flange fixed in housing at a given angle.
1616 flange = Flange ()
1717 end
1818 @parameters begin
19- phi0 = 0.0 , [description = " Fixed offset angle of flange" ]
19+ phi0 = 0.0 , [description = " Fixed offset angle of flange" , unit = u " rad " ]
2020 end
2121 @equations begin
2222 flange. phi ~ phi0
4545"""
4646@mtkmodel Inertia begin
4747 @parameters begin
48- J, [description = " Moment of inertia" ]
48+ J, [description = " Moment of inertia" , unit = u " kg*m^2 " ]
4949 end
5050 @components begin
5151 flange_a = Flange ()
5555 @symcheck J > 0 || throw (ArgumentError (" Expected `J` to be positive" ))
5656 end
5757 @variables begin
58- phi (t) = 0.0 , [description = " Absolute rotation angle" ]
59- w (t) = 0.0 , [description = " Absolute angular velocity" ]
60- a (t) = 0.0 , [description = " Absolute angular acceleration" ]
58+ phi (t) = 0.0 , [description = " Absolute rotation angle" , unit = u " rad " ]
59+ w (t) = 0.0 , [description = " Absolute angular velocity" , unit = u " rad*s^-1 " ]
60+ a (t) = 0.0 , [description = " Absolute angular acceleration" , rad = u " rad*s^-2 " ]
6161 end
6262 @equations begin
6363 phi ~ flange_a. phi
@@ -94,8 +94,8 @@ Linear 1D rotational spring
9494 @symcheck c > 0 || throw (ArgumentError (" Expected `c` to be positive" ))
9595 end
9696 @parameters begin
97- c, [description = " Spring constant" ]
98- phi_rel0 = 0.0 , [description = " Unstretched spring angle" ]
97+ c, [description = " Spring constant" , unit = u " N*m*rad^-1 " ]
98+ phi_rel0 = 0.0 , [description = " Unstretched spring angle" , unit = u " rad " ]
9999 end
100100 @equations begin
101101 tau ~ c * (phi_rel - phi_rel0)
@@ -129,7 +129,7 @@ Linear 1D rotational damper
129129 @symcheck d > 0 || throw (ArgumentError (" Expected `d` to be positive" ))
130130 end
131131 @parameters begin
132- d, [description = " Damping constant" ]
132+ d, [description = " Damping constant" , unit = u " N*m*s*rad^-1 " ]
133133 end
134134 @equations begin
135135 tau ~ d * w_rel
@@ -159,10 +159,10 @@ Linear 1D rotational spring and damper
159159 - `phi_rel0`: [`rad`] Unstretched spring angle
160160"""
161161@mtkmodel SpringDamper begin
162- @extend phi_rel, w_rel, tau = partial_comp = PartialCompliantWithRelativeStates ()
162+ @extend phi_rel, w_rel, a_rel, tau = partial_comp = PartialCompliantWithRelativeStates ()
163163 @variables begin
164- tau_c (t), [description = " Spring torque" ]
165- tau_d (t), [description = " Damper torque" ]
164+ tau_c (t), [description = " Spring torque" , unit = u " N*m " ]
165+ tau_d (t), [description = " Damper torque" , unit = u " N*m " ]
166166 end
167167 @parameters begin
168168 d, [description = " Damping constant" ]
@@ -206,8 +206,14 @@ This element characterizes any type of gear box which is fixed in the ground and
206206 ratio, [description = " Transmission ratio" ]
207207 end
208208 @variables begin
209- phi_a (t) = 0.0 , [description = " Relative angle between shaft a and the support" ]
210- phi_b (t) = 0.0 , [description = " Relative angle between shaft b and the support" ]
209+ function phi_a (t)
210+ 0.0 ,
211+ [description = " Relative angle between shaft a and the support" , unit = u " rad" ]
212+ end
213+ function phi_b (t)
214+ 0.0 ,
215+ [description = " Relative angle between shaft b and the support" , unit = u " rad" ]
216+ end
211217 end
212218 @equations begin
213219 phi_a ~ flange_a. phi - phi_support
@@ -245,14 +251,13 @@ Friction model: "Armstrong, B. and C.C. de Wit, Friction Modeling and Compensati
245251 - `tau_brk`: [`N⋅m`] Breakaway friction torque
246252"""
247253@mtkmodel RotationalFriction begin
248- @extend w_rel, tau = partial_comp = PartialCompliantWithRelativeStates ()
254+ @extend phi_rel, w_rel, a_rel , tau = partial_comp = PartialCompliantWithRelativeStates ()
249255 @parameters begin
250- f, [description = " Viscous friction coefficient" ]
251- tau_c, [description = " Coulomb friction torque" ]
252- w_brk, [description = " Breakaway friction velocity" ]
253- tau_brk, [description = " Breakaway friction torque" ]
256+ f, [description = " Viscous friction coefficient" , unit = u " N*m*s/rad " ]
257+ tau_c, [description = " Coulomb friction torque" , unit = u " N*m " ]
258+ w_brk, [description = " Breakaway friction velocity" , unit = u " rad*s^-1 " ]
259+ tau_brk, [description = " Breakaway friction torque" , unit = " N*m " ]
254260 end
255-
256261 begin
257262 str_scale = sqrt (2 * exp (1 )) * (tau_brk - tau_c)
258263 w_st = w_brk * sqrt (2 )
0 commit comments