ControlSystem
System Constructors
ModelingToolkit.ControlSystem — Typestruct ControlSystem <: ModelingToolkit.AbstractControlSystemA system describing an optimal control problem. This contains a loss function and ordinary differential equations with control variables that describe the dynamics.
Fields
lossThe Loss function
eqsThe ODEs defining the system.
ivIndependent variable.
statesDependent (state) variables.
controlsControl variables.
psParameter variables.
observednameName: the name of the system
systemssystems: The internal systems
default_u0default_u0: The default initial conditions to use when initial conditions are not supplied in
ODEProblem.
default_pdefault_p: The default parameters to use when parameters are not supplied in
ODEProblem.
Example
using ModelingToolkit
@variables t x(t) v(t) u(t)
D = Differential(t)
loss = (4-x)^2 + 2v^2 + u^2
eqs = [
D(x) ~ v
D(v) ~ u^3
]
sys = ControlSystem(loss,eqs,t,[x,v],[u],[])Composition and Accessor Functions
sys.eqsorequations(sys): The equations that define the system.sys.statesorstates(sys): The set of states in the system.sys.parametersorparameters(sys): The parameters of the system.sys.controlsorcontrols(sys): The control variables of the system
Transformations
ModelingToolkit.runge_kutta_discretize — Functionrunge_kutta_discretize(sys::ControlSystem,dt,tspan;
tab = ModelingToolkit.constructRadauIIA5())Transforms a nonlinear optimal control problem into a constrained OptimizationProblem according to a Runge-Kutta tableau that describes a collocation method. Requires a fixed dt over a given timespan. Defaults to using the 5th order RadauIIA tableau, and altnerative tableaus can be specified using the SciML tableau style.