Class System

Inheritance Relationships

Base Type

  • public handle

Class Documentation

class System : public handle

Class container for the system of Ordinary Differential Equations (ODEs) or Differential Algebraic Equations (DAEs). This class is the base class for more specific systems, such as the explicit, semi-explicit and implicit systems. The system must define the abstract methods. The system is defined by the following equations:

\[ \mathbf{F}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) = \mathbf{0} \]

with optional veils \( \mathbf{v}( \mathbf{x}, t ) \) of the form:

\[\begin{split} \mathbf{v}( \mathbf{x}, t ) = \left{\begin{array}{c} v_1( \mathbf{x}, t ) \\ v_2( \mathbf{x}, v_1, t ) \\ v_3( \mathbf{x}, v_1, v_2, t ) \\ \vdots \\ v_n( \mathbf{x}, v_1, \dots, v_{n-1}, t ) \end{array}\right. \end{split}\]

optional linear system for index-1 variables \mathbf{y} of the form:

\[ \mathbf{A}( \mathbf{x}, \mathbf{v}, t ) \mathbf{y} = \mathbf{b}( \mathbf{x}, \mathbf{v}, t ) \]

and optional invariants of the form:

\[ \mathbf{h}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) = \mathbf{0} \]

where \( \mathbf{x} \) are the unknown functions (states) of the independent variable \( t \).

Public Functions

function System(t_name, t_num_eqns, t_num_sysy, t_num_veil, t_num_invs)

Class constructor for a system that requires the following inputs:

Parameters
  • t_name – The name of the system.

  • t_num_eqns – The number of equations of the system.

  • t_num_sysy – The number of linear index-1 variables of the system.

  • t_num_veil – The number of (user-defined) veils of the system.

  • t_num_invs – The number of invariants of the system.

function get_name()

Get the system name.

Returns

The system name.

function get_num_eqns()

Get the number of equations of the system.

Returns

The number of equations of the system.

function set_num_eqns(t_num_eqns)

Set the number of equations of the system.

Parameters

t_num_eqns – The number of equations of the system.

function get_num_sysy()

Get the number of linear index-1 variables of the system.

Returns

The number of linear index-1 variables of the system.

function set_num_sysy(t_num_sysy)

Set the number of linear index-1 variables of the system.

Parameters

t_num_sysy – The number of linear index-1 variables of the system.

function get_num_veil()

Get the number of veils of the system.

Returns

The number of veils of the system.

function set_num_veil(t_num_veil)

Set the number of veils of the system.

Parameters

t_num_veil – The number of veils of the system.

function get_num_invs()

Get the number of invariants of the system.

Returns

The number of invariants of the system.

function set_num_invs(t_num_invs)

Set the number of invariants of the system.

Parameters

t_num_invs – The number of invariants of the system.

function y(x, v, t)

Calculate the linear states \( \mathbf{y} \).

Parameters
  • x – States \( \mathbf{x} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The linear states \( \mathbf{y} \).

function Jy_x(x, y, v, t)

Calculate the Jacobial of the linear states \( \mathbf{y} \) with respect to the states \( \mathbf{x} \):

\[ \dfrac{\partial}{\partial\mathbf{x}} \left[ \mathbf{A}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) \mathbf{y} - \mathbf{b}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) \right] = \mathbf{0} \]

which, if expanded applying the chain rule, can be written as:

\[ (\mathbf{TA}_{\mathbf{x}} + \mathbf{TA}_{\mathbf{v}}\mathbf{Jv}_{\mathbf{x}})\mathbf{y} + \mathbf{A}\mathbf{Jy}_\mathbf{x} = \mathbf{Jb}_{\mathbf{x}} + \mathbf{Jb}_{\mathbf{v}}\mathbf{Jv}_{\mathbf{x}} \]
Parameters
  • x – States \( \mathbf{x} \).

  • y – Linear states \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian of the linear states with respect to the states \mathbf{Jy}_\mathbf{x}.

virtual function F(x, x_dot, y, v, t)

Evaluate the system function \( \mathbf{F} \).

