Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3479 closed defect (fixed)

Conditional equation is not working

Reported by: Christian Kral <dr.christian.kral@…> Owned by: Per Östlund
Priority: high Milestone: 1.9.4
Component: Frontend Version:
Keywords: Cc: Lennart Ochel, Volker Waurich

Description

When simulating the example Modelica.Electrical.Machines.Examples.DCMachines.DCPM_withLosses machine dcpm1 does not consider brush loss and dcpm2 does consider brush loss. However, in case of dcpm2 the voltage drop across the brush model shall differ from zero during operation of the machine -- but it does not. Consequently, lossPower is zero, as well -- which shall not be the case.

This is a bug in OpenModelica 1.9.4~dev-101-g operated under Ubuntu 14.04, 32bit.


Change History (9)

comment:1 by Christian Kral <dr.christian.kral@…>, 9 years ago

dcpm2.brush.brushParameters.V=0.5

In this case the else branch should have been evaluated:

  if brushParameters.V <= 0 then
    v = 0;
  else
    v = smooth(1, if i > (+brushParameters.ILinear) then +brushParameters.V else if i < (-brushParameters.ILinear) then -brushParameters.V else brushParameters.V * i / brushParameters.ILinear);
  end if;
  lossPower = v * i;

comment:2 by Christian Kral <dr.christian.kral@…>, 9 years ago

When investigating example Modelica.Electrical.Machines.Examples.DCMachines.DCPM_withLosses I noticed the same kind of issue with the friction model which is not working correctly in dcpm2. In this case the torque ŧau and lossPower shall be non-zero.

dcpm2.friction.frictionParameters.PRef=100

In this case also the else branch should have been evaluated:

  if frictionParameters.PRef <= 0 then
    tau = 0;
  else
    tau = -smooth(1, if w >= (+frictionParameters.wLinear) then +frictionParameters.tauRef * (+w / frictionParameters.wRef) ^ frictionParameters.power_w else if w <= (-frictionParameters.wLinear) then -frictionParameters.tauRef * (-w / frictionParameters.wRef) ^ frictionParameters.power_w else frictionParameters.tauLinear * (w / frictionParameters.wLinear));
  end if;
  lossPower = -tau * w;

comment:3 by Per Östlund, 9 years ago

Cc: Lennart Ochel Volker Waurich added
Component: OMEditBackend
Owner: changed from Adeel Asghar to somebody
Status: newassigned

I'm not sure if it's actually a backend issue, but let's start there and see.

comment:4 by Volker Waurich, 9 years ago

Using +d=dumpdaelow gives:

203/203 (1): dcpm2.friction.tau = 0.0    [dynamic]

So it seems that there is already something wrong in the frontend.

comment:5 by Per Östlund, 9 years ago

Component: BackendFrontend
Owner: changed from somebody to Per Östlund

Ok, I'll take a look at it then.

comment:6 by Per Östlund, 9 years ago

Resolution: fixed
Status: assignedclosed

Fixed in 10f5341.

comment:7 by Christian Kral <dr.christian.kral@…>, 9 years ago

Thanks for fixing this issue; I just tested my models. Your solutions helps a lot in one of my projects.

comment:8 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:9 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.