Skip to main content

cwright simulate

cwright simulate <model> [--replication N] [--out FILE] [--cycles-out FILE]
[--checkpoint FILE --checkpoint-every EVENTS]

Drives one replication — as opposed to run, which reports a summary over many. simulate exists as its own command specifically so a single replication can be interrupted and resumed via resume, which is the only shape checkpointing makes sense in.

Flags​

FlagDefaultMeaning
--replication N0Which replication (seed) to run.
--out FILEstdoutWhere to write the outcome document.
--cycles-out FILE—Also write the full per-product cycle-time distribution as JSON — needed for anything computed from the whole distribution rather than its mean (a median flow factor, for instance), since that cannot be reconstructed from a mean alone.
--checkpoint FILE—Where to write checkpoints. Requires --checkpoint-every.
--checkpoint-every EVENTS250000How many executed events between checkpoints.

Output​

A single JSON document describing this one replication: the model hash, event and completion counts, the trace hash, mean cycle time, per-product breakdowns, and — the same shape run reports per replication — a resources map with each resource's utilisation, availability, mean queue length, campaign statistics, and full state-percentage breakdown, plus an operators map when the model uses labour.

Checkpointing a long run​

cwright simulate model.yaml --checkpoint run.ckpt --checkpoint-every 250000

Every --checkpoint-every executed events, the current engine state is written to a temporary file and atomically renamed into place at --checkpoint, so a crash mid-write can never leave a corrupted checkpoint where a good one used to be. Each checkpoint is reported on stderr with its size and how long writing it blocked the simulation:

checkpoint at t=1250000000 (2500000 events, 41823 bytes, 3.2 ms blocking)

See Checkpointing for what makes a resumed run provably identical to one that ran straight through, and resume for continuing from a checkpoint.