Skip to content

Add 1d translational lever #4538

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions Modelica/Mechanics/Translational/Components/IdealGear.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
within Modelica.Mechanics.Translational.Components;
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)";

equation
s_a = ratio*s_b;
0 = ratio*flange_a.f + flange_b.f;

annotation (
Documentation(info="<html>
<p>
This element characterizes any type of gear which is fixed in the
ground and which has one driving flange and one driven flange.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost all elements where it is relevant to have a connection to ground/support/housing has an optional such connector. any particular reason this one is different?

Copy link
Contributor Author

@tobolar tobolar Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason for this. I simply took and modified documentation of Modelica.Mechanics.Rotational.Components.IdealGear which refers to the ground in the same manner.

The gear is <strong>ideal</strong>, 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.
</p>
</html>"),
Icon(
coordinateSystem(preserveAspectRatio=true,
extent={{-100,-100},{100,100}}),
graphics={ Line(points={{70,0},{100,0}}, color={0,127,0}),
Line(points={{-100,0},{-70,0}},color={0,127,0}),
Ellipse(
extent={{-38,38},{38,-38}},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
lineColor={95,95,95}),
Ellipse(
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,0}},
color={0,127,0}),
Line(
points={{0,-100},{0,-78}},
color={0,127,0}),
Ellipse(
extent={{-4,4},{4,-4}},
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"),
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;
1 change: 1 addition & 0 deletions Modelica/Mechanics/Translational/Components/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SpringDamper
ElastoGap
SupportFriction
Brake
IdealGear
IdealGearR2T
IdealRollingWheel
RollingResistance
Expand Down
61 changes: 61 additions & 0 deletions Modelica/Mechanics/Translational/Examples/GearGrounded.mo
Original file line number Diff line number Diff line change
@@ -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="<html>
<p>
The <code>flange_a</code> 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 <code>springDamper</code> acts against
the external force.
For ratio <code>idealGear.ratio&nbsp;&gt;&nbsp;1</code> the driven flange
<code>flange_b</code> performs smaler movement then the driving flange
<code>flange_a</code>.
</p>
<p>
Simulate for 3&nbsp;seconds and plot e.g. the position of masses:
<code>mass1.s</code>, <code>mass2.s</code>
</p>
</html>"));
end GearGrounded;
1 change: 1 addition & 0 deletions Modelica/Mechanics/Translational/Examples/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ WhyArrows
Accelerate
CompareBrakingForce
Damper
GearGrounded
Oscillator
Sensors
Friction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
time
damper.s_rel
damper.v_rel
mass3.s
mass3.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
time
inertia1.phi
inertia1.w
inertia3.phi
inertia3.w
mass1.s
mass1.v
mass3.s
mass3.v

112 changes: 112 additions & 0 deletions ModelicaTest/Translational.mo
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,116 @@ 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 IdealGears
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 idealGearR(
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.IdealGear idealGearT(
ratio=idealGearR.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 idealGearR1(
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.IdealGear idealGearT1(
useSupport=true,
ratio=idealGearR1.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, 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,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,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, 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,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}));
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 IdealGears;
end Translational;