$darkmode
#include <simulation_machine.hpp>
Public Member Functions | |
| void | run (SimulationContext &ctx) |
| void | run_machine (StateId initial, SimulationContext &ctx) |
| StateId | run_state_async (StateId id, SimulationContext &ctx) |
| void | pause () |
| void | resume () |
| void | stop () |
| void | succeed () |
| void | fail () |
| void | reset () |
| void | abort () |
| StateId | handle_interrupt (StateId nominal, StateId interrupt, SimulationContext &ctx) override |
| DEFINE_STATE (CONNECT, Connect) | |
| DEFINE_STATE (PROBE, Probe) | |
| DEFINE_STATE (START, Start) | |
| DEFINE_STATE (STEP_BEGIN, StepBegin) | |
| DEFINE_STATE (STEP_SIMULATORS, StepSimulators) | |
| DEFINE_STATE (STEP_CONTROLLERS, StepControllers) | |
| DEFINE_STATE (STEP_END, StepEnd) | |
| DEFINE_STATE (PAUSE, Pause) | |
| DEFINE_STATE (RESUME, Resume) | |
| DEFINE_STATE (SUCCESS, Success) | |
| DEFINE_STATE (FAIL, Fail) | |
| DEFINE_STATE (ABORT, Abort) | |
| DEFINE_STATE (STOP, Stop) | |
| DEFINE_STATE (RESET, Reset) | |
| DEFINE_STATE (KEEP_ALIVE, KeepAlive) | |
| DEFINE_STATE (DISCONNECT, Disconnect) | |
Friends | |
| void | to_json (cloe::Json &j, const SimulationMachine &m) |
The SimulationMachine is statemachine with the given set of states and simulation context.
The state transitions are given by the states themselves and are not stored in the simulation machine itself.
The entry-point for this simulation machine is the run() method.
If you want to modify the simulation flow, you need to do this with the simulation context and by adding a new transition from the desired state. You may need to add a new state, which you can do in this file by defining it and then registering it in the SimulationMachine constructor.
|
inlineoverridevirtual |
Handle an interrupt.
This method will be called between states, with the nominal state that would have occurred being passed along.
Implements engine::StateMachine< State< SimulationMachine, SimulationContext >, SimulationContext >.
|
inline |
This is the main entry-point of the simulation.
This should be used even if you have a shortened simulation flow, like CONNECT -> PROBING -> DISCONNECT.
|
inline |
Starting with the initial state, keep running states until the sentinel state (nullptr) has been reached.
|
inline |
Run state in a separate thread asynchronously and abort if watchdog_timeout is exceeded.
See configuration: stack.hpp See documentation: doc/reference/watchdog.rst