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

Very very long simulation times when having several combitime tables

Very very long simulation times when having several combitime tables

Hi,

I'm having performance problems with my models including several combitimetables. There are less than 1000 variables/equations and the models does not seem so complex, but I noticed that a reduced version, without some tables and a component, simulates in 16 seconds, whereas for the complete model I have to wait 1000 seconds. Moreover, the component, that is not used in the reduced version, simulate alone in 0.2 s.

My simulations take some input data depending on time and we have 10 combitimetables at the moment, but we have to take into account some additional ones. At the beginning, we try to simulate on 2677800 seconds with 4464 number of intervals corresponding to the duration and sampling of our data. I can imagine that it may be difficult to simulate on about 1 month, but now we consider 3-4 days and each sub-model simulate very quickly (also for one month simulation) in less than 1s.

I made a simple test with my partial model simulating in 16s. If I just add the 2 combitimetables needed for the last component, which I kept in comment, and I have to wait a very long time (I stop the simulation after a few minutes). In that case, the simulation should be the same, there are only 2 tables to load in additions to previous ones and they do not interfere with models to simulate.

Previously, I also noticed some errors when my file names and table names are not enough different. I don't take time to clarify that, but I had the feeling that omc didn't take the right tables. I'll try to make a simple test model if I have time.

I hope i was clear and that the(se) problem(s) could be solved quickly. I don't know if I should report a bug on that and if some of you already encounter such issues.

Edited by: Raphael - Jun-26-12 13:52:49

Re: Very very long simulation times when having several combitime tables

Hi again,

I made a simple test using a previous version of omc (1.8.1 release, i.e. r11645) comparing to my current development version (r12101) and it is really faster with r11645. With r12101 compared to r11645, simulation times are at least multiplied by 5.
Maybe some solving algorithms have been modified between these releases and it is not the same problem than the one with combitimetables.
This great time difference has been mesured on 2 different computers, one under windows and the other under macos.

I'll make a bug report soon, but if any of you have others clues...

Raphael.

Re: Very very long simulation times when having several combitime tables

Can you break up the time for initialization and see if that is what became slower? simulate(M,measureTime=true) might help, if it was working in the revisions you tested.

Re: Very very long simulation times when having several combitime tables

Hi,

Sorry for late answer, but i got these timings:
* with partial model and 4 combiTimeTables:
    timeFrontend = 1.5306536700000002,
    timeBackend = 0.669462612,
    timeSimCode = 0.12590120600000002,
    timeTemplates = 0.09917368600000001,
    timeCompile = 0.832953845,
    timeSimulation = 139.272365344,
    timeTotal = 142.530665018
* with partial model and 7 combiTimeTables:
    timeFrontend = 2.034122126,
    timeBackend = 0.872566469,
    timeSimCode = 0.17585834,
    timeTemplates = 0.126219451,
    timeCompile = 1.054016333,
    timeSimulation = 438.42944458200003,
    timeTotal = 442.69237597100005

The two simulations use the same model, but several additional time tables are defined in the second run.

I got additional information using measureTime=true:
<simulation>
<modelinfo>
  <name>test</name>
  <prefix>test</prefix>
  <date>2012-07-18 17:20:18</date>
  <method>dassl</method>
  <outputFormat>csv</outputFormat>
  <outputFilename>test_res.csv</outputFilename>
  <outputFilesize>590675</outputFilesize>
  <overheadTime>0.000431</overheadTime>
  <preinitTime>0.000542</preinitTime>
  <initTime>438.074586</initTime>
  <eventTime>0.002683</eventTime>
  <outputTime>0.048277</outputTime>
  <linearizeTime>0.000000</linearizeTime>
  <totalTime>876.257215</totalTime>
  <totalStepsTime>0.007271</totalStepsTime>
  <numStep>365</numStep>
  <maxTime>0.001215089</maxTime>
</modelinfo>
<profilingdataheader>
  <filename>test_prof.data</filename>
  <filesize>38064</filesize>
  <format>
    <uint32>step</uint32>
    <double>time</double>
    <double>cpu time</double>
    <uint32>Modelica.Blocks.Sources.CombiTimeTable.tableTimeIpo (calls)</uint32>
    <uint32>Modelica.Blocks.Sources.CombiTimeTable.tableTimeInit (calls)</uint32>
    <uint32>EonavLib.Components.PowerSystemC.Control.PMS (calls)</uint32>
    <uint32>Modelica.Blocks.Tables.CombiTable1D.tableIpo (calls)</uint32>
    <uint32>Modelica.Blocks.Tables.CombiTable1D.tableInit (calls)</uint32>
    <uint32>Modelica.Blocks.Sources.CombiTimeTable.tableTimeTmin (calls)</uint32>
    <uint32>Modelica.Blocks.Sources.CombiTimeTable.tableTimeTmax (calls)</uint32>
    <double>Modelica.Blocks.Sources.CombiTimeTable.tableTimeIpo (cpu time)</double>
    <double>Modelica.Blocks.Sources.CombiTimeTable.tableTimeInit (cpu time)</double>
    <double>EonavLib.Components.PowerSystemC.Control.PMS (cpu time)</double>
    <double>Modelica.Blocks.Tables.CombiTable1D.tableIpo (cpu time)</double>
    <double>Modelica.Blocks.Tables.CombiTable1D.tableInit (cpu time)</double>
    <double>Modelica.Blocks.Sources.CombiTimeTable.tableTimeTmin (cpu time)</double>
    <double>Modelica.Blocks.Sources.CombiTimeTable.tableTimeTmax (cpu time)</double>
  </format>
</profilingdataheader>
<functions>
  <function id="fun152">
    <name>Modelica.Blocks.Sources.CombiTimeTable.tableTimeIpo</name>
    <ncall>357222166</ncall>
    <time>25.055090068</time>
    <maxTime>0.000128783</maxTime></function>
  <function id="fun153">
    <name>Modelica.Blocks.Sources.CombiTimeTable.tableTimeInit</name>
    <ncall>14</ncall>
    <time>0.002904343</time>
    <maxTime>0.002904343</maxTime>
  </function>
  <function id="fun154">
    <name>f1</name>
    <ncall>51031924</ncall>
    <time>18.877085101</time>
    <maxTime>18.876788672</maxTime>
  </function>
  <function id="fun155">
    <name>Modelica.Blocks.Tables.CombiTable1D.tableIpo</name>
    <ncall>1224762270</ncall>
    <time>81.967103370</time>
    <maxTime>81.966007920</maxTime>
  </function>
  <function id="fun156">
    <name>Modelica.Blocks.Tables.CombiTable1D.tableInit</name>
    <ncall>48</ncall>
    <time>0.000099072</time>
    <maxTime>0.000099072</maxTime>
  </function>
  <function id="fun157">
    <name>Modelica.Blocks.Sources.CombiTimeTable.tableTimeTmin</name>
    <ncall>357216181</ncall>
    <time>16.263642791</time>
    <maxTime>0.000000000</maxTime>
  </function>
  <function id="fun158">
    <name>Modelica.Blocks.Sources.CombiTimeTable.tableTimeTmax</name>
    <ncall>357216181</ncall>
    <time>18.669338380</time>
    <maxTime>18.669338380</maxTime>
  </function>
</functions><profileblocks>
</profileblocks>
</simulation>

If i understand well what is generated in test_prof.xml, the major time consuming phase is initialization with a lots of calls of Modelica.Blocks.Tables.CombiTable1D.tableIpo function calls (475342134 calls for about 33 seconds in the 1rst case and 1224762270 calls for 82 seconds in the second case). Is there a way to improve these timings?

Regards,
R.C.

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