Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

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 ???
https://drive.google.com/file/d/0B3hdjNocLdHrcjB3ckdlcTZHeVU
(Sorry, I wanted to share a picture but it doesn't work current/sad, unless you right-clik on it current/smile )

Greetings!

Edited by: fran_jo - Jan-29-14 20:07:59

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

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!

There are 0 guests and 0 other users also viewing this topic
You are here: