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

Classes

class  CoSimulation
 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...
struct  CoSimParticipantConfig
 The settings of CoSimParticipant. More...
class  CoSimParticipant
 One subsystem of a co-simulation, in a process or on a machine of its own. More...
class  CoSimSubsystem
 A part of a coupled system that a co-simulation steps on its own: a robot, a trailer, a motor, each with its own solver, coupled to the others only through its inputs and outputs. More...
class  OdeSubsystem
 A subsystem given by its equations: the state x moves with dx/dt = f(t, x, u), and the outputs are y = h(x, u). More...
struct  Connection
 Output output of subsystem from feeds input input of subsystem to. More...
class  CouplingLayout
 The subsystems of a co-simulation, their sizes, and which output feeds which input. More...
struct  CouplingConfig
 How a co-simulation couples its subsystems. More...
struct  CouplingState
 The inputs of every subsystem at the present time, and at the time before. More...
struct  MacroStepResult
 What one macro step did. More...

Typedefs

using try_step_type
 The outputs of every subsystem at the end of try iteration of a macro step, the subsystems having stepped with their inputs moving from begin to end.

Enumerations

enum class  CouplingScheme { JACOBI , GAUSS_SEIDEL }
 The order in which the subsystems of a macro step take their inputs. More...

Functions

MacroStepResult jacobi_step (const CouplingLayout &layout, const CouplingConfig &config, CouplingState &state, const try_step_type &try_step)
 One macro step of the Jacobi scheme, with as many tries as config allows.
std::vector< std::vector< real_t > > resolve_inputs (const CouplingLayout &layout, const std::function< std::vector< std::vector< real_t > >(const std::vector< std::vector< real_t > > &)> &outputs_of)
 The inputs at the start: outputs_of(inputs) gives the outputs of every subsystem for the inputs, and resolve() feeds them back as many times as there are subsystems, which is enough unless the direct feedthroughs form a loop.

Typedef Documentation

◆ try_step_type

Initial value:
std::function<std::vector<std::vector<real_t>>(
uint_t iteration, const std::vector<std::vector<real_t>> &begin,
const std::vector<std::vector<real_t>> &end)>
std::size_t uint_t
uint_t
Definition bitsim_types.h:40

The outputs of every subsystem at the end of try iteration of a macro step, the subsystems having stepped with their inputs moving from begin to end.

Enumeration Type Documentation

◆ CouplingScheme

enum class bitsim::cosim::CouplingScheme
strong

The order in which the subsystems of a macro step take their inputs.

Enumerator
JACOBI 

Every subsystem steps at the same time, with the inputs of the start of the step, or a guess of those of its end. With max_iterations > 1, the step is repeated with the inputs its outputs gave, until they agree: strong coupling.

GAUSS_SEIDEL 

The subsystems step one after the other, in the order of the layout, each with the outputs at the end of the step of those before it. It cannot step them in parallel.

Function Documentation

◆ jacobi_step()

MacroStepResult bitsim::cosim::jacobi_step ( const CouplingLayout & layout,
const CouplingConfig & config,
CouplingState & state,
const try_step_type & try_step )

One macro step of the Jacobi scheme, with as many tries as config allows.

try_step steps every subsystem, restoring its saved state first if iteration > 0, and returns the outputs of all of them. The next state of the inputs is what the outputs of the last try give.

◆ resolve_inputs()

std::vector< std::vector< real_t > > bitsim::cosim::resolve_inputs ( const CouplingLayout & layout,
const std::function< std::vector< std::vector< real_t > >(const std::vector< std::vector< real_t > > &)> & outputs_of )

The inputs at the start: outputs_of(inputs) gives the outputs of every subsystem for the inputs, and resolve() feeds them back as many times as there are subsystems, which is enough unless the direct feedthroughs form a loop.