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

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...

#include <cosim_subsystem.h>

Inheritance diagram for bitsim::cosim::CoSimSubsystem:

Public Member Functions

virtual ~CoSimSubsystem ()=default
virtual uint_t n_inputs () const =0
virtual uint_t n_outputs () const =0
virtual std::vector< real_t > outputs (const std::vector< real_t > &inputs) const =0
 The outputs at the present time, with the inputs at the present time.
virtual void do_step (real_t t, real_t H, const std::vector< real_t > &u_begin, const std::vector< real_t > &u_end)=0
 Advance from t to t + H, the inputs moving linearly from u_begin to u_end.
virtual void save ()=0
 Remember the present state.
virtual void restore ()=0
 Go back to the state save() remembered.

Detailed Description

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.

The interface follows that of a co-simulation unit of the Functional Mock-up Interface: the master gives the inputs, asks the subsystem to advance by a macro step, and reads the outputs. Over a step from t to t + H the inputs move linearly from u_begin to u_end, so a subsystem can interpolate them within its own smaller steps; a master that does not know u_end yet passes a guess.

To couple tightly, the master repeats a macro step until the inputs and the outputs agree. It calls save() before the first try and restore() before every other, so the subsystem must be able to go back to the state it saved.

Constructor & Destructor Documentation

◆ ~CoSimSubsystem()

virtual bitsim::cosim::CoSimSubsystem::~CoSimSubsystem ( )
virtualdefault

Member Function Documentation

◆ do_step()

virtual void bitsim::cosim::CoSimSubsystem::do_step ( real_t t,
real_t H,
const std::vector< real_t > & u_begin,
const std::vector< real_t > & u_end )
pure virtual

Advance from t to t + H, the inputs moving linearly from u_begin to u_end.

Implemented in bitsim::cosim::OdeSubsystem.

◆ n_inputs()

virtual uint_t bitsim::cosim::CoSimSubsystem::n_inputs ( ) const
pure virtual

Implemented in bitsim::cosim::OdeSubsystem.

◆ n_outputs()

virtual uint_t bitsim::cosim::CoSimSubsystem::n_outputs ( ) const
pure virtual

Implemented in bitsim::cosim::OdeSubsystem.

◆ outputs()

virtual std::vector< real_t > bitsim::cosim::CoSimSubsystem::outputs ( const std::vector< real_t > & inputs) const
pure virtual

The outputs at the present time, with the inputs at the present time.

Outputs that depend on the inputs directly, a force computed from a position that comes in, are called direct feedthrough; the master resolves them, see CoSimulation.

Implemented in bitsim::cosim::OdeSubsystem.

◆ restore()

virtual void bitsim::cosim::CoSimSubsystem::restore ( )
pure virtual

Go back to the state save() remembered.

Implemented in bitsim::cosim::OdeSubsystem.

◆ save()

virtual void bitsim::cosim::CoSimSubsystem::save ( )
pure virtual

Remember the present state.

Implemented in bitsim::cosim::OdeSubsystem.


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