Opened 4 years ago

Last modified 3 years ago

#6178 new defect

unable -assert (simulation flag) with ompython

Reported by: lukas.koenemann@… Owned by: arun3688
Priority: high Milestone:
Component: OMPython Version:
Keywords: simflags Cc:

Description

Hello,
I'm using OMPython to simulate OpenModelica models. Inside of OMPython there is an option to call the *.exe-file with some simulation flags. A default option of OpenModelica is the "-lv=assert" Option. On the Website https://www.openmodelica.org/doc/OpenModelicaUsersGuide/latest/simulationflags.html
it says that one can unable this with the flag "-lv=-assert", but while simulating it is still showing the assers from the simulation in the commandline. The other standard Options (-lv=Log_Succes & -lv=stdout) i can unable with the flag "-lv=-stdout" ,...


Change History (6)

comment:1 Changed 4 years ago by arun3688

@lukas can you show an example of what you are trying to do, which API you are using to do that in OMPython

comment:2 Changed 4 years ago by lukas.koenemann@…

from OMPython I'm using the ModelicaSystem Object to initialize my model. And I'm running the simulation with self.simulate(simflags='-lv=-assert,-stdout,-LOG_SUCCESS'). When I show up the cmd that is called in the end:
C:/Users/LukasKo/AppData/Local/Temp/tmp0wz8fd5x/EnSysLib.SystemModels.ShowCases.Quartier.exe -override=PV.P_nominal=1000000.0,startTime=0,stopTime=3.1536e+07,stepSize=900,solver=dassl,tolerance=1e-06 -r=C:/Users/LukasKo/AppData/Local/Temp/tmp0wz8fd5x/EnSysLib.SystemModels.ShowCases.Quartier_res.mat -lv=-LOG_SUCCESS,-stdout,-assert -alarm=600 -inputPath=C:/Users/LukasKo/AppData/Local/Temp/tmp0wz8fd5x -outputPath=C:/Users/LukasKo/AppData/Local/Temp/tmp0wz8fd5x

comment:3 Changed 4 years ago by arun3688

@lukas The simulation flag -lv=-assert removes only the assert labelled as "warnings" and "info"

let us say in your simulation messages, you have the following assert logs

record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 10.0, numberOfIntervals = 500, tolerance = 1e-05, method = 'dassl', fileNamePrefix = 'Test2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "Simulation execution failed for model: Test2
assert            | warning | The following assertion has been violated during initialization at time 0.000000
|                 | |       | 5.0 >= assertTest.lowlimit and 5.0 <= assertTest.highlimit
assert            | error   | Variable x out of limit
assert            | info    | simulation terminated by an assertion at initialization
"
end SimulationResult;

using the simflags in simulate command simulate("XXX", simflags="-lv=-assert") will remove all assert statements labelled as "warnings" and "info" , something like below

record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 10.0, numberOfIntervals = 500, tolerance = 1e-05, method = 'dassl', fileNamePrefix = 'Test2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv=-assert'",
    messages = "Simulation execution failed for model: Test2
assert            | error   | Variable x out of limit
"
end SimulationResult;

comment:4 Changed 4 years ago by casella

  • Milestone changed from Future to 1.17.0

comment:5 Changed 4 years ago by casella

  • Milestone changed from 1.17.0 to 1.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:6 Changed 3 years ago by casella

  • Milestone 1.18.0 deleted

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.