Class DynamicalSystem

Contents

Class DynamicalSystem#

Defined in Program listing for file kernel/src/modelingTools/DynamicalSystem.hpp

class DynamicalSystem#

Abstract interface to Dynamical Systems.

This class is used to describe dynamical systems of the form :

\( g(\dot x, x, t, z) = 0 \)

where

  • \( x \in R^{n} \) is the state.

  • \( z \in R^{zSize} \) is a vector of arbitrary algebraic variables, some sort of discret state. For example, z may be used to set some perturbation parameters, to control the system (z set by actuators) and so on.

  • \( g : R^{n} \times R \to R^{n} \) .

By default, the DynamicalSystem is considered to be an Initial Value Problem (IVP) and the initial conditions are given by

\( x(t_0)=x_0 \)

Under some specific conditions, the system can be written as:

\( \dot x = rhs(x, t, z) \)

In that case, \( \nabla_{\dot x} g \) must be invertible.

Subclassed by FirstOrderNonLinearDS, SecondOrderDS

Public Types

enum DSWorkVectorId#

List of indices used to save tmp work vectors The last value is the size of the present list, so you HAVE to leave it at the end position.

Values:

enumerator local_buffer#
enumerator freeresidu#
enumerator free#
enumerator acce_memory#
enumerator acce_like#
enumerator sizeWorkV#

Public Functions

inline virtual ~DynamicalSystem()#

destructor

virtual void initRhs(double time) = 0#

allocate (if needed) and compute rhs and its jacobian.

Parameters:

time – of initialization

virtual void initializeNonSmoothInput(unsigned int level) = 0#

set nonsmooth input to zero

Parameters:

level – input-level to be initialized.

void update(double time)#

compute all component of the dynamical system, for the current state.

Parameters:

time – current time (the one used to update ds component)

virtual void computeRhs(double time) = 0#

update right-hand side for the current state

Parameters:

time – of interest

virtual void computeJacobianRhsx(double time) = 0#

update \( \nabla_x rhs \) for the current state

Parameters:

time – of interest

virtual void resetAllNonSmoothParts() = 0#

reset nonsmooth part of the rhs, for all ‘levels’

virtual void resetNonSmoothPart(unsigned int level) = 0#

set nonsmooth part of the rhs to zero for a given level

Parameters:

level

inline size_t number() const#

returns the id of the dynamical system

inline size_t setNumber(size_t new_number)#

set the id of the DynamicalSystem

Returns:

the previous value of number

inline unsigned int n() const#

returns the size of the vector state x

inline virtual unsigned int dimension() const#

returns the dimension of the system (depends on system type, e.g.

n for first order, ndof for Lagrangian).

inline SP::SiconosVector x0() const#

returns a pointer to the initial state vector

inline const SiconosVector getX0() const#

get a copy of the initial state vector

void setX0(const SiconosVector &newValue)#

set initial state (copy)

Parameters:

newValue – input vector to copy

void setX0Ptr(SP::SiconosVector newPtr)#

set initial state (pointer link)

Parameters:

newPtr – vector (pointer) to set x0

inline SP::SiconosVector x() const#

returns a pointer to the state vector \( x \)

Returns:

SP::SiconosVector

inline const SiconosVector &getx() const#

get a copy of the current state vector \( x \)

Returns:

SiconosVector

void setX(const SiconosVector &newValue)#

set content of current state vector \( x \)

Parameters:

newValueSiconosVector

void setXPtr(SP::SiconosVector newPtr)#

set state vector \( x \) (pointer link)

Parameters:

newPtr – SP::SiconosVector

inline SP::SiconosVector r() const#

returns a pointer to r vector (input due to nonsmooth behavior)

Returns:

SP::SiconosVector

inline const SiconosVector getR() const#

get a copy of r vector (input due to nonsmooth behavior)

Returns:

a SiconosVector

void setR(const SiconosVector &newValue)#

set r vector (input due to nonsmooth behavior) content (copy)

Parameters:

newValueSiconosVector

void setRPtr(SP::SiconosVector newPtr)#

set r vector (input due to nonsmooth behavior) (pointer link)

Parameters:

newPtr – SP::SiconosVector newPtr

inline SP::SiconosVector rhs() const#

returns a pointer to the right-hand side vector, (i.e.

\( \dot x \))

Returns:

SP::SiconosVector

inline SiconosVector &getRhs() const#

get a copy of the right-hand side vector, (i.e.

\( \dot x \))

Returns:

SiconosVector

virtual void setRhs(const SiconosVector &newValue)#

set the value of the right-hand side, \( \dot x \)

Parameters:

newValueSiconosVector

virtual void setRhsPtr(SP::SiconosVector newPtr)#

set right-hand side, \( \dot x \) (pointer link)

Parameters:

newPtr – SP::SiconosVector

inline SP::SiconosMatrix jacobianRhsx() const#

returns a pointer to \( \nabla_x rhs()\)

Returns:

SP::SiconosMatrix

void setJacobianRhsx(const SiconosMatrix &newValue)#

set the value of \( \nabla_x rhs() \)

Parameters:

newValueSiconosMatrix

void setJacobianRhsxPtr(SP::SiconosMatrix newPtr)#

set \( \nabla_x rhs() \), pointer link

Parameters:

newPtr – SP::SiconosMatrix

inline SP::SiconosVector z() const#

returns a pointer to \( z \), the vector of algebraic parameters.

Returns:

SP::SiconosVector

inline const SiconosVector &getz() const#

get a copy of \( z \), the vector of algebraic parameters.

Returns:

a SiconosVector

void setz(const SiconosVector &newValue)#

set the value of \( z \) (copy)

Parameters:

newValueSiconosVector

void setzPtr(SP::SiconosVector newPtr)#

set \( z \) (pointer link)

Parameters:

newPtr – SP::SiconosVector

inline SiconosMemory &xMemory()#

get all the values of the state vector x stored in a SiconosMemory object (not const due to LinearSMC::actuate)

Returns:

a reference to the SiconosMemory object

inline const SiconosMemory &xMemory() const#

get all the values of the state vector x stored in a SiconosMemory object

Returns:

a const reference to the SiconosMemory object

inline unsigned int stepsInMemory() const#

returns the number of step saved in memory for state vector

Returns:

int

inline void setStepsInMemory(unsigned int steps)#

set number of steps to be saved

Parameters:

steps

virtual void initMemory(unsigned int steps)#

initialize the SiconosMemory objects: reserve memory for i vectors in memory and reset all to zero.

Parameters:

steps – the size of the SiconosMemory (i)

virtual void swapInMemory() = 0#

push the current values of x and r in memory (index 0 of memory is the last inserted vector) xMemory and rMemory,

virtual void updatePlugins(double time) = 0#

call all plugged functions for the current state

Parameters:

time – the current time

virtual void resetToInitialState() = 0#

reset the state x() to the initial state x0

inline virtual bool isLinear()#
Returns:

true if the system is linear

virtual void display(bool brief = true) const = 0#

print the data of the dynamical system on the standard output

Public Static Functions

static inline size_t resetCount(size_t new_count = 0)#

reset the global DynamicSystem counter (for ids)

Returns:

the previous value of count