From ac8fc82027ee1600d791485d656396a126c15240 Mon Sep 17 00:00:00 2001 From: Jakub Tobolar Date: Mon, 15 Apr 2024 13:05:58 +0200 Subject: [PATCH 1/7] Add translational model of lever --- .../Translational/Components/IdealLever.mo | 103 ++++++++++++++++++ .../Translational/Components/package.order | 1 + .../Translational/Examples/LeverGrounded.mo | 50 +++++++++ .../Translational/Examples/package.order | 1 + .../FirstGrounded/comparisonSignals.txt | 5 + 5 files changed, 160 insertions(+) create mode 100644 Modelica/Mechanics/Translational/Components/IdealLever.mo create mode 100644 Modelica/Mechanics/Translational/Examples/LeverGrounded.mo create mode 100644 Modelica/Resources/Reference/Modelica/Mechanics/Translational/Examples/FirstGrounded/comparisonSignals.txt diff --git a/Modelica/Mechanics/Translational/Components/IdealLever.mo b/Modelica/Mechanics/Translational/Components/IdealLever.mo new file mode 100644 index 0000000000..ef07a96f2b --- /dev/null +++ b/Modelica/Mechanics/Translational/Components/IdealLever.mo @@ -0,0 +1,103 @@ +within Modelica.Mechanics.Translational.Components; +model IdealLever "Ideal lever without mass" + extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryTwoFlangesAndSupport2; + parameter Real ratio(start=1) + "Transmission ratio (flange_a.s/flange_b.s)"; + +equation + if abs(ratio) < Modelica.Constants.eps then + flange_a.f = 0; + flange_b.f = 0; + else + s_a = ratio*s_b; + 0 = ratio*flange_a.f + flange_b.f; + end if; + + annotation ( + Documentation(info=" +

+This element characterizes any type of lever which is fixed in the +ground and which has one driving flange and one driven flange. +The lever is ideal, i.e., it does not have mass, elasticity, damping +or backlash. If these effects have to be considered, the lever has to be +connected to other elements in an appropriate way. +

+ +

Classification of lever

+

+Generally, a lever is classified by its ratio i which is the ratio +between the driving flange position and the driven flange position. The type of lever is, +then, given by the magnitude of i as follows: +

+ +

+Applying the abovementioned to this element, the parameter ratio can be considered equal +to i only when flange_a is the driving flange. +

+"), + Icon( + coordinateSystem(preserveAspectRatio=true, + extent={{-100,-100},{100,100}}), + graphics={ + Polygon( + points={{-6,-30},{-6,50},{0,50},{6,50},{6,-30},{-6,-30}}, + lineColor={0,0,0}, + fillColor={160,215,160}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-20,-10},{20,-50}}, + fillColor={160,215,160}, + fillPattern=FillPattern.Solid, + pattern=LinePattern.None), + Ellipse( + extent={{-20,-10},{20,-50}}, + startAngle=-73, + endAngle=253, + closure=EllipseClosure.None), + Ellipse( + extent={{-10,-20},{10,-40}}, + fillColor={175,190,175}, + fillPattern=FillPattern.Solid), + Line( + points={{0,-54},{0,-30}}, + color={0,127,0}), + Line( + points={{0,-100},{0,-78}}, + color={0,127,0}), + Line( + points={{-98,0},{0,50}}, + color={0,127,0}), + Line( + points={{0,20},{100,0}}, + color={0,127,0}), + Ellipse( + extent={{-4,54},{4,46}}, + lineColor={0,127,0}, + fillColor={160,215,160}, + fillPattern=FillPattern.Solid), + Ellipse( + extent={{-4,24},{4,16}}, + lineColor={0,127,0}, + fillColor={160,215,160}, + fillPattern=FillPattern.Solid), + Text( + extent={{-150,100},{150,60}}, + textColor={0,0,255}, + textString="%name"), + Text( + extent={{-100,-50},{100,-80}}, + textString="ratio=%ratio")})); +end IdealLever; diff --git a/Modelica/Mechanics/Translational/Components/package.order b/Modelica/Mechanics/Translational/Components/package.order index 0fe3ef587b..915a795889 100644 --- a/Modelica/Mechanics/Translational/Components/package.order +++ b/Modelica/Mechanics/Translational/Components/package.order @@ -8,6 +8,7 @@ ElastoGap SupportFriction Brake IdealGearR2T +IdealLever IdealRollingWheel RollingResistance Vehicle diff --git a/Modelica/Mechanics/Translational/Examples/LeverGrounded.mo b/Modelica/Mechanics/Translational/Examples/LeverGrounded.mo new file mode 100644 index 0000000000..be81476b50 --- /dev/null +++ b/Modelica/Mechanics/Translational/Examples/LeverGrounded.mo @@ -0,0 +1,50 @@ +within Modelica.Mechanics.Translational.Examples; +model LeverGrounded "Translational grounded lever" + extends Modelica.Icons.Example; + + Sources.Force force( + useSupport=false) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); + Components.Mass mass1( + m=0.1) annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); + Components.IdealLever idealLever( + ratio=1.6, useSupport=true) + annotation (Placement(transformation(extent={{10,-10},{30,10}}))); + Components.Mass mass2( + m=7, + s(fixed=true, start=0), + v(fixed=true, start=0)) annotation (Placement(transformation(extent={{40,-10},{60,10}}))); + Modelica.Blocks.Sources.Sine sine(amplitude=10, + f=5) + annotation (Placement(transformation(extent={{-80,-10},{-60,10}}))); + Components.Fixed fixed annotation (Placement(transformation(extent={{-48,-60},{-28,-40}}))); + Components.SpringDamper springDamper( + s_rel(fixed=true), + v_rel(fixed=true), + c=800, + d=50) annotation (Placement(transformation(extent={{-20,-60},{0,-40}}))); +equation + connect(mass1.flange_b, idealLever.flange_a) annotation (Line(points={{0,0},{10,0}}, color={0,127,0})); + connect(idealLever.flange_b, mass2.flange_a) annotation (Line(points={{30,0},{40,0}}, color={0,127,0})); + connect(sine.y, force.f) annotation (Line(points={{-59,0},{-52,0}}, color={0,0,127})); + connect(force.flange, mass1.flange_a) annotation (Line(points={{-30,0},{-20,0}}, color={0,127,0})); + connect(fixed.flange, springDamper.flange_a) annotation (Line(points={{-38,-50},{-20,-50}}, color={0,127,0})); + connect(springDamper.flange_b, idealLever.support) annotation (Line(points={{0,-50},{20,-50},{20,-10}}, color={0,127,0})); + annotation ( + experiment( + StopTime=1.0, + Interval=0.001), + Documentation(info=" +

+The flange_a of the lever is driven by a sine-wave motor force. +Via a lever the translational energy is transmitted to a load mass. +The lever is elastically mounted. +For ratio idealLever.ratio > 1 the 2nd class lever is +realized, i.e. the driven flange flange_b is located between the +driving flange flange_a and the lever's support. +

+

+Simulate for 1 second and plot the velocities of masses: +mass2.v, mass2.v +

+")); +end LeverGrounded; diff --git a/Modelica/Mechanics/Translational/Examples/package.order b/Modelica/Mechanics/Translational/Examples/package.order index aa645c0dc7..7f515e0ec5 100644 --- a/Modelica/Mechanics/Translational/Examples/package.order +++ b/Modelica/Mechanics/Translational/Examples/package.order @@ -4,6 +4,7 @@ WhyArrows Accelerate CompareBrakingForce Damper +LeverGrounded Oscillator Sensors Friction diff --git a/Modelica/Resources/Reference/Modelica/Mechanics/Translational/Examples/FirstGrounded/comparisonSignals.txt b/Modelica/Resources/Reference/Modelica/Mechanics/Translational/Examples/FirstGrounded/comparisonSignals.txt new file mode 100644 index 0000000000..eb59732ec4 --- /dev/null +++ b/Modelica/Resources/Reference/Modelica/Mechanics/Translational/Examples/FirstGrounded/comparisonSignals.txt @@ -0,0 +1,5 @@ +time +damper.s_rel +damper.v_rel +mass3.s +mass3.v From 763e58b3be4d49deaae8de9d714c174f6d76c44f Mon Sep 17 00:00:00 2001 From: Jakub Tobolar Date: Tue, 18 Feb 2025 17:57:14 +0100 Subject: [PATCH 2/7] Add test GearAndLever --- .../GearAndLever/comparisonSignals.txt | 9 ++ ModelicaTest/Translational.mo | 116 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt diff --git a/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt b/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt new file mode 100644 index 0000000000..5637368c24 --- /dev/null +++ b/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt @@ -0,0 +1,9 @@ +time +inertia1.phi +inertia1.w +inertia3.phi +inertia3.w +mass1.s +mass1.v +mass3.s +mass3.v diff --git a/ModelicaTest/Translational.mo b/ModelicaTest/Translational.mo index d278f28245..132760d421 100644 --- a/ModelicaTest/Translational.mo +++ b/ModelicaTest/Translational.mo @@ -383,4 +383,120 @@ extends Modelica.Icons.ExamplesPackage; connect(position1.flange, supportFriction2.flange_a) annotation (Line(points={{10,0},{46,0}}, color={0,127,0})); annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestFrictionPosition; + + model GearAndLever + extends Modelica.Icons.Example; + + constant Real tol=Modelica.Constants.eps; + + Modelica.Blocks.Math.Add errVel(k2=-1) annotation (Placement(transformation(extent={{80,60},{100,80}}))); + Modelica.Blocks.Math.Add errPos(k2=-1) annotation (Placement(transformation(extent={{80,-60},{100,-40}}))); + Modelica.Mechanics.Rotational.Sources.Torque torque(useSupport=false) annotation (Placement( + transformation(extent={{-58,80},{-38,100}}))); + Modelica.Mechanics.Rotational.Components.Inertia inertia1(J=1.2) annotation (Placement( + transformation(extent={{-30,80},{-10,100}}))); + Modelica.Mechanics.Rotational.Components.IdealGear idealGear( + ratio=-0.4, + useSupport=false) + annotation (Placement(transformation(extent={{0,80},{20,100}}))); + Modelica.Mechanics.Rotational.Components.Inertia inertia2( + J=2, + phi(fixed=true, start=0), + w(fixed=true, start=0)) annotation (Placement(transformation(extent={{30,80},{50,100}}))); + Modelica.Blocks.Sources.Sine sine(amplitude=1, f=3) + annotation (Placement(transformation(extent={{-100,50},{-80,70}}))); + Modelica.Mechanics.Translational.Sources.Force force annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); + Modelica.Mechanics.Translational.Components.Mass mass1(m=1.2) annotation (Placement(transformation(extent={{-30,40},{-10,60}}))); + Modelica.Mechanics.Translational.Components.IdealLever idealLever( + ratio=idealGear.ratio, + useSupport=false) annotation (Placement(transformation(extent={{0,40},{20,60}}))); + Modelica.Mechanics.Translational.Components.Mass mass2( + m=2, + s(fixed=true), + v(fixed=true)) annotation (Placement(transformation(extent={{30,40},{50,60}}))); + Modelica.Mechanics.Rotational.Sources.Torque torque1(useSupport=false) annotation (Placement( + transformation(extent={{-58,-10},{-38,10}}))); + Modelica.Mechanics.Rotational.Components.Inertia inertia3(J=1.2) annotation (Placement( + transformation(extent={{-30,-10},{-10,10}}))); + Modelica.Mechanics.Rotational.Components.IdealGear idealGear1( + ratio=1.4, + useSupport=true) + annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + Modelica.Mechanics.Rotational.Components.Inertia inertia4( + J=2, + phi(fixed=true, start=0), + w(fixed=true, start=0)) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); + Modelica.Mechanics.Translational.Sources.Force force1 annotation (Placement(transformation(extent={{-60,-100},{-40,-80}}))); + Modelica.Mechanics.Translational.Components.Mass mass3(m=1.2) annotation (Placement(transformation(extent={{-30,-100},{-10,-80}}))); + Modelica.Mechanics.Translational.Components.IdealLever idealLever1( + useSupport=true, + ratio=idealGear1.ratio) annotation (Placement(transformation(extent={{0,-80},{20,-100}}))); + Modelica.Mechanics.Translational.Components.Mass mass4( + m=2, + s(fixed=true), + v(fixed=true)) annotation (Placement(transformation(extent={{30,-100},{50,-80}}))); + Modelica.Mechanics.Rotational.Components.Fixed fixedR annotation (Placement(transformation(extent={{-60,-40},{-40,-20}}))); + Modelica.Mechanics.Rotational.Components.SpringDamper springDamperR( + c=20, + d=2.2, + phi_rel(fixed=true), + w_rel(fixed=true)) annotation (Placement(transformation(extent={{-30,-40},{-10,-20}}))); + Modelica.Mechanics.Translational.Components.Fixed fixedT annotation (Placement(transformation(extent={{-60,-70},{-40,-50}}))); + Modelica.Mechanics.Translational.Components.SpringDamper springDamperT( + s_rel(fixed=true), + v_rel(fixed=true), + c=20, + d=2.2) annotation (Placement(transformation(extent={{-32,-70},{-12,-50}}))); + Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensorR1 annotation (Placement(transformation(extent={{54,80},{74,100}}))); + Modelica.Mechanics.Translational.Sensors.SpeedSensor speedSensorT1 annotation (Placement(transformation(extent={{54,40},{74,60}}))); + Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor annotation (Placement(transformation(extent={{20,-40},{40,-20}}))); + Modelica.Mechanics.Translational.Sensors.PositionSensor positionSensor annotation (Placement(transformation(extent={{20,-70},{40,-50}}))); + Modelica.Blocks.Sources.Sine sine1( + amplitude=sine.amplitude, + f=sine.f, + phase=sine.phase, + continuous=sine.continuous, + offset=sine.offset, + startTime=sine.startTime) + annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}))); + equation + assert(abs(errVel.y) < tol, + "Velocity of rotational and translational component must be equal (less then tolerance)"); + assert(abs(errPos.y) < tol, + "Position of rotational and translational component must be equal (less then tolerance)"); + + connect(inertia1.flange_b,idealGear. flange_a) + annotation (Line(points={{-10,90},{0,90}})); + connect(idealGear.flange_b,inertia2. flange_a) + annotation (Line(points={{20,90},{30,90}})); + connect(sine.y,torque. tau) + annotation (Line(points={{-79,60},{-72,60},{-72,90},{-60,90}}, color={0,0,127})); + connect(torque.flange,inertia1. flange_a) annotation (Line( + points={{-38,90},{-30,90}})); + connect(force.flange, mass1.flange_a) annotation (Line(points={{-40,50},{-30,50}}, color={0,127,0})); + connect(mass1.flange_b, idealLever.flange_a) annotation (Line(points={{-10,50},{0,50}}, color={0,127,0})); + connect(idealLever.flange_b, mass2.flange_a) annotation (Line(points={{20,50},{30,50}}, color={0,127,0})); + connect(inertia3.flange_b, idealGear1.flange_a) annotation (Line(points={{-10,0},{0,0}})); + connect(idealGear1.flange_b, inertia4.flange_a) annotation (Line(points={{20,0},{30,0}})); + connect(sine.y, torque1.tau) annotation (Line(points={{-79,60},{-72,60},{-72,0},{-60,0}}, color={0,0,127})); + connect(torque1.flange, inertia3.flange_a) annotation (Line(points={{-38,0},{-30,0}})); + connect(force1.flange, mass3.flange_a) annotation (Line(points={{-40,-90},{-30,-90}}, color={0,127,0})); + connect(mass3.flange_b, idealLever1.flange_a) annotation (Line(points={{-10,-90},{0,-90}}, color={0,127,0})); + connect(idealLever1.flange_b, mass4.flange_a) annotation (Line(points={{20,-90},{30,-90}}, color={0,127,0})); + connect(fixedR.flange, springDamperR.flange_a) annotation (Line(points={{-50,-30},{-30,-30}}, color={0,0,0})); + connect(springDamperR.flange_b, idealGear1.support) annotation (Line(points={{-10,-30},{10,-30},{10,-10}}, color={0,0,0})); + connect(fixedT.flange, springDamperT.flange_a) annotation (Line(points={{-50,-60},{-32,-60}}, color={0,127,0})); + connect(springDamperT.flange_b, idealLever1.support) annotation (Line(points={{-12,-60},{10,-60},{10,-80}}, color={0,127,0})); + connect(inertia2.flange_b, speedSensorR1.flange) annotation (Line(points={{50,90},{54,90}}, color={0,0,0})); + connect(mass2.flange_b, speedSensorT1.flange) annotation (Line(points={{50,50},{54,50}}, color={0,127,0})); + connect(speedSensorR1.w, errVel.u1) annotation (Line(points={{75,90},{78,90},{78,76}}, color={0,0,127})); + connect(speedSensorT1.v, errVel.u2) annotation (Line(points={{75,50},{78,50},{78,64}}, color={0,0,127})); + connect(springDamperR.flange_b, angleSensor.flange) annotation (Line(points={{-10,-30},{20,-30}}, color={0,0,0})); + connect(springDamperT.flange_b, positionSensor.flange) annotation (Line(points={{-12,-60},{20,-60}}, color={0,127,0})); + connect(angleSensor.phi, errPos.u1) annotation (Line(points={{41,-30},{70,-30},{70,-44},{78,-44}}, color={0,0,127})); + connect(positionSensor.s, errPos.u2) annotation (Line(points={{41,-60},{70,-60},{70,-56},{78,-56}}, color={0,0,127})); + connect(sine1.y, force.f) annotation (Line(points={{-79,-50},{-68,-50},{-68,50},{-62,50}}, color={0,0,127})); + connect(sine1.y, force1.f) annotation (Line(points={{-79,-50},{-68,-50},{-68,-90},{-62,-90}}, color={0,0,127})); + annotation (experiment(StopTime=1.1)); + end GearAndLever; end Translational; From abed982df0374f56935902c2aa3d4b35373c580c Mon Sep 17 00:00:00 2001 From: tobolar Date: Thu, 20 Feb 2025 08:50:22 +0100 Subject: [PATCH 3/7] Update ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt Co-authored-by: Thomas Beutlich --- .../Translational/GearAndLever/comparisonSignals.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt b/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt index 5637368c24..0a4d38e596 100644 --- a/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt +++ b/ModelicaTest/Resources/Reference/ModelicaTest/Translational/GearAndLever/comparisonSignals.txt @@ -7,3 +7,4 @@ mass1.s mass1.v mass3.s mass3.v + From bc4cf65f1ee406d236258236fe0774ba7dc2e709 Mon Sep 17 00:00:00 2001 From: tobolar Date: Tue, 25 Feb 2025 09:51:43 +0100 Subject: [PATCH 4/7] Rename lever and change its icon --- .../{IdealLever.mo => IdealGear.mo} | 55 +++++++---------- .../Translational/Components/package.order | 2 +- .../Translational/Examples/GearGrounded.mo | 61 +++++++++++++++++++ .../Translational/Examples/LeverGrounded.mo | 50 --------------- .../Translational/Examples/package.order | 2 +- 5 files changed, 86 insertions(+), 84 deletions(-) rename Modelica/Mechanics/Translational/Components/{IdealLever.mo => IdealGear.mo} (72%) create mode 100644 Modelica/Mechanics/Translational/Examples/GearGrounded.mo delete mode 100644 Modelica/Mechanics/Translational/Examples/LeverGrounded.mo diff --git a/Modelica/Mechanics/Translational/Components/IdealLever.mo b/Modelica/Mechanics/Translational/Components/IdealGear.mo similarity index 72% rename from Modelica/Mechanics/Translational/Components/IdealLever.mo rename to Modelica/Mechanics/Translational/Components/IdealGear.mo index ef07a96f2b..258f85a1a1 100644 --- a/Modelica/Mechanics/Translational/Components/IdealLever.mo +++ b/Modelica/Mechanics/Translational/Components/IdealGear.mo @@ -1,5 +1,5 @@ within Modelica.Mechanics.Translational.Components; -model IdealLever "Ideal lever without mass" +model IdealGear "Ideal gear without mass" extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryTwoFlangesAndSupport2; parameter Real ratio(start=1) "Transmission ratio (flange_a.s/flange_b.s)"; @@ -51,45 +51,31 @@ to i only when flange_a is the driving flange. Icon( coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), - graphics={ - Polygon( - points={{-6,-30},{-6,50},{0,50},{6,50},{6,-30},{-6,-30}}, - lineColor={0,0,0}, - fillColor={160,215,160}, - fillPattern=FillPattern.Solid), + graphics={ Line(points={{70,0},{100,0}}, color={0,127,0}), + Line(points={{-100,0},{-70,0}},color={0,127,0}), Ellipse( - extent={{-20,-10},{20,-50}}, - fillColor={160,215,160}, + extent={{-38,38},{38,-38}}, + fillColor={255,255,255}, fillPattern=FillPattern.Solid, - pattern=LinePattern.None), - Ellipse( - extent={{-20,-10},{20,-50}}, - startAngle=-73, - endAngle=253, - closure=EllipseClosure.None), + lineColor={95,95,95}), Ellipse( - extent={{-10,-20},{10,-40}}, - fillColor={175,190,175}, + extent={{-16,16},{16,-16}}, + fillColor={255,255,255}, + fillPattern=FillPattern.Solid, + lineColor={95,95,95}), + Polygon( + points={{76,-10},{76,0},{76,24},{-42,24},{-42,16},{56,16},{66,-10},{76,-10}}, + lineColor={0,127,0}, + fillColor={160,215,160}, fillPattern=FillPattern.Solid), Line( - points={{0,-54},{0,-30}}, + points={{0,-54},{0,0}}, color={0,127,0}), Line( points={{0,-100},{0,-78}}, color={0,127,0}), - Line( - points={{-98,0},{0,50}}, - color={0,127,0}), - Line( - points={{0,20},{100,0}}, - color={0,127,0}), - Ellipse( - extent={{-4,54},{4,46}}, - lineColor={0,127,0}, - fillColor={160,215,160}, - fillPattern=FillPattern.Solid), Ellipse( - extent={{-4,24},{4,16}}, + extent={{-4,4},{4,-4}}, lineColor={0,127,0}, fillColor={160,215,160}, fillPattern=FillPattern.Solid), @@ -99,5 +85,10 @@ to i only when flange_a is the driving flange. textString="%name"), Text( extent={{-100,-50},{100,-80}}, - textString="ratio=%ratio")})); -end IdealLever; + textString="ratio=%ratio"), + Polygon( + points={{50,48},{50,38},{-52,38},{-66,-10},{-76,-10},{-76,48},{50,48}}, + lineColor={95,95,95}, + fillColor={131,175,131}, + fillPattern=FillPattern.Solid)})); +end IdealGear; diff --git a/Modelica/Mechanics/Translational/Components/package.order b/Modelica/Mechanics/Translational/Components/package.order index 915a795889..9c6d1783fd 100644 --- a/Modelica/Mechanics/Translational/Components/package.order +++ b/Modelica/Mechanics/Translational/Components/package.order @@ -7,8 +7,8 @@ SpringDamper ElastoGap SupportFriction Brake +IdealGear IdealGearR2T -IdealLever IdealRollingWheel RollingResistance Vehicle diff --git a/Modelica/Mechanics/Translational/Examples/GearGrounded.mo b/Modelica/Mechanics/Translational/Examples/GearGrounded.mo new file mode 100644 index 0000000000..5220ab8d41 --- /dev/null +++ b/Modelica/Mechanics/Translational/Examples/GearGrounded.mo @@ -0,0 +1,61 @@ +within Modelica.Mechanics.Translational.Examples; +model GearGrounded "Translational grounded gear" + extends Modelica.Icons.Example; + + Sources.Force force annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); + Components.IdealGear idealGear( + ratio=1.6, + useSupport=true) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); + Components.Mass mass1( + m=0.1) annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); + Components.Mass mass2( + m=7, + s(fixed=true, start=0), + v(fixed=true, start=0)) annotation (Placement(transformation(extent={{20,-10},{40,10}}))); + Components.SpringDamper springDamper( + c=160, + d=10, + s_rel0=0.1) annotation (Placement(transformation(extent={{50,-10},{70,10}}))); + Components.SpringDamper springDamperSupport( + s_rel(fixed=true), + v_rel(fixed=true), + c=800, + d=50) annotation (Placement(transformation(extent={{-40,-50},{-20,-30}}))); + Blocks.Sources.Ramp ramp( + height=10, + duration=0.6, + offset=springDamper.s_rel0*springDamper.c/idealGear.ratio, + startTime=0.3) + annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); + Components.Fixed fixed annotation (Placement(transformation(extent={{-70,-50},{-50,-30}}))); + Components.Fixed fixed1 annotation (Placement(transformation(extent={{70,-10},{90,10}}))); +equation + connect(mass1.flange_b, idealGear.flange_a) annotation (Line(points={{-20,0},{-10,0}}, color={0,127,0})); + connect(idealGear.flange_b, mass2.flange_a) annotation (Line(points={{10,0},{20,0}}, color={0,127,0})); + connect(ramp.y, force.f) annotation (Line(points={{-79,0},{-72,0}}, color={0,0,127})); + connect(force.flange, mass1.flange_a) annotation (Line(points={{-50,0},{-40,0}}, color={0,127,0})); + connect(fixed.flange, springDamperSupport.flange_a) annotation (Line(points={{-60,-40},{-40,-40}}, color={0,127,0})); + connect(springDamperSupport.flange_b, idealGear.support) annotation (Line(points={{-20,-40},{0,-40},{0,-10}}, color={0,127,0})); + connect(mass2.flange_b, springDamper.flange_a) annotation (Line(points={{40,0},{50,0}}, color={0,127,0})); + connect(springDamper.flange_b, fixed1.flange) annotation (Line(points={{70,0},{80,0}}, color={0,127,0})); + annotation ( + experiment( + StopTime=3.0, + Interval=0.001), + Documentation(info=" +

+The flange_a of the ideal gear is driven by an external ramp-formed +force. +Via the elastically mounted gear the translational energy is transmitted to +a load mass where a preload force of springDamper acts against +the external force. +For ratio idealGear.ratio > 1 the driven flange +flange_b performs smaler movement then the driving flange +flange_a. +

+

+Simulate for 3 seconds and plot e.g. the position of masses: +mass1.s, mass2.s +

+")); +end GearGrounded; diff --git a/Modelica/Mechanics/Translational/Examples/LeverGrounded.mo b/Modelica/Mechanics/Translational/Examples/LeverGrounded.mo deleted file mode 100644 index be81476b50..0000000000 --- a/Modelica/Mechanics/Translational/Examples/LeverGrounded.mo +++ /dev/null @@ -1,50 +0,0 @@ -within Modelica.Mechanics.Translational.Examples; -model LeverGrounded "Translational grounded lever" - extends Modelica.Icons.Example; - - Sources.Force force( - useSupport=false) annotation (Placement(transformation(extent={{-50,-10},{-30,10}}))); - Components.Mass mass1( - m=0.1) annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); - Components.IdealLever idealLever( - ratio=1.6, useSupport=true) - annotation (Placement(transformation(extent={{10,-10},{30,10}}))); - Components.Mass mass2( - m=7, - s(fixed=true, start=0), - v(fixed=true, start=0)) annotation (Placement(transformation(extent={{40,-10},{60,10}}))); - Modelica.Blocks.Sources.Sine sine(amplitude=10, - f=5) - annotation (Placement(transformation(extent={{-80,-10},{-60,10}}))); - Components.Fixed fixed annotation (Placement(transformation(extent={{-48,-60},{-28,-40}}))); - Components.SpringDamper springDamper( - s_rel(fixed=true), - v_rel(fixed=true), - c=800, - d=50) annotation (Placement(transformation(extent={{-20,-60},{0,-40}}))); -equation - connect(mass1.flange_b, idealLever.flange_a) annotation (Line(points={{0,0},{10,0}}, color={0,127,0})); - connect(idealLever.flange_b, mass2.flange_a) annotation (Line(points={{30,0},{40,0}}, color={0,127,0})); - connect(sine.y, force.f) annotation (Line(points={{-59,0},{-52,0}}, color={0,0,127})); - connect(force.flange, mass1.flange_a) annotation (Line(points={{-30,0},{-20,0}}, color={0,127,0})); - connect(fixed.flange, springDamper.flange_a) annotation (Line(points={{-38,-50},{-20,-50}}, color={0,127,0})); - connect(springDamper.flange_b, idealLever.support) annotation (Line(points={{0,-50},{20,-50},{20,-10}}, color={0,127,0})); - annotation ( - experiment( - StopTime=1.0, - Interval=0.001), - Documentation(info=" -

-The flange_a of the lever is driven by a sine-wave motor force. -Via a lever the translational energy is transmitted to a load mass. -The lever is elastically mounted. -For ratio idealLever.ratio > 1 the 2nd class lever is -realized, i.e. the driven flange flange_b is located between the -driving flange flange_a and the lever's support. -

-

-Simulate for 1 second and plot the velocities of masses: -mass2.v, mass2.v -

-")); -end LeverGrounded; diff --git a/Modelica/Mechanics/Translational/Examples/package.order b/Modelica/Mechanics/Translational/Examples/package.order index 7f515e0ec5..110cbc949e 100644 --- a/Modelica/Mechanics/Translational/Examples/package.order +++ b/Modelica/Mechanics/Translational/Examples/package.order @@ -4,7 +4,7 @@ WhyArrows Accelerate CompareBrakingForce Damper -LeverGrounded +GearGrounded Oscillator Sensors Friction From 383f609f12fb0591001d7fbe6132757ed5cb465c Mon Sep 17 00:00:00 2001 From: tobolar Date: Tue, 25 Feb 2025 10:34:06 +0100 Subject: [PATCH 5/7] Change documentation --- .../Translational/Components/IdealGear.mo | 31 ++----------------- 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/Modelica/Mechanics/Translational/Components/IdealGear.mo b/Modelica/Mechanics/Translational/Components/IdealGear.mo index 258f85a1a1..fec439211e 100644 --- a/Modelica/Mechanics/Translational/Components/IdealGear.mo +++ b/Modelica/Mechanics/Translational/Components/IdealGear.mo @@ -16,37 +16,12 @@ equation annotation ( Documentation(info="

-This element characterizes any type of lever which is fixed in the +This element characterizes any type of gear which is fixed in the ground and which has one driving flange and one driven flange. -The lever is ideal, i.e., it does not have mass, elasticity, damping -or backlash. If these effects have to be considered, the lever has to be +The gear is ideal, i.e., it does not have mass, elasticity, damping +or backlash. If these effects have to be considered, the gear has to be connected to other elements in an appropriate way.

- -

Classification of lever

-

-Generally, a lever is classified by its ratio i which is the ratio -between the driving flange position and the driven flange position. The type of lever is, -then, given by the magnitude of i as follows: -

-
    -
  • - i < 0: 1st class lever; the lever's pivot is - located between the driving and the driven flange. -
  • -
  • - i > 1: 2nd class lever; the driven - flange is located between the driving flange and the lever's pivot. -
  • -
  • - 0 < i < 1: 3rd class lever; the - driving flange is located between the driven flange and the lever's pivot. -
  • -
-

-Applying the abovementioned to this element, the parameter ratio can be considered equal -to i only when flange_a is the driving flange. -

"), Icon( coordinateSystem(preserveAspectRatio=true, From 627fafbe85bd75d2af609c3906bf98cdae3a6b6e Mon Sep 17 00:00:00 2001 From: tobolar Date: Tue, 25 Feb 2025 13:10:43 +0100 Subject: [PATCH 6/7] Rename test GearAndLever to IdealGears --- ModelicaTest/Translational.mo | 44 ++++++++++++++++------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/ModelicaTest/Translational.mo b/ModelicaTest/Translational.mo index 132760d421..00395ca460 100644 --- a/ModelicaTest/Translational.mo +++ b/ModelicaTest/Translational.mo @@ -384,7 +384,7 @@ extends Modelica.Icons.ExamplesPackage; annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(coordinateSystem(preserveAspectRatio=false))); end TestFrictionPosition; - model GearAndLever + model IdealGears extends Modelica.Icons.Example; constant Real tol=Modelica.Constants.eps; @@ -395,10 +395,9 @@ extends Modelica.Icons.ExamplesPackage; transformation(extent={{-58,80},{-38,100}}))); Modelica.Mechanics.Rotational.Components.Inertia inertia1(J=1.2) annotation (Placement( transformation(extent={{-30,80},{-10,100}}))); - Modelica.Mechanics.Rotational.Components.IdealGear idealGear( + Modelica.Mechanics.Rotational.Components.IdealGear idealGearR( ratio=-0.4, - useSupport=false) - annotation (Placement(transformation(extent={{0,80},{20,100}}))); + useSupport=false) annotation (Placement(transformation(extent={{0,80},{20,100}}))); Modelica.Mechanics.Rotational.Components.Inertia inertia2( J=2, phi(fixed=true, start=0), @@ -407,8 +406,8 @@ extends Modelica.Icons.ExamplesPackage; annotation (Placement(transformation(extent={{-100,50},{-80,70}}))); Modelica.Mechanics.Translational.Sources.Force force annotation (Placement(transformation(extent={{-60,40},{-40,60}}))); Modelica.Mechanics.Translational.Components.Mass mass1(m=1.2) annotation (Placement(transformation(extent={{-30,40},{-10,60}}))); - Modelica.Mechanics.Translational.Components.IdealLever idealLever( - ratio=idealGear.ratio, + Modelica.Mechanics.Translational.Components.IdealGear idealGearT( + ratio=idealGearR.ratio, useSupport=false) annotation (Placement(transformation(extent={{0,40},{20,60}}))); Modelica.Mechanics.Translational.Components.Mass mass2( m=2, @@ -418,19 +417,18 @@ extends Modelica.Icons.ExamplesPackage; transformation(extent={{-58,-10},{-38,10}}))); Modelica.Mechanics.Rotational.Components.Inertia inertia3(J=1.2) annotation (Placement( transformation(extent={{-30,-10},{-10,10}}))); - Modelica.Mechanics.Rotational.Components.IdealGear idealGear1( + Modelica.Mechanics.Rotational.Components.IdealGear idealGearR1( ratio=1.4, - useSupport=true) - annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + useSupport=true) annotation (Placement(transformation(extent={{0,-10},{20,10}}))); Modelica.Mechanics.Rotational.Components.Inertia inertia4( J=2, phi(fixed=true, start=0), w(fixed=true, start=0)) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); Modelica.Mechanics.Translational.Sources.Force force1 annotation (Placement(transformation(extent={{-60,-100},{-40,-80}}))); Modelica.Mechanics.Translational.Components.Mass mass3(m=1.2) annotation (Placement(transformation(extent={{-30,-100},{-10,-80}}))); - Modelica.Mechanics.Translational.Components.IdealLever idealLever1( + Modelica.Mechanics.Translational.Components.IdealGear idealGearT1( useSupport=true, - ratio=idealGear1.ratio) annotation (Placement(transformation(extent={{0,-80},{20,-100}}))); + ratio=idealGearR1.ratio) annotation (Placement(transformation(extent={{0,-80},{20,-100}}))); Modelica.Mechanics.Translational.Components.Mass mass4( m=2, s(fixed=true), @@ -465,28 +463,26 @@ extends Modelica.Icons.ExamplesPackage; assert(abs(errPos.y) < tol, "Position of rotational and translational component must be equal (less then tolerance)"); - connect(inertia1.flange_b,idealGear. flange_a) - annotation (Line(points={{-10,90},{0,90}})); - connect(idealGear.flange_b,inertia2. flange_a) - annotation (Line(points={{20,90},{30,90}})); + connect(inertia1.flange_b, idealGearR.flange_a) annotation (Line(points={{-10,90},{0,90}})); + connect(idealGearR.flange_b, inertia2.flange_a) annotation (Line(points={{20,90},{30,90}})); connect(sine.y,torque. tau) annotation (Line(points={{-79,60},{-72,60},{-72,90},{-60,90}}, color={0,0,127})); connect(torque.flange,inertia1. flange_a) annotation (Line( points={{-38,90},{-30,90}})); connect(force.flange, mass1.flange_a) annotation (Line(points={{-40,50},{-30,50}}, color={0,127,0})); - connect(mass1.flange_b, idealLever.flange_a) annotation (Line(points={{-10,50},{0,50}}, color={0,127,0})); - connect(idealLever.flange_b, mass2.flange_a) annotation (Line(points={{20,50},{30,50}}, color={0,127,0})); - connect(inertia3.flange_b, idealGear1.flange_a) annotation (Line(points={{-10,0},{0,0}})); - connect(idealGear1.flange_b, inertia4.flange_a) annotation (Line(points={{20,0},{30,0}})); + connect(mass1.flange_b,idealGearT. flange_a) annotation (Line(points={{-10,50},{0,50}}, color={0,127,0})); + connect(idealGearT.flange_b, mass2.flange_a) annotation (Line(points={{20,50},{30,50}}, color={0,127,0})); + connect(inertia3.flange_b, idealGearR1.flange_a) annotation (Line(points={{-10,0},{0,0}})); + connect(idealGearR1.flange_b, inertia4.flange_a) annotation (Line(points={{20,0},{30,0}})); connect(sine.y, torque1.tau) annotation (Line(points={{-79,60},{-72,60},{-72,0},{-60,0}}, color={0,0,127})); connect(torque1.flange, inertia3.flange_a) annotation (Line(points={{-38,0},{-30,0}})); connect(force1.flange, mass3.flange_a) annotation (Line(points={{-40,-90},{-30,-90}}, color={0,127,0})); - connect(mass3.flange_b, idealLever1.flange_a) annotation (Line(points={{-10,-90},{0,-90}}, color={0,127,0})); - connect(idealLever1.flange_b, mass4.flange_a) annotation (Line(points={{20,-90},{30,-90}}, color={0,127,0})); + connect(mass3.flange_b,idealGearT1. flange_a) annotation (Line(points={{-10,-90},{0,-90}}, color={0,127,0})); + connect(idealGearT1.flange_b, mass4.flange_a) annotation (Line(points={{20,-90},{30,-90}}, color={0,127,0})); connect(fixedR.flange, springDamperR.flange_a) annotation (Line(points={{-50,-30},{-30,-30}}, color={0,0,0})); - connect(springDamperR.flange_b, idealGear1.support) annotation (Line(points={{-10,-30},{10,-30},{10,-10}}, color={0,0,0})); + connect(springDamperR.flange_b, idealGearR1.support) annotation (Line(points={{-10,-30},{10,-30},{10,-10}}, color={0,0,0})); connect(fixedT.flange, springDamperT.flange_a) annotation (Line(points={{-50,-60},{-32,-60}}, color={0,127,0})); - connect(springDamperT.flange_b, idealLever1.support) annotation (Line(points={{-12,-60},{10,-60},{10,-80}}, color={0,127,0})); + connect(springDamperT.flange_b,idealGearT1. support) annotation (Line(points={{-12,-60},{10,-60},{10,-80}}, color={0,127,0})); connect(inertia2.flange_b, speedSensorR1.flange) annotation (Line(points={{50,90},{54,90}}, color={0,0,0})); connect(mass2.flange_b, speedSensorT1.flange) annotation (Line(points={{50,50},{54,50}}, color={0,127,0})); connect(speedSensorR1.w, errVel.u1) annotation (Line(points={{75,90},{78,90},{78,76}}, color={0,0,127})); @@ -498,5 +494,5 @@ extends Modelica.Icons.ExamplesPackage; connect(sine1.y, force.f) annotation (Line(points={{-79,-50},{-68,-50},{-68,50},{-62,50}}, color={0,0,127})); connect(sine1.y, force1.f) annotation (Line(points={{-79,-50},{-68,-50},{-68,-90},{-62,-90}}, color={0,0,127})); annotation (experiment(StopTime=1.1)); - end GearAndLever; + end IdealGears; end Translational; From 219a87019ab76f228c703371a291a14188b7f0c7 Mon Sep 17 00:00:00 2001 From: "Tobolar, Jakub" Date: Mon, 28 Apr 2025 14:01:17 +0200 Subject: [PATCH 7/7] Do not check ratio's magnitude --- Modelica/Mechanics/Translational/Components/IdealGear.mo | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Modelica/Mechanics/Translational/Components/IdealGear.mo b/Modelica/Mechanics/Translational/Components/IdealGear.mo index fec439211e..4475aa8b52 100644 --- a/Modelica/Mechanics/Translational/Components/IdealGear.mo +++ b/Modelica/Mechanics/Translational/Components/IdealGear.mo @@ -5,13 +5,8 @@ model IdealGear "Ideal gear without mass" "Transmission ratio (flange_a.s/flange_b.s)"; equation - if abs(ratio) < Modelica.Constants.eps then - flange_a.f = 0; - flange_b.f = 0; - else - s_a = ratio*s_b; - 0 = ratio*flange_a.f + flange_b.f; - end if; + s_a = ratio*s_b; + 0 = ratio*flange_a.f + flange_b.f; annotation ( Documentation(info="