- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » mechanics rotational end stop
mechanics rotational end stop
mechanics rotational end stop
Hi
Is there an existing component to represent a rotational end stop ( torque opposition when the angle reaches a fixed value ) ?
Thanks
Gregory
- ggtlse
- 14 Posts
Re: mechanics rotational end stop
Hello Gregory,
I made a mechanical switching rod that might be useful for you. It has a boolean input 'fixed' in which case the connection is a solid rod. If the boolean is false, the connection is open. I've used it for two colliding masses, but you can use it to make one the world.
The code of the switching element and the model are below. (They get messy here due to the annotations.)
Hopefully it helps.
Bas
model SwitichingRod "A connection between two masses that can be on or off. Can be used for non-elastic collision."
parameter Real small = 1e-12;
import Modelica.Mechanics.Translational.Interfaces.Flange_a;
import Modelica.Mechanics.Translational.Interfaces.Flange_b;
import Modelica.Blocks.Interfaces.BooleanInput;
Real t;
Real f, dv;
Flange_a flange_a annotation(Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Flange_b flange_b annotation(Placement(visible = true, transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
BooleanInput fixed annotation(Placement(visible = true, transformation(origin = {-100, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {0, 100}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
equation
f = t * (if fixed then 1 else 0);
dv = t * (if fixed then small else 1);
flange_a.f = -f;
flange_b.f = f;
der(flange_b.s) - der(flange_a.s) = dv;
annotation(Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-100, 0}, {-55, 0}}, color = {0, 127, 0}), Line(points = {{54, 0}, {100, 0}}, color = {0, 127, 0}), Polygon(points = {{50, -90}, {20, -80}, {20, -100}, {50, -90}}, lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Line(points = {{-60, -90}, {20, -90}}, color = {0, 0, 0}), Rectangle(extent = {{-55, 3}, {53, -4}}, lineColor = {160, 160, 164}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-100, -29}, {-100, -61}}, color = {0, 0, 0}), Line(points = {{100, -61}, {100, -28}}, color = {0, 0, 0}), Line(points = {{-98, -60}, {98, -60}}, color = {0, 0, 0}), Polygon(points = {{-101, -60}, {-96, -59}, {-96, -61}, {-101, -60}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{100, -60}, {95, -61}, {95, -59}, {100, -60}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid), Text(extent = {{-44, -41}, {51, -57}}, textString = "Length L", lineColor = {0, 0, 255})}), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Line(points = {{-100, 0}, {-55, 0}}, color = {0, 127, 0}), Line(points = {{53, 0}, {99, 0}}, color = {0, 127, 0}), Polygon(lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid, points = {{50, -90}, {20, -80}, {20, -100}, {50, -90}}), Line(points = {{-60, -90}, {20, -90}}), Rectangle(lineColor = {160, 160, 164}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, extent = {{-55, 10}, {53, -10}}), Text(lineColor = {0, 0, 255}, extent = {{-150, 80}, {150, 40}}, textString = "%name"), Line(origin = {-14.61, 1.04}, points = {{-12.7733, 22.6698}, {12.7733, -20.5984}}, thickness = 3), Line(origin = {2.6282, 1.93758}, points = {{-12.7733, 22.6698}, {12.7733, -20.5984}}, thickness = 3)}), experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02));
end SwitichingRod;
model test
Modelica.Mechanics.Translational.Components.Mass mass1(m = 1, s(start = 0), v(start = 1)) annotation(Placement(visible = true, transformation(origin = {-80, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Components.Fixed fixed1 annotation(Placement(visible = true, transformation(origin = {-140, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Components.Spring spring1(c = 1) annotation(Placement(visible = true, transformation(origin = {-120, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
SwitichingRod switichingrod1 annotation(Placement(visible = true, transformation(origin = {-40, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Logical.Hysteresis hysteresis1(uLow = 0.49, uHigh = 0.5) annotation(Placement(visible = true, transformation(origin = {-60, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Translational.Sensors.PositionSensor positionsensor1 annotation(Placement(visible = true, transformation(origin = {-100, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(positionsensor1.flange, mass1.flange_a) annotation(Line(points = {{-110, 80}, {-136.232, 80}, {-136.232, 57.971}, {-90.4348, 57.971}, {-90.4348, 40}, {-90, 40}}, color = {0, 127, 0}));
connect(positionsensor1.s, hysteresis1.u) annotation(Line(points = {{-89, 80}, {-93.3333, 80}, {-72, 80}, {-72, 80}}, color = {0, 0, 127}));
connect(hysteresis1.y, switichingrod1.fixed) annotation(Line(points = {{-49, 80}, {-39.4203, 80}, {-39.4203, 50}, {-40, 50}}, color = {255, 0, 255}));
connect(switichingrod1.flange_b, fixed1.flange) annotation(Line(points = {{-30, 40}, {-26.087, 40}, {-26.087, 0}, {-139.13, 0}, {-139.13, 0}}, color = {0, 127, 0}));
connect(mass1.flange_b, switichingrod1.flange_a) annotation(Line(points = {{-70, 40}, {-49.4822, 40}, {-49.4822, 39.8159}, {-49.4822, 39.8159}}, color = {0, 127, 0}));
connect(spring1.flange_a, fixed1.flange) annotation(Line(points = {{-130, 40}, {-140.161, 40}, {-140.161, 0.460299}, {-140.161, 0.460299}}, color = {0, 127, 0}));
connect(spring1.flange_b, mass1.flange_a) annotation(Line(points = {{-110, 40}, {-90.2186, 40}, {-90.2186, 39.8159}, {-90.2186, 39.8159}}, color = {0, 127, 0}));
annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 90}}, preserveAspectRatio = true, initialScale = 0.1, grid = {1, 1})), Diagram(coordinateSystem(extent = {{-150, -100}, {150, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {0.02, 0.02})), experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02));
end test;
- bjdekruif
- 18 Posts
Re: mechanics rotational end stop
Thanks a lot.
I've tried it for a collision upon:
a free mass -> the incoming mass is slowed, and then the two masses move together
a mass fixed to ground -> the incoming mass is stopped
This works well and i will adapt it to rotational case.
Gregory
- ggtlse
- 14 Posts
Re: mechanics rotational end stop
Here it is :
model RotationalContact "A connection between two shafts that can be on or off. Can be used for non-elastic collision."
parameter Real small = 1e-12;
import Modelica.Mechanics.Rotational.Interfaces.Flange_a;
import Modelica.Mechanics.Rotational.Interfaces.Flange_b;
import Modelica.Blocks.Interfaces.BooleanInput;
Real t;
Real tau, dw;
Flange_a flange_a annotation(Placement(visible = true, transformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Flange_b flange_b annotation(Placement(visible = true, transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
BooleanInput fixed annotation(Placement(visible = true, transformation(origin = {-100, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {0, 100}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
equation
tau = t * (if fixed then 1 else 0);
dw = t * (if fixed then small else 1);
flange_a.tau = -tau;
flange_b.tau = tau;
der(flange_b.phi) - der(flange_a.phi) = dw;
annotation(Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}}), graphics = {Line(points = {{-100, 0}, {-55, 0}}, color = {0, 127, 0}), Line(points = {{54, 0}, {100, 0}}, color = {0, 127, 0}), Polygon(points = {{50, -90}, {20, -80}, {20, -100}, {50, -90}}, lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid), Line(points = {{-60, -90}, {20, -90}}, color = {0, 0, 0}), Rectangle(extent = {{-55, 3}, {53, -4}}, lineColor = {160, 160, 164}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid), Line(points = {{-100, -29}, {-100, -61}}, color = {0, 0, 0}), Line(points = {{100, -61}, {100, -28}}, color = {0, 0, 0}), Line(points = {{-98, -60}, {98, -60}}, color = {0, 0, 0}), Polygon(points = {{-101, -60}, {-96, -59}, {-96, -61}, {-101, -60}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid), Polygon(points = {{100, -60}, {95, -61}, {95, -59}, {100, -60}}, lineColor = {0, 0, 0}, fillColor = {0, 0, 0}, fillPattern = FillPattern.Solid), Text(extent = {{-44, -41}, {51, -57}}, textString = "Length L", lineColor = {0, 0, 255})}), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Line(points = {{-100, 0}, {-55, 0}}, color = {0, 127, 0}), Line(points = {{53, 0}, {99, 0}}, color = {0, 127, 0}), Polygon(lineColor = {128, 128, 128}, fillColor = {128, 128, 128}, fillPattern = FillPattern.Solid, points = {{50, -90}, {20, -80}, {20, -100}, {50, -90}}), Line(points = {{-60, -90}, {20, -90}}), Rectangle(lineColor = {160, 160, 164}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, extent = {{-55, 10}, {53, -10}}), Text(lineColor = {0, 0, 255}, extent = {{-150, 80}, {150, 40}}, textString = "%name"), Line(origin = {-14.61, 1.04}, points = {{-12.7733, 22.6698}, {12.7733, -20.5984}}, thickness = 3), Line(origin = {2.6282, 1.93758}, points = {{-12.7733, 22.6698}, {12.7733, -20.5984}}, thickness = 3)}), experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02));
end RotationalContact;
model TestRotationalContact
Modelica.Mechanics.Rotational.Sources.Torque torque1 annotation(Placement(visible = true, transformation(origin = {-60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Inertia inertia1(J = 1E-2) annotation(Placement(visible = true, transformation(origin = {-20, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
RotationalContact rotationalcontact1 annotation(Placement(visible = true, transformation(origin = {60, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Fixed fixed1 annotation(Placement(visible = true, transformation(origin = {120, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Logical.GreaterEqual greaterequal1 annotation(Placement(visible = true, transformation(origin = {40, 80}, extent = {{-5, -5}, {5, 5}}, rotation = 0)));
Modelica.Mechanics.Rotational.Sensors.AngleSensor anglesensor1 annotation(Placement(visible = true, transformation(origin = {0, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant const(k = 20) annotation(Placement(visible = true, transformation(origin = {0, 40}, extent = {{-5, -5}, {5, 5}}, rotation = 0)));
Modelica.Blocks.Sources.Constant constant1(k = 0.5) annotation(Placement(visible = true, transformation(origin = {-100, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.Rotational.Components.Inertia inertia2(J = 10E-2) annotation(Placement(visible = true, transformation(origin = {100, 60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(rotationalcontact1.flange_b, inertia2.flange_a) annotation(Line(points = {{70, 60}, {89.9877, 60}, {89.9877, 59.3695}, {89.9877, 59.3695}}));
connect(constant1.y, torque1.tau) annotation(Line(points = {{-89, 60}, {-74.3052, 60}, {-74.3052, 60.863}, {-74.3052, 60.863}}, color = {0, 0, 127}));
connect(const.y, greaterequal1.u2) annotation(Line(points = {{5.5, 40}, {23.1504, 40}, {23.1504, 76.1722}, {34.7255, 76.1722}, {34.7255, 76.1722}}, color = {0, 0, 127}));
connect(anglesensor1.flange, inertia1.flange_b) annotation(Line(points = {{-10, 80}, {-10.0816, 80}, {-10.0816, 67.9575}, {0.746786, 67.9575}, {0.746786, 60.1163}, {-9.33482, 60.1163}, {-9.33482, 59.7429}, {-9.33482, 59.7429}}));
connect(anglesensor1.phi, greaterequal1.u1) annotation(Line(points = {{11, 80}, {33.232, 80}, {33.232, 79.1593}, {33.232, 79.1593}}, color = {0, 0, 127}));
connect(inertia1.flange_b, rotationalcontact1.flange_a) annotation(Line(points = {{-10, 60}, {50.408, 60}, {50.408, 58.9961}, {50.408, 58.9961}}));
connect(greaterequal1.y, rotationalcontact1.fixed) annotation(Line(points = {{45.5, 80}, {60.0032, 80}, {60.0032, 69.3444}, {60, 69.3444}, {60, 70}}, color = {255, 0, 255}));
connect(torque1.flange, inertia1.flange_a) annotation(Line(points = {{-50, 60}, {-29.338, 60}, {-29.338, 59.0094}, {-29.338, 59.0094}}));
annotation(Diagram(coordinateSystem(extent = {{-100, -100}, {150, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Icon(coordinateSystem(extent = {{-100, -100}, {150, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 4, Tolerance = 1e-6, Interval = 0.008));
end TestRotationalContact;
- ggtlse
- 14 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » mechanics rotational end stop