There are questions how to determine the maximum of a mixed time-continuous and time-discrete signal x(t) over passed time with Modelica, i.e.,
y(t) = max{ x(s) with s in [startTime,t] }.
This is an open issue in the Modelica bug tracker (see https://trac.modelica.org/Modelica/ticket/109).
I will give a SimultionX-specific solution.
SimulationX extends Modelica by the
last-operator which returns the last accepted value of the argument. At event-time points it returns the value at which the integration stopped before the event iteration. Thelast-operator can be used to calculate the maximum of the currentxvalue and the last maximum. See the following working example.The input signal
xand the corresponding output signalyare depicted in the following Figure.