Skip to main content
Docs navigation

Tutorials

Each tutorial takes a small but realistic piece of control software, runs it in a simulation, states its requirements as verification rules, and uses the result to find something wrong with it. All the code is on the page, complete, and every graph comes from a run of that code exactly as shown.

They build on each other, so if you are new to CppModel, take them in order.

TutorialThe code under testWhat you learn
1. Excavator Boom ControlJoystick to hydraulic valve coils, with signal monitoringA simulation's structure, a scripted scenario, parameters, Always and Response rules. Finds a broken-wire fault that drives the boom down.
2. Temperature ControlA P and PI room temperature controllerA plant model and a closed loop, the Settle rule, controller variants from --inputs files without rebuilding, comparing runs. Shows steady-state error and integrator windup.
3. Garage Door ControllerA state machine with a button, a photo-eye and limit switchesTest sequences with steps and reusable input profiles, Mode rules, requirement IDs and coverage. Finds a motor reversal without a rest.

Before you start​

  • Install the CppModel library and a C compiler with CMake (see Installation). Each tutorial expects the library in a dependencies folder next to its CMakeLists.txt.
  • The first run of a simulation prints a login link to your workspace. After that, each run prints a link to its results.
  • Each tutorial's complete project is on GitHub, linked at the end of the tutorial: excavator-boom-control, temperature-control and garage-door-controller.

How to read the graphs​

The graphs show the same things the workspace draws for a run:

  • Lines are the inputs and outputs the simulation recorded, held between changes.
  • Lanes under the graph show each verification rule: green where it passed, red where it failed. A mode strip shows the state of a Mode rule.
  • Grey windows are the time a rule allows, such as a deadline after a trigger.
  • Bands are the range a rule allows, and the checked signal turns red where it failed.
  • Diamonds mark events, such as a response time or a settling point, green when within the rule and red when not.

See Rules on the graph for the full list.

More examples​