# File kernel/src/simulationTools/ZeroOrderHoldOSI.hpp¶

Go to the source code of this file

Time-Integrator for linear dynamical systems using the Zero-Order Hold (ZOH) method.

Variables

const unsigned int ZOHSTEPSINMEMORY = 1
class ZeroOrderHoldOSI : public OneStepIntegrator
#include <ZeroOrderHoldOSI.hpp>

ZeroOrderHoldOSI Time-Integrator for Dynamical Systems.

See User’s guide for details.

ZeroOrderHoldOSI class is used to define some time-integrators methods for a list of dynamical systems. A ZeroOrderHoldOSI instance is defined by the value of theta and the list of concerned dynamical systems. Each DynamicalSystem is associated to

• computeFreeState(): computes xfree of dynamical systems state without taking the non-smooth part into account
• updateState(): update the state x of the dynamical systems

Public Types

enum ZeroOrderHoldOSI_ds_workVector_id

Values:

RESIDU_FREE
FREE
DELTA_X_FOR_RELATION
WORK_LENGTH
enum ZeroOrderHoldOSI_interaction_workBlockVector_id

Values:

xfree
DELTA_X
BLOCK_WORK_LENGTH
enum ZeroOrderHoldOSI_interaction_workVector_id

Values:

OSNSP_RHS
H_ALPHA
WORK_INTERACTION_LENGTH

Public Functions

ZeroOrderHoldOSI()

basic constructor

virtual ~ZeroOrderHoldOSI()

destructor

ACCEPT_STD_VISITORS()

visitors hook

get $$\Phi$$ corresponding to DynamicalSystem ds

Return
pointer to a SiconosMatrix
Parameters

virtual bool addInteractionInIndexSet(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be included in the IndexSet of level i.

Return
true if y<=0
Parameters
• inter: a pointer to the Interaction to be added
• i: the level of the IndexSet

const SiconosMatrix &Bd(SP::DynamicalSystem ds)

get $$B_d$$ corresponding to DynamicalSystem ds

Return
pointer to a SiconosMatrix
Parameters

virtual void computeFreeOutput(InteractionsGraph::VDescriptor &vertex_inter, OneStepNSProblem *osnsp)

Compute the Output (y) which corresponds to the free state (state without taking into account the nonsmooth input) plus the possible contribution of the nslaw.

Parameters
• vertex_inter: of the interaction graph
• osnsp: a pointer to the OneStepNSProblem

virtual void computeFreeState()

Perform the integration of the dynamical systems linked to this integrator without taking into account the nonsmooth input (_r or _p)

double computeResidu()

return the maximum of all norms for the “ZeroOrderHoldOSI-discretized” residus of DS

Return
a double

void display()

Displays the data of the ZeroOrderHoldOSI’s integrator.

void initializeWorkVectorsForDS(double t, SP::DynamicalSystem ds)

initialization of the ZeroOrderHoldOSI integrator

initialization of the work vectors and matrices (properties) related to one dynamical system on the graph and needed by the osi

Parameters
• t: time of initialization
• ds: the dynamical system

void initializeWorkVectorsForInteraction(Interaction &inter, InteractionProperties &interProp, DynamicalSystemsGraph &DSG)

initialization of the work vectors and matrices (properties) related to one interaction on the graph and needed by the osi

Parameters
• inter: the interaction
• interProp: the properties on the graph
• DSG: the dynamical systems graph

void integrate(double &tinit, double &tend, double &tout, int &notUsed)

integrate the system, between tinit and tend (->iout=true), with possible stop at tout (->iout=false)

Parameters

unsigned int numberOfIndexSets() const

get the number of index sets required for the simulation

Return
unsigned int

void prepareNewtonIteration(double time)

Unused.

Parameters
• time: current time

virtual bool removeInteractionFromIndexSet(SP::Interaction inter, unsigned int i)

Apply the rule to one Interaction to known if is it should be removed in the IndexSet of level i.

Return
true if y>0
Parameters
• inter: a pointer to the Interaction to be removed
• i: the level of the IndexSet

void updateMatrices(SP::DynamicalSystem ds)
virtual void updateState(const unsigned int level)

updates the state of the Dynamical Systems

Parameters
• level: level of interest for the dynamics: not used at this moment

Protected Functions

ACCEPT_SERIALIZATION(ZeroOrderHoldOSI)

serialization hooks

Protected Attributes

bool _useGammaForRelation

Unused for now.

Friends

friend _NSLEffectOnFreeOutput