- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Modelica sources Sin doesn't work well.
Modelica sources Sin doesn't work well.
Modelica sources Sin doesn't work well.
Hi!
I am working with a simple Van Der Pol model with a sinusoidal input as input, using the Sources.Sin block. It seems to work ok because the outputs from the Van Der Pol are quite ok, but when I plot the input signal from the sin I get a straight line ???
(Sorry, I wanted to share a picture but it doesn't work , unless you right-clik on it )
Greetings!
Re: Modelica sources Sin doesn't work well.
Hi,
I assume you have done something like that:
Code:
loadModel(Modelica);
loadString("
package p
model vdp
Real x1,x2(start=1);
parameter Real lambda = 1;
Modelica.Blocks.Interfaces.RealInput u;
equation
der(x1) = x2;
der(x2) = lambda*(1-x1^2)*x2-x1;
end vdp;
model test
vdp a;
Modelica.Blocks.Sources.Sine sine1;
equation
connect(sine1.y, a.u);
end test;
end p;
");
getErrorString();
simulate(p.test, stopTime=10);
getErrorString();
What works fine for me. Please add your code if you have still issues.
so long.
Willi
- wbraun
- 75 Posts
Re: Modelica sources Sin doesn't work well.
I see...
This is my code from OMEdit (I remove all the annotation keywords)
Code:
model VanDerPol
parameter Real x1_0 = 0;
parameter Real x2_0 = 1;
Real x1(start = x1_0);
Real x2(start = x2_0);
Modelica.Blocks.Interfaces.RealInput u;
equation
der(x1) = (1 - x2 ^ 2) * x1 - x2 + u;
der(x2) = x1;
end VanDerPol;
model TestVanDerPol
VanDerPol vanderpol(x2_0 = 1);
Modelica.Blocks.Sources.Sine u_sin(freqHz = 50);
equation
connect(u_sin.y,vanderpol.u);
end TestVanDerPol;
The strange thing is that the output trajectory of x1 and x2 are plotted ok but not the sin (in OMEdit)
Cheers!
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Modelica sources Sin doesn't work well.