functionlinearize2

Linearize a model at the start time, or optionally after simulation up to a given time instant, and return it as StateSpace object

Extends from Modelica.Icons.Function (Icon for functions).

Information

This function initializes a Modelica model and then simulates the model until time instant "t_linearize". If t_linearize=0, no simulation takes place (only initialization). At the simulation stop time, the model is linearized in such a form that

  • all top-level signals with prefix "input" are treated as inputs u(t) of the model,
  • all top-level signals with prefix "output" are treated as outputs y(t) of the model,
  • all variables that appear differentiated and that are selected as states at this time instant are treated as states x of the model.

Formally, the non-linear hybrid differential-algebraic equation system is therefore treated as the following ordinary equation system at time instant t_linearize:

der(x) = f(x,u)
    y  = g(x,u) 

Taylor series expansion (linearization) of this model around the simulation stop time t_linearize:

u0 = u(t_linearize)
y0 = y(t_linearize)
x0 = x(t_linearize)

and neglecting higher order terms results in the following system:

der(x0 + dx) = f(x0,u0) + der(f,x)*dx + der(f,u)*du
    y0 + dy  = g(x0,u0) + der(g,x)*dx + der(g,u)*du

where der(f,x) is the partial derivative of f with respect to x, and the partial derivatives are computed at the linearization point t_linearize. Re-ordering of terms gives (note der(x0) = 0):

der(dx) = der(f,x)*dx + der(f,u)*du + f(x0,u0)
    dy  = der(g,x)*dx + der(g,u)*du + (g(x0,u0) - y0)

or

der(dx) = A*dx + B*du + f0
    dy  = C*dx + D*du

This function returns the matrices A, B, C, D and assumes that the linearization point is a steady-state point of the simulation (i.e., f(x0,u0) = 0). Additionally, the full Modelica names of all inputs, outputs and states shall be returned if possible (default is to return empty name strings).

Inputs

TypeNameDefaultDescription
StringmodelNameName of the Modelica model
Modelica_LinearSystems2.Records.SetParameter[:]modelParamfill(Modelica_LinearSystems2.Records.SetParameter(Name = "", Value = 0.0), 0)Values of model parameters used for linearization
Modelica_LinearSystems2.Records.SimulationOptionsForLinearizationsimulationSetupModelica_LinearSystems2.Records.SimulationOptionsForLinearization()Simulation options

Outputs

TypeNameDefaultDescription
Modelica_LinearSystems2.StateSpacessModelica_LinearSystems2.StateSpace.Internal.read_dslin(fileName)Linearized system as StateSpace object

Contents

NameDescription
setModelParamprotected