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

Simulation output to csv

Simulation output to csv

Hi,

I observed 2 issues while writing simulated output to csv files

1. when I click on "csv" button in plot window or set in simulation options ( Output tab , Output format =csv) , the generated csv as addtional row at end duplicating the last row (like this , first column is time of simulation and interval was set as 0.1)
3.8   23,1, 43,2
3.9    21,1, 41,2
4    20,1, 40,2
4  20,1, 40,2   ( this row gets repeated)


2. When combitime table is added , 2 rows duplicated are added for each simulated row as shown below

0    0    0    0
1    2    3    4
1    2    3    4
1    2    3    4
2    4    6    8
2    4    6    8
2    4.    6    8
3    6    9    12
3    6    9    12


I  am using OPenmodeilca 1.17 and Modelica 4.0.0

Thanks

Re: Simulation output to csv

I guess that the last row is duplicated is because at the end of the simulation an event iteration is done. So OpenModelica will store the values previously and after that event iteration. If nothing changes one could of course store only one time point.

Can you provide a minimal working example for the second case you are describing? I think that could be considered a bug, so opening an issue about it should be a way to get this changed: https://github.com/OpenModelica/OpenMod … new/choose

Re: Simulation output to csv

Hi,
Thanks for reply
For second issue
Here is lookup.mo file, data file sued and csv file generated

lookup-res.csv

data2.txt

lookup.mo

for the first issue - so what is the solution. how to avoid the last line from being repeated ?

Thanks

Edited by: mahesRBR - Jul-09-21 13:42:44

Re: Simulation output to csv

I've tried it with your example and when you enable event logging (LOG_EVENTS) you can see that combiTImeTable introduces events. And for each event a result before and after the event (at the same time point) is stored. If you want to suppress this use the simulation flag -noEventEmit.

Re: Simulation output to csv

Thanks. Both issues are resolved by setting simulation flag -noEventEmit

There is 1 guest and 0 other users also viewing this topic