Engee documentation

trim

Search for dynamic system operating points.

Library

EngeeControlSystems

Description

Function trim uses the Sequential quadratic programming (SQP) method to find workpoints. The function can search for adjustment points that satisfy the conditions imposed on the state variables, input and output variables of the model, as well as balancing points at which the system has non-zero derivative values.

Syntax

Function call

  • x, u, y, dx, options = trim(model) — finds the equilibrium point of the model model in the vicinity of the initial state vector x0. The found equilibrium point minimizes the absolute value of the expression . If the function cannot find an equilibrium point in the vicinity of the initial state vector, then it returns the point closest to the equilibrium point. The found equilibrium point minimizes the absolute value of the vector of derivatives of the model. You can define the initial state vector using the command engee.model.

  • x, u, y, dx, options = trim(model, x0, u0, y0) — finds the equilibrium point of the model model in the vicinity of the initial state vectors x0, entrance u0 and exit y0, which minimizes the absolute value of the trajectory .

  • x, u, y, dx, options = trim(model, x0, u0, y0, ix, iu, iy) — finds the equilibrium point of the model model in the vicinity of the initial state vectors x0, entrance u0 and exit y0 given the vectors of the indices of the elements of the initial vectors of the state ix, entrance iu and exit iy. These indexes indicate the states that should remain unchanged as a result of the optimization process. If the function cannot find an equilibrium point that strictly satisfies the set conditions, then it returns the nearest point that minimizes the absolute value of the trajectory. .

  • x, u, y, dx, options = trim(model, x0, u0, y0, ix, iu, iy, dx0, idx) — finds the working points of the model model in the vicinity of the initial state vectors x0, entrance u0 and exit y0 given the vectors of the indices of the elements of the initial vectors of the state ix, entrance iu and exit iy in which it has nonzero derivative values. Parameter dx0 sets the initial approximations of the derivatives of the model state variables, and the parameter idx specifies the indexes of the elements of the initial vector of derivatives, which should remain unchanged as a result of the optimization process.

  • x, u, y, dx, options = trim(model, x0, u0, y0, ix, iu, iy, dx0, idx, options) — finds the operating points of the model using an optimization algorithm, the parameters of which are set by the input argument options.

The function also returns the value options, which contains information about the optimization process.

Arguments

Input arguments

# model — the name of the model

+ line

Details

The name of the model without the file extension.

Типы данных

String

# x0 is the initial state vector

+ nothing | scalar | vector

Details

Initial approximations of the model state variables.

Типы данных

Nothing, Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# u0 is the initial input vector

+ nothing | scalar | vector

Details

Initial approximations of the model’s input variables.

Типы данных

Nothing, Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# y0 is the initial output vector

+ nothing | scalar | vector

Details

Initial approximations of the output variables of the model.

Типы данных

Nothing, Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# ix — indexes of elements of the initial state vector

+ nothing | scalar | vector

Details

The ordinal numbers of the fixed components of the initial state vector.

Типы данных

Nothing, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# iu — indexes of the elements of the initial input vector

+ nothing | scalar | vector

Details

The ordinal numbers of the fixed components of the initial input vector.

Типы данных

Nothing, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# iy — indexes of the elements of the initial output vector

+ nothing | scalar | vector

Details

The ordinal numbers of the fixed components of the initial output vector.

Типы данных

Nothing, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# dx0 is the initial vector of derivatives

+ nothing | scalar | vector

Details

Initial approximations of the derivatives of the model state variables.

Типы данных

Nothing, Float16, Float32, Float64, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# idx — indexes of elements of the initial vector of derivatives

+ nothing | scalar | vector

Details

The ordinal numbers of the components of the initial vector of derivatives, the values of which should remain unchanged as a result of the optimization process.

Типы данных

Nothing, Int8, Int16, Int32, Int64, UInt8, UInt16, UInt32, UInt64

Support for complex numbers

None

# options — optimization options

+ mutable composite type

Details

Optimization parameters recorded in the TrimOptions structure. The structure has the following fields and default values:

  • verbose::Bool = false — enable/disable the output of optimization progress messages;

  • computation_precision::Float64 = 1e−4 — the required accuracy of the calculation of the operating point;

  • search_precision::Float64 = 1e−4 — the required accuracy of solving the optimization problem;

  • derivatives_precision::Float64 = 1e−6 — the required accuracy of calculating the derived variables of the model state;

  • goal_function_value::Float64 = 0.0 — the value of the objective function;

  • iterations::Int64 = 1 — the number of iterations in the search process;

  • gradient_evaluations::Int64 = 1 — the number of gradient calculations;

  • equality_constraints::Int64 = 0 — the number of restrictions in the form of equality;

  • max_function_evaluations::Int64 = 0 — the maximum number of calculations of the objective function;

  • gradient_min_diff::Float64 = 1e−8 — the minimum value of the number that characterizes the accuracy of finding the minimum;

  • gradient_max_diff::Float64 = 0.1 — the maximum value of the number that characterizes the accuracy of finding the minimum;

  • step_length::Float64 = 1.0 — the step value.

Типы данных

TrimOptions

Output arguments

# x — operating point

+ vector

Details

The operating point.

Типы данных

Float64

# u is the input vector corresponding to the operating point

+ vector

Details

The input vector corresponding to the operating point.

Типы данных

Float64

# y is the output vector corresponding to the operating point

+ vector

Details

The output vector corresponding to the operating point.

Типы данных

Float64

# dx is the vector of derivatives corresponding to the operating point

+ vector

Details

The vector of derivatives corresponding to the operating point.

Типы данных

Float64

# options — optimization options

+ mutable composite type

Details

Optimization parameters recorded in the TrimOptions structure. The structure has the following fields and default values:

  • verbose::Bool = false — enable/disable the output of optimization progress messages;

  • computation_precision::Float64 = 1e−4 — the required accuracy of the calculation of the operating point;

  • search_precision::Float64 = 1e−4 — the required accuracy of solving the optimization problem;

  • derivatives_precision::Float64 = 1e−6 — the required accuracy of calculating the derived variables of the model state;

  • goal_function_value::Float64 = 0.0 — the value of the objective function;

  • iterations::Int64 = 1 — the number of iterations in the search process;

  • gradient_evaluations::Int64 = 1 — the number of gradient calculations;

  • equality_constraints::Int64 = 0 — the number of restrictions in the form of equality;

  • max_function_evaluations::Int64 = 0 — the maximum number of calculations of the objective function;

  • gradient_min_diff::Float64 = 1e−8 — the minimum value of the number that characterizes the accuracy of finding the minimum;

  • gradient_max_diff::Float64 = 0.1 — the maximum value of the number that characterizes the accuracy of finding the minimum;

  • step_length::Float64 = 1.0 — the step value.

Типы данных

TrimOptions