Parameters
  • x – States \( \mathbf{x} \).

  • x_dot – States derivatives \( \mathbf{x}' \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The system function \( \mathbf{F} \).

virtual function JF_x(x, x_dot, y, v, t)

Evaluate the Jacobian of the system function \( \mathbf{F} \) with respect to the states \( \mathbf{x} \):

\[ \mathbf{JF}_{\mathbf{x}}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{F}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) }{ \partial \mathbf{x} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • x_dot – States derivatives \( \mathbf{x}' \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{JF}_{\mathbf{x}} \).

virtual function JF_y(x, x_dot, y, v, t)

Evaluate the Jacobian of the system function \( \mathbf{F} \) with respect to the states \( \mathbf{x} \):

\[ \mathbf{JF}_{\mathbf{x}}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{F}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) }{ \partial \mathbf{x} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • x_dot – States derivatives \( \mathbf{x}' \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{JF}_{\mathbf{x}} \).

virtual function JF_x_dot(x, x_dot, y, v, t)

Evaluate the Jacobian of the system function \( \mathbf{F} \) with respect to the states derivative \( \mathbf{x}' \):

\[ \mathbf{JF}_{\mathbf{x}'}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{F}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) }{ \partial \mathbf{x}' }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • x_dot – States derivatives \( \mathbf{x}' \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{JF}_{\mathbf{x}'} \).

virtual function JF_v(x, x_dot, y, v, t)

Evaluate the Jacobian of the system function \( \mathbf{F} \) with respect to the veils \( \mathbf{v} \):

\[ \mathbf{JF}_{\mathbf{v}}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{F}( \mathbf{x}, \mathbf{x}', \mathbf{y}, \mathbf{v}, t ) }{ \partial \mathbf{v} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • x_dot – States derivatives \( \mathbf{x}' \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{JF}_{\mathbf{v}} \).

virtual function v(x, t)

Evaluate the system veils \( \mathbf{v} \):

\[ \mathbf{v}( \mathbf{x}, t ) = \mathbf{0}. \]
Parameters
  • x – States \( \mathbf{x} \).

  • t – Independent variable \( t \).

Returns

The system veils \( \mathbf{v} \)..

virtual function Jv_x(x, v, t)

Evaluate the Jacobian of the system veils \( \mathbf{v} \) with respect to the states \( \mathbf{x} \):

\[ \mathbf{Jv}_{\mathbf{x}}( \mathbf{x}, t ) = \dfrac{ \partial \mathbf{v}( \mathbf{x}, t ) }{ \partial \mathbf{x} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{Jv}_{\mathbf{x}} \).

virtual function h(x, y, v, t)

Evaluate the system invariants \( \mathbf{h} \):

\[ \mathbf{h}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) = \mathbf{0}. \]
Parameters
  • x – States \( \mathbf{x} \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The invariants \( \mathbf{h} \)..

virtual function Jh_x(x, y, v, t)

Evaluate the Jacobian of the system invariants \( \mathbf{h} \) with respect to the states \( \mathbf{x} \):

\[ \mathbf{Jh}_{\mathbf{x}}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{h}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) }{ \partial \mathbf{x} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{Jh}_{\mathbf{x}} \).

virtual function Jh_y(x, y, v, t)

Evaluate the Jacobian of the system invariants \( \mathbf{h} \) with respect to the veils \( \mathbf{v} \):

\[ \mathbf{Jh}_{\mathbf{v}}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{h} }{ \partial \mathbf{v} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{Jh}_{\mathbf{v}} \).

virtual function Jh_v(x, y, v, t)

Evaluate the Jacobian of the system invariants \( \mathbf{h} \) with respect to the veils \( \mathbf{v} \):

\[ \mathbf{Jh}_{\mathbf{v}}( \mathbf{x}, \mathbf{y}, \mathbf{v}, t ) = \dfrac{ \partial \mathbf{h} }{ \partial \mathbf{v} }. \]
Parameters
  • x – States \( \mathbf{x} \).

  • y – Linear index-1 variables \( \mathbf{y} \).

  • v – Veils \( \mathbf{v} \).

  • t – Independent variable \( t \).

Returns

The Jacobian \( \mathbf{Jh}_{\mathbf{v}} \).

virtual function whattype()

Get the system type.

Returns

The system type.

virtual function is_explicit()

Check if the system is explicit.

Returns

True if the system is explicit, false otherwise.

virtual function is_semiexplicit()

Check if the system is explicit.

Returns

True if the system is explicit, false otherwise.

virtual function is_implicit()

Check if the system is implicit.

Returns

True if the system is implicit, false otherwise.

virtual function in_domain(x, t)

Return true if (x,t) is in the domain of the DAE system.