OpenModelica


Forgot password? | Forgot username? | Register

voltage compareing

voltage compareing

Hi There,
I want to compare VoltageSensor vMeter.v with 26.5 volt raference voltage.
If vMeter.v>26.5 then do something else ....

But with this code vMeter.v always act like bigger then 26.5. I know during simulation vMeter goes to below 26.5.

What's wrong?
Do you have any idea?

Oki



Code:


model lab2b
  parameter Real xPnom(start = 1500);
  Real xIdc;
  Modelica.Blocks.Interfaces.RealInput Pneed;
  Modelica.Electrical.Analog.Interfaces.NegativePin pin_n;
  Modelica.Electrical.Analog.Interfaces.PositivePin pin_p;
  Modelica.Electrical.Analog.Sensors.VoltageSensor vMeter;
  Modelica.Blocks.Tables.CombiTable1D Tnd1(tableOnFile = true, tableName = "leff", fileName = "C:/p/deff.txt");
  Modelica.Electrical.Analog.Sources.SignalCurrent SD;
equation
  Tnd1.u[1] = Pneed / xPnom;
  xIdc = Pneed / vMeter.v * Tnd1.y[1];
  if vMeter.v > 26.5 then
    SD.i = 10;
  else
    SD.i = 0;
  end if;
  connect(SD.n, pin_n);
  connect(SD.p, pin_p);
  connect(vMeter.n, pin_n);
  connect(vMeter.p, pin_p);
end lab2b;

Administrator has disabled public posting. Please login or register in order to proceed.
There are 0 guests and 0 other users also viewing this topic