#5129 closed defect (fixed)
SimulationResult.resultFile ignores simflag -r
Reported by: | Owned by: | Adrian Pop | |
---|---|---|---|
Priority: | normal | Milestone: | 1.13.0 |
Component: | Interactive Environment | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: | robert.mueller@… |
Description
Hello,
When simulating a model via the OMShell, the response from the interface has a wrong path for 'resultFile' if its name is specified as a simflag to the simulate call.
Please see the following example:
OMShell 1.1 Copyright Open Source Modelica Consortium (OSMC) 2002-2018 Distributed under OMSC-PL and GPL, see www.openmodelica.org Connected to v1.13.0-dev-516-g2199757a2 (64-bit) Um Hilfe zur Benutzung von OMShell und OpenModelica zu bekommen, tippen Sie "help()" und dann Enter. >> loadModel(Modelica) true >> simulate(Modelica.Blocks.Examples.PID_Controller, simflags="-r=result.mat") record SimulationResult resultFile = "C:/Users/*****/AppData/Local/Temp/OpenModelica/Modelica.Blocks.Examples.PID_Controller_res.mat", simulationOptions = "startTime = 0.0, stopTime = 4.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'Modelica.Blocks.Examples.PID_Controller', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-r=result.mat'", messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method. LOG_SUCCESS | info | The simulation finished successfully. ", timeFrontend = 0.4211824075777083, timeBackend = 0.03604395478073517, timeSimCode = 0.007793409574607846, timeTemplates = 0.02874894900023647, timeCompile = 2.795966870516829, timeSimulation = 0.1441454386610263, timeTotal = 3.434178265981765 end SimulationResult; >>
It should be:
record SimulationResult resultFile = "C:/Users/*****/AppData/Local/Temp/OpenModelica/result.mat", ... end SimulationResult;
The same goes for the response via Python interface.
Change History (5)
comment:1 by , 6 years ago
Component: | *unknown* → Interactive Environment |
---|---|
Milestone: | Future → 1.13.0 |
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | assigned → accepted |
I've seen this as well, we need to parse the simflags and intercept -r setting to be able to change the result file name in the record we create. Currently the result file name is created from the model name.
comment:3 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Fixed with PR: https://github.com/OpenModelica/OMCompiler/pull/2657
comment:4 by , 6 years ago
Good morning and thank you for fixing this problem so fast!
Before the fix, the record contained the absolute path to the result file, whereas now we only get the file name, is this on purpose?
1.
simflags= "-r=result.mat" resultFile = "result.mat"
2.
simflags= "-r=C:/Users/*****/AppData/Local/Temp/OpenModelica/result.mat" resultFile = "C:/Users/*****/AppData/Local/Temp/OpenModelica/result.mat"
3.
No simflags
specified
resultFile = "C:/Users/*****/AppData/Local/Temp/OpenModelica/Modelica.Blocks.Examples.PID_Controller_res.mat"
It would be really nice to have a consistent response from the interface, or is this on purpose?
comment:5 by , 6 years ago
This is on purpose. The -r you specify is given back exactly as it is because it may include a path as you have 2) there. You can easily specify the full path to the file via simflags="-r" + cd() + "/filename.mat" if you want that.
@adeas31, could you have a look or assign it to somebody who could?