Opened 7 years ago

Closed 7 years ago

#4634 closed defect (fixed)

Modelica.Electrical.Machines.Sensors.ElectricalPowerSensor not working properly

Reported by: dma@… Owned by: Patrick Täuber
Priority: high Milestone: 1.13.0
Component: Backend Version: v1.13.0-dev-nightly
Keywords: Cc: Francesco Casella, Lennart Ochel

Description

The attached model uses the Modelica.Electrical.Machines.Sensors.ElectricalPowerSensor elements. Instead of producing "power" as a single trace they often oscillate at the base frequency. The attached file has two figures (as PNG), one from JModelica showing the correct behavior and the other from OpenModelica showing that one of the power sensor elements is behaving correctly and the other is not. As I change the model, which ones behave incorrectly seems to change at random.

I am using: OpenModelica-v1.13.0-dev-255-g6f71dc5-64bit.exe

The attached file contains the model (3 .mo files) and the two result files.

Attachments (1)

SimpleSynch3.zip (70.0 KB ) - added by dma@… 7 years ago.

Download all attachments as: .zip

Change History (6)

by dma@…, 7 years ago

Attachment: SimpleSynch3.zip added

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

So it is the following that is solved:

electricalPowerSensorGen.P = 1.5 * (electricalPowerSensorGen.v_[1] * electricalPowerSensorGen.i_[1] + electricalPowerSensorGen.v_[2] * electricalPowerSensorGen.i_[2])

OM calculates:

v_[1]=-16.2867
v_[2]=-89.6272

With i_[n] being slightly out of phase which seem reasonable. Do you have the actual result-file from JModelica including protected variables?

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

Cc: Francesco Casella Lennart Ochel added

Comparing the result of the FMU and OM, it seems that in the first time-step we calculate identical results. But it seems that electricalPowerSensorGen.v_ is marked as not continuous-time and it is never re-calculated. I'm not yet sure why this happens since the statement is (electricalPowerSensorGen.v_, _) := Modelica.Electrical.Machines.SpacePhasors.Functions.ToSpacePhasor({-resistorLoad.v[1], -resistorLoad.v[2], -resistorLoad.v[3]}); and this expression is continuous-time.

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

If you add the following flag to OM, you get the expected results:

--postOptModules-=wrapFunctionCalls

@lochel @casella - can you whip the responsible developer into fixing this bug?

comment:4 by Patrick Täuber, 7 years ago

Owner: changed from somebody to Patrick Täuber
Status: newassigned

comment:5 by Patrick Täuber, 7 years ago

Component: *unknown*Backend
Milestone: Future1.13.0
Resolution: fixed
Status: assignedclosed

wrapFunctionCalls works fine, the problem was the equation electricalPowerSensorSine.v_=electricalPowerSensorGen.v_, which was correctly created by WFC but solved for the wrong variable, although the matching was correct.

OMCompiler/5cea0b5 should fix this problem.

Please reopen the ticket if you still experience problems.

Note: See TracTickets for help on using tickets.