Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Strange behavior of System Modeler
Replies: 2   Last Post: Mar 3, 2013 10:58 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Albert Retey

Posts: 688
Registered: 7/15/08
Re: Strange behavior of System Modeler
Posted: Mar 3, 2013 10:58 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi,

>
> I have just started studying WSM and the Modelica language by implementing the simple pendulum model (class) es. described on p.33 of Peter Fritzson's book Introduction to "Modeling and Simulation of Technical and Physical Systems with Modelica". The code (pendulum equation written as a DAE) is:
>
> model DAEExample "DAEExample"
> constant Real PI=3.14159265358979;
> parameter Real m=1,g=9.81,l=0.5;
> output Real F;
> output Real x(start=0.5),y(start=0);
> output Real vx,vy;
> equation
> m*der(vx)=-x/l*F;
> m*der(vy)=-y/l*F - m*g;
> der(x)=vx;
> der(y)=vy;
> x^2 + y^2=l^2;
> end DAEExample;
>
> I run the example in WSM and I get totally meaningless results.
> The solver is the default one (DASSL) which, I think, is the right one for handling DAEs.
>
> Any ideas?


Just a followup to my recent post: you can use manual state selection
(dynamic state selection is one of the tricks that Dymola uses to get
this right) to get correct solutions with WSM like this:

model DAEExample
constant Real PI=3.14159265358979;
parameter Real m=1,g=9.81,l=0.5;
Real F;
Real x(start=0.5,stateSelect=StateSelect.always);
Real y(start=0);
Real vx(start=0);
Real vy(start=0);
equation
m*der(vx) = -x/l*F;
m*der(vy) = -y/l*F - m*g;
der(x) = vx;
der(y) = vy;
x^2 + y^2 = l^2;
end DAEExample;

hth,

albert





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.