Message Boards Message Boards

1
|
9447 Views
|
9 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Help debugging singular model in SystemModeler

Posted 10 years ago

I am trying to build a model for "walking sticks". It would look like this when done:

stick model

and here is the top part animated (in mathematica): animation

I built the top part of the top part (z2-z3-z4) but for some reason I get "Model is structurally singular" error. Any idea why would be appreciated.

model WalkingSticks
  inner Modelica.Mechanics.MultiBody.World world(gravityType = Modelica.Mechanics.MultiBody.Types.GravityTypes.NoGravity) annotation(Placement(visible = true, transformation(origin = {48, -86}, extent = {{-10, -10}, {10, 10}}, rotation = -270)));
  parameter Modelica.SIunits.Length z1 = 15;
  parameter Modelica.SIunits.Length z2 = 2.78;
  parameter Modelica.SIunits.Length z3 = 20.02;
  parameter Modelica.SIunits.Length z4 = 12;
  parameter Modelica.SIunits.Length z5 = 20.02;
  parameter Modelica.SIunits.Length z6 = 12;
  parameter Modelica.SIunits.Length d = 0.1;
  Modelica.Mechanics.MultiBody.Parts.BodyCylinder Z2(r = {z2, 0, 0}, diameter = d) annotation(Placement(visible = true, transformation(origin = {48, -4}, extent = {{-10, -10}, {10, 10}}, rotation = -270)));
  Modelica.Mechanics.MultiBody.Joints.Revolute RA0(w.start = 1) annotation(Placement(visible = true, transformation(origin = {48, -44}, extent = {{-10, -10}, {10, 10}}, rotation = -270)));
  Modelica.Mechanics.MultiBody.Joints.Revolute R23 annotation(Placement(visible = true, transformation(origin = {26, 22}, extent = {{-10, -10}, {10, 10}}, rotation = -540)));
  Modelica.Mechanics.MultiBody.Parts.BodyCylinder Z3(r = {z3, 0, 0}, diameter = d) annotation(Placement(visible = true, transformation(origin = {-20, 22}, extent = {{-10, -10}, {10, 10}}, rotation = -360)));
  Modelica.Mechanics.MultiBody.Parts.FixedTranslation fixedTranslation(r = {-z1, 0, 0}) annotation(Placement(visible = true, transformation(origin = {0, -72}, extent = {{-10, -10}, {10, 10}}, rotation = -180)));
  Modelica.Mechanics.MultiBody.Parts.BodyCylinder Z4(r = {z4, 0, 0}, diameter = d) annotation(Placement(visible = true, transformation(origin = {-56, -40}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  Modelica.Mechanics.MultiBody.Joints.Revolute R34 annotation(Placement(visible = true, transformation(origin = {-56, 4}, extent = {{-10, -10}, {10, 10}}, rotation = -450)));
  Modelica.Mechanics.MultiBody.Joints.Revolute RB0 annotation(Placement(visible = true, transformation(origin = {-34, -72}, extent = {{-10, -10}, {10, 10}}, rotation = -180)));
equation
  connect(RB0.frame_b, Z4.frame_b) annotation(Line(visible = true, origin = {-52, -64.667}, points = {{8, -7.333}, {-4, -7.333}, {-4, 14.667}}));
  connect(RB0.frame_a, fixedTranslation.frame_b) annotation(Line(visible = true, origin = {-17, -72}, points = {{-7, 0}, {7, 0}}));
  connect(RA0.frame_a, world.frame_b) annotation(Line(visible = true, origin = {48, -65}, points = {{0, 11}, {0, -11}}));
  connect(fixedTranslation.frame_a, world.frame_b) annotation(Line(visible = true, origin = {35.333, -73.333}, points = {{-25.333, 1.333}, {12.667, 1.333}, {12.667, -2.667}}));
  connect(R34.frame_b, Z4.frame_a) annotation(Line(visible = true, origin = {-56, -18}, points = {{0, 12}, {-0, -12}}));
  connect(Z3.frame_a, R34.frame_a) annotation(Line(visible = true, origin = {-47.333, 19.333}, points = {{17.333, 2.667}, {-8.667, 2.667}, {-8.667, -5.333}}));
  connect(R23.frame_b, Z3.frame_b) annotation(Line(visible = true, origin = {3, 22}, points = {{13, 0}, {-13, 0}}));
  connect(R23.frame_a, Z2.frame_b) annotation(Line(visible = true, origin = {44, 16.667}, points = {{-8, 5.333}, {4, 5.333}, {4, -10.667}}));
  connect(Z2.frame_a, RA0.frame_b) annotation(Line(visible = true, origin = {48, -24}, points = {{0, 10}, {0, -10}}));
  annotation(experiment(StopTime = 12.56637), Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})));
end WalkingSticks;
POSTED BY: skippa
9 Replies
Posted 10 years ago
POSTED BY: Johan Rhodin
Posted 10 years ago

I should also add that if you are planning to stay in 2D, I'd recommend the PlanarMechanics library from DLR. You can download it here: PlanarMechanics. It is easier to work with than the full 3D library included with SystemModeler.

POSTED BY: Johan Rhodin

Thanks for Johan's update. I tried the PlanarMechanics library quickly this afternoon and it works for me. You can take a look at the attachment.

The screenshots shows the assembly and the distance the Z3/Z4 joint and origin (Z2-ground) over time. Starting position is that Z2 pointing to the right horizontally and angular velocity is at constant of 0.8 rad per second.

Model

model

Result of simulation

simulation

Attachments:
POSTED BY: Shenghui Yang
Posted 10 years ago

Johan,

That seems to be the culprit, thanks. After I replaced one of the joints with RevolutePlanarLoopConstraint I was able to get a different result: solver would exit with errors until I changed length = zx attribute values into r = {zx, 0, 0} ones. Now SystemModeller can calculate the initial position, but I can't make it move, even though I have w=1 specified for RA0. My current model is attached.

As for planar mechanics - I don't think I can do that because I plan to assemble multiple joints like this in 3d.

model

Attachments:
POSTED BY: skippa
Posted 10 years ago

If you want to ensure that your value for initial value for the angular velocity is respected you can: Click on RA0, select the "Advanced" tab in the parameters view and change stateSelect from StateSelect.prefer to StateSelect.always.

POSTED BY: Johan Rhodin
Posted 10 years ago

This helps. Thanks a lot. Though I find exactly 0 documentation for this property in documentation. Can you briefly explain why is it necessary here?

Do you also think it should work if I replace all r={z4, 0, 0} with length=z4? I expect that it should, but it doesn't.

Once again, thanks for help.

POSTED BY: skippa
Posted 10 years ago

The other issue is why isn't RA0.phi linear???

RA0.phi

POSTED BY: skippa
Posted 10 years ago

Here's another surprise: in Mathematica WSMSimulate["WalkingSticks", {0, 12}, WSMParameterValues -> {"z12" -> 0.18}]; gives me: "The variables {"z12"}) can only be modified directly in the model, for example with WSMSetValues, and will be ignored for this simulation." I was hoping to do parameter sweep :(

POSTED BY: skippa
Posted 9 years ago

It's because that parameter potentially changes the whole configuration of the system and requires the model to be re-compiled.

POSTED BY: Johan Rhodin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract