Reputation: 117
I have the following simple Modelica script that models a cylinder with a spring-mass attached to it. A planar constraint is applied to constrain the spring-mass to a plane.
I want to plot the angular velocity of the cylinder in its body-fixed frame, but in the Modelica plotting tab, I can only see the angular velocity resolved in the world frame.
How can I get the cylinder's angular velocity in the body-fixed frame of the cylinder (i.e. rigidBody.frame_a
)?
model ModelicaCheckCase
Modelica.Mechanics.MultiBody.Joints.Planar planar(
n = {1,0,0},
n_x = {0,1,0}) annotation (Placement(transformation(origin = {6, 54}, extent = {{-10, -10}, {10, 10}})));
Modelica.Mechanics.MultiBody.Parts.BodyCylinder rigidBody(r = {0.5, 0, 0}, r_shape = {-0.5, 0, 0}, r_0(start = {0, 0, 0}, each fixed = true), w_0_start = {0, 0, 0.1}) annotation(
Placement(transformation(extent = {{40, -10}, {60, 10}})));
inner Modelica.Mechanics.MultiBody.World world(n = {-1, 0, 0}, gravityType = Modelica.Mechanics.MultiBody.Types.GravityTypes.NoGravity) annotation(
Placement(transformation(origin = {-40, -26}, extent = {{-40, 40}, {-20, 60}})));
Modelica.Mechanics.MultiBody.Parts.Body sloshMass(r_CM = {0, 0, 0}, m = 3, r_0(each fixed = true, start = {0, 0.2, 0}), v_0(each fixed = true, start = {0, 0, 0})) annotation(
Placement(transformation(extent = {{40, 30}, {60, 50}})));
Modelica.Mechanics.MultiBody.Forces.Spring spring(c = 20, s_unstretched=0) annotation(
Placement(transformation(origin = {-22, 76}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
Modelica.Mechanics.MultiBody.Parts.FixedTranslation attachmentPoint(r = {0, 0, 0}) annotation(
Placement(transformation(origin = {-16, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
equation
connect(attachmentPoint.frame_a, rigidBody.frame_a) annotation(
Line(points = {{-16, 0}, {-16, -3}, {6, -3}, {6, 0}}, color = {95, 95, 95}, thickness = 0.5));
connect(attachmentPoint.frame_b, planar.frame_a) annotation(
Line(points = {{-16, 20}, {-19, 20}, {-19, 54}, {-4, 54}}, color = {95, 95, 95}, thickness = 0.5));
connect(spring.frame_b, sloshMass.frame_a) annotation(
Line(points = {{-22, 86}, {28, 86}, {28, 40}, {40, 40}}, color = {95, 95, 95}, thickness = 0.5));
connect(spring.frame_a, attachmentPoint.frame_b) annotation(
Line(points = {{-22, 66}, {-16, 66}, {-16, 20}}));
connect(planar.frame_b, sloshMass.frame_a) annotation(
Line(points = {{16, 54}, {40, 54}, {40, 40}}, color = {95, 95, 95}));
annotation(
Icon(coordinateSystem(preserveAspectRatio = false)),
Diagram(coordinateSystem(preserveAspectRatio = false)),
uses(Modelica(version = "4.0.0")),
experiment(StopTime = 10, Interval = 0.01));
end ModelicaCheckCase;
Upvotes: 0
Views: 61
Reputation: 7525
Would using a absolute angular velocity sensor (Modelica.Mechanics.MultiBody.Sensors.AbsoluteAngularVelocity
) help? I think it has the correct parameters set as default, if not, changing resolveInFrame
should help...
A screenshot of possible settings:
Upvotes: 4