diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/ZeroForceAndTorque.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/ZeroForceAndTorque.mo index 4a66927abd..b91bc2c25d 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/ZeroForceAndTorque.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/ZeroForceAndTorque.mo @@ -1,8 +1,7 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model ZeroForceAndTorque "Set force and torque to zero" - extends Modelica.Blocks.Icons.Block; - Interfaces.Frame_a frame_a - annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); + extends Modelica.Blocks.Icons.Block; + extends Interfaces.PartialOneFrame_a; equation frame_a.f = zeros(3); frame_a.t = zeros(3); diff --git a/Modelica/Mechanics/MultiBody/Interfaces/OneFrame_a.mo b/Modelica/Mechanics/MultiBody/Interfaces/OneFrame_a.mo new file mode 100644 index 0000000000..72b949305d --- /dev/null +++ b/Modelica/Mechanics/MultiBody/Interfaces/OneFrame_a.mo @@ -0,0 +1,18 @@ +within Modelica.Mechanics.MultiBody.Interfaces; +partial model OneFrame_a + "Base model for components providing one frame_a connector and outer world" + + Interfaces.Frame_a frame_a + "Coordinate system fixed to the component with one cut-force and cut-torque" + annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); +protected + outer Modelica.Mechanics.MultiBody.World world; + + annotation (Documentation(info=" +
+This partial model provides one frame_a connector and access to +the world object. +Therefore, inherit from this partial model if both is needed. +
+")); +end OneFrame_a; diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialConstraint.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialConstraint.mo new file mode 100644 index 0000000000..40e501ab13 --- /dev/null +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialConstraint.mo @@ -0,0 +1,73 @@ +within Modelica.Mechanics.MultiBody.Interfaces; +partial model PartialConstraint + "Base model for elementary constraints" + extends PartialTwoFrames; + + parameter Boolean x_locked=true + "= true, if constraint force in x-direction, resolved in frame_a" + annotation (Dialog(group="Constrain translational motion"), choices(checkBox=true)); + parameter Boolean y_locked=true + "= true, if constraint force in y-direction, resolved in frame_a" + annotation (Dialog(group="Constrain translational motion"), choices(checkBox=true)); + parameter Boolean z_locked=true + "= true, if constraint force in z-direction, resolved in frame_a" + annotation (Dialog(group="Constrain translational motion"), choices(checkBox=true)); + +protected + SI.Position r_rel_a[3] + "Position vector from origin of frame_a to origin of frame_b, resolved in frame_a"; + Frames.Orientation R_rel + "Relative orientation object from frame_a to frame_b"; + SI.InstantaneousPower P "Instantaneous power"; + +equation + // Determine relative position and orientation + r_rel_a = Frames.resolve2(frame_a.R, frame_b.r_0 - frame_a.r_0); + R_rel = Frames.relativeRotation(frame_a.R, frame_b.R); + + // Constraint equations concerning translations + if x_locked then + r_rel_a[1]=0; + else + frame_a.f[1]=0; + end if; + + if y_locked then + r_rel_a[2]=0; + else + frame_a.f[2]=0; + end if; + + if z_locked then + r_rel_a[3]=0; + else + frame_a.f[3]=0; + end if; + + // Force and torque balance + zeros(3) = frame_a.f + Frames.resolve1(R_rel, frame_b.f); + zeros(3) = frame_a.t + Frames.resolve1(R_rel, frame_b.t) - cross(r_rel_a, frame_a.f); + // - cross(r_rel_a, frame_a.f) gives the same result like cross(r_rel_a, Frames.resolve1(R_rel, frame_b.f)) + + // Instantaneous power + P = frame_a.t * Frames.angularVelocity2(frame_a.R) + + frame_b.t * Frames.angularVelocity2(frame_b.R) + + frame_a.f * Frames.resolve2(frame_a.R, der(frame_a.r_0)) + + frame_b.f * Frames.resolve2(frame_b.R, der(frame_b.r_0)); + + annotation (Documentation(info=" ++All elementary joints defined by constraints should inherit +from this base model, i.e., joints that are directly defined by constraint +equations between the two frames. +
+
+This partial model provides relative kinematic quantities r_rel_a
+and R_rel between the two frame connectors frame_a
+and frame_b, and basic equations constraining translational movement.
+The inheriting class shall additionally provide corresponding equations
+constraining rotational movement.
+
All elementary joints should inherit from this base model, i.e., @@ -30,5 +23,6 @@ This partial model provides two frame connectors, a \"Connections.branch\" between frame_a and frame_b, access to the world object and an assert to check that both frame connectors are connected.
-")); +