siconos.kernel.DynamicalSystem (Python class)

class siconos.kernel.DynamicalSystem(*args)[source]

Bases: object

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.

Generated class (swig), based on C++ header Program listing for file kernel/src/modelingTools/DynamicalSystem.hpp.

computeJacobianRhsx(time: double) → void[source]

computeJacobianRhsx(double time)=0 -> None

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

Parameters:time – of interest
computeRhs(time: double) → void[source]

computeRhs(double time)=0 -> None

update right-hand side for the current state

Parameters:time – of interest
dimension() → int[source]

returns the dimension of the system (n for first order, ndof for Lagrangian).

Useful to avoid if(typeOfDS) when size is required.

display() → void[source]

display() =0 -> None

print the data of the dynamical system on the standard output

getR() -> array_like (np.float64, 1D)[source]

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

Returns:a SiconosVector
getRhs() -> array_like (np.float64, 1D)[source]

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

\(\dot x\))

Returns:SiconosVector
getX0() -> array_like (np.float64, 1D)[source]

get a copy of the initial state vector

getx() -> array_like (np.float64, 1D)[source]

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

Returns:SiconosVector
getz() -> array_like (np.float64, 1D)[source]

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

Returns:a SiconosVector
initMemory(int steps) → None[source]

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

Parameters:steps – the size of the SiconosMemory (i)
initRhs(time: double) → void[source]

initRhs(double time)=0 -> None

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

Parameters:time – of initialization
initializeNonSmoothInput(level: unsigned int) → void[source]

initializeNonSmoothInput( int level)=0 -> None

set nonsmooth input to zero

Parameters:level – input-level to be initialized.
isLinear() → bool[source]

True if the system is linear.

Returns:a boolean
jacobianRhsx() -> array_like (np.float64, 2D)[source]

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

Returns:SP::SiconosMatrix
n() → int[source]

returns the size of the vector state x

number() → int[source]

returns the id of the dynamical system

r() -> array_like (np.float64, 1D)[source]

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

Returns:SP::SiconosVector
resetAllNonSmoothParts() → void[source]

resetAllNonSmoothParts()=0 -> None

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

static resetCount(int new_count=0) → int[source]

reset the global DynamicSystem counter (for ids)

Returns:the previous value of count
resetNonSmoothPart(level: unsigned int) → void[source]

resetNonSmoothPart( int level)=0 -> None

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

Parameters:level
resetToInitialState() → None[source]

reset the state x() to the initial state x0

rhs() -> array_like (np.float64, 1D)[source]

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

\(\dot x\))

Returns:SP::SiconosVector
setJacobianRhsx(array_like (np.float64, 2D) newValue) → None[source]

set the value of :math:`nabla_x rhs()`$

Parameters:newValue – SiconosMatrix
setJacobianRhsxPtr(array_like (np.float64, 2D) newPtr) → None[source]

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

Parameters:newPtr – SP::SiconosMatrix
setNumber(int new_number) → int[source]

set the id of the DynamicalSystem

Returns:the previous value of number
setR(array_like (np.float64, 1D) newValue) → None[source]

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

Parameters:newValue – SiconosVector
setRPtr(array_like (np.float64, 1D) newPtr) → None[source]

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

Parameters:newPtr – SP::SiconosVector newPtr
setRhs(array_like (np.float64, 1D) newValue) → None[source]

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

Parameters:newValue – SiconosVector
setRhsPtr(array_like (np.float64, 1D) newPtr) → None[source]

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

Parameters:newPtr – SP::SiconosVector
setStepsInMemory(int steps) → None[source]

set number of steps to be saved

Parameters:steps
setX(array_like (np.float64, 1D) newValue) → None[source]

set content of current state vector \(x\)

Parameters:newValue – SiconosVector
setX0(array_like (np.float64, 1D) newValue) → None[source]

set initial state (copy)

Parameters:newValue – input vector to copy
setX0Ptr(array_like (np.float64, 1D) newPtr) → None[source]

set initial state (pointer link)

Parameters:newPtr – vector (pointer) to set x0
setXPtr(array_like (np.float64, 1D) newPtr) → None[source]

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

Parameters:newPtr – SP::SiconosVector
setz(array_like (np.float64, 1D) newValue) → None[source]

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

Parameters:newValue – SiconosVector
setzPtr(array_like (np.float64, 1D) newPtr) → None[source]

set \(z\) (pointer link)

Parameters:newPtr – SP::SiconosVector
stepsInMemory() → int[source]

returns the number of step saved in memory for state vector

Returns:int
swapInMemory() → void[source]

swapInMemory()=0 -> None

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

update(double time) → None[source]

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

Parameters:time – current time (the one used to update ds component)
updatePlugins(time: double) → void[source]

updatePlugins(double time)=0 -> None

call all plugged functions for the current state

Parameters:time – the current time
x() -> array_like (np.float64, 1D)[source]

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

Returns:SP::SiconosVector
x0() -> array_like (np.float64, 1D)[source]

returns a pointer to the initial state vector

xMemory(*args)[source]

Warning - Overloaded function : multiple signatures available, check prototypes below.

xMemory() → SiconosMemory[source]

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
xMemory() → SiconosMemory[source]

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

Returns:a const reference to the SiconosMemory object
z() -> array_like (np.float64, 1D)[source]

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

Returns:SP::SiconosVector