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

multibody spring mass damper question

multibody spring mass damper question

Hello,

I've started learning how to use open modelica and I'm looking through the examples and trying to build them by myself to try to understand them and I have a few questions concerning using the multibody library.  I've got the example "SpringWithMass" to compile and run, but when I try to re-create it in OMEdit it didn't  quite run the first time.

I looked at the error from why it didn't solve and looked properties of the body in my simulation and I have:

Modelica.Mechanics.MultiBody.Parts.Body body1(m = 1, angles_fixed = true, r_CM = {0, 0, 0}, w_0_fixed = true, animation = false) annotation(Placement(visible = true, transformation(origin = {20, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));

and the example has the following:

Modelica.Mechanics.MultiBody.Parts.Body body(r_0(start = {0, -0.3, 0}, each fixed = true), v_0(each fixed = true), angles_fixed = true, w_0_fixed = true, r_CM = {0, 0, 0}, m = 1) annotation(Placement(transformation(origin = {10, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 270)));

If I change my model to have "r_0(start = {0, -0.3, 0}, each fixed = true)" then it solves.  Which I think gives it an initial guess for r_0 to fix the solver error about the distance between the origin of frame_a and the origin of frame_b

Is there a way to set these variables in the body dialog box?  If I try to enter "r_0(start = {0, -0.3, 0}, each fixed = true)" into the modifiers tab of body I get errors that it isn't formatted right.  I tried some formatting combinations to try and get it to accept it but I couldn't figure out the correct format.

I got the model to solve by manually changing the model in the Text View.  Is this the only way to do it?  Is there another way I can make this change?

Thanks,
Mark

Re: multibody spring mass damper question

Hello,

So I worked some more on a spring mass damper model.  I put together a new model based on the example, but with no initial stretch of the spring, but instead have a step input of force at 0.5s which is a more interesting response and kind of along the lines of adding an actuator control the mass at some point.  I attached the model if anyone is interested.

One question I have is when I connect a force a window comes up called "Connect Array" (picture attached for clarity) and says

"Connect step1.y with force.force[index]
Enter index value for force.force"

What am I supposed to enter in this box?  I tried 1,2,3... etc and anything I put gets the following error when I try to run the model

"Error: Type mismatch in binding height = {0, 10, 0}, expected subtype of Real, got type Integer[3]."


I manually edited the modelica code to get the model to run.  I made these changes:

Removed [1] in "force connect(step1.y, force.force[1])" to get "connect(step1.y, force.force)"

Added [3] after step1 to get "Modelica.Blocks.Sources.Step step1[3](height = {0, 10, 0}, startTime = 0.5)"

This got the model to solve, but now I get this warning:

"Warning: Non-array modification '0.5' for array component, possibly due to missing 'each'."

What does the warning mean?

If you think the attached model is helpful I would be happy to to keep posting some models as I am learning how to use the software.

Thanks,
Mark

I didn't quite get the attachments the first time.  Hopefully this edit gets them in the post

https://www.openmodelica.org/images/agorapro/attachments/4292/mini_connect-array.JPG

spring-mass-stepinput-mf.mo

Edited by: markf - Feb-28-15 21:33:03
There are 0 guests and 0 other users also viewing this topic
You are here: