Skip to contents

linearization_function(sys, inputs, outputs) compiles sys with the given inputs and outputs and returns a list with lin_fun, a function of (u, p, t) returning the Jacobian blocks f_x, f_z, g_x, g_z, f_u, g_u, h_x, h_z, h_u of $$x' = f(x, z, u), \quad 0 = g(x, z, u), \quad y = h(x, z, u)$$ at a consistent point (algebraic unknowns are solved for first), and the simplified system sys. u and p are numeric vectors ordered as unknowns(sys) and the problem parameters of sys; inputs have become parameters. linearize() is the higher level interface.

Usage

linearization_function(
  sys,
  inputs,
  outputs,
  op = list(),
  t = 0,
  simplify = FALSE,
  initialize = TRUE,
  guesses = list(),
  p = list(),
  zero_dummy_der = FALSE,
  ignore_system_initial_conditions = FALSE,
  loop_openings = list(),
  loop_opening_params = list(),
  loop_opening_drivers = list(),
  system_modifier = identity,
  verbose = TRUE,
  ...
)

Arguments

sys

A System (not compiled).

inputs, outputs

Lists of variables, or analysis points.

op

Operating point: values of unknowns, parameters and inputs.

t

Time of the linearization.

simplify

Passed to mtkcompile().

initialize

Solve for consistent algebraic unknowns.

guesses

Initial guesses for algebraic unknowns.

p

Further parameter values.

zero_dummy_der

Set the values of unknowns added by compilation (dummy derivatives) to zero.

ignore_system_initial_conditions

Ignore the initial conditions of the system and use only op.

loop_openings

Analysis points whose connections are removed.

loop_opening_params, loop_opening_drivers

Opened signals and the variables that drove them (set by the analysis functions).

system_modifier

A function applied to the system before compilation.

verbose

Warn about an empty operating point.

...

Passed to mtkcompile().

Value

A list with lin_fun (class LinearizationFunction) and sys.

Details

When inputs are analysis points (or their names) they are transformed with linearization_ap_transform() first.

Examples

t <- t_nounits; D <- D_nounits
x <- Variable("x", t); u <- Variable("u", t, input = TRUE)
sys <- System(list(D(x) ~ -2 * x + u), t, name = "s")
lf <- linearization_function(sys, list(u), list(x), op = list(x ~ 0, u ~ 0))
blocks <- lf$lin_fun(c(0), c(0), 0)
blocks$f_x
#>      [,1]
#> [1,]   -2