2. Defining a system¶
Since casiopeia uses CasADi, the user first has to define the considered system using CasADi symbolic variables (of type MX). Afterwards, the symbolic variables which define states, controls, parameters, etc. of the system can be brought into connection by creating a casiopeia.System
object.
-
class
casiopeia.system.
System
(u='MX(u)', q='MX(q)', p=None, x='MX(x)', eps_u='MX(eps_u)', phi=None, f='MX(f)', g='MX(g)')[source]¶ The class
System
is used to define non-dynamic, explicit ODE- or fully implicit DAE-systems systems within casiopeia.Raises: TypeError, NotImplementedError
Parameters: - u (casadi.casadi.MX) – time-varying controls \(u \in \mathbb{R}^{\text{n}_\text{u}}\) that are applied piece-wise-constant for each control intervals, and therefor can change from on interval to another, e. g. motor dutycycles, temperatures, massflows (optional)
- q (casadi.casadi.MX) – time-constant controls \(q \in \mathbb{R}^{\text{n}_\text{q}}\) that are constant over time, e. g. initial mass concentrations of reactants, elevation angles (optional)
- p (casadi.casadi.MX) – unknown parameters \(p \in \mathbb{R}^{\text{n}_\text{p}}\)
- x (casadi.casadi.MX) – differential states \(x \in \mathbb{R}^{\text{n}_\text{x}}\) (optional)
- eps_u (casadi.casadi.MX) – input errors \(\epsilon_{u} \in \mathbb{R}^{\text{n}_{\epsilon_\text{u}}}\) (optional)
- phi (casadi.casadi.MX) – output function \(\phi(u, q, x, p) = y \in \mathbb{R}^{\text{n}_\text{y}}\)
- f (casadi.casadi.MX) – explicit system of ODEs \(f(u, q, x, p, \epsilon_\text{u}) = \dot{x} \in \mathbb{R}^{\text{n}_\text{x}}\) (optional)
- g (casadi.casadi.MX) – equality constraints \(g(u, q, p) = 0 \in \mathbb{R}^{\text{n}_\text{g}}\) (optional)
Depending on the inputs the user provides, the
System
is interpreted as follows:Non-dynamic system (x = None):
\[ \begin{align}\begin{aligned}y = \phi(u, q, p)\\0 = g(u, q, p).\end{aligned}\end{align} \]Explicit ODE system (x != None):
\[\begin{split}y & = & \phi(u, q, x, p) \\ \dot{x} & = & f(u, q, x, p, \epsilon_\text{u}).\end{split}\]
This system object can now be used within the casiopeia simulation, parameter estimation and optimum experimental design classes.