OpenModelica simulate with small time step

I am currently exploring OpenModelica for some simulation that requires high frequency. It turns out that the plot of a sine source is always wrong. This is the test code:

model testfreq
parameter Real f1=1e10;
Real u;
equation
u=sin(2*3.14*f1*time);
end testfreq;

simulate(testfreq,stopTime=10e-10)
plot(u)

The Forum was very helpful. It turns out that the default solver for OpenModelica is dassl, and it has some problem for small time step simulation.

sjoelund.se suggested to use “euler” or “dassl2″ for the solver, and it works! To do this simply add method=”euler” in the simulate command,

simulate(testfreq,stopTime=10e-10,method="euler")

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: