Skip to content

Instantly share code, notes, and snippets.

@baggepinnen
Last active August 4, 2022 15:55
Show Gist options
  • Save baggepinnen/bf3cd3c945ab9e552928c4dd2eda93e9 to your computer and use it in GitHub Desktop.
Save baggepinnen/bf3cd3c945ab9e552928c4dd2eda93e9 to your computer and use it in GitHub Desktop.
Specification of the trimming problem.

Trimming

givne a system $\dot x = f(x, u)$ where $x$ are state variables and $u$ control inputs, we want to find a trim point $x_t, u_t$ that satisfies a set of trim conditions. In the absence of any user-specified conditions, this reduces to finding a stationary point $$0 = f(x,u)$$ i.e., $\dot x = 0$ is typically an implicit trim condition.

The user-specified trim conditions may take many forms, for example

  • $x_i \approx 5$ should be close to 5 (called a soft constraint)
  • $x_i = 5$ should be exactly 5 (called a hard constraint)
  • $\dot{x}_i$ is free, i.e., is not bound to be 0 like the other derivatives.
  • $-10 < u_i < 10$ may specify inequality constraints (may be more complicated than this).

After structural_simplify, we may get a system where some states in $x$ have been moved to observed, let $x_r$ be the reduced state vector and $x_o$ be the observed states.

Cost function

The cost function looks something like this

$\sum_i (x_i - x_i^d)^2 + \sum_i (\dot{x}_i - \dot{x}_i^d)^2$

$\text{subject to} \quad c_0(\dot x, x, u) = 0$

$\text{subject to} \quad c_1(\dot x, x, u) \leq 0$

where $x_i^d$ specifies a desired value for $x_i$, and $c_0, c_1$ are constraint functions that indicate the hard constraints.

Issues

Specification of the loss function and $c_0, c_1$ despite $x$ having been split up in $x_r, x_o$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment