Feedforward

class InterpolationTrajectory(t, u, **kwargs)

Bases: pyinduct.simulation.SimulationInput

Provides a system input through one-dimensional linear interpolation in the given vector u .

Parameters
  • t (array_like) – Vector t with time steps.

  • u (array_like) – Vector u with function values, evaluated at t.

  • **kwargs – see below

Keyword Arguments
  • show_plot (bool) – to open a plot window, showing u(t).

  • scale (float) – factor to scale the output.

get_plot(self)

Create a plot of the interpolated trajectory.

Todo

the function name does not really tell that a QtEvent loop will be executed in here

Returns

the PlotWindow widget.

Return type

(pg.PlotWindow)

scale(self, scale)
class RadFeedForward(l, T, param_original, bound_cond_type, actuation_type, n=80, sigma=None, k=None, length_t=None, y_start=0, y_end=1, **kwargs)

Bases: pyinduct.trajectory.InterpolationTrajectory

Class that implements a flatness based control approach for the reaction-advection-diffusion equation

\dot x(z,t) = a_2 x''(z,t) + a_1 x'(z,t) + a_0 x(z,t)

with the boundary condition

  • bound_cond_type == "dirichlet": x(0,t)=0

    • A transition from x'(0,0)=y0 to x'(0,T)=y1 is considered.

    • With x'(0,t) = y(t) where y(t) is the flat output.

  • bound_cond_type == "robin": x'(0,t) = \alpha \, x(0,t)

    • A transition from x(0,0)=y0 to x(0,T)=y1 is considered.

    • With x(0,t) = y(t) where y(t) is the flat output.

and the actuation

  • actuation_type == "dirichlet": x(l,t)=u(t)

  • actuation_type == "robin": x'(l,t) = -\beta x(l,t) + u(t).

The flat output trajectory y(t) will be calculated with gevrey_tanh().

Parameters
  • l (float) – Domain length.

  • t_end (float) – Transition time.

  • param_original (tuple) – Tuple holding the coefficients of the pde and boundary conditions.

  • bound_cond_type (string) – Boundary condition type. Can be dirichlet or robin, see above.

  • actuation_type (string) – Actuation condition type. Can be dirichlet or robin, see above.

  • n (int) – Derivative order to provide (defaults to 80).

  • sigma (number.Number) – sigma value for gevrey_tanh().

  • k (number.Number) – K value for gevrey_tanh().

  • length_t (int) – length_t value for gevrey_tanh().

  • y0 (float) – Initial value for the flat output.

  • y1 (float) – Desired value for the flat output after transition time.

  • **kwargs – see below. All arguments that are not specified below are passed to InterpolationTrajectory .

class SecondOrderOperator(a2=0, a1=0, a0=0, alpha1=0, alpha0=0, beta1=0, beta0=0, domain=- np.inf, np.inf)

Interface class to collect all important parameters that describe a second order ordinary differential equation.

Parameters
  • a2 (Number or callable) – coefficient a_2.

  • a1 (Number or callable) – coefficient a_1.

  • a0 (Number or callable) – coefficient a_0.

  • alpha1 (Number) – coefficient \alpha_1.

  • alpha0 (Number) – coefficient \alpha_0.

  • beta1 (Number) – coefficient \beta_1.

  • beta0 (Number) – coefficient \beta_0.

static from_dict(param_dict, domain=None)
static from_list(param_list, domain=None)
get_adjoint_problem(self)

Return the parameters of the operator A^* describing the the problem

(\textup{A}^*\psi)(z) = \bar a_2 \partial_z^2 \psi(z)
+ \bar a_1 \partial_z \psi(z)
+ \bar a_0 \psi(z) \:,

where the \bar a_i are constant and whose boundary conditions are given by

\bar\alpha_1 \partial_z \psi(z_1) + \bar\alpha_0 \psi(z_1)
  &= 0 \\
\bar\beta_1 \partial_z \psi(z_2) + \bar\beta_0 \psi(z_2)
  &= 0 .

The following mapping is used:

\bar a_2 = a_2,  \quad\bar a_1 = -a_1, \quad\bar a_0 = a_0, \\
\bar\alpha_1 = -1, \quad
     \bar\alpha_0 = \frac{a_1}{a_2} - \frac{\alpha_0}{\alpha_1}
     , \\
\bar\beta_1 = -1, \quad
    \bar\beta_0 = \frac{a_1}{a_2} - \frac{\beta_0}{\beta_1} \:.

Returns

Parameter set describing A^* .

Return type

SecondOrderOperator

eliminate_advection_term(param, domain_end)

This method performs a transformation

