#3479 closed defect (fixed)
Conditional equation is not working
| Reported by: | 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 , 10 years ago
comment:2 by , 10 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 , 10 years ago
| Cc: | added |
|---|---|
| Component: | OMEdit → Backend |
| Owner: | changed from to |
| Status: | new → assigned |
I'm not sure if it's actually a backend issue, but let's start there and see.
comment:4 by , 10 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 , 10 years ago
| Component: | Backend → Frontend |
|---|---|
| Owner: | changed from to |
Ok, I'll take a look at it then.
comment:7 by , 10 years ago
Thanks for fixing this issue; I just tested my models. Your solutions helps a lot in one of my projects.

dcpm2.brush.brushParameters.V=0.5In this case the
elsebranch 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;