Simcraft Docs

data Measured Data Components

Measured data carried inline in the document. A series publishes a sampled time series that expressions read. A schedule creates entities at an explicit list of times. The data lives in params, so a document that uses these components needs no external files.

Generated from spec/libraries/data.library.json · library version 0.1.0 · OSDL 0.1

data.series SeriesData#

An inline sampled time series. The component has no ports. Other components read it in expressions as <id>.value. interpolation defines the value between samples, and outOfRange defines it before the first sample and after the last. The component publishes value at every sample time, and under the cyclic policy the sample times repeat in every cycle. Under linear interpolation, it also publishes value at k * resolution for each positive integer k, on a grid anchored at time 0. Without the cyclic policy, these publications fall strictly between the first and last sample times. An expression read returns the most recently published value.

Parameters

ParamTypeDescription
timesrequired array<number> Sample times in model time units, strictly increasing. With the cyclic policy, every time must lie in [0, period).
valuesrequired array<number> Sample values, one for each entry in times.
interpolation "step" | "linear" How the value behaves between samples: step holds each sample value until the next sample time; linear interpolates between consecutive samples and also publishes at k * resolution for each positive integer k, on a grid anchored at time 0. Without the cyclic policy, these publications fall strictly between the first and last sample times. default "step" · "step" | "linear"
outOfRange "hold" | "zero" | "cyclic" The value outside the sampled range: hold extends the first and last sample values, zero publishes 0, cyclic repeats the samples every period time units. default "hold" · "hold" | "zero" | "cyclic"
period number Cycle length in model time units. Required when outOfRange is cyclic and rejected otherwise.
resolution number Re-publish interval in model time units. Required when interpolation is linear and rejected otherwise.

Observable state

StateTypeDescription
value number The series value at the current simulation time, as most recently published.

data.schedule ScheduleData#

Creates entities at an explicit list of times and sends them through out. Creation waits for downstream acceptance: a blocked entity pauses the schedule, and remaining entries fire as soon as delivery unblocks. With period set, the list repeats every cycle.

Ports

PortDirectionDescription
out out Newly created entities leave here.

Parameters

ParamTypeDescription
timesrequired array<number> Creation times in model time units, non-decreasing and at least 0. Duplicate times create coincident entities. With period, every time must lie in [0, period).
entityType string Type label stamped on created entities. Defaults to the component id.
period number Cycle length in model time units. When present, every entry t also fires at t + k * period for each positive integer k.

Observable state

StateTypeDescription
count integer Entities created so far.
held integer 1 while a created entity is blocked waiting for the downstream component to accept it (the schedule is paused), else 0.

Emitted events

EventDescription
entity.created Emitted for every entity this schedule creates.