Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3798 closed defect (fixed)

removeSimpleEquations makes trafo models singular

Reported by: Rüdiger Franke Owned by: Volker Waurich
Priority: critical Milestone:
Component: Backend Version: v1.10.0-dev-nightly
Keywords: PowerSystems Cc: Volker Waurich

Description (last modified by Rüdiger Franke)

After #3195 has been solved and #3274 makes some progress, the next problem seems to be removeSimpleEquations. The AC1ph_DC transformers don't seem to suffer from #3274. The example PowerSystems.Examples.Spot.AC1ph_DC.Transformer fails in the backend. See:

https://test.openmodelica.org/libraries/PowerSystems/files/PowerSystems.Examples.Spot.AC1ph_DC.Transformer.err

It works if removeSimpleEquations is disabled.

Btw. the online docu lists --postOptModules-. Attempts to use it failed; tried:

setCommandLineOptions("--postOptModules-=removeSimpleEquations");

Would be great if the online docu gave an example for the usage of this option.

Change History (21)

comment:1 by Rüdiger Franke, 9 years ago

Description: modified (diff)

comment:2 by Lennart Ochel, 9 years ago

The command line option --postOptModules-= does work for me. I tested it using the following script:

loadString("
model test
end test;
"); getErrorString();

setCommandLineOptions("--postOptModules-=removeSimpleEquations");
simulate(test); getErrorString();

The post-optimization module is removed from the transformation process. Only the pre-optimization module removeSimpleEquations is still applied.

comment:3 by Lennart Ochel, 9 years ago

I will add an example to the documentation.
However, can you provide a list of all selected flags? Maybe it is related to a certain combination of flags.

comment:4 by Rüdiger Franke, 9 years ago

It happens with all kinds of flags. The nightly tests use for instance:

setCommandLineOptions("-d=nogen,initialization,backenddaeinfo,discreteinfo,stateselection,execstat");
setMatchingAlgorithm("PFPlusExt");
setIndexReductionMethod("dynamicStateSelection");

See: https://test.openmodelica.org/libraries/PowerSystems/BuildModelRecursive.html

comment:5 by Rüdiger Franke, 9 years ago

Milestone: Future1.10.0

comment:6 by Rüdiger Franke, 9 years ago

Cc: Volker Waurich added

Here is the complete error message for PowerSystems.Examples.Spot.AC1ph_DC.Transformer:

Error: Too few equations, under-determined system. The model has 35 equation(s) and 37 variable(s).
Error: pre-optimization module encapsulateWhenConditions (simulation) failed.

It compiles and simulates with

setCommandLineOptions("--preOptModules-=removeSimpleEquations")

comment:7 by Lennart Ochel, 9 years ago

Keywords: PowerSystems added

comment:8 by Volker Waurich, 9 years ago

Owner: changed from Lennart Ochel to Volker Waurich
Status: newassigned

comment:9 by Volker Waurich, 9 years ago

The problem is that removeSimpleEquations is not consistent on how to assign alias variables in cases like: trafo.w1_set = trafo.W1[1 + trafo.tap_p_internal]
whereas a variable is assigned to a scalar array parameter whose subscribt is a discrete variable. For reasons of simplicity I will try to NOT assign alias variables in that case.

comment:10 by Volker Waurich, 9 years ago

Pushed the fix in [10507c7]
BTW: Skipping this kind of alias assignments does not occure in any of the msl3.2.1. models.

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

Did it occur in any test in the test suite? If not, perhaps a testcase should be added?

comment:12 by Volker Waurich, 9 years ago

Got 2 more models simulating in PowerSystems. Everything else seems stable.

@sjoelund.se:
It does not occur in the testsuite. Would be good to test PowerSystems.Examples.Spot.AC1ph_DC.Transformer somewhere but PowerSystems is not available for the Hudson testsuite, isnt it?

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

Create a total model (should not be many kilobytes, right?). Then you don't have problems when the libraries change.

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

It is also possible to add it to the gitlibraries portion of the test suite (which is run by the pull request job, but only on a flag in runtests.pl):

OpenModelica/testsuite/simulation/libraries/3rdParty/GitLibraries

in reply to:  13 comment:15 by Volker Waurich, 9 years ago

Replying to sjoelund.se:

Create a total model (should not be many kilobytes, right?). Then you don't have problems when the libraries change.

Any idea how to create a total modal without copy-pasting everything needed? I mean, PowerSystems uses a lot of inheritance it would take some time and its quite annoying to gather every model that is used.

comment:16 by Adrian Pop, 9 years ago

Via a script:

loadModel(Modelica); getErrorString();
loadModel(PowerSystems); getErrorString();
saveTotalSCode("TotalModel.mo", PowerSystems.Examples.Spot.AC1ph_DC.Transformer);

will give you TotalModel.mo containing everything you need.
You can also do it from OMEdit.

in reply to:  16 comment:17 by Volker Waurich, 9 years ago

Replying to adrpo:

Via a script:

loadModel(Modelica); getErrorString();
loadModel(PowerSystems); getErrorString();
saveTotalSCode("TotalModel.mo", PowerSystems.Examples.Spot.AC1ph_DC.Transformer);

will give you TotalModel.mo containing everything you need.
You can also do it from OMEdit.

Thats pretty cool. Thanks for the hint.

comment:18 by Adrian Pop, 9 years ago

You can use also saveTotalModel instead of saveTotalSCode:
https://build.openmodelica.org/Documentation/OpenModelica.Scripting.saveTotalSCode.html

comment:19 by Volker Waurich, 9 years ago

Resolution: fixed
Status: assignedclosed

Added a testcase, i.e. the trafo model.

comment:20 by Rüdiger Franke, 9 years ago

Overall 3 more PowerSystems models translate now (2 more simulate), including also the 3-phase PowerSystems.Examples.Spot.TransformationAC3ph.TapChanger!

Thanks :)

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

Milestone: 1.10.0

Milestone deleted

Note: See TracTickets for help on using tickets.