Tutorial

This tutorial is a guided tour. Each chapter builds one model, introduces a handful of new ideas, and explains why the code is shaped the way it is. By the end you will have used every major feature of Cimba Python on problems that look like real work.

The first six chapters follow the upstream Cimba C tutorial, so if you know the C library you will recognize the models. The seventh uses simulation optimization to tune policy parameters. Every chapter has a matching, self-contained script in the repository’s tutorial/ directory. The code on these pages is pulled straight from those scripts, so what you read is exactly what runs.

uv run python tutorial/tut_1_1.py

Ch.

Model

What you learn

1

A single-server queue

Models, inputs, processes, entities, outputs, the measurement window, logging, datasets, captures, composition, sweeps and parallel runs. Ends by driving the same queue with recorded data.

2

Mice, rats and a cat

Resources with capacity, priorities, preemption, interrupts, signals, process handles and model-internal randomness.

3

An amusement park

Dynamic models (spawn/release), priority stores, process timers, suspend/resume, and balking, reneging and jockeying.

4

A weather-gated harbor

Composing several models, references between siblings, conditions and predicates, process priorities, and comparing designs fairly.

5

An assembly line

Handing model objects between stores, captured histories, plotting, structure diagrams and finding a bottleneck.

6

A multi-echelon supply chain

Data-driven simulation: time-indexed Series inputs, joint bootstraps, checking an input model before trusting it, provenance, and comparing input models head to head.

7

Tuning a policy

Letting Cimba find good parameter values, reading an honest estimate, comparing tuned policies, and searching a whole number of agents.

If you only have half an hour, read chapter 1 and then chapter 6.