$darkmode
simulation.cpp File Reference
#include "simulation.hpp"
#include <filesystem>
#include <fstream>
#include <string>
#include <vector>
#include <cloe/data_broker.hpp>
#include <fable/utility.hpp>
#include <fable/utility/sol.hpp>
#include "coordinator.hpp"
#include "lua_api.hpp"
#include "server.hpp"
#include "simulation_context.hpp"
#include "simulation_machine.hpp"
#include "simulation_probe.hpp"
#include "simulation_result.hpp"
#include "utility/command.hpp"
Include dependency graph for simulation.cpp:

Detailed Description

See also
simulation.hpp

This file provides the simulation state machine.

The following flow diagram shows how the states of a simulation are traversed in a typical simulation. The nominal flow is rendered in solid lines, while irregular situations are rendered in dashed lines.

                    ┌──────────────────────┐
      +------------ │       Connect        │
      |             └──────────────────────┘
      |                        │
      |                        ▼
      |             ┌──────────────────────┐
      +---...       │        Start         │ <-------------------------+
      |             └──────────────────────┘                           |
      |                        │                                       |
      |                        ▼                                       |
      |             ┌──────────────────────┐          +-----------+    |
      +---...       │      StepBegin       │ ◀──┐<--- |   Resume  |    |
      |             └──────────────────────┘    │     +-----------+    |
      |                        │                │           ^          |
      |                        ▼                │           |          |
      |             ┌──────────────────────┐    │           |          |
      +---...       │    StepSimulators    │    │           |          |
      |             └──────────────────────┘    │           |          |
      |                        │                │           |          |
      |                        ▼                │           |          |
      |             ┌──────────────────────┐    │           |          |
      +---...       │    StepControllers   │    │           |          |
      |             └──────────────────────┘    │           |          |
      |                        │                │           |          |
      v                        ▼                │           |          |
+-----------+       ┌──────────────────────┐    │     +-----------+    |
|   Abort   |       │       StepEnd        │ ───┘---> |   Pause   |    |
+-----------+       └──────────────────────┘          +-----------+    |
    |    |                     │                         |     ^       |
    |    |             failure │ success                 |     |       |
    |    |                     ▼                         +-----+       |
    |    |          ┌──────────────────────┐          +-----------+    |
    |    +--------> │        Stop          │ -------> |   Reset   | ---+
    |               └──────────────────────┘          +-----------+
    |                          │
    |                          ▼
    |               ┌──────────────────────┐
    +-------------> │      Disconnect      │
                    └──────────────────────┘

Note that not all possible transitions or states are presented in the above diagram; for example, it is possible to go into the Abort state from almost any other state. Neither can one see the constraints that apply to the above transitions; for example, after Abort, the state machine may go into the Stop state, but then will in every case go into the Disconnect state and never into the Reset state.