Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » ggtlse
  • » Profile

Posts

Posts

Thanks, it works well with the nightly builds v1.9.4 dev 389

( and the pointer changes to arrows to resize the windows  :-)  )

Hi,
I just installed the 1.9.3 version and cannot connect wires to the 'fixed' component in mechanics.transational or mechanics.rotational
As if the 'fixed' component had no flange. The simple connection from 'fixed' to a spring or damper flange is impossible.
I use windows 7 64bits.
Is this a general issue or a problem with my installation ?

Thanks
Gregory

Thanks. It works well in this order.

Is there a way to script the loading of multiple components in good order ? ( With OMShell perhaps ? )

Hi,

I try to make a model including own components.

This works well until i close openmodica and reopen it. The components are not found anymore and i have an error 'class (my component)  not found in scope (my model)'

In the schematics the component appears as a red box with cross :

https://openmodelica.org/images/agorapro/attachments/4161/mini_not-found.PNG

How can i specify the location of my components so that the model find them once saved en reopened ?

Thanks
Greg

Hi,

Once a model has been simulated in OMedit, is there a way to come back to the schematics view and back to simulation results again without resimulating ? Or to open two separate windows for schematics and simulation results ?

Thanks
Greg

Hello,

I'm a new user too. It seems that the way to do that with openmodelica is :
- first,  to create a new class/model with connectors for the superbloc
- then to use this class in one with higher level

You can copy/paste the code of an existing component with similar interfaces and adapt the equations and names


Greg

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;

I suppose it since I just begin with this language.

Also 'parameter' seems to be a keyword reserved for constants.

What do you want to do with this code ?

Hi,

It seems that in the first code, x is unevaluated when the code reaches y=1/x. And perhaps 0 is used as a default value for x.

In the second code, the value 2 is already assigned to x when the code reaches y=1/x.

Gregory

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

Hi

Is there an existing component to represent a rotational end stop ( torque opposition when the angle reaches a fixed value ) ?

Thanks
Gregory

Hi,

Is there a way to use a single model in OMedit with several sets of parameters, and to store/recall these sets of parameters for simulation ?

Thaks for your help

Gregory

  • Index
  • » Users
  • » ggtlse
  • » Profile
You are here: