From c163513d79f61c359cf7723bf6d597af50bb90f0 Mon Sep 17 00:00:00 2001 From: tobolar Date: Wed, 8 Nov 2023 12:02:50 +0100 Subject: [PATCH 01/21] Extend from PartialForce instead of PartialTwoFrames --- .../MultiBody/Forces/Internal/BasicForce.mo | 47 +++++++++---------- .../MultiBody/Forces/Internal/BasicTorque.mo | 43 ++++++++--------- 2 files changed, 43 insertions(+), 47 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo index 0731015d7a..0f5e98576d 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo @@ -1,8 +1,9 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model BasicForce "Force acting between two frames, defined by 3 input signals" - extends Modelica.Mechanics.MultiBody.Interfaces.PartialTwoFrames; + extends Interfaces.PartialForce; import Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB; + Interfaces.Frame_resolve frame_resolve "The input signals are optionally resolved in this frame" annotation (Placement(transformation( @@ -22,36 +23,34 @@ model BasicForce SI.Position r_0[3] "Position vector from origin of frame_a to origin of frame_b resolved in world frame"; - SI.Force f_b_0[3] "frame_b.f resolved in world frame"; + SI.Force f_b_0[3] "Force frame_b.f resolved in world frame"; equation assert(cardinality(frame_resolve) > 0, "Connector frame_resolve must be connected at least once and frame_resolve.r_0/.R must be set"); frame_resolve.f = zeros(3); frame_resolve.t = zeros(3); - if resolveInFrame == ResolveInFrameAB.frame_a then - f_b_0 = -Frames.resolve1(frame_a.R, force); - frame_b.f = Frames.resolve2(frame_b.R, f_b_0); - elseif resolveInFrame == ResolveInFrameAB.frame_b then - f_b_0 = -Frames.resolve1(frame_b.R, force); - frame_b.f = -force; - elseif resolveInFrame == ResolveInFrameAB.world then - f_b_0 = -force; - frame_b.f = Frames.resolve2(frame_b.R, f_b_0); - elseif resolveInFrame == ResolveInFrameAB.frame_resolve then - f_b_0 = -Frames.resolve1(frame_resolve.R, force); - frame_b.f = Frames.resolve2(frame_b.R, f_b_0); - else - assert(false, "Wrong value for parameter resolveInFrame"); - f_b_0 = zeros(3); - frame_b.f = zeros(3); - end if; - frame_b.t = zeros(3); + r_0 = frame_b.r_0 - frame_a.r_0; + frame_b.t = zeros(3); + + if resolveInFrame == ResolveInFrameAB.frame_a then + f_b_0 = -Frames.resolve1(frame_a.R, force); + frame_b.f = Frames.resolve2(frame_b.R, f_b_0); + elseif resolveInFrame == ResolveInFrameAB.frame_b then + f_b_0 = -Frames.resolve1(frame_b.R, force); + frame_b.f = -force; + elseif resolveInFrame == ResolveInFrameAB.world then + f_b_0 = -force; + frame_b.f = Frames.resolve2(frame_b.R, f_b_0); + elseif resolveInFrame == ResolveInFrameAB.frame_resolve then + f_b_0 = -Frames.resolve1(frame_resolve.R, force); + frame_b.f = Frames.resolve2(frame_b.R, f_b_0); + else + assert(false, "Wrong value for parameter resolveInFrame"); + f_b_0 = zeros(3); + frame_b.f = zeros(3); + end if; - // Force and torque balance - r_0 = frame_b.r_0 - frame_a.r_0; - zeros(3) = frame_a.f + Frames.resolve2(frame_a.R, f_b_0); - zeros(3) = frame_a.t + Frames.resolve2(frame_a.R, cross(r_0, f_b_0)); annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics={ diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo index 57c821a617..17a52732fb 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo @@ -1,15 +1,15 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model BasicTorque "Torque acting between two frames, defined by 3 input signals" + extends Interfaces.PartialForce; import Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB; - extends Modelica.Mechanics.MultiBody.Interfaces.PartialTwoFrames; + Interfaces.Frame_resolve frame_resolve "The input signals are optionally resolved in this frame" annotation (Placement(transformation( origin={40,100}, extent={{-16,-16},{16,16}}, rotation=90))); - Modelica.Blocks.Interfaces.RealInput torque[3](each final quantity="Torque", each final unit="N.m") "x-, y-, z-coordinates of torque resolved in frame defined by resolveInFrame" annotation (Placement(transformation( @@ -23,7 +23,7 @@ model BasicTorque SI.Position r_0[3] "Position vector from origin of frame_a to origin of frame_b resolved in world frame"; - SI.Torque t_b_0[3] "frame_b.t resolved in world frame"; + SI.Torque t_b_0[3] "Torque frame_b.t resolved in world frame"; equation assert(cardinality(frame_resolve) > 0, "Connector frame_resolve must be connected at least once and frame_resolve.r_0/.R must be set"); @@ -31,29 +31,26 @@ equation frame_resolve.t = zeros(3); r_0 = frame_b.r_0 - frame_a.r_0; - frame_a.f = zeros(3); frame_b.f = zeros(3); - if resolveInFrame == ResolveInFrameAB.frame_a then - t_b_0 = -Frames.resolve1(frame_a.R, torque); - frame_b.t = Frames.resolve2(frame_b.R, t_b_0); - elseif resolveInFrame == ResolveInFrameAB.frame_b then - t_b_0 = -Frames.resolve1(frame_b.R, torque); - frame_b.t = -torque; - elseif resolveInFrame == ResolveInFrameAB.world then - t_b_0 = -torque; - frame_b.t = Frames.resolve2(frame_b.R, t_b_0); - elseif resolveInFrame == ResolveInFrameAB.frame_resolve then - t_b_0 = -Frames.resolve1(frame_resolve.R, torque); - frame_b.t = Frames.resolve2(frame_b.R, t_b_0); - else - assert(false, "Wrong value for parameter resolveInFrame"); - t_b_0 = zeros(3); - frame_b.t = zeros(3); - end if; + if resolveInFrame == ResolveInFrameAB.frame_a then + t_b_0 = -Frames.resolve1(frame_a.R, torque); + frame_b.t = Frames.resolve2(frame_b.R, t_b_0); + elseif resolveInFrame == ResolveInFrameAB.frame_b then + t_b_0 = -Frames.resolve1(frame_b.R, torque); + frame_b.t = -torque; + elseif resolveInFrame == ResolveInFrameAB.world then + t_b_0 = -torque; + frame_b.t = Frames.resolve2(frame_b.R, t_b_0); + elseif resolveInFrame == ResolveInFrameAB.frame_resolve then + t_b_0 = -Frames.resolve1(frame_resolve.R, torque); + frame_b.t = Frames.resolve2(frame_b.R, t_b_0); + else + assert(false, "Wrong value for parameter resolveInFrame"); + t_b_0 = zeros(3); + frame_b.t = zeros(3); + end if; - // torque balance - zeros(3) = frame_a.t + Frames.resolve2(frame_a.R, t_b_0); annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics={ From 7ef5bfa2d4e0fe649f0a79f6618267a21f344c8b Mon Sep 17 00:00:00 2001 From: Jakub Tobolar Date: Wed, 8 Nov 2023 13:22:49 +0100 Subject: [PATCH 02/21] Introduce orientation object R_rel (in accordance with class' documentation) --- .../MultiBody/Interfaces/PartialForce.mo | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo index f5729ce3ff..844fce359e 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo @@ -1,32 +1,37 @@ within Modelica.Mechanics.MultiBody.Interfaces; partial model PartialForce - "Base model for force elements (provide frame_b.f and frame_b.t in subclasses)" + "Base model for force elements, used for textual modeling, i.e., for elementary models" extends PartialTwoFrames; + SI.Position r_rel_b[3] "Position vector from origin of frame_a to origin of frame_b, resolved in frame_b"; + Frames.Orientation R_rel + "Relative orientation object from frame_a to frame_b"; equation - // Determine relative position vector between frame_a and frame_b + // Determine relative position and orientation r_rel_b = Frames.resolve2(frame_b.R, frame_b.r_0 - frame_a.r_0); + R_rel = Frames.relativeRotation(frame_a.R, frame_b.R); // Force and torque balance between frame_a and frame_b - zeros(3) = frame_a.f + Frames.resolveRelative(frame_b.f, frame_b.R, frame_a.R); - zeros(3) = frame_a.t + Frames.resolveRelative(frame_b.t + cross(r_rel_b, frame_b.f), frame_b.R, frame_a.R); + 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_b, frame_b.f)); + annotation (Documentation(info="

-All 3-dimensional force and torque elements -should be based on this superclass. +All elementary 3-dimensional force and +torque elements should be based on this superclass. This model defines frame_a and frame_b, computes the relative translation and rotation between the two frames and calculates the cut-force and cut-torque at frame_a by a force and torque balance from the cut-force and cut-torque at frame_b. As a result, in a subclass, only the relationship between -the cut-force and cut-torque at frame_b has to be defined as -a function of the following relative quantities: +the cut-force and cut-torque at frame_b (i.e., frame_b.f and frame_b.t) +has to be defined as a function of the following relative quantities:

 r_rel_b[3]: Position vector from origin of frame_a to origin
             of frame_b, resolved in frame_b
-R_rel     : Relative orientation object to rotate from frame_a to frame_b
+R_rel     : Relative orientation object from frame_a to frame_b
 

Assume that force f = {100,0,0} should be applied on the body @@ -42,7 +47,7 @@ the definition should be: end Constant_x_Force;

-Note, that frame_b.f and frame_b.t are flow variables and therefore +Note, that frame_b.f and frame_b.t are flow variables and, therefore, the negative value of frame_b.f and frame_b.t is acting at the part to which this force element is connected.

From 67eb83a85147292bcab89f4218907b84ea585b0b Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 29 Jan 2021 16:49:01 +0100 Subject: [PATCH 03/21] Extend from PartialElementaryJoint --- Modelica/Mechanics/MultiBody/Joints/Revolute.mo | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Joints/Revolute.mo b/Modelica/Mechanics/MultiBody/Joints/Revolute.mo index 640f58178a..25ed2fdcba 100644 --- a/Modelica/Mechanics/MultiBody/Joints/Revolute.mo +++ b/Modelica/Mechanics/MultiBody/Joints/Revolute.mo @@ -2,6 +2,7 @@ within Modelica.Mechanics.MultiBody.Joints; model Revolute "Revolute joint (1 rotational degree-of-freedom, 2 potential states, optional axis flange)" + extends Modelica.Mechanics.MultiBody.Interfaces.PartialElementaryJoint; Modelica.Mechanics.Rotational.Interfaces.Flange_a axis if useAxisFlange "1-dim. rotational flange that drives the joint" annotation (Placement(transformation(extent={{10,90},{-10,110}}))); @@ -9,13 +10,6 @@ model Revolute "1-dim. rotational flange of the drive support (assumed to be fixed in the world frame, NOT in the joint)" annotation (Placement(transformation(extent={{-70,90},{-50,110}}))); - Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system fixed to the joint with one cut-force and cut-torque" - annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); - Modelica.Mechanics.MultiBody.Interfaces.Frame_b frame_b - "Coordinate system fixed to the joint with one cut-force and cut-torque" - annotation (Placement(transformation(extent={{84,-16},{116,16}}))); - parameter Boolean useAxisFlange=false "= true, if axis flange is enabled" annotation(Evaluate=true, HideResult=true, choices(checkBox=true)); parameter Boolean animation=true @@ -58,7 +52,6 @@ Possible reasons: SI.Angle angle "= phi"; protected - outer Modelica.Mechanics.MultiBody.World world; parameter Real e[3](each final unit="1")=Modelica.Math.Vectors.normalizeWithAssert(n) "Unit vector in direction of rotation axis, resolved in frame_a (= same as in frame_b)"; Frames.Orientation R_rel @@ -85,13 +78,6 @@ protected Rotational.Sources.ConstantTorque constantTorque(tau_constant=0) if not useAxisFlange annotation (Placement(transformation(extent={{40,70},{20,90}}))); equation - Connections.branch(frame_a.R, frame_b.R); - - assert(cardinality(frame_a) > 0, - "Connector frame_a of revolute joint is not connected"); - assert(cardinality(frame_b) > 0, - "Connector frame_b of revolute joint is not connected"); - angle = phi; w = der(phi); a = der(w); From d99fa56b9d0f9dad9fafd28db935d5be2446bd15 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 29 Jan 2021 16:49:15 +0100 Subject: [PATCH 04/21] Extend from PartialTwoFrames --- .../Joints/RevolutePlanarLoopConstraint.mo | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Joints/RevolutePlanarLoopConstraint.mo b/Modelica/Mechanics/MultiBody/Joints/RevolutePlanarLoopConstraint.mo index cf2b39ffbc..27ece3f186 100644 --- a/Modelica/Mechanics/MultiBody/Joints/RevolutePlanarLoopConstraint.mo +++ b/Modelica/Mechanics/MultiBody/Joints/RevolutePlanarLoopConstraint.mo @@ -1,17 +1,11 @@ within Modelica.Mechanics.MultiBody.Joints; model RevolutePlanarLoopConstraint "Revolute joint that is described by 2 positional constraints for usage in a planar loop (the ambiguous cut-force perpendicular to the loop and the ambiguous cut-torques are set arbitrarily to zero)" + extends Modelica.Mechanics.MultiBody.Interfaces.PartialTwoFrames; import T = Modelica.Mechanics.MultiBody.Frames.TransformationMatrices; import Modelica.Mechanics.MultiBody.Types; - Interfaces.Frame_a frame_a - "Coordinate system fixed to the joint with one cut-force and cut-torque" - annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); - Interfaces.Frame_b frame_b - "Coordinate system fixed to the joint with one cut-force and cut-torque" - annotation (Placement(transformation(extent={{84,-16},{116,16}}))); - parameter Boolean animation=true "= true, if animation shall be enabled (show axis as cylinder)"; parameter Modelica.Mechanics.MultiBody.Types.Axis n={0,0,1} @@ -30,7 +24,6 @@ model RevolutePlanarLoopConstraint "Reflection of ambient light (= 0: light is completely absorbed)" annotation (Dialog(group="if animation = true", enable=animation)); protected - outer Modelica.Mechanics.MultiBody.World world; parameter Real e[3](each final unit="1")=Modelica.Math.Vectors.normalizeWithAssert(n) "Unit vector in direction of rotation axis, resolved in frame_a (= same as in frame_b)"; parameter Real nnx_a[3](each final unit="1")=if abs(e[1]) > 0.1 then {0,1,0} else (if abs(e[2]) @@ -64,11 +57,6 @@ protected r=frame_a.r_0, R=frame_a.R) if world.enableAnimation and animation; equation - assert(cardinality(frame_a) > 0, - "Connector frame_a of revolute joint is not connected"); - assert(cardinality(frame_b) > 0, - "Connector frame_b of revolute joint is not connected"); - // Determine relative position vector resolved in frame_a R_rel = Frames.relativeRotation(frame_a.R, frame_b.R); r_rel_a = Frames.resolve2(frame_a.R, frame_b.r_0 - frame_a.r_0); From 5d72aa3ea37db92c774d453a437013cfc94b1b98 Mon Sep 17 00:00:00 2001 From: tobolar Date: Tue, 14 Mar 2023 14:46:37 +0100 Subject: [PATCH 05/21] PartialXxxBaseSensors depend on corresponding interface definitions --- .../Sensors/Internal/PartialAbsoluteBaseSensor.mo | 7 +------ .../Sensors/Internal/PartialAbsoluteSensor.mo | 2 +- .../Sensors/Internal/PartialRelativeBaseSensor.mo | 11 +---------- .../Sensors/Internal/PartialRelativeSensor.mo | 4 ++-- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo index 77642943bf..90f95a7067 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo @@ -1,11 +1,7 @@ within Modelica.Mechanics.MultiBody.Sensors.Internal; model PartialAbsoluteBaseSensor "Base class for absolute sensor models defined by equations (frame_resolve must be connected exactly once)" - extends Modelica.Icons.RoundSensor; - - Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system from which kinematic quantities are measured" annotation (Placement( - transformation(extent={{-116,-16},{-84,16}}))); + extends PartialAbsoluteSensor; Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve "Coordinate system in which output vector(s) is optionally resolved" @@ -14,7 +10,6 @@ model PartialAbsoluteBaseSensor origin={0,-100}))); equation - assert(cardinality(frame_a) > 0, "Connector frame_a must be connected at least once"); assert(cardinality(frame_resolve) == 1, "Connector frame_resolve must be connected exactly once"); frame_a.f = zeros(3); frame_a.t = zeros(3); diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteSensor.mo index 2efde157dc..22528e420b 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteSensor.mo @@ -3,7 +3,7 @@ partial model PartialAbsoluteSensor "Base class for absolute sensor models" extends Modelica.Icons.RoundSensor; Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system a of which the absolute kinematic quantities are measured" annotation (Placement( + "Coordinate system of which the absolute kinematic quantities are measured" annotation (Placement( transformation(extent={{-116,-16},{-84,16}}))); equation diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo index 15d33e9945..dd3acfb55d 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo @@ -1,22 +1,13 @@ within Modelica.Mechanics.MultiBody.Sensors.Internal; model PartialRelativeBaseSensor "Base class for relative sensor models defined by equations (frame_resolve must be connected exactly once)" - extends Modelica.Icons.RoundSensor; - - Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system a (measurement is between frame_a and frame_b)" annotation (Placement( - transformation(extent={{-116,-16},{-84,16}}))); - Modelica.Mechanics.MultiBody.Interfaces.Frame_b frame_b - "Coordinate system b (measurement is between frame_a and frame_b)" annotation (Placement( - transformation(extent={{84,-16},{116,16}}))); + extends PartialRelativeSensor; Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve "Coordinate system in which vector is optionally resolved" annotation (Placement(transformation(extent={{84,64},{116,96}}))); equation - assert(cardinality(frame_a) > 0, "Connector frame_a must be connected at least once"); - assert(cardinality(frame_b) > 0, "Connector frame_b must be connected at least once"); assert(cardinality(frame_resolve) == 1, "Connector frame_resolve must be connected exactly once"); frame_a.f = zeros(3); frame_a.t = zeros(3); diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeSensor.mo index 81f942e3c9..9580ae1a53 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeSensor.mo @@ -4,10 +4,10 @@ partial model PartialRelativeSensor extends Modelica.Icons.RoundSensor; Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system a" annotation (Placement( + "Coordinate system a (measurement is between frame_a and frame_b)" annotation (Placement( transformation(extent={{-116,-16},{-84,16}}))); Modelica.Mechanics.MultiBody.Interfaces.Frame_b frame_b - "Coordinate system b" annotation (Placement( + "Coordinate system b (measurement is between frame_a and frame_b)" annotation (Placement( transformation(extent={{84,-16},{116,16}}))); equation From 139d70b8d1c17275651596d93bd328e13592889e Mon Sep 17 00:00:00 2001 From: tobolar Date: Tue, 14 Mar 2023 15:45:21 +0100 Subject: [PATCH 06/21] Inherite from PartialAbsoluteSensor (Similar to inheritance of TransformRelativeVector) --- .../Sensors/TransformAbsoluteVector.mo | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Sensors/TransformAbsoluteVector.mo b/Modelica/Mechanics/MultiBody/Sensors/TransformAbsoluteVector.mo index e2f8d77aa1..c0e1ae87b0 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/TransformAbsoluteVector.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/TransformAbsoluteVector.mo @@ -1,15 +1,10 @@ within Modelica.Mechanics.MultiBody.Sensors; model TransformAbsoluteVector "Transform absolute vector in to another frame" - extends Modelica.Icons.RoundSensor; + extends Internal.PartialAbsoluteSensor; - Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system from which absolute kinematic quantities are measured" - annotation (Placement( - transformation(extent={{-116,-16},{-84,16}}))); - - Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve if - (frame_r_in == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve) or - (frame_r_out == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve) + Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve + if (frame_r_in == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve) + or (frame_r_out == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve) "Coordinate system in which r_in or r_out is optionally resolved" annotation (Placement(transformation(extent={{84,-16},{116,16}}))); @@ -35,8 +30,8 @@ protected Internal.BasicTransformAbsoluteVector basicTransformVector(frame_r_in= frame_r_in, frame_r_out=frame_r_out) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - Modelica.Mechanics.MultiBody.Interfaces.ZeroPosition zeroPosition if - not (frame_r_in == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve or + Modelica.Mechanics.MultiBody.Interfaces.ZeroPosition zeroPosition + if not (frame_r_in == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve or frame_r_out == Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_resolve) annotation (Placement(transformation(extent={{40,18},{60,38}}))); From b39daaef3eb7b297aa2d8c746e16256192eaf744 Mon Sep 17 00:00:00 2001 From: tobolar Date: Thu, 9 Nov 2023 17:37:47 +0100 Subject: [PATCH 07/21] Add PartialTwoFramesResolve --- .../Interfaces/PartialTwoFramesResolve.mo | 47 +++++++++++++++++++ .../MultiBody/Interfaces/package.order | 1 + 2 files changed, 48 insertions(+) create mode 100644 Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo new file mode 100644 index 0000000000..709253f7ea --- /dev/null +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo @@ -0,0 +1,47 @@ +within Modelica.Mechanics.MultiBody.Interfaces; +partial model PartialTwoFramesResolve + "Base model for components providing two frame connectors, frame_resolve connector and outer world" + extends PartialTwoFrames; + +protected + parameter Boolean enableFrameResolve = false "= true, if frame_resolve shall be enabled" + annotation(Evaluate=true, HideResult=true); + +public + Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve if enableFrameResolve + "Coordinate system in which input/output vector is optionally resolved" + annotation (Placement(transformation(extent={{-16,-16},{16,16}}, + rotation=-90, + origin={0,-100}))); + + annotation ( + Documentation(info=" +

+This partial model provides two frame connectors, a frame connector for +resolving vectors in this frame and access to the world object. +It is reasonable to inherit from this partial model if the two frame connectors +are needed. +

+ +

+The conditional frame_resolve connector is activated by a protected +parameter enableFrameResolve. This parameter can be set directly +in the extending class. In a more typical case – such as for sensors or +forces, it can be utilized to define in which frame a particular vector is +resolved. In such a case, a definition similar to the following can be +utilized. +

+ + + + + + + + + + + +
resolveInFrame =
Types.ResolveInFrameA.
Meaning
worldResolve vector in world frame
frame_aResolve vector in frame_a
frame_resolveResolve vector in frame_resolve
+")); +end PartialTwoFramesResolve; diff --git a/Modelica/Mechanics/MultiBody/Interfaces/package.order b/Modelica/Mechanics/MultiBody/Interfaces/package.order index f90accb778..064291528f 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/package.order +++ b/Modelica/Mechanics/MultiBody/Interfaces/package.order @@ -6,6 +6,7 @@ FlangeWithBearing FlangeWithBearingAdaptor PartialTwoFrames PartialTwoFramesDoubleSize +PartialTwoFramesResolve PartialOneFrame_a PartialOneFrame_b PartialElementaryJoint From 40975d0ed74c4e8ee8c946d1086b95fc032a3a0e Mon Sep 17 00:00:00 2001 From: tobolar Date: Thu, 9 Nov 2023 17:38:18 +0100 Subject: [PATCH 08/21] Disable cardinality assertion --- .../Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo index 8ee6e05a13..d678cc1da8 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo @@ -7,10 +7,10 @@ partial model PartialTwoFrames protected outer Modelica.Mechanics.MultiBody.World world; equation - assert(cardinality(frame_a) > 0, - "Connector frame_a of component is not connected"); - assert(cardinality(frame_b) > 0, - "Connector frame_b of component is not connected"); +// assert(cardinality(frame_a) > 0, +// "Connector frame_a of component is not connected"); +// assert(cardinality(frame_b) > 0, +// "Connector frame_b of component is not connected"); annotation ( Icon(coordinateSystem( preserveAspectRatio=true, From 9aae0eda94dcb590f701cb1404bf637df9d6a4d4 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 15:50:25 +0100 Subject: [PATCH 09/21] Add PartialFrameResolveConditional --- .../PartialFrameResolveConditional.mo | 43 +++++++++++++++++++ .../MultiBody/Interfaces/package.order | 1 + 2 files changed, 44 insertions(+) create mode 100644 Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo new file mode 100644 index 0000000000..790829c9eb --- /dev/null +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo @@ -0,0 +1,43 @@ +within Modelica.Mechanics.MultiBody.Interfaces; +partial model PartialFrameResolveConditional + "Base model for components providing conditional connector frame_resolve" + +protected + parameter Boolean enableFrameResolve = false "= true, if frame_resolve shall be enabled" + annotation(Evaluate=true, HideResult=true); + +public + Interfaces.Frame_resolve frame_resolve if enableFrameResolve + "Coordinate system in which input/output vector is optionally resolved" + annotation (Placement(transformation(extent={{-16,-16},{16,16}}, + rotation=-90, + origin={0,-100}))); + + annotation ( + Documentation(info=" +

+This partial model provides one conditional connector frame_resolve +for resolving input/output vectors in this frame. +The connector is activated by a protected parameter enableFrameResolve. +This parameter can be set directly in the extending class. +In a more typical case – such as for sensors or forces, it can be +utilized to define in which frame a particular vector is resolved. +In such a case, a definition similar to the following can be +utilized. +

+ +
+model A
+  import Modelica.Mechanics.MultiBody.Types.ResolveInFrameB;
+  ...
+  extends Interfaces.PartialFrameResolveConditional(
+    final enableFrameResolve = resolveInFrame==ResolveInFrameB.frame_resolve);
+  parameter ResolveInFrameB resolveInFrame = ResolveInFrameB.world
+    \"Frame in which input u is resolved\";
+  Modelica.Blocks.Interfaces.RealInput u[3]
+    \"x-, y-, z-coordinates of force resolved in frame defined by resolveInFrame\"
+  ...
+end A;
+
+")); +end PartialFrameResolveConditional; diff --git a/Modelica/Mechanics/MultiBody/Interfaces/package.order b/Modelica/Mechanics/MultiBody/Interfaces/package.order index 064291528f..a84fd133af 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/package.order +++ b/Modelica/Mechanics/MultiBody/Interfaces/package.order @@ -7,6 +7,7 @@ FlangeWithBearingAdaptor PartialTwoFrames PartialTwoFramesDoubleSize PartialTwoFramesResolve +PartialFrameResolveConditional PartialOneFrame_a PartialOneFrame_b PartialElementaryJoint From 5a13a894ce150fb218cd33e4559fd1c9389eb09b Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 15:52:51 +0100 Subject: [PATCH 10/21] Icon: delete letters 'a' and 'b' --- .../Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo index d678cc1da8..ed15e110a0 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFrames.mo @@ -14,13 +14,7 @@ equation annotation ( Icon(coordinateSystem( preserveAspectRatio=true, - extent={{-100,-100},{100,100}}), graphics={Text( - extent={{-136,-25},{-100,-50}}, - textColor={128,128,128}, - textString="a"), Text( - extent={{100,-25},{136,-50}}, - textColor={128,128,128}, - textString="b")}), + extent={{-100,-100},{100,100}})), Documentation(info="

This partial model provides two frame connectors, access to the world From e9354cad8218502913aaee0db5fd21ea92001a02 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:17:03 +0100 Subject: [PATCH 11/21] Improve documentation --- .../Interfaces/PartialFrameResolveConditional.mo | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo index 790829c9eb..d062b657ea 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo @@ -20,8 +20,8 @@ This partial model provides one conditional connector frame_resolve for resolving input/output vectors in this frame. The connector is activated by a protected parameter enableFrameResolve. This parameter can be set directly in the extending class. -In a more typical case – such as for sensors or forces, it can be -utilized to define in which frame a particular vector is resolved. +In a more typical case – such as for sensors or forces, this partial class +can be utilized to define in which frame a particular vector is resolved. In such a case, a definition similar to the following can be utilized.

@@ -39,5 +39,11 @@ utilized. ... end A; + +

+Note, the ResolveInFrameB type is not part of this class since there +exist more similar types which can be used instead – depending on a use +case. +

")); end PartialFrameResolveConditional; From 0364d42ffd11d394e001bab96c443e4303ae1c94 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:18:03 +0100 Subject: [PATCH 12/21] Make frame_resolve non-conditional since there is PartialFrameResolveConditional --- .../Interfaces/PartialTwoFramesResolve.mo | 50 +++++++------------ 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo index 709253f7ea..795925e75c 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialTwoFramesResolve.mo @@ -1,47 +1,35 @@ within Modelica.Mechanics.MultiBody.Interfaces; partial model PartialTwoFramesResolve "Base model for components providing two frame connectors, frame_resolve connector and outer world" - extends PartialTwoFrames; -protected - parameter Boolean enableFrameResolve = false "= true, if frame_resolve shall be enabled" - annotation(Evaluate=true, HideResult=true); - -public - Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve if enableFrameResolve + Interfaces.Frame_a frame_a "Coordinate system a fixed to the component with one cut-force and cut-torque" annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); + Interfaces.Frame_b frame_b "Coordinate system b fixed to the component with one cut-force and cut-torque" annotation (Placement(transformation(extent={{84,-16},{116,16}}))); + Interfaces.Frame_resolve frame_resolve "Coordinate system in which input/output vector is optionally resolved" annotation (Placement(transformation(extent={{-16,-16},{16,16}}, rotation=-90, origin={0,-100}))); +protected + outer Modelica.Mechanics.MultiBody.World world; annotation ( Documentation(info="

-This partial model provides two frame connectors, a frame connector for -resolving vectors in this frame and access to the world object. -It is reasonable to inherit from this partial model if the two frame connectors -are needed. -

- -

-The conditional frame_resolve connector is activated by a protected -parameter enableFrameResolve. This parameter can be set directly -in the extending class. In a more typical case – such as for sensors or -forces, it can be utilized to define in which frame a particular vector is -resolved. In such a case, a definition similar to the following can be -utilized. +This partial model provides two frame connectors, a frame connector +frame_resolve for resolving input/output or whatever vector +in this frame, and access to the protected outer world object. +This partial class can, thus, cover a wide range of use cases. +If either of the components is not needed in the extending class, it can +be simply disabled – such as the connector frame_a in +the following.

- - - - - - - - - - -
resolveInFrame =
Types.ResolveInFrameA.
Meaning
worldResolve vector in world frame
frame_aResolve vector in frame_a
frame_resolveResolve vector in frame_resolve
+
+model A
+  extends Interfaces.PartialTwoFramesResolve(
+    break frame_a);
+  ...
+end A;
+
")); end PartialTwoFramesResolve; From 00988077d9cc6cff34c66844939419ad2b97150d Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:21:23 +0100 Subject: [PATCH 13/21] Inherit form PartialTwoFramesResolve which adds also frame_resolve --- .../Interfaces/PartialAbsoluteSensor.mo | 16 +++++------ .../Interfaces/PartialRelativeSensor.mo | 27 +++++-------------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialAbsoluteSensor.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialAbsoluteSensor.mo index 27ed57e300..9369dd718c 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialAbsoluteSensor.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialAbsoluteSensor.mo @@ -2,18 +2,15 @@ within Modelica.Mechanics.MultiBody.Interfaces; partial model PartialAbsoluteSensor "Base model to measure an absolute frame variable" extends Modelica.Icons.RoundSensor; + extends PartialTwoFramesResolve( + break frame_b); + parameter Integer n_out = 1 "Number of output signals"; - Interfaces.Frame_a frame_a "Coordinate system from which absolute quantities are provided as output signals" annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); Modelica.Blocks.Interfaces.RealOutput y[n_out] "Measured data as signal vector" annotation (Placement(transformation(extent={{100,-10},{120,10}}))); -protected - outer Modelica.Mechanics.MultiBody.World world; -equation - assert(cardinality(frame_a) > 0, - "Connector frame_a of absolute sensor object is not connected"); annotation ( Documentation(info="

@@ -27,9 +24,10 @@ with the blocks of package Modelica.Blocks. preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ Line(points={{-70,0},{-100,0}}), - Line(points={{70,0},{100,0}}, color={0,0,255}), + Line(points={{70,0},{100,0}}, color={0,0,127}), Text( - extent={{-132,-125},{131,-79}}, + extent={{-150,120},{150,80}}, textString="%name", - textColor={0,0,255})})); + textColor={0,0,255}), + Line(points={{0,-100},{0,-70}}, pattern=LinePattern.Dot)})); end PartialAbsoluteSensor; diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialRelativeSensor.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialRelativeSensor.mo index 80cdbd684f..652120c1f8 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialRelativeSensor.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialRelativeSensor.mo @@ -2,24 +2,16 @@ within Modelica.Mechanics.MultiBody.Interfaces; partial model PartialRelativeSensor "Base model to measure a relative variable between two frames" extends Modelica.Icons.RoundSensor; + extends PartialTwoFramesResolve; + parameter Integer n_out = 1 "Number of output signals"; - Interfaces.Frame_a frame_a "Coordinate system a" annotation (Placement(transformation(extent={{-116,-16},{-84,16}}))); - Interfaces.Frame_b frame_b "Coordinate system b" annotation (Placement(transformation(extent={{84,-16},{116,16}}))); Modelica.Blocks.Interfaces.RealOutput y[n_out] "Measured data as signal vector" annotation (Placement(transformation( - origin={0,-110}, + origin={-80,-110}, extent={{10,-10},{-10,10}}, rotation=90))); -protected - outer Modelica.Mechanics.MultiBody.World world; - -equation - assert(cardinality(frame_a) > 0, - "Connector frame_a of relative sensor object is not connected"); - assert(cardinality(frame_b) > 0, - "Connector frame_b of relative sensor object is not connected"); annotation ( Documentation(info=" @@ -36,17 +28,10 @@ with the blocks of package Modelica.Blocks. extent={{-100,-100},{100,100}}), graphics={ Line(points={{-70,0},{-101,0}}), Line(points={{70,0},{100,0}}), - Line(points={{0,-100},{0,-70}}, color={0,0,127}), Text( - extent={{-132,76},{129,124}}, + extent={{-150,120},{150,80}}, textString="%name", textColor={0,0,255}), - Text( - extent={{-118,52},{-82,27}}, - textColor={128,128,128}, - textString="a"), - Text( - extent={{85,53},{121,28}}, - textColor={128,128,128}, - textString="b")})); + Line(points={{-50,-50},{-80,-80},{-80,-100}}, color={0,0,127}), + Line(points={{0,-100},{0,-70}}, pattern=LinePattern.Dot)})); end PartialRelativeSensor; From 9ff27380129b4255ea466810a8c6248e787c63f1 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:24:20 +0100 Subject: [PATCH 14/21] Introduce frame_resolve in PartialForce, which requires to redesign icon as well --- .../MultiBody/Forces/Internal/BasicForce.mo | 41 ++++++++----------- .../MultiBody/Forces/Internal/BasicTorque.mo | 37 +++++++---------- .../MultiBody/Interfaces/PartialForce.mo | 9 ++++ 3 files changed, 39 insertions(+), 48 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo index 0f5e98576d..1cdba6483f 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicForce.mo @@ -1,21 +1,16 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model BasicForce "Force acting between two frames, defined by 3 input signals" - extends Interfaces.PartialForce; + extends Interfaces.PartialForce( + break world); import Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB; - Interfaces.Frame_resolve frame_resolve - "The input signals are optionally resolved in this frame" - annotation (Placement(transformation( - origin={40,100}, - extent={{-16,-16},{16,16}}, - rotation=90))); Modelica.Blocks.Interfaces.RealInput force[3](each final quantity="Force", each final unit="N") "x-, y-, z-coordinates of force resolved in frame defined by resolveInFrame" annotation (Placement(transformation( - origin={-60,120}, - extent={{-20,-20},{20,20}}, - rotation=270))); + extent={{20,-20},{-20,20}}, + rotation=270, + origin={-60,-120}))); parameter Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB resolveInFrame= Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB.frame_b @@ -54,30 +49,26 @@ equation annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ 100,100}}), graphics={ - Text( - extent={{-80,70},{100,40}}, - textColor={192,192,192}, - textString="resolve"), - Text( - extent={{-150,-55},{150,-95}}, - textString="%name", - textColor={0,0,255}), Line( - points={{40,100},{40,0}}, + points={{40,0},{40,-100},{-60,-100}}, color={95,95,95}, pattern=LinePattern.Dot), + Line(points={{-80,0},{-20,0}}), + Line(points={{20,0},{80,0}}), Polygon( points={{-94,0},{-64,11},{-64,-10},{-94,0}}, fillPattern=FillPattern.Solid), - Line( - points={{-60,100},{40,100}}, - color={95,95,95}, - pattern=LinePattern.Dot), Polygon( points={{94,0},{65,12},{65,-11},{94,0}}, fillPattern=FillPattern.Solid), - Line(points={{-64,0},{-20,0}}), - Line(points={{20,0},{65,0}})}), + Text( + extent={{-100,-40},{80,-70}}, + textColor={192,192,192}, + textString="resolve"), + Text( + extent={{-150,80},{150,40}}, + textString="%name", + textColor={0,0,255})}), Documentation(info="

The 3 signals of the force connector are interpreted diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo index 17a52732fb..3b9ae6f292 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicTorque.mo @@ -1,20 +1,15 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model BasicTorque "Torque acting between two frames, defined by 3 input signals" - extends Interfaces.PartialForce; + extends Interfaces.PartialForce( + break world); import Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB; - Interfaces.Frame_resolve frame_resolve - "The input signals are optionally resolved in this frame" - annotation (Placement(transformation( - origin={40,100}, - extent={{-16,-16},{16,16}}, - rotation=90))); Modelica.Blocks.Interfaces.RealInput torque[3](each final quantity="Torque", each final unit="N.m") "x-, y-, z-coordinates of torque resolved in frame defined by resolveInFrame" annotation (Placement(transformation( - origin={-60,120}, - extent={{-20,-20},{20,20}}, + origin={-60,-120}, + extent={{20,-20},{-20,20}}, rotation=270))); parameter Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB resolveInFrame= @@ -66,28 +61,24 @@ equation startAngle=40, endAngle=80, closure=EllipseClosure.None), - Text( - extent={{-80,90},{100,60}}, - textColor={192,192,192}, - textString="resolve"), - Text( - extent={{-150,-30},{150,-70}}, - textString="%name", - textColor={0,0,255}), Polygon( points={{92,0},{82,36},{60,22},{92,0}}, fillPattern=FillPattern.Solid), - Line( - points={{40,100},{80,20}}, - color={95,95,95}, - pattern=LinePattern.Dot), Polygon( points={{-92,0},{-82,36},{-60,22},{-92,0}}, fillPattern=FillPattern.Solid), Line( - points={{-60,100},{40,100}}, + points={{-60,-100},{80,-100},{80,20}}, color={95,95,95}, - pattern=LinePattern.Dot)}), + pattern=LinePattern.Dot), + Text( + extent={{-100,-40},{80,-70}}, + textColor={192,192,192}, + textString="resolve"), + Text( + extent={{-150,100},{150,60}}, + textString="%name", + textColor={0,0,255})}), Documentation(info="

The 3 signals of the torque connector are interpreted diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo index 844fce359e..444232c1c5 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialForce.mo @@ -7,6 +7,15 @@ partial model PartialForce "Position vector from origin of frame_a to origin of frame_b, resolved in frame_b"; Frames.Orientation R_rel "Relative orientation object from frame_a to frame_b"; + + Frame_resolve frame_resolve + "Coordinate system in which input signal is optionally resolved" + annotation (Placement(transformation(extent={{-16,-16},{16,16}}, + rotation=-90, + origin={0,-100}), iconTransformation( + extent={{-16,-16},{16,16}}, + rotation=-90, + origin={0,-100}))); equation // Determine relative position and orientation r_rel_b = Frames.resolve2(frame_b.R, frame_b.r_0 - frame_a.r_0); From 41525527aab43d869fe8a970908852fd8523e1dd Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:28:34 +0100 Subject: [PATCH 15/21] Get rid of PartialOneFrame_b --- Modelica/Mechanics/MultiBody/Forces/Force.mo | 50 ++++++++----------- .../Mechanics/MultiBody/Forces/WorldForce.mo | 13 ++--- .../MultiBody/Forces/WorldForceAndTorque.mo | 24 ++++----- .../Mechanics/MultiBody/Forces/WorldTorque.mo | 22 ++++---- 4 files changed, 47 insertions(+), 62 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Forces/Force.mo b/Modelica/Mechanics/MultiBody/Forces/Force.mo index e62762feb7..8fefc043c3 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Force.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Force.mo @@ -2,20 +2,17 @@ within Modelica.Mechanics.MultiBody.Forces; model Force "Force acting between two frames, defined by 3 input signals and resolved in frame world, frame_a, frame_b or frame_resolve" import Modelica.Units.Conversions.to_unit1; - extends Modelica.Mechanics.MultiBody.Interfaces.PartialTwoFrames; - Interfaces.Frame_resolve frame_resolve if - resolveInFrame == Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB.frame_resolve - "The input signals are optionally resolved in this frame" - annotation (Placement(transformation( - origin={40,100}, - extent={{-16,-16},{16,16}}, - rotation=90))); + extends Interfaces.PartialTwoFramesResolve( + break frame_resolve); + extends Interfaces.PartialFrameResolveConditional( + final enableFrameResolve = resolveInFrame==Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB.frame_resolve); + Modelica.Blocks.Interfaces.RealInput force[3](each final quantity="Force", each final unit="N") "x-, y-, z-coordinates of force resolved in frame defined by resolveInFrame" annotation (Placement(transformation( - origin={-60,120}, + origin={-60,-120}, extent={{-20,-20},{20,20}}, - rotation=270))); + rotation=90))); parameter Boolean animation=true "= true, if animation shall be enabled"; parameter Modelica.Mechanics.MultiBody.Types.ResolveInFrameAB resolveInFrame= @@ -69,43 +66,40 @@ equation color={95,95,95}, thickness=0.5)); connect(force, basicForce.force) annotation (Line( - points={{-60,120},{-60,40},{4,40},{4,12}}, color={0,0,127})); + points={{-60,-120},{-60,40},{4,40},{4,-12}}, + color={0,0,127})); connect(basicForce.frame_resolve, frame_resolve) annotation (Line( - points={{14,10},{14,40},{40,40},{40,100}}, + points={{10,-10},{10,40},{0,40},{0,-100}}, color={95,95,95}, pattern=LinePattern.Dot)); connect(zeroPosition.frame_resolve, basicForce.frame_resolve) annotation ( Line( - points={{40,20},{27,20},{27,10},{14,10}}, + points={{40,20},{27,20},{27,-10},{10,-10}}, color={95,95,95}, pattern=LinePattern.Dot)); annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 100}}), graphics={ - Text( - extent={{-80,70},{100,40}}, - textColor={192,192,192}, - textString="resolve"), - Text( - extent={{-150,-55},{150,-95}}, - textString="%name", - textColor={0,0,255}), Line( - points={{40,100},{40,0}}, + points={{40,0},{40,-100},{-60,-100}}, color={95,95,95}, pattern=LinePattern.Dot), + Line(points={{-80,0},{-20,0}}), + Line(points={{20,0},{80,0}}), Polygon( points={{-94,0},{-64,11},{-64,-10},{-94,0}}, fillPattern=FillPattern.Solid), - Line( - points={{-60,100},{40,100}}, - color={95,95,95}, - pattern=LinePattern.Dot), Polygon( points={{94,0},{65,12},{65,-11},{94,0}}, fillPattern=FillPattern.Solid), - Line(points={{-64,0},{-20,0}}), - Line(points={{20,0},{65,0}})}), + Text( + extent={{-100,-40},{80,-70}}, + textColor={192,192,192}, + textString="resolve"), + Text( + extent={{-150,80},{150,40}}, + textString="%name", + textColor={0,0,255})}), Documentation(info="

The 3 signals of the force connector are interpreted diff --git a/Modelica/Mechanics/MultiBody/Forces/WorldForce.mo b/Modelica/Mechanics/MultiBody/Forces/WorldForce.mo index 3901fa4ad2..6ba5e9d02d 100644 --- a/Modelica/Mechanics/MultiBody/Forces/WorldForce.mo +++ b/Modelica/Mechanics/MultiBody/Forces/WorldForce.mo @@ -1,15 +1,12 @@ within Modelica.Mechanics.MultiBody.Forces; model WorldForce "External force acting at frame_b, defined by 3 input signals and resolved in frame world, frame_b or frame_resolve" + extends Interfaces.PartialTwoFramesResolve( + break frame_a, + break frame_resolve); + extends Interfaces.PartialFrameResolveConditional( + final enableFrameResolve = resolveInFrame==Modelica.Mechanics.MultiBody.Types.ResolveInFrameB.frame_resolve); - extends Interfaces.PartialOneFrame_b; - Interfaces.Frame_resolve frame_resolve if - resolveInFrame == Modelica.Mechanics.MultiBody.Types.ResolveInFrameB.frame_resolve - "The input signals are optionally resolved in this frame" - annotation (Placement(transformation( - origin={0,-100}, - extent={{-16,-16},{16,16}}, - rotation=270))); Modelica.Blocks.Interfaces.RealInput force[3](each final quantity="Force", each final unit="N") "x-, y-, z-coordinates of force resolved in frame defined by resolveInFrame" annotation (Placement(transformation(extent={{-140,-20},{-100,20}}))); diff --git a/Modelica/Mechanics/MultiBody/Forces/WorldForceAndTorque.mo b/Modelica/Mechanics/MultiBody/Forces/WorldForceAndTorque.mo index 16c45070cd..bc8e6f7cfa 100644 --- a/Modelica/Mechanics/MultiBody/Forces/WorldForceAndTorque.mo +++ b/Modelica/Mechanics/MultiBody/Forces/WorldForceAndTorque.mo @@ -1,16 +1,14 @@ within Modelica.Mechanics.MultiBody.Forces; model WorldForceAndTorque "External force and torque acting at frame_b, defined by 3+3 input signals and resolved in frame world, frame_b or in frame_resolve" + extends Interfaces.PartialTwoFramesResolve( + break frame_a, + break frame_resolve); + extends Interfaces.PartialFrameResolveConditional( + final enableFrameResolve = resolveInFrame==Modelica.Mechanics.MultiBody.Types.ResolveInFrameB.frame_resolve); import Modelica.Mechanics.MultiBody.Types; - extends Interfaces.PartialOneFrame_b; - Interfaces.Frame_resolve frame_resolve if - resolveInFrame == Modelica.Mechanics.MultiBody.Types.ResolveInFrameB.frame_resolve - "The input signals are optionally resolved in this frame" - annotation (Placement(transformation( - origin={0,100}, - extent={{16,-16},{-16,16}}, - rotation=270))); + Blocks.Interfaces.RealInput force[3](each final quantity="Force", each final unit= "N") "x-, y-, z-coordinates of force resolved in frame defined by resolveInFrame" @@ -75,12 +73,12 @@ equation annotation (Line( points={{-12,60},{-120,60}}, color={0,0,127})); connect(basicWorldForce.frame_resolve, frame_resolve) annotation (Line( - points={{28,-50},{28,80},{0,80},{0,100}}, + points={{28,-50},{28,80},{0,80},{0,-100}}, color={95,95,95}, pattern=LinePattern.Dot)); connect(basicWorldTorque.frame_resolve, frame_resolve) annotation (Line( - points={{0,70},{0,100}}, + points={{0,70},{0,-100}}, color={95,95,95}, pattern=LinePattern.Dot)); connect(zeroPosition.frame_resolve, basicWorldTorque.frame_resolve) @@ -103,18 +101,18 @@ equation endAngle=150, closure=EllipseClosure.None), Text( - extent={{-100,50},{80,20}}, + extent={{-80,-60},{100,-90}}, textColor={192,192,192}, textString="resolve"), Text( - extent={{-150,-75},{150,-115}}, + extent={{-150,130},{150,90}}, textString="%name", textColor={0,0,255}), Polygon( points={{91,21},{64,76},{36,48},{91,21}}, fillPattern=FillPattern.Solid), Line( - points={{0,101},{0,-20}}, + points={{0,79},{0,-100}}, color={95,95,95}, pattern=LinePattern.Dot), Line( diff --git a/Modelica/Mechanics/MultiBody/Forces/WorldTorque.mo b/Modelica/Mechanics/MultiBody/Forces/WorldTorque.mo index 3ae7426088..c2ed90f70b 100644 --- a/Modelica/Mechanics/MultiBody/Forces/WorldTorque.mo +++ b/Modelica/Mechanics/MultiBody/Forces/WorldTorque.mo @@ -1,16 +1,12 @@ within Modelica.Mechanics.MultiBody.Forces; model WorldTorque "External torque acting at frame_b, defined by 3 input signals and resolved in frame world, frame_b or frame_resolve" + extends Interfaces.PartialTwoFramesResolve( + break frame_a, + break frame_resolve); + extends Interfaces.PartialFrameResolveConditional( + final enableFrameResolve = resolveInFrame==Modelica.Mechanics.MultiBody.Types.ResolveInFrameB.frame_resolve); - extends Interfaces.PartialOneFrame_b; - - Interfaces.Frame_resolve frame_resolve if - resolveInFrame == Modelica.Mechanics.MultiBody.Types.ResolveInFrameB.frame_resolve - "The input signals are optionally resolved in this frame" - annotation (Placement(transformation( - origin={0,100}, - extent={{16,-16},{-16,16}}, - rotation=270))); Modelica.Blocks.Interfaces.RealInput torque[3](each final quantity="Torque", each final unit="N.m") "x-, y-, z-coordinates of torque resolved in frame defined by resolveInFrame" annotation (Placement(transformation(extent={{-140,-20},{-100,20}}))); @@ -49,7 +45,7 @@ equation connect(basicWorldTorque.torque, torque) annotation (Line( points={{-12,0},{-120,0}}, color={0,0,127})); connect(frame_resolve, basicWorldTorque.frame_resolve) annotation (Line( - points={{0,100},{0,10}}, + points={{0,-100},{0,10}}, color={95,95,95}, pattern=LinePattern.Dot)); connect(zeroPosition.frame_resolve, basicWorldTorque.frame_resolve) @@ -135,15 +131,15 @@ This leads to the following animation endAngle=160, closure=EllipseClosure.None), Text( - extent={{-100,90},{100,60}}, + extent={{-100,-40},{100,-70}}, textColor={192,192,192}, textString="resolve"), Text( - extent={{-150,-40},{150,-80}}, + extent={{-150,100},{150,60}}, textString="%name", textColor={0,0,255}), Line( - points={{0,95},{0,50}}, + points={{0,-100},{0,50}}, color={95,95,95}, pattern=LinePattern.Dot), Polygon( From 544f488e370a917a8e0e4ddb75eff82c9c4a37a3 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:30:04 +0100 Subject: [PATCH 16/21] Get rid of PartialOneFrame_b --- .../Mechanics/MultiBody/Forces/Internal/BasicWorldForce.mo | 3 ++- .../Mechanics/MultiBody/Forces/Internal/BasicWorldTorque.mo | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldForce.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldForce.mo index 614dde4375..563e27268b 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldForce.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldForce.mo @@ -2,7 +2,8 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model BasicWorldForce "External force acting at frame_b, defined by 3 input signals" import Modelica.Mechanics.MultiBody.Types.ResolveInFrameB; - extends Interfaces.PartialOneFrame_b; + extends Interfaces.PartialTwoFrames( + break frame_a); Interfaces.Frame_resolve frame_resolve "The input signals are optionally resolved in this frame" annotation (Placement(transformation( diff --git a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldTorque.mo b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldTorque.mo index b71b0ac0a9..f1dd244b29 100644 --- a/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldTorque.mo +++ b/Modelica/Mechanics/MultiBody/Forces/Internal/BasicWorldTorque.mo @@ -2,7 +2,8 @@ within Modelica.Mechanics.MultiBody.Forces.Internal; model BasicWorldTorque "External torque acting at frame_b, defined by 3 input signals" import Modelica.Mechanics.MultiBody.Types.ResolveInFrameB; - extends Interfaces.PartialOneFrame_b; + extends Interfaces.PartialTwoFrames( + break frame_a); Interfaces.Frame_resolve frame_resolve "The input signals are optionally resolved in this frame" annotation (Placement(transformation( From 0cebbbd311bd3e7c9081e7d8843f5081255039e9 Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:32:54 +0100 Subject: [PATCH 17/21] Inherit from PartialAbsoluteSensor from Interfaces --- .../Internal/BasicAbsoluteAngularVelocity.mo | 4 ---- .../Sensors/Internal/BasicAbsolutePosition.mo | 4 ---- .../Internal/PartialAbsoluteBaseSensor.mo | 24 +++---------------- 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsoluteAngularVelocity.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsoluteAngularVelocity.mo index 90e2279ced..ffcf5ee05d 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsoluteAngularVelocity.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsoluteAngularVelocity.mo @@ -28,10 +28,6 @@ equation annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Text( - extent={{-130,76},{131,124}}, - textString="%name", - textColor={0,0,255}), Text( extent={{-50,-14},{50,-54}}, textColor={64,64,64}, diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsolutePosition.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsolutePosition.mo index 41aa7dcd9c..f2ae220891 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsolutePosition.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicAbsolutePosition.mo @@ -28,10 +28,6 @@ equation annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100, -100},{100,100}}), graphics={ - Text( - extent={{-127,75},{134,123}}, - textString="%name", - textColor={0,0,255}), Text( extent={{-50,-14},{50,-54}}, textColor={64,64,64}, diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo index 90f95a7067..43fcddeed6 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialAbsoluteBaseSensor.mo @@ -1,16 +1,10 @@ within Modelica.Mechanics.MultiBody.Sensors.Internal; model PartialAbsoluteBaseSensor "Base class for absolute sensor models defined by equations (frame_resolve must be connected exactly once)" - extends PartialAbsoluteSensor; - - Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve - "Coordinate system in which output vector(s) is optionally resolved" - annotation (Placement(transformation(extent={{-16,-16},{16,16}}, - rotation=-90, - origin={0,-100}))); + extends Interfaces.PartialAbsoluteSensor( + break y); equation - assert(cardinality(frame_resolve) == 1, "Connector frame_resolve must be connected exactly once"); frame_a.f = zeros(3); frame_a.t = zeros(3); frame_resolve.f = zeros(3); @@ -18,20 +12,8 @@ equation annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Text( - extent={{-108,43},{-72,18}}, - textColor={95,95,95}, - textString="a"), - Line( - points={{-70,0},{-96,0},{-96,0}}), - Line( - points={{0,15},{0,-15}}, - color={0,0,127}, - origin={85,0}, - rotation=90), Line( - points={{0,-95},{0,-95},{0,-70},{0,-70}}, - pattern=LinePattern.Dot), + points={{-70,0},{-100,0}}), Text( extent={{0,-75},{131,-100}}, textColor={95,95,95}, From c70b83a69c80df30cc28880be4573e75cbb0c08a Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:34:02 +0100 Subject: [PATCH 18/21] Icon: delete letters 'a' and 'b' --- .../Internal/PartialRelativeBaseSensor.mo | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo index dd3acfb55d..902b4725fb 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialRelativeBaseSensor.mo @@ -16,26 +16,22 @@ equation frame_resolve.f = zeros(3); frame_resolve.t = zeros(3); - annotation (Icon(coordinateSystem(preserveAspectRatio=true, + annotation ( + Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Text( - extent={{-108,43},{-72,18}}, - textColor={128,128,128}, - textString="a"), - Text( - extent={{72,43},{108,18}}, - textColor={128,128,128}, - textString="b"), Line( points={{-70,0},{-96,0},{-96,0}}), Line( points={{96,0},{70,0},{70,0}}), - Line( - points={{0,-70},{0,-100}}, - color={0,0,127}), Line( points={{60,36},{60,36},{60,80},{95,80}}, - pattern=LinePattern.Dot)}), Documentation(info=" + pattern=LinePattern.Dot), + Line(points={{0,-70},{0,-100}}, color={0,0,127}), + Text( + extent={{-150,140},{150,100}}, + textString="%name", + textColor={0,0,255})}), + Documentation(info="

Partial base class for relative sensor models defined by equations. The connector frame_resolve is always enabled and must be connected exactly once. From 43d8c160729f6e06c5ccf4ac12c55a508d4ada4d Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:35:18 +0100 Subject: [PATCH 19/21] Inherit from PartialRelativeSensor from Interfaces --- .../Sensors/Internal/BasicCutForce.mo | 1 - .../Sensors/Internal/BasicCutTorque.mo | 1 - .../Internal/PartialCutForceBaseSensor.mo | 38 ++----------------- 3 files changed, 4 insertions(+), 36 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutForce.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutForce.mo index 1b31d73f9a..7e500994d4 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutForce.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutForce.mo @@ -29,7 +29,6 @@ equation annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Line(points={{-80,-100},{-80,0}}, color={0,0,127}), Text( extent={{-50,-14},{50,-54}}, textColor={64,64,64}, diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutTorque.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutTorque.mo index d44fcfe031..3e11c8dd0a 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutTorque.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicCutTorque.mo @@ -32,7 +32,6 @@ equation annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Line(points={{-80,-100},{-80,0}}, color={0,0,127}), Text( extent={{-50,-14},{50,-54}}, textColor={64,64,64}, diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialCutForceBaseSensor.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialCutForceBaseSensor.mo index aa6bdb95a8..d6fd5131e7 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialCutForceBaseSensor.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/PartialCutForceBaseSensor.mo @@ -1,27 +1,13 @@ within Modelica.Mechanics.MultiBody.Sensors.Internal; partial model PartialCutForceBaseSensor "Base class to measure cut force and/or torque between two frames, defined by equations (frame_resolve must be connected exactly once)" - - extends Modelica.Icons.RoundSensor; - Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a - "Coordinate system a" annotation (Placement( - transformation(extent={{-116,-16},{-84,16}}))); - Modelica.Mechanics.MultiBody.Interfaces.Frame_b frame_b - "Coordinate system b" annotation (Placement( - transformation(extent={{84,-16},{116,16}}))); - Modelica.Mechanics.MultiBody.Interfaces.Frame_resolve frame_resolve - "The output vector is optionally resolved in this frame (cut-force/-torque are set to zero)" - annotation (Placement(transformation( - origin={80,-100}, - extent={{-16,-16},{16,16}}, - rotation=270))); + extends Interfaces.PartialRelativeSensor( + break y); parameter Modelica.Mechanics.MultiBody.Types.ResolveInFrameA resolveInFrame= Modelica.Mechanics.MultiBody.Types.ResolveInFrameA.frame_a "Frame in which output vector is resolved (world, frame_a, or frame_resolve)"; -protected - outer Modelica.Mechanics.MultiBody.World world; equation Connections.branch(frame_a.R, frame_b.R); assert(cardinality(frame_a) > 0, @@ -54,23 +40,7 @@ with the blocks of package Modelica.Blocks. Line(points={{-70,0},{-101,0}}), Line(points={{70,0},{100,0}}), Text( - extent={{-132,76},{129,124}}, - textString="%name", - textColor={0,0,255}), - Text( - extent={{-118,55},{-82,30}}, - textColor={128,128,128}, - textString="a"), - Text( - extent={{83,55},{119,30}}, - textColor={128,128,128}, - textString="b"), - Text( - extent={{70,-66},{201,-91}}, + extent={{-70,-69},{70,-94}}, textColor={95,95,95}, - textString="resolve"), - Line( - points={{80,0},{80,-100}}, - color={95,95,95}, - pattern=LinePattern.Dot)})); + textString="resolve")})); end PartialCutForceBaseSensor; From 5c306d56172fb08eb687d0e3b35201ff77226d6a Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 10 Nov 2023 16:36:05 +0100 Subject: [PATCH 20/21] Icon: delete Text annotation contained in the baseclass --- .../Sensors/Internal/BasicRelativeAngularVelocity.mo | 4 ---- .../MultiBody/Sensors/Internal/BasicRelativePosition.mo | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativeAngularVelocity.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativeAngularVelocity.mo index 93f72c5ea7..f086ce1f5f 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativeAngularVelocity.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativeAngularVelocity.mo @@ -35,10 +35,6 @@ equation annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Text( - extent={{-132,90},{129,138}}, - textString="%name", - textColor={0,0,255}), Text( extent={{-50,-14},{50,-54}}, textColor={64,64,64}, diff --git a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativePosition.mo b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativePosition.mo index 2f82179cf7..ac1bd61766 100644 --- a/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativePosition.mo +++ b/Modelica/Mechanics/MultiBody/Sensors/Internal/BasicRelativePosition.mo @@ -32,10 +32,6 @@ equation annotation ( Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={ - Text( - extent={{-127,95},{134,143}}, - textString="%name", - textColor={0,0,255}), Text( extent={{-50,-14},{50,-54}}, textColor={64,64,64}, From b392a016c9a859be39a4213b655948db20e42beb Mon Sep 17 00:00:00 2001 From: tobolar Date: Fri, 15 Dec 2023 10:00:56 +0100 Subject: [PATCH 21/21] Documentation: proper font for Modelica keyword in code snippet --- .../MultiBody/Interfaces/PartialFrameResolveConditional.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo b/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo index d062b657ea..713ccdc895 100644 --- a/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo +++ b/Modelica/Mechanics/MultiBody/Interfaces/PartialFrameResolveConditional.mo @@ -31,7 +31,7 @@ utilized. import Modelica.Mechanics.MultiBody.Types.ResolveInFrameB; ... extends Interfaces.PartialFrameResolveConditional( - final enableFrameResolve = resolveInFrame==ResolveInFrameB.frame_resolve); + final enableFrameResolve = resolveInFrame==ResolveInFrameB.frame_resolve); parameter ResolveInFrameB resolveInFrame = ResolveInFrameB.world \"Frame in which input u is resolved\"; Modelica.Blocks.Interfaces.RealInput u[3]