Opened 11 years ago

Closed 9 years ago

Last modified 7 years ago

#2612 closed defect (fixed)

dcpm model gives wrong results for 'wMechanical'

Reported by: christian.potthast@… Owned by: Willi Braun
Priority: blocker Milestone:
Component: Backend Version: trunk
Keywords: Cc: christian.potthast@…, Willi Braun, Lennart Ochel, Adrian Pop

Description

Please find attached a test model, where the dcpm model (Electrical.Machines.BasicMachines.DCMachines.DC_PermanentMagnet) gives a wrong result for the angular velocity (dcpm.wMechanical).

(I assume that OpenModelica is wrong here, because Dymola and SimulationX produce the same result which significantly differs from OpenModelica.)

MSL version: 3.2.1
Dymola version: 2014 FD01
SimulationX version: 3.6.1.26028
OMEdit version: 1.9.1 (r18938)

Attached files:
testmotor_3.mo
Dymola_result.png
OM_result.png
OM_OutputMessages.png

Attachments (4)

testmotor_3.mo (3.9 KB ) - added by anonymous 11 years ago.
Testmodel for dcpm model
Dymola_result.png (8.1 KB ) - added by anonymous 11 years ago.
result plot from Dymola
OM_result.png (32.7 KB ) - added by anonymous 11 years ago.
result plot from OM(Edit)
OM_OutputMessages.png (71.0 KB ) - added by anonymous 11 years ago.
Output messages from OM(Edit)

Download all attachments as: .zip

Change History (21)

by anonymous, 11 years ago

Attachment: testmotor_3.mo added

Testmodel for dcpm model

by anonymous, 11 years ago

Attachment: Dymola_result.png added

result plot from Dymola

by anonymous, 11 years ago

Attachment: OM_result.png added

result plot from OM(Edit)

by anonymous, 11 years ago

Attachment: OM_OutputMessages.png added

Output messages from OM(Edit)

comment:1 by Martin Sjölund, 11 years ago

Cc: Willi Braun Lennart Ochel added

This might be because of one of the many warnings triggered. First of all, many variables have start-value out of bounds.

<ScalarVariable na me = "dcpm.coreParameters.wRef" useStart="true" start="0.0" min="1e-60" unit="rad/s" displayUnit="rad/s" />

There seems to be a front-end/back-end warning missing regarding this, and could certainly cause unexpected results...

Version 1, edited 11 years ago by Martin Sjölund (previous) (next) (diff)

comment:2 by Willi Braun, 11 years ago

Component: Run-timeBackend
Keywords: zerocrossings added; dcpm wMechanical removed
Owner: changed from Potthast to Willi Braun
Status: newaccepted

There are im Dymola events, which even not occur for us as zero-crossings.

comment:3 by Willi Braun, 11 years ago

It's really strange Dymola has the following events:

Expression dcpm.la.i > dcpm.brush.brushParameters.ILinear became true ( (dcpm.la.i) - (dcpm.brush.brushParameters.ILinear) = 1.38045e-12 )
Iterating to find consistent restart conditions.
      during event at Time :  0.1019447655784616
Expression dcpm.la.i > dcpm.brush.brushParameters.ILinear became false ( (dcpm.la.i) - (dcpm.brush.brushParameters.ILinear) = -1.29292e-10 )
Iterating to find consistent restart conditions.

But this expressions are inside a function:

function Modelica.Electrical.Machines.Losses.DCMachines.brushVoltageDrop \"Voltage drop of carbon brushes\"
  input Modelica.Electrical.Machines.Losses.BrushParameters brushParameters \"Brush loss parameters\";
  input Real i(quantity = \"ElectricCurrent\", unit = \"A\") \"Actual current\";
  output Real v(quantity = \"ElectricPotential\", unit = \"V\") \"Voltage drop\";
algorithm
  if brushParameters.V <= 0.0 then
    v := 0.0;
  else
    v := if i > brushParameters.ILinear then brushParameters.V else if i < (-brushParameters.ILinear) then -brushParameters.V else brushParameters.V * i / brushParameters.ILinear;
  end if;
end Modelica.Electrical.Machines.Losses.DCMachines.brushVoltageDrop;

So they should never generate events!?

comment:4 by Martin Sjölund, 11 years ago

Functions may only generate events if they are inlined and annotation GenerateEvents=true. This function uses neither.

comment:5 by Willi Braun, 11 years ago

Okay, we end-up in different flat equation. Dymola has:

  dcpm.brush.v := smooth(1, (if dcpm.la.i > dcpm.brush.brushParameters.ILinear
     then 0.7 else (if dcpm.la.i <  -dcpm.brush.brushParameters.ILinear then 
    -0.7 else 0.7*dcpm.la.i/dcpm.brush.brushParameters.ILinear)));

and we get:

dcpm.brush.v = 0.0;

That's also the reason why we haven't that events.

comment:6 by Willi Braun, 11 years ago

Component: BackendFrontend
Keywords: zerocrossings removed

comment:7 by Willi Braun, 11 years ago

Cc: Adrian Pop added

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

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

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

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

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

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:11 by Willi Braun, 9 years ago

Owner: changed from Willi Braun to somebody
Status: acceptedassigned

comment:12 by Adrian Pop, 9 years ago

Owner: changed from somebody to Adrian Pop
Status: assignedaccepted

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

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

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

Milestone: 1.9.51.10.0

Milestone renamed

comment:15 by Willi Braun, 9 years ago

Owner: changed from Adrian Pop to Willi Braun

It seems that this has been fixed, perhaps by #3791.

comment:16 by Willi Braun, 9 years ago

Component: FrontendBackend
Resolution: fixed
Status: acceptedclosed

comment:17 by Martin Sjölund, 7 years ago

Milestone: 1.10.0

Milestone deleted

Note: See TracTickets for help on using tickets.