system

class system(f, nx, nu, system_type='discrete', sampling_rate=1.0, t0=0.0, method='cvodes')[source]

A class used to define the system dynamics of an optimal control problem.

The dynamics can be discrete or continuous. A discrete system is defined by a difference equation

\[x(t_{k+1}) = f(t_k,x(t_k),u(t_k))\]

and a continous system is defined by the ordinary differential equation

\[\dot{x}(t_k)=f(t_k,x(t_k),u(t_k))).\]

In the letter case the differential equation will be discretized by a choosen integration method.

Parameters:
  • f (callable) – Function defining the right hand side of the system dynamics of the form \(f(t,x,u)\) or \(f(x,u)\) in the autonomous case. See also f.

  • nx (int) – Dimension of the state. Must be a positive integer. See also nx.

  • nu (int) – Dimension of the control. Must be a positive integer. See also nu.

  • system_type (str, optional) – String defining if the given system dynamics are discrete or continuous. The default is ‘discrete’.

  • sampling_rate (float, optional) – Sampling rate defining at which time instances the dynamics are evaluated. The default is 1.

  • t0 (float, optional) – Initial time for the optimal control problem. The default is 0. See also t0.

  • method (str, optional) – String defining which integration method should be used to discretize the system dynamics. The default is ‘cvodes’. For further informations about the provided integrators see method.

Attributes

system.autonomous

If True, the system is time-invariant.

system.f

Right hand side \(f(t,x,u)\) of the system dynamics.

system.h

Sampling time \(h\) of the system.

system.method

Integration method for discretization of the dynamics.

system.nu

Dimension of the control.

system.nx

Dimension of the state.

system.system_type

String defining whether the dynamics are discrete or continuous.

system.t0

Initial time of the optimal control problem.

system.type

Indicating whether the system dynamics are linear.

Methods

system.LQP

Initialize the system with linear dynamics.

system.load

Loads a nMPyC system object from a file.

system.save

Saving the system to a given file with dill.

system.set_integratorOptions

Set options for the integration method.

system.system

Evaluate right hand side \(f(t,x,u)\) of the dynamics.

system.system_discrete

Evaluate discretized right hand side of the system dynamics.