Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

OpenModelica - plotting of Simulation Results - option to save as file

OpenModelica - plotting of Simulation Results - option to save as file

I am working on integrating a web application with OpenModelica. I am using the JavaOMC API from Google Code to programmatically invoke OpenModelica simulation and plot functionality. But the plot() call is throwing up the OMPLOT window. It would be great to be able to directly save the graph as an image file in a standard format such as .png, so as to be able to display the image in a webpage.

I am not sure whether OpenModelica OMPLOT lacks support for this feature or  the JavaOMC API does not provide support for this feature - I rather feel the former is the case.

Can somebody guide me as to:

1. Whether OMPLOT supports the feature described?
2. If yes, what are the command-line switches to be provided?

Thanks,
Satya

Re: OpenModelica - plotting of Simulation Results - option to save as file

I suggest you stay in Java and make your own plot.
When you run simulate it will create a Model_res.mat so you can read that using for example:
http://sourceforge.net/projects/jmatio/
and plot the variables.

Alternatively you could use simulate(Model, outputFormat="csv") to get a Model_res.csv (comma separated values file)

Cheers,
Adrian Pop/

Re: OpenModelica - plotting of Simulation Results - option to save as file

Thanks, Adrian.

I will try out the .csv file based approach.

Cheers,
Satya

Re: OpenModelica - plotting of Simulation Results - option to save as file

Just one notice. The cvs file does not contain the parameters. The mat file has those too.

Re: OpenModelica - plotting of Simulation Results - option to save as file

I tried to use the OMC API methods to read simulation results like readSimulationResult but I didn't get any result.

I also tried to use JMatIO - Matlab's MAT-file I/O in JAVA but I got an error saying that the .mat file is not a valid MATLAB 5.0 MAT-file.

Should I just export the simulation results in csv? Is there another better alternative?

Thanks,
Axel

There are 0 guests and 0 other users also viewing this topic
You are here: