Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13698

Re: Strange behavior of System Modeler

From awnl <awnl@gmx-topmail.de>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Strange behavior of System Modeler
Date 2013-03-04 03:58 +0000
Message-ID <kh164v$sb0$1@smc.vnet.net> (permalink)
References <kgse56$jar$1@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Strange behavior of System Modeler Marco Gabiccini <m.gabiccini@ing.unipi.it> - 2013-03-02 08:44 +0000
  Re: Strange behavior of System Modeler awnl <awnl@gmx-topmail.de> - 2013-03-04 03:58 +0000
  Re: Strange behavior of System Modeler awnl <awnl@gmx-topmail.de> - 2013-03-04 03:58 +0000

csiph-web