Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#5777 closed defect (duplicate)

State event at each sample step of CombiTimeTable

Reported by: Oliver Lenord Owned by: Lennart Ochel
Priority: high Milestone: 1.16.0
Component: Backend Version: v1.14.0
Keywords: events, table Cc:

Description (last modified by Oliver Lenord)

Simulating a simple CombiTimeTable with a time series of step size ~=0.01 leads to time events at each sample step. his slows down the simulation significantly.

The attached model contains for test cases using the CombiTimeTable with data from a file, a matrix as parameter each with a sample step of exactly 0.01 and slightly larger with 0.010000037. Test have been carried out with the step size exactly 0.01 or not. In all cases the comparison of OMEdit against Dymola shows the following:

Dymola statistics:

Number of (U) time events : 0
Number of state events : 0
Number of step events : 0

OMC Statistics:

time events 0
state events 799

For larger models the simulation time of OMEdit is multiple times slower than Dymola.

Attachments (3)

TableIssue.mo (32.0 KB ) - added by Oliver Lenord 5 years ago.
table_data.mat (5.5 KB ) - added by Oliver Lenord 5 years ago.
table_data_even.mat (3.0 KB ) - added by Oliver Lenord 5 years ago.

Download all attachments as: .zip

Change History (8)

by Oliver Lenord, 5 years ago

Attachment: TableIssue.mo added

by Oliver Lenord, 5 years ago

Attachment: table_data.mat added

by Oliver Lenord, 5 years ago

Attachment: table_data_even.mat added

comment:1 by Oliver Lenord, 5 years ago

Description: modified (diff)

comment:2 by Francesco Casella, 5 years ago

Resolution: duplicate
Status: newclosed

The event generation in the CombiTimeTable code:

    when {time >= pre(nextTimeEvent), initial()} then
      nextTimeEventScaled = Internal.getNextTimeEvent(tableID, timeScaled);
      nextTimeEvent = if nextTimeEventScaled < Modelica.Constants.inf then nextTimeEventScaled*timeScale else Modelica.Constants.inf;
    end when;

As far as I understand, OMC still trivially implements time events as state events, by means of zero-crossing functions. This is a very old issue that I already marked as a blocker for release 2.0.0, see #2152.

comment:3 by Oliver Lenord, 5 years ago

Dymola is creating neither state events nor time events.

Is it really the same case as #2152?
Or is there something one could learn from Dymola to gain performance?

comment:4 by Francesco Casella, 5 years ago

This is the simulation log of your test case with Dymola 2020x:

Integration started at T = 0 using integration method DASSL
(DAE multi-step solver (dassl/dasslrt of Petzold modified by Dassault Systemes))
Integration terminated successfully at T = 8
   CPU-time for integration                : 0.018 seconds
   CPU-time for one grid interval          : 0.036 milliseconds
   CPU-time for initialization             : 0.001 seconds
   Number of result points                 : 2100
   Number of grid points                   : 501
   Number of accepted steps                : 20
   Number of f-evaluations (dynamics)      : 20
   Number of crossing function evaluations : 1319
   Number of Jacobian-evaluations          : 18
   Number of model time events             : 799
   Number of input time events             : 0
   Number of state events                  : 0
   Number of step events                   : 0
   Minimum integration stepsize            : 1e-005
   Maximum integration stepsize            : 2.99
   Maximum integration order               : 1

As I understand it, there are indeed 799 time events. I would be surprised of the contrary, since there is a when statement triggered at each time corresponing to the values of the first column of the table.

comment:5 by Francesco Casella, 4 years ago

Milestone: 1.15.01.16.0

Release 1.15.0 was scrapped, because replaceable support eventually turned out to be more easily implemented in 1.16.0. Hence, all 1.15.0 tickets are rescheduled to 1.16.0

Note: See TracTickets for help on using tickets.