|
bitsim
Model, simulate, estimate and control robots in C++
|
A co-simulation in one process: the master algorithm that steps coupled subsystems, each with its own solver, and passes the outputs of each to the inputs of the others. More...
#include <co_simulation.h>


Public Member Functions | |
| CoSimulation (const CouplingConfig &config=CouplingConfig()) | |
| void | add (const std::string &name, CoSimSubsystem &subsystem) |
| Add a subsystem; it must outlive this. | |
| void | connect (const std::string &from, uint_t output, const std::string &to, uint_t input) |
| void | initialise (real_t t0=0.0) |
| Check the layout and find the inputs at time t0. | |
| MacroStepResult | step (real_t H) |
| Advance every subsystem by H. | |
| void | set_pool (utils::concurrency::ThreadPool *pool) noexcept |
| Step the subsystems of a try on the threads of pool; nullptr steps them one after the other on this thread. | |
| real_t | time () const noexcept |
| const CouplingLayout & | layout () const noexcept |
| const CouplingConfig & | config () const noexcept |
| const std::vector< real_t > & | inputs (const std::string &name) const |
| The inputs of subsystem name at the present time. | |
| uint_t | total_iterations () const noexcept |
| The tries of all the macro steps so far. | |
| uint_t | n_not_converged () const noexcept |
| The macro steps that ended without converging. | |
A co-simulation in one process: the master algorithm that steps coupled subsystems, each with its own solver, and passes the outputs of each to the inputs of the others.
The subsystems only meet every macro step H, so between two meetings each sees the others' outputs as a guess: held from the start of the step, or extrapolated. That is loose coupling, the Jacobi scheme with one try, and its error grows with H; with a stiff coupling, a stiff spring between two bodies for one, it can make the simulation unstable. Strong coupling repeats every macro step, with the inputs that the outputs of the last try gave, until they agree within a tolerance; it costs more tries per step, and allows much longer steps. Gauss-Seidel lets each subsystem use the new outputs of those before it.
In the Jacobi scheme the subsystems of a try step at the same time, on the threads of a pool if one is set, and the result does not depend on the threads. CoSimParticipant runs the same scheme with every subsystem in a process or on a machine of its own, and gives the same result to the last bit.
|
inlineexplicit |
| void bitsim::cosim::CoSimulation::add | ( | const std::string & | name, |
| CoSimSubsystem & | subsystem ) |
Add a subsystem; it must outlive this.
|
inlinenoexcept |
|
inline |
| void bitsim::cosim::CoSimulation::initialise | ( | real_t | t0 = 0.0 | ) |
Check the layout and find the inputs at time t0.
| const std::vector< real_t > & bitsim::cosim::CoSimulation::inputs | ( | const std::string & | name | ) | const |
The inputs of subsystem name at the present time.
|
inlinenoexcept |
|
inlinenoexcept |
The macro steps that ended without converging.
|
inlinenoexcept |
Step the subsystems of a try on the threads of pool; nullptr steps them one after the other on this thread.
| MacroStepResult bitsim::cosim::CoSimulation::step | ( | real_t | H | ) |
Advance every subsystem by H.
|
inlinenoexcept |
|
inlinenoexcept |
The tries of all the macro steps so far.