Simcraft Docs

OSDL Model Document

Open Simulation Definition Language (OSDL) v0.1: a vendor-neutral, JSON-native format for discrete-event, agent-based, system-dynamics, and hybrid simulation models. This schema validates document structure (phase one). Component params objects are additionally validated against the params schema published in the component type's library definition (phase two). See SPEC.md for the semantics.

Generated from spec/schemas/osdl.schema.json · https://osdl.dev/schemas/0.1/osdl.schema.json

Document root#

FieldTypeDescription
$schema string Optional URI of the OSDL JSON Schema, for editor tooling.
osdlrequired "0.1" Version of the OSDL specification this document conforms to.
modelrequired model
experiments array<experiment> Run configurations: duration, replications, seeds, parameter overrides, sweeps, and recorded outputs.
views array<view> Presentation-only layout (canvas positions, edge routing). Views must not affect simulation semantics.
metadata metadata

Definitions#

identifier#

A name: starts with a letter or underscore, then letters, digits, underscores, or hyphens.

string pattern ^[A-Za-z_][A-Za-z0-9_-]*$

typeName#

A namespaced component type, <namespace>.<name>, e.g. des.queue. The namespace identifies the component library that defines the type. core.composite is reserved for a future additive version.

string pattern ^[a-z][a-z0-9_]*\.[a-z][a-zA-Z0-9_]*$

portRef#

A connection endpoint, <componentId>.<portId>, referring to a sibling component in the same model scope.

string pattern ^[A-Za-z_][A-Za-z0-9_-]*\.[A-Za-z_][A-Za-z0-9_-]*$

statePath#

A dotted path to an observable state variable, e.g. teller.utilization or patients.inState.sick.

string pattern ^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)+$

eventType#

A dotted event type name, e.g. entity.moved.

string pattern ^[a-z][a-zA-Z0-9]*(\.[a-z][a-zA-Z0-9]*)+$

expressionString#

An expression in the OSDL expression language (SPEC.md §7.3). References resolve to parameters, component state paths, and (in agent scope) agent attributes.

string min length 1

metadata#

Free-form extension data. Keys should be namespaced, for example com.example.tool. Metadata must not affect simulation semantics.

No properties.

model#

FieldTypeDescription
namerequired identifier
label string Human-readable display name.
description string
time timeConfig
parameters array<parameterDef> Model-level inputs, overridable per experiment and referenceable from any value position.
componentsrequired array<component>
connections array<connection>
metadata metadata

timeConfig#

FieldTypeDescription
unit "ticks" | "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "weeks" | "years" The unit of simulation time. All durations, delays, and rates in the model are expressed in this unit. default "ticks"
start number | string
integration integrationConfig

integrationConfig#

Numerical integration settings for continuous components. The step size defines observable integration boundaries on the shared simulation clock. An implementation can use any internal integration design that preserves boundary behavior.

FieldTypeDescription
method "euler" | "rk4" default "euler"
dt number Integration step size, in model time units. default 1 · > 0

parameterDef#

FieldTypeDescription
namerequired identifier
label string
description string
type "number" | "integer" | "boolean" | "string" default "number"
default number | boolean | string
unit string Unit of measure, e.g. patients/hour. Informational in v0.1.
min number
max number
choices array<number | string> If present, the parameter value must be one of these. min items 1
metadata metadata

component#

FieldTypeDescription
idrequired identifier Unique within the enclosing model scope.
typerequired typeName
label string
description string
params object Configuration for this component instance. Validated (phase two) against the params schema in the component type's library definition.
tags array<string>
metadata metadata

connection#

FieldTypeDescription
id identifier Optional, but required if the connection is referenced from a view route.
fromrequired portRef
torequired portRef
label string
params object Library-defined link configuration (e.g. routing weight). Interpreted by the component types at the endpoints.
tags array<string>
metadata metadata

paramRef#

FieldTypeDescription
paramrequired identifier The name of a model parameter.

expression#

FieldTypeDescription
exprrequired expressionString

scalarValue#

A deterministic numeric value: a literal, a parameter reference, or an expression.

One of:
number

number

numericValue#

A possibly stochastic numeric value: a literal, a parameter reference, an expression, or a probability distribution (re-sampled at each use).

value#

A general value: literal, parameter reference, expression, or distribution. Plain strings are literals. Expressions must use the {"expr": ...} form.

One of:
number

number

boolean

boolean

string

string

distribution#

A probability distribution. Numeric arguments may themselves be parameter references or expressions.

