Simcraft Docs

Paradigms on one calendar#

Discrete-event, agent-based, and system dynamics modelling are usually separate tools with separate solvers. In OSDL they are three optional component libraries over one kernel, and a hybrid model is an ordinary model.

What the kernel provides#

The core specification is paradigm-neutral. It defines the clock, the calendar ordering, values and expressions, connections and entity escrow, experiments, and the event stream. Nothing in the kernel knows what a queue or a stock is.

Each standard library then defines component behavior for its namespace:

LibraryStyleComponents
desEvent-driven entity flowsource, queue, server, delay, router, sink
abmAgents with statechartspopulation
sdContinuous stocks and flowsstock, flow, auxiliary
dataMeasured time series and schedulesseries, schedule

Simcraft also installs rf, a resource-flow library for game economies that is not part of OSDL. Its nodes advance together on a model-wide tick that interleaves with the other libraries on the same calendar.

Entities enter rf at an rf.deposit and leave from an rf.emitter. Expressions of other libraries read rf pool levels and registers, except while those libraries start at time 0, before rf publishes them. A read at that point, such as the first value of an SD auxiliary, stops the run unless a guard such as if(time() > 0, gems.value, 0) skips it.

Support is declared per library, outside the document. An engine that claims [email protected] must pass the des conformance suite; it has no obligation to abm or sd unless it claims them too.

How they interleave#

Everything schedulable is an entry on the one calendar. Entries are ordered by time. At one time, the SD integration step runs first, the samples that record outputs run last, and the other entries run in the order they were scheduled:

  • A DES service completion is an event.
  • An ABM rate-triggered transition is an event.
  • An SD integration boundary, every dt, is an event.
  • An rf tick, every tickInterval, is an event.

Because ordering is total and deterministic, cross-paradigm interaction is just reference and flow. An SD auxiliary can read a DES server's utilization. An ABM statechart can send its agent into a DES queue as an entity. The integration step to a boundary runs before the discrete events at that time. A discrete event at a boundary reads the stock values for that time, and the next step reads the changes that the event makes. The interleaving is the same in every run.

The hybrid clinic example exercises all three: an agent population feeds a queue, and a continuous fatigue stock throttles the servers.

Why not federate solvers#

The common alternative couples separate simulators through a co-simulation interface. Each solver keeps its own clock, and the coupling layer exchanges values at synchronization points. That approach makes time alignment, event ordering, and reproducibility properties of the integration, not of the model.

OSDL's choice is stricter and simpler: one clock, one ordering, one trace. The cost is that every paradigm must be expressed as components on the shared kernel. The benefit is that a hybrid model has the same determinism promise as a single-paradigm one, with no integration layer to configure or debug.

Read more#