\tilde x(z,t)=x(z,t)
e^{\int_0^z \frac{a_1(\bar z)}{2 a_2}\,d\bar z} ,

on the system, which eliminates the advection term a_1 x(z,t) from a reaction-advection-diffusion equation of the type:

\dot x(z,t) = a_2 x''(z,t) + a_1(z) x'(z,t) + a_0(z) x(z,t) .

The boundary can be given by robin

x'(0,t) = \alpha x(0,t), \quad x'(l,t) = -\beta x(l,t) ,

dirichlet

x(0,t) = 0, \quad x(l,t) = 0

or mixed boundary conditions.

Parameters
  • param (array_like) – \Big( a_2, a_1, a_0, \alpha, \beta \Big)^T

  • domain_end (float) – upper bound of the spatial domain

Raises
  • TypeError – If a_1(z) is callable but no derivative handle is

  • defined for it.

Returns

Parameters

\big(a_2, \tilde a_1=0, \tilde a_0(z),
\tilde \alpha, \tilde \beta \big) for

the transformed system

\dot{\tilde{x}}(z,t) = a_2 \tilde x''(z,t) +
\tilde a_0(z) \tilde x(z,t)

and the corresponding boundary conditions (\alpha and/or \beta set to None by dirichlet boundary condition).

Return type

SecondOrderOperator or tuple

gevrey_tanh(T, n, sigma=1.1, K=2, length_t=None)

Provide Gevrey function

\eta(t) = \left\{ \begin{array}{lcl}
    0 & \forall & t<0 \\
    \frac{1}{2} + \frac{1}{2}\tanh \left(K \frac{2(2t-1)}
    {(4(t^2-t))^\sigma} \right) & \forall & 0\le t \le T \\
    1 & \forall & t>T  \end{array} \right.

with the Gevrey-order \rho=1+\frac{1}{\sigma} and the derivatives up to order n.

Note

For details of the recursive calculation of the derivatives see:

Rudolph, J., J. Winkler und F. Woittennek: Flatness Based Control of Distributed Parameter Systems: Examples and Computer Exercises from Various Technological Domains (Berichte aus der Steuerungs- und Regelungstechnik). Shaker Verlag GmbH, Germany, 2003.

Parameters
  • T (numbers.Number) – End of the time domain=[0, T].

  • n (int) – The derivatives will calculated up to order n.

  • sigma (numbers.Number) – Constant \sigma to adjust the Gevrey order \rho=1+\frac{1}{\sigma} of \varphi(t).

  • K (numbers.Number) – Constant to adjust the slope of \varphi(t).

  • length_t (int) – Ammount of sample points to use. Default: int(50 * T)

Returns

  • numpy.array([[\varphi(t)], … , [\varphi^{(n)}(t)]])

  • t: numpy.array([0,…,T])

Return type

tuple

power_series_flat_out(z, t, n, param, y, bound_cond_type)

Provides the solution x(z,t) (and the spatial derivative x'(z,t)) of the pde

\dot x(z,t) = a_2 x''(z,t) + \underbrace{a_1 x'(z,t)}_{=0}
+ a_0 x(z,t), \qquad a_1 = 0, \qquad z\in(0,l), \qquad t\in(0,T)

as power series approximation:

  • for the boundary condition (bound_cond_type == "dirichlet") x(0,t)=0 and the flat output y(t) = x'(0,t) with

    x(z,t) = \sum_{n=0}^\infty \frac{z^{2n+1}}{a_2^n(2n+1)!}
\sum_{k=0}^n \binom{n}{k}(-a_0)^{n-k}y^{(k)}(t)

  • for the boundary condition (bound_cond_type == "robin") x'(0,t) = \alpha \, x(0,t) and the flat output y(t) = x(0,t) with

    x(z,t) = \sum_{n=0}^\infty
\left( 1 + \alpha\frac{z}{2n+1}\right)
\frac{z^{2n}}{a_2^{n}(2n)!}
\sum_{k=0}^{n} \binom{n}{k}(-a_0)^{n-k}y^{(k)}(t).

Parameters
  • z (array_like) – [0, ..., l]

  • t (array_like) – [0, ... , T]

  • n (int) – Series termination index.

  • param (array_like) –

    Parameters

    [a_2, a_1, a_0, \alpha, \beta]

    • \alpha=\text{None} for bound_cond_type == dirichlet

    • beta is not used from this function but has to be provided (for now)

  • y (array_like) –

    Flat output y(t) and derivatives:

    [[y(0), ..., y(T)],...,[y^{(n/2)}(0), ..., y^{(n/2)}(T)]].

  • bound_cond_type (str) – dirichlet or robin

Returns

Solution x(z,t) of the pde and the spatial derivative x'(z,t).

Return type

tuple