One of:
dist: "constant"
FieldTypeDescription
distrequired "constant"
valuerequired scalarValue
dist: "uniform"
FieldTypeDescription
distrequired "uniform"
minrequired scalarValue
maxrequired scalarValue
dist: "exponential"
FieldTypeDescription
distrequired "exponential"
raterequired scalarValue Events per model time unit; mean = 1/rate.
dist: "normal"
FieldTypeDescription
distrequired "normal"
meanrequired scalarValue
stdrequired scalarValue
dist: "lognormal"
FieldTypeDescription
distrequired "lognormal"
murequired scalarValue Mean of the underlying normal (log space).
sigmarequired scalarValue Std of the underlying normal (log space).
dist: "triangular"
FieldTypeDescription
distrequired "triangular"
minrequired scalarValue
moderequired scalarValue
maxrequired scalarValue
dist: "weibull"
FieldTypeDescription
distrequired "weibull"
shaperequired scalarValue
scalerequired scalarValue
dist: "gamma"
FieldTypeDescription
distrequired "gamma"
shaperequired scalarValue
scalerequired scalarValue
dist: "beta"
FieldTypeDescription
distrequired "beta"
alpharequired scalarValue
betarequired scalarValue
dist: "poisson"
FieldTypeDescription
distrequired "poisson"
raterequired scalarValue Mean count per draw.
dist: "binomial"
FieldTypeDescription
distrequired "binomial"
nrequired scalarValue Number of trials (integer).
prequired scalarValue
dist: "bernoulli"
FieldTypeDescription
distrequired "bernoulli"
prequired scalarValue
dist: "geometric"
FieldTypeDescription
distrequired "geometric"
prequired scalarValue
dist: "discrete"
FieldTypeDescription
distrequired "discrete"
valuesrequired array<object> Categorical distribution: each entry is drawn with probability weight/sum(weights). min items 1
dist: "empirical"
FieldTypeDescription
distrequired "empirical"
samplesrequired array<number> Observed data; draws resample from these values. min items 1

statechart#

A finite-state behaviour definition. Used by agent definitions and stateful components across paradigms.

FieldTypeDescription
initialrequired identifier The id of the initial state.
statesrequired array<state> min items 1
transitions array<transition>

state#

FieldTypeDescription
idrequired identifier
label string
description string
onEnter array<action>
onExit array<action>

transition#

FieldTypeDescription
fromrequired identifier
torequired identifier
triggerrequired trigger
guard expressionString Boolean expression; the transition fires only if it evaluates true.
actions array<action>
label string

trigger#

One of:
type: "timeout"
FieldTypeDescription
typerequired "timeout"
delayrequired numericValue Fires after this much time in the source state.
type: "rate"
FieldTypeDescription
typerequired "rate"
raterequired numericValue Exponential hazard: fires after Exp(rate)-distributed time; mean = 1/rate.
type: "condition"
FieldTypeDescription
typerequired "condition"
exprrequired expressionString Fires when the expression becomes true.
type: "message"
FieldTypeDescription
typerequired "message"
topicrequired string Fires when a message with this topic is received.
type: "arrive"
FieldTypeDescription
typerequired "arrive"
portrequired identifier Fires when this agent, having previously departed, arrives back at the named port of its population.

action#

One of:
type: "set"
FieldTypeDescription
typerequired "set"
targetrequired string An agent attribute name (in agent scope) or a writable component state path. pattern ^[A-Za-z_][A-Za-z0-9_-]*(\.[A-Za-z_][A-Za-z0-9_-]*)*$
valuerequired value
type: "send"
FieldTypeDescription
typerequired "send"
topicrequired string
to "self" | "connected" | "random" | "all" Recipients within the population: the agent itself, its network neighbours, one uniformly random agent, or every agent. default "connected"
payload object
type: "emit"
FieldTypeDescription
typerequired "emit"
eventrequired eventType Emits a custom event onto the simulation event stream.
payload object
type: "depart"
FieldTypeDescription
typerequired "depart"
portrequired identifier The agent leaves its population as an entity through this out port (e.g. into a discrete-event process).
type: "log"
FieldTypeDescription
typerequired "log"
messagerequired string

experiment#

FieldTypeDescription
namerequired identifier
label string
description string
durationrequired number Run length in model time units. > 0
warmup number Initial period excluded from recorded outputs. min 0
replications integer default 1 · min 1
seed integer Root random seed. Replication r uses a stream deterministically derived from (seed, r). Engines must produce identical results for identical (model, experiment, seed, replication). min 0
parameters map<string, number | boolean | string> Fixed overrides of model parameter defaults, keyed by parameter name.
sweep array<object> Parameter sweep. The experiment runs once per element of the cross product of all entries' value lists (times replications). min items 1
outputs array<output>
stopWhen expressionString Optional early-stop condition; the run ends when it evaluates true.
metadata metadata

output#

A recorded observable with one or more independent recorders. The recorder type must support the observable's state type.

FieldTypeDescription
pathrequired statePath
as identifier Alias used in results and metric.updated events.
recordsrequired array<recorder> min items 1

recorder#

One of:
type: "timeseries"

Records number or integer values at an interval or on change.

FieldTypeDescription
typerequired "timeseries"
interval number Sampling interval. If omitted, the value is recorded on every change. > 0
type: "summary"

Computes numeric statistics for a number or integer observable.

FieldTypeDescription
typerequired "summary"
statistics array<"mean" | "std" | "min" | "max" | "median" | "p5" | "p25" | "p75" | "p90" | "p95" | "p99" | "count" | "sum" | "last"> Summary statistics to compute. The default is ["mean"]. min items 1
type: "final"

Records the final number, integer, boolean, or string value.

FieldTypeDescription
typerequired "final"

view#

FieldTypeDescription
idrequired identifier
label string
type "canvas" default "canvas"
elements array<object>
routes array<object>
metadata metadata

point#

FieldTypeDescription
xrequired number
yrequired number