﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5587	Bad value for interpolation in delayImpl	ni.ding@…		"The following example using delay operator is not properly handled when there is a state event (please see the attached log).

model example_delay
  Real x;
  Real y;
equation
  x = if time < 0.00003 then 0 else 2*Modelica.Math.cos(2
    *Modelica.Constants.pi*60*(time));
  y = delay(x, 0.00034);
annotation(
    __OpenModelica_simulationFlags(lv = ""LOG_STATS"", outputFormat = ""csv"", s = ""trapezoid""),
    experiment(StartTime = 0, StopTime = 0.05, Tolerance = 1e-6, Interval = 5e-05));
end example_delay;


In this example, the ring buffer contains values
storeDelayed[0] 0:0 position=1
storeDelayed[0] 5e-005:0 position=2
storeDelayed[0] 3.00001e-005:0 position=3
storeDelayed[0] 5e-005:1.99964 position=4
storeDelayed[0] 0.0001:1.99858 position=5
…
We have
delayImpl: exprNumber = 0, exprValue = 1.99432, time = 0.00035, delayTime = 0.00034
|                 | |       | | | findTime 1.000000e-005
|                 | |       | | | time(0, 9)[4] = 1.000000e-004
|                 | |       | | | time(0, 4)[2] = 3.000010e-005
|                 | |       | | | time(0, 2)[1] = 5.000000e-005
|                 | |       | | | return time[0, 1] = 5.000000e-005
|                 | |       | | | delayImpl: Linear interpolation of 1e-005 between 0 and 5e-005
|                 | |       | | | delayImpl: Linear interpolation of 1e-005 value: 0 and 0 = 0
Here the value to be used in the interpolation at t=5e-005 should be 1.99964 instead of 0, since the state event has occurred at 3.00001e-005. In other words, storeDelayed[0] 5e-005:0 position=2 should be erased in event handling.
"	defect	closed	high	Future	Backend	v1.13.2	fixed		alireza.masoom@… adrien.guironnet@…
