bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
bitsim::cosim::CoSimParticipant Class Reference

One subsystem of a co-simulation, in a process or on a machine of its own. More...

#include <cosim_participant.h>

Inheritance diagram for bitsim::cosim::CoSimParticipant:
Collaboration diagram for bitsim::cosim::CoSimParticipant:

Public Member Functions

 CoSimParticipant (CouplingLayout layout, const std::string &name, CoSimSubsystem &subsystem, distributed::Transport &transport, const CouplingConfig &coupling={}, const CoSimParticipantConfig &config={})
 ~CoSimParticipant ()
void initialise (real_t t0=0.0)
 Find the inputs at time t0, with the others.
MacroStepResult step (real_t H)
 Advance by H, with the others.
void leave ()
 Tell the others that this participant stops.
real_t time () const noexcept
const std::vector< real_t > & inputs () const
 The inputs of this participant's subsystem at the present time.
const std::vector< real_t > & inputs (const std::string &name) const
 The inputs of subsystem name at the present time: every participant knows them.
const distributed::Synchroniser & synchroniser () const noexcept
uint_t total_iterations () const noexcept
uint_t n_not_converged () const noexcept

Detailed Description

One subsystem of a co-simulation, in a process or on a machine of its own.

Every subsystem of the layout is a participant, named after it, with its own CoSimParticipant; they meet through a bitsim::distributed::Transport. Every try of a macro step, a participant steps its subsystem, sends its outputs, and waits for those of the others, with bitsim::distributed::Synchroniser in lockstep. Every participant then has the outputs of every subsystem, and, from the layout that all share, works out the inputs of every subsystem, the residual, and whether to try again, so all agree without another message. The result is that of CoSimulation with the Jacobi scheme in one process, to the last bit.

Gauss-Seidel would make every participant wait for the ones before it, so it is not offered.

Constructor & Destructor Documentation

◆ CoSimParticipant()

bitsim::cosim::CoSimParticipant::CoSimParticipant ( CouplingLayout layout,
const std::string & name,
CoSimSubsystem & subsystem,
distributed::Transport & transport,
const CouplingConfig & coupling = {},
const CoSimParticipantConfig & config = {} )
Parameters
layoutthe layout of the whole co-simulation, the same on every participant
namethe subsystem this participant is
subsystemit; it must outlive this
transportwhere the participants meet; it must outlive this
couplinghow the subsystems couple, the same on every participant; Jacobi only
confighow long to wait for the others, and how often to send again

◆ ~CoSimParticipant()

bitsim::cosim::CoSimParticipant::~CoSimParticipant ( )
default

Member Function Documentation

◆ initialise()

void bitsim::cosim::CoSimParticipant::initialise ( real_t t0 = 0.0)

Find the inputs at time t0, with the others.

◆ inputs() [1/2]

const std::vector< real_t > & bitsim::cosim::CoSimParticipant::inputs ( ) const
inline

The inputs of this participant's subsystem at the present time.

◆ inputs() [2/2]

const std::vector< real_t > & bitsim::cosim::CoSimParticipant::inputs ( const std::string & name) const
inline

The inputs of subsystem name at the present time: every participant knows them.

◆ leave()

void bitsim::cosim::CoSimParticipant::leave ( )

Tell the others that this participant stops.

◆ n_not_converged()

uint_t bitsim::cosim::CoSimParticipant::n_not_converged ( ) const
inlinenoexcept

◆ step()

MacroStepResult bitsim::cosim::CoSimParticipant::step ( real_t H)

Advance by H, with the others.

◆ synchroniser()

const distributed::Synchroniser & bitsim::cosim::CoSimParticipant::synchroniser ( ) const
inlinenoexcept

◆ time()

real_t bitsim::cosim::CoSimParticipant::time ( ) const
inlinenoexcept

◆ total_iterations()

uint_t bitsim::cosim::CoSimParticipant::total_iterations ( ) const
inlinenoexcept

The documentation for this class was generated from the following files: