- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » New to Modelica, trying to build a model
New to Modelica, trying to build a model
New to Modelica, trying to build a model
I'm new to Modelica, but not to modeling in general - I'm extremely active with FreeMat, and experienced in that style of language. I'm trying to buitl a custom model with a discontinuous spring, effectively. How can I make a component that switches spring behavior on and off based on some criteria? In other words, something like this:
when inertia1.w > inertia2.w
spring1.c = 10000;
else
spring1.c = 0;
end
Sorry for the basic nature of the question - I'm trying to get up to speed on the language in general. Thanks!
Re: New to Modelica, trying to build a model
Using events:
when inertia1.w > inertia2.w then
spring1.c = 10000;
else
spring1.c = 0;
end when;
No root-finding:
spring1.c = if noEvent(inertia1.w > inertia2.w) then 10000 else 0;
- sjoelund.se
- 1700 Posts
Re: New to Modelica, trying to build a model
OK, how do I put that into a spring component? That's where I'm confused. I can easily build a mass-spring-damper in the connection editor, and I can easily write out the differential equations by hand and do a simple one-step model (like the HelloWorld program), but how do I edit a spring in a model I built in the connection editor? Is there a way to make my own component in the connection editor that I can re-use later? Thanks!
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » New to Modelica, trying to build a model