Name | Description |
---|---|
PlanarRevolute | revolute cut joint for planar loops |
If a planar loop is cut by a standard revolute joint a singular system of equations results.
The parameter phi_offset defines an offset value for the revolute angle phi.
The parameter animation toggles the visualization of the element.
Name | Default | Description |
---|---|---|
animation | true | animate revolute as cylinder |
n[3] | {0,0,1} | direction of revolute axis [m] |
Animation | ||
if animation = true | ||
cylinderLength | world3D.defaultJointLength | Length of cylinder representing the joint axis [m] |
cylinderDiameter | world3D.defaultJointWidth | Diameter of cylinder representing the joint axis [m] |
cylinderColor | world3D.defaultJointColor | Color of cylinder representing the joint axis |
model PlanarRevolute "revolute cut joint for planar loops" import SI = Modelica.SIunits; import MB = Modelica.Mechanics.MultiBody; parameter Boolean animation = true "animate revolute as cylinder"; parameter SI.Position n[3] = {0,0,1} "direction of revolute axis"; final parameter SI.Position eN[3] = n/sqrt(n*n); final parameter Real notN[3] = if abs(eN[1]) > 0.1 then {0,1,0} else (if abs(eN[2]) > 0.1 then {0,0,1} else {1,0,0}) "Arbitrary vector that is not aligned with eN"; final parameter Real vec_a[3] = cross(eN,notN) "vector in loop plane"; final parameter Real eA[3] = {1,0,0} "normalized vector in loop plane"; final parameter Real eB[3] = cross(eA,eN) "normalized vector in loop plane orthogonal to eA"; parameter SI.Distance cylinderLength=world3D.defaultJointLength "|Animation|if animation = true| Length of cylinder representing the joint axis"; parameter SI.Distance cylinderDiameter=world3D.defaultJointWidth "|Animation|if animation = true| Diameter of cylinder representing the joint axis"; parameter Modelica.Mechanics.MultiBody.Types.Color cylinderColor=world3D.defaultJointColor "|Animation|if animation = true| Color of cylinder representing the joint axis"; Real eA0[3] "eA resolved in inertial frame"; Real eB0[3] "eB resolved in inertial frame"; SI.Torque tau=0 "Revolute torque"; Interfaces.Frame_a frame_a; Interfaces.Frame_b frame_b; protected outer World3D world3D; protected inner Defaults MBG_defaults(n=3); parameter Integer ndim=if world3D.enableAnimation and animation then 1 else 0; MB.Visualizers.Advanced.Shape cylinder[ndim]( each shapeType="cylinder", each color=cylinderColor, each length=cylinderLength, each width=cylinderDiameter, each height=cylinderDiameter, each lengthDirection=eN, each widthDirection={0,1,0}, each r_shape=-eN*cylinderLength/2, each r=frame_a.P.x, each R=MB.Frames.Orientation(T=frame_a.P.R,w=zeros(3))); equation eA0 = transpose(frame_a.P.R)*eA; eB0 = transpose(frame_a.P.R)*eB; (frame_a.P.x - frame_b.P.x)*eA0 = 0; (frame_a.P.x - frame_b.P.x)*eB0 = 0; frame_a.f*transpose(frame_a.P.R)*eN = 0; frame_a.t = eN*tau; frame_a.f + frame_b.f = zeros(3); frame_a.t + frame_b.t = zeros(3); end PlanarRevolute;