Opened 5 years ago
Closed 3 years ago
#5679 closed defect (wontfix)
+daeMode error with omc but not with OMEdit
Reported by: | Owned by: | Adeel Asghar | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Run-time | Version: | v1.13.2 |
Keywords: | +daeMode OMCompiler OMEdit | Cc: |
Description
I'm facing an issue when I try to simulate my model using omc command line with +daeMode flag. The generation of the C code and the compilation are both working well but once I try to run the executable I get the following error message :
Limited backtrace at point of segmentation fault
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7fb254dda890]
Segmentation fault (core dumped)
I don't understand why I get this error knowing that I don't get any error messages when I simulate it in OMEdit with +daeMode flag. Are there any environment variable set by default in OMEdit that I should set with omc in order to resolve that issue ?
Change History (21)
comment:1 by , 5 years ago
Component: | *unknown* → Run-time |
---|---|
Milestone: | Future → 1.16.0 |
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 5 years ago
I've checked this but it didn't help, I guess the problem is that when I build my model with +daeMode flag in OMshell-terminal the following dae.h file is created :
/* residual variable define for daeMode */ /* $DAEres0 */ #define $P$DAEres0 data->simulationInfo->daeModeData->residualVars[0] /* $DAEres1 */ #define $P$DAEres1 data->simulationInfo->daeModeData->residualVars[1] /* $DAEres2 */ #define $P$DAEres2 data->simulationInfo->daeModeData->residualVars[2] /* $DAEres3 */ #define $P$DAEres3 data->simulationInfo->daeModeData->residualVars[3] /* $DAEres4 */ #define $P$DAEres4 data->simulationInfo->daeModeData->residualVars[4] /* $DAEres5 */ #define $P$DAEres5 data->simulationInfo->daeModeData->residualVars[5] /* $DAEres6 */ #define $P$DAEres6 data->simulationInfo->daeModeData->residualVars[6] /* $DAEres7 */ #define $P$DAEres7 data->simulationInfo->daeModeData->residualVars[7] ...
But when I use ./omc the dae.h file is almost empty :
#ifndef ModelName_16DAE_H #define ModelName_16DAE_H #endif
Just like if I didn't use the +daeMode and I guess this is what leads to that segmentation fault but I have no clue why is the header not correctly generated with omc.
comment:3 by , 5 years ago
This confuses me, we removed the #define
part completely some years ago, this is just a fallback strategy which usually fails. Instead we directly generate the function pointers in the equations. Could you provide an example model?
comment:4 by , 5 years ago
Sure, here is the model I use
model Two_Areas_PSSE parameter Real r = 0.0001; parameter Real x = 0.001; parameter Real b = 0.00175 * 0.5; replaceable TwoAreas.Data.PF3 PF_results annotation( Placement(visible = true, transformation(origin = {-210, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))) constrainedby Support.PF_TwoAreas annotation( Placement(transformation(extent = {{-220, -40}, {-200, -20}}))); OpenIPSL.Electrical.Buses.Bus bus1 annotation( Placement(visible = true, transformation(origin = {-186, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus2 annotation( Placement(visible = true, transformation(origin = {-180, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus3 annotation( Placement(visible = true, transformation(origin = {180, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus4 annotation( Placement(visible = true, transformation(origin = {180, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus5 annotation( Placement(visible = true, transformation(origin = {-138, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus6 annotation( Placement(visible = true, transformation(origin = {-100, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus7 annotation( Placement(visible = true, transformation(origin = {-60, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus8(displayPF = true) annotation( Placement(visible = true, transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus9 annotation( Placement(visible = true, transformation(origin = {60, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus10 annotation( Placement(visible = true, transformation(origin = {100, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Buses.Bus bus11 annotation( Placement(visible = true, transformation(origin = {140, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); TwoAreas.Groups.PSSE.No_Controls.G1 g1(V_0 = PF_results.voltages.V1, angle_0 = PF_results.voltages.A1, P_0 = PF_results.machines.P1_1, Q_0 = PF_results.machines.Q1_1) annotation( Placement(visible = true, transformation(origin = {-208, 30}, extent = {{-6, -6}, {6, 6}}, rotation = 0))); TwoAreas.Groups.PSSE.No_Controls.G2 g2(V_0 = PF_results.voltages.V2, angle_0 = PF_results.voltages.A2, P_0 = PF_results.machines.P2_1, Q_0 = PF_results.machines.Q2_1) annotation( Placement(visible = true, transformation(origin = {-208, 0}, extent = {{-6, -6}, {6, 6}}, rotation = 0))); TwoAreas.Groups.PSSE.No_Controls.G3 g3(V_0 = PF_results.voltages.V3, angle_0 = PF_results.voltages.A3, P_0 = PF_results.machines.P3_1, Q_0 = PF_results.machines.Q3_1) annotation( Placement(visible = true, transformation(origin = {208, 30}, extent = {{-6, -6}, {6, 6}}, rotation = 180))); TwoAreas.Groups.PSSE.No_Controls.G4 g4(V_0 = PF_results.voltages.V4, angle_0 = PF_results.voltages.A4, P_0 = PF_results.machines.P4_1, Q_0 = PF_results.machines.Q4_1) annotation( Placement(visible = true, transformation(origin = {208, -10}, extent = {{-6, -6}, {6, 6}}, rotation = 180))); OpenIPSL.Electrical.Branches.PwLine Line6_7(R = r * 10, X = x * 10, G = 0, B = b * 10) annotation( Placement(visible = true, transformation(origin = {-80, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line5_6(R = r * 25, X = x * 25, G = 0, B = b * 25) annotation( Placement(visible = true, transformation(origin = {-120, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line7_8_1(R = r * 110, X = x * 110, G = 0, B = b * 110) annotation( Placement(visible = true, transformation(origin = {-30, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line7_8_2(R = r * 110, X = x * 110, G = 0, B = b * 110) annotation( Placement(visible = true, transformation(origin = {-30, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line8_9_2(R = r * 110, X = x * 110, G = 0, B = b * 110) annotation( Placement(visible = true, transformation(origin = {30, 20}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line8_9_1(R = r * 110, X = x * 110, G = 0, B = b * 110) annotation( Placement(visible = true, transformation(origin = {30, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line9_10(R = r * 10, X = x * 10, G = 0, B = b * 10) annotation( Placement(visible = true, transformation(origin = {80, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line10_11(R = r * 25, X = x * 25, G = 0, B = b * 25) annotation( Placement(visible = true, transformation(origin = {120, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Loads.PSSE.Load Load7(PQBRAK = 0.7, V_0 = PF_results.voltages.V7, angle_0 = PF_results.voltages.A7, P_0 = PF_results.loads.PL7_1, Q_0 = PF_results.loads.QL7_1) annotation( Placement(visible = true, transformation(origin = {-64, -13}, extent = {{-14, -13}, {14, 13}}, rotation = 0))); OpenIPSL.Electrical.Loads.PSSE.Load Load9(PQBRAK = 0.7, V_0 = PF_results.voltages.V9, angle_0 = PF_results.voltages.A9, P_0 = PF_results.loads.PL9_1, Q_0 = PF_results.loads.QL9_1) annotation( Placement(visible = true, transformation(origin = {65, -15}, extent = {{15, -13}, {-15, 13}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line5_1(G = 0, R = 0, X = 0.01667, B = 0) annotation( Placement(visible = true, transformation(origin = {-160, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line5_2(G = 0, R = 0, X = 0.01667, B = 0) annotation( Placement(visible = true, transformation(origin = {-160, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line5_3(G = 0, R = 0, X = 0.01667, B = 0) annotation( Placement(visible = true, transformation(origin = {160, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); OpenIPSL.Electrical.Branches.PwLine Line5_4(G = 0, R = 0, X = 0.01667, B = 0) annotation( Placement(visible = true, transformation(origin = {160, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); inner OpenIPSL.Electrical.SystemBase SysData(fn = 60) annotation( Placement(transformation(extent = {{-220, 48}, {-172, 62}}))); equation connect(Load9.p, Line9_10.p) annotation( Line(points = {{65, -2}, {66, -2}, {66, 28.7}, {68.3333, 28.7}}, color = {0, 0, 255})); connect(bus5.p, Line5_1.n) annotation( Line(points = {{-138, 30}, {-151, 30}}, color = {0, 0, 255})); connect(Line5_6.p, bus5.p) annotation( Line(points = {{-129, 30}, {-138, 30}}, color = {0, 0, 255})); connect(Line5_1.p, bus1.p) annotation( Line(points = {{-169, 30}, {-186, 30}}, color = {0, 0, 255})); connect(g1.pwPin, bus1.p) annotation( Line(points = {{-201.4, 30}, {-186, 30}}, color = {0, 0, 255})); connect(bus4.p, Line5_4.n) annotation( Line(points = {{180, -10}, {171.667, -10}}, color = {0, 0, 255})); connect(g4.pwPin, bus4.p) annotation( Line(points = {{201.4, -10}, {201.4, -10}, {180, -10}}, color = {0, 0, 255})); connect(Line5_4.p, Line10_11.p) annotation( Line(points = {{151, -10}, {106.667, -10}, {106.667, 30}, {111, 30}}, color = {0, 0, 255})); connect(g3.pwPin, bus3.p) annotation( Line(points = {{201.4, 30}, {180, 30}}, color = {0, 0, 255})); connect(Load7.p, bus7.p) annotation( Line(points = {{-64, 0}, {-64, 0}, {-64, 28.7}, {-60, 28.7}}, color = {0, 0, 255})); connect(g2.pwPin, bus2.p) annotation( Line(points = {{-201.4, 0}, {-201.4, 0}, {-180, 0}}, color = {0, 0, 255})); connect(bus2.p, Line5_2.p) annotation( Line(points = {{-180, 0}, {-171.667, 0}}, color = {0, 0, 255})); connect(Line5_2.n, bus6.p) annotation( Line(points = {{-151, 0}, {-106.667, 0}, {-106.667, 30}, {-102.667, 30}}, color = {0, 0, 255})); connect(Line5_3.n, bus3.p) annotation( Line(points = {{169, 30}, {169, 30}, {177.333, 30}}, color = {0, 0, 255})); connect(bus11.p, Line5_3.p) annotation( Line(points = {{140, 30}, {148.333, 30}}, color = {0, 0, 255})); connect(Line10_11.n, bus11.p) annotation( Line(points = {{129, 30}, {129, 30}, {137.333, 30}}, color = {0, 0, 255})); connect(bus10.p, Line10_11.p) annotation( Line(points = {{100, 30}, {108.333, 30}}, color = {0, 0, 255})); connect(Line7_8_1.n, bus8.p) annotation( Line(points = {{-21, 40}, {-8.6667, 40}, {-8.6667, 30}, {-2.6667, 30}}, color = {0, 0, 255})); connect(Line7_8_2.n, bus8.p) annotation( Line(points = {{-21, 20}, {-8.6667, 20}, {-8.6667, 22}, {-8.6667, 30}, {-2.6667, 30}}, color = {0, 0, 255})); connect(Line8_9_1.p, bus8.p) annotation( Line(points = {{21, 40}, {8.6667, 40}, {8.6667, 30}, {2.6667, 30}}, color = {0, 0, 255})); connect(Line8_9_2.p, bus8.p) annotation( Line(points = {{21, 20}, {8.6667, 20}, {8.6667, 30}, {2.6667, 30}}, color = {0, 0, 255})); connect(bus9.p, Line9_10.p) annotation( Line(points = {{60, 30}, {68.3333, 30}}, color = {0, 0, 255})); connect(Line8_9_1.n, bus9.p) annotation( Line(points = {{39, 40}, {51.3333, 40}, {51.3333, 30}, {57.3333, 30}}, color = {0, 0, 255})); connect(Line8_9_2.n, bus9.p) annotation( Line(points = {{39, 20}, {51.3333, 20}, {51.3333, 30}, {57.3333, 30}}, color = {0, 0, 255})); connect(Line9_10.n, bus10.p) annotation( Line(points = {{89, 30}, {89, 30}, {97.3333, 30}}, color = {0, 0, 255})); connect(Line7_8_2.p, bus7.p) annotation( Line(points = {{-39, 20}, {-51.3333, 20}, {-51.3333, 30}, {-57.3333, 30}}, color = {0, 0, 255})); connect(Line7_8_1.p, bus7.p) annotation( Line(points = {{-39, 40}, {-51.3333, 40}, {-51.3333, 30}, {-57.3333, 30}}, color = {0, 0, 255})); connect(Line6_7.n, bus7.p) annotation( Line(points = {{-71, 30}, {-71, 30}, {-62.6667, 30}}, color = {0, 0, 255})); connect(Line6_7.p, bus6.p) annotation( Line(points = {{-89, 30}, {-89, 30}, {-97.3333, 30}}, color = {0, 0, 255})); connect(Line5_6.n, bus6.p) annotation( Line(points = {{-111, 30}, {-111, 30}, {-102.667, 30}}, color = {0, 0, 255})); annotation( Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-240, -100}, {220, 160}}, initialScale = 0.1)), Icon(coordinateSystem(extent = {{-240, -100}, {220, 160}}, preserveAspectRatio = false)), Documentation(info = "<html> <table cellspacing=\"1\" cellpadding=\"1\" border=\"1\"> <tr> <td><p>Reference</p></td> <td>Klein-Rogers-Kundur power network</td> </tr> <tr> <td><p>Last update</p></td> <td>2015-12-01</td> </tr> <tr> <td><p>Author</p></td> <td><p>Maxime Baudette, Tin Rabuzin, SmarTS Lab, KTH Royal Institute of Technology</p></td> </tr> <tr> <td><p>Contact</p></td> <td><p><a href=\"mailto:luigiv@kth.se\">luigiv@kth.se</a></p></td> </tr> </table> </html>"), experiment(StopTime = 10, Tolerance = 0.001), __OpenModelica_commandLineOptions = ""); end Two_Areas_PSSE;
You will need to load the OpenIPSL library which you can find at : https://github.com/OpenIPSL/OpenIPSL
comment:5 by , 5 years ago
replaceable TwoAreas.Data.PF3 PF_results
This does not seem to be part of OpenIPSL, unless i am missing something. Did you define it in a surrounding package?
comment:6 by , 5 years ago
Oh yeah I forgot about that, actually you have to load the library then use the package.mo file available in OpenIPSL-1.5.0/ApplicationsExample/TwoAreas and specify the model name which is Two_Areas_PSSE
comment:7 by , 5 years ago
The first thing that seems wrong to me, is that i am getting an error for the variable V_0
e.g. in TwoAreas.Groups.PSSE.No_Controls.G1
. It inherits from OpenIPSL.Electrical.Machines.PSSE.GENSAL
where the variable seems to be called v_0
. I changed it in all models where this occurs TwoAreas.Groups.PSSE.No_Controls.G1
, TwoAreas.Groups.PSSE.No_Controls.G2
, TwoAreas.Groups.PSSE.No_Controls.G3
and TwoAreas.Groups.PSSE.No_Controls.G4
. Maybe other tools are not case sensitive, but OpenModelica is and i think it is correct.
I also changed it in all the constructors of those models in TwoAreas.Two_Areas_PSSE
, now i can actually run the model. Without DAEMode it seems to run fine:
messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method. LOG_SUCCESS | info | The simulation finished successfully. ",
But with --daeMode
(i would recommend this instead of +daeMode
since we want to get rid of the plus sign in the future and have all compilation flags with -- instead) i get following error message:
messages = "Simulation execution failed for model: TwoAreas.Two_Areas_PSSE LOG_SUCCESS | info | The initialization finished successfully without homotopy method. stdout | info | ##IDA## -4 error occurred at time = 0.923681947497321 stdout | info | model terminate | Integrator failed. | Simulation terminated at time 0.923682 ",
Which seems to be independent of OMEdit, i got those results from both command line and OMEdit. Probably something we should fix but first i want to make sure that we are on the same page. Did you have no problems with this V_0
variable? Do you have the same error?
It seems to produce some of the #define
structures you mentioned, but without deeper investigation i can't really tell if they are problematic.
My current OMCompiler version: 1.15.0~dev-9-g34505da
EDIT: I also run this on linux, i don't know if that makes any difference.
follow-ups: 9 10 14 comment:8 by , 5 years ago
I didn't get this error I checked my OpenIPSL.Electrical.Machines.PSSE.GENSAL
and the variable is correctly named V_0
so I don't know why yours is not named correctly but to match what I have you should change v_0
to V_0
in OpenIPSL.Electrical.Machines.PSSE.GENSAL
.
I run this on Linux too my distribution is Ubuntu 18.04 and my OMCompiler version is 1.13.2.
When I run omc --daeMode with this model I get this error :
Limited backtrace at point of segmentation fault /lib/x86_64-linux-gnu/libpthread.so.0(+0x12890)[0x7fb254dda890] Segmentation fault (core dumped)
But in OMEdit the simulation is successful with --daeMode
comment:9 by , 5 years ago
Replying to anonymous:
I run this on Linux too my distribution is Ubuntu 18.04 and my OMCompiler version is 1.13.2.
I guess should should try to run it with 1.14.0-dev.beta1, which was released last week. it is likely that at least the crash issue has been fixed in the meantime.
comment:10 by , 5 years ago
Replying to anonymous:
I didn't get this error I checked my
OpenIPSL.Electrical.Machines.PSSE.GENSAL
and the variable is correctly namedV_0
so I don't know why yours is not named correctly but to match what I have you should changev_0
toV_0
inOpenIPSL.Electrical.Machines.PSSE.GENSAL
.
Maybe it is some sort of git or library version problem.
As @Francesco already mentioned the crash seems to be fixed with the current version. The general problem that it fails with --daeMode
has still to be resolved, but i can only do that for the nightly build and future releases.
follow-up: 12 comment:11 by , 5 years ago
I still have the error with 1.14.0-dev.beta1 but it works with version 1.15.0-dev.
comment:12 by , 5 years ago
Replying to anonymous:
I still have the error with 1.14.0-dev.beta1 but it works with version 1.15.0-dev.
Does it work entirely, or did you encounter the same problem?
messages = "Simulation execution failed for model: TwoAreas.Two_Areas_PSSE LOG_SUCCESS | info | The initialization finished successfully without homotopy method. stdout | info | ##IDA## -4 error occurred at time = 0.923681947497321 stdout | info | model terminate | Integrator failed. | Simulation terminated at time 0.923682 ",
comment:13 by , 5 years ago
I don't encounter this problem at all, with version 1.15.0-dev the simulation is successful and with version 1.14.0-dev.beta1 I still have the segmentation fault I had with version 1.13.2 when I use --daeMode
comment:14 by , 5 years ago
Replying to anonymous:
I didn't get this error I checked my
OpenIPSL.Electrical.Machines.PSSE.GENSAL
and the variable is correctly namedV_0
so I don't know why yours is not named correctly but to match what I have you should changev_0
toV_0
inOpenIPSL.Electrical.Machines.PSSE.GENSAL
.
I also checked this myself, using the HEAD version on the master branch of the OpenIPSL library from GitHub. Indeed, many components inherit from OpenIPSL.Electrical.Essentials.pfComponent, which has
parameter SI.PerUnit v_0=1 "Initial voltage magnitude (pu)" annotation (Dialog(group="Power flow data", enable=enablev_0));
where the parameter v_0
has a small v, not a capital V. As a consequence, I couldn't run your Two_Areas_PSSE
model either, because I got
[1] 19:29:13 Translation Error [M: 56:59-56:87]: Modified element V_0 not found in class Load.
I don't think fixing the model on our side is the way to go, because then we are not working on the same model. I think we need to sort that out first.
Can you please check which version of OpenIPSL are you using? The issue reported by @Karim arises if you use the HEAD version on the master branch, I also tried the latest released version (1.15.0) but it gives other errors, I guess you are using something in between.
I would recommend that you check your model with the latest version of OpenIPSL on the master branch, attach the updated test case, and report what happens, then we are on the same page.
Thanks!
follow-up: 16 comment:15 by , 5 years ago
Okay I got the same translation error when I cloned the GitHub repository. This error is fixed when you download the tar.gz file corresponding to OpenIPSL v1.5.0 https://github.com/OpenIPSL/OpenIPSL/releases which is the version I am using.
Now we should be on the same page and you should be able to run the Two_Areas_PSSE model. In order to be fully in sync with the model I run you should remove the pwFault block.
comment:16 by , 5 years ago
Replying to anonymous:
Okay I got the same translation error when I cloned the GitHub repository. This error is fixed when you download the tar.gz file corresponding to OpenIPSL v1.5.0 https://github.com/OpenIPSL/OpenIPSL/releases which is the version I am using.
Now we should be on the same page and you should be able to run the Two_Areas_PSSE model. In order to be fully in sync with the model I run you should remove the pwFault block.
Sorry, this is not going to work. If you want us to help with this issue please provide
- the .mo files containing the test models we should run (you can attach them to this ticket)
- an exact indication of the libraries we should use to compile those models, either the version numbers if you are using released versions, or hash codes if you are using specific development versions from github
Thank you!
comment:19 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
comment:21 by , 3 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
@paul.mordant, if you still have issues with this model, please reopen a ticket on https://github.com/OpenModelica/OpenModelica/issues/new/choose. Please make sure we can reproduce the issue without any manual intervention on the source code.
Under Tools|Open Working Directory, you can check the omeditcommands.mos file in the temp directory to see a list of the commands the OMEdit sends to OMC.