Help - Search - Members - Calendar
Full Version: imput a potition or speed step
Modelica Forum > Modelica > Modelica
blacksmith
Hello everybody,

I'm new in the dymola world, I have to use it to make a project in my university and then compare it with symulink.

I got many little troubles that an experienced user can solve very easily.

-- In a model I create with block, I would like to input a position step (and later a speed step). I only found the way to put an step on a force that will push my spring. If I enter all the equation model, I can get the result I want, but it take me long time write everything. This way remove the advantage to work with block.

-- I read the post that explain how to show y=f(x) and not only x=f(t) and y=g(t). Does anyone get another simpler explaination?

-- One another very basic question is (even I google it) what is the difference between dymola and modelica?


I hope you'll forgive my basic questions and help me,
Blacksmith
wagner
Hello blacksmith,

I only have short time that's why I'll answer only your last question now. For the other questions you'll get an answer soon.

The difference between Dymola and Modelica is that Dymola is a modelling environment whereas Modelica is a modelling language. There are many modelling environments supporting Modelica on the market like OpenModelica, MathModelica, Simulation X and many others. But right now, Dymola is the most widespread one (as far as I know).

Dymola supports the Modelica language to describe the dynamics of physical systems in a graphical and textual way. The Modelica language is specified by the non-profit Modelica Association (www.modelica.org) which was founded by academics and industry in the 90s. The Modelica Association enforces the development of the Modelica modelling language and releases the Standard Library (current version: 2.2.1) which is the common base of all modelling tools using Modelica as modelling language.

Regards

Florian
blacksmith
Hello Wagner,

Thanks for your answer, I actually have to say that I will not have guess that by myself. Thanks for your explaination, I think that can help another beginner on that forum.

Regards,
Blacksmith
wagner
Hello Blacksmith,

to your first question: Which Modelica Library do you use? In Modelica Standard Library 2.2.1 you find in Modelica.Mechanics.Translational the model Position which takes a Real value as input. Combined with Modelica.Blocks.Sources.Step you should get the result you want.

Hope this can help you.

Florian
blacksmith
Hi Florian,
I still don't get it...
My Dymola version is 5.3d, 2005-06-23. I don't really know where to get a the version of the library (sorry).
Anyway I found the thing you wrote me to use. But I get strange result when I just put the step and the position blocks. The position output is wrong (very high then very low), even the output of the step is what I want.

I attached the package I create. One model is an incredibly simple using but that doesn't work. The second model is a little bit more complicated, but of course doesn't work, cuz the same problem like the first model.

I succeed modeling that with only equation, I get good result, but it take me more time, I will copy it after my text.

Hope you can help me do that.
Have a nice day,
Blacksmith


model s_a_equation_trottoir
annotation (uses(Modelica(version="1.6")), DymolaStoredErrors);

parameter Real g=9.81;
parameter Modelica.SIunits.Mass M=250;
parameter Modelica.SIunits.Mass m=35;
parameter Real ks = 12000;
parameter Real kp = 120000;
parameter Real bs = 1900;
Real s_M( start=0.8);
Real s_m( start = 0.5);
Modelica.SIunits.Velocity v_M; //v_M(start = 0);
Modelica.SIunits.Velocity v_m; //v_m(start = 0);
Real s_route;

equation
der(s_M) = v_M;
der(s_m) = v_m;

-M*g+ks*((s_m-s_M)+M*g/ks+0.3)+bs*(v_m-v_M) = M*der(v_M);
-m*g+kp*((s_route-s_m)+(M+m)*g/kp+0.3)-ks*((s_m-s_M)+M*g/ks+0.3)-bs*(v_m-v_M) = m*der(v_m);
s_route = 0.2 + (if time< 1 then 0 else -0.2);
end s_a_equation_trottoir;
wagner
Hello Blacksmith,

I tested your models and they seem to work. In the screen-shot attached to this post you can see my simulation result of the step applied to the position in your simple model. There is a step from 0.2 to 0 at time 2. The position element has some low pass characteristic, that's why it doesn't follow exactly the step.

Also attached to this post you'll find your package converted to modelica 2.2.1. I suggest you to use this Version of the modelica library. It's much simpler to use since there's only one library and not three like in Modelica 1.6 (not Modelica Additions ...). Also the connector variables are simplified (they are no array anymore).

Back to your problem. I figured out, that your initial values for the spring and the spring-damper system are not set correctly. For both, spring and spring-damper system, you need to set the intial value of s_rel to 0.3 and s_rel0 to 0.3. Otherwise your initial state is not a steady state and you get movements in your system without applying an input signal.

In the attached package there's the corrected version of your how_I_want_use_Dymola model. Run the comparison model and you'll see that graphical and textual model are identical as shown in the second screen-hot. If you have problems to run the model download modelica 2.2.1 from modelica.org and manuallay load in dymola.

If you still have problems, just ask again.

Regards

Florian


Click to view attachmentClick to view attachment
blacksmith

Hey hey hey!!!

That's working, thanks a lot for your help, that's so great!

I download the latest library version, install it, then I redo the model, copying what you did, then it works.
Now I face new problems, even they are basic, but I will send another post because it's a different matter.

Ciao
Blacksmith
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.