.ModelicaReference.Operators.'sample()'

Information

Trigger time events

Syntax

sample(start, interval)

Description

Returns true and triggers time events at time instants "start + i*interval" (i=0, 1, ...). During continuous integration the operator returns always false. The starting time "start" and the sample interval "interval" need to be parameter expressions and need to be a subtype of Real or Integer.

Examples

model Sampling
  Integer i;
equation
  when sample(1, 0.1) then
    i = pre(i) + 1;
  end when;
end Sampling;
Simulation result
Generated at 2020-02-19T02:36:33Z by OpenModelicaOpenModelica 1.16.0~dev-189-gf9a0b48 using GenerateDoc.mos