Control¶
- class IntegralTerm(integrand, limits, scale=1.0)¶
Bases:
EquationTerm
Class that represents an integral term in a weak equation.
- Parameters:
integrand –
limits (tuple) –
scale –
- class ScalarTerm(argument, scale=1.0)¶
Bases:
EquationTerm
Class that represents a scalar term in a weak equation.
- Parameters:
argument –
scale –
- class SimulationInput(name='')¶
Bases:
object
Base class for all objects that want to act as an input for the time-step simulation.
The calculated values for each time-step are stored in internal memory and can be accessed by
get_results()
(after the simulation is finished).Note
Due to the underlying solver, this handle may get called with time arguments, that lie outside of the specified integration domain. This should not be a problem for a feedback controller but might cause problems for a feedforward or trajectory implementation.
- clear_cache()¶
Clear the internal value storage.
When the same SimulationInput is used to perform various simulations, there is no possibility to distinguish between the different runs when
get_results()
gets called. Therefore this method can be used to clear the cache.
- get_results(time_steps, result_key='output', interpolation='nearest', as_eval_data=False)¶
Return results from internal storage for given time steps.
- Raises:
Error – If calling this method before a simulation was run.
- Parameters:
time_steps – Time points where values are demanded.
result_key – Type of values to be returned.
interpolation – Interpolation method to use if demanded time-steps are not covered by the storage, see
scipy.interpolate.interp1d()
for all possibilities.as_eval_data (bool) – Return results as
EvalData
object for straightforward display.
- Returns:
Corresponding function values to the given time steps.
- class SimulationInputSum(inputs)¶
Bases:
SimulationInput
Helper that represents a signal mixer.
- class StateFeedback(control_law)¶
Bases:
Feedback
Base class for all feedback controllers that have to interact with the simulation environment.
- Parameters:
control_law (
WeakFormulation
) – Variational formulation of the control law.
- class WeakFormulation(terms, name, dominant_lbl=None)¶
Bases:
object
This class represents the weak formulation of a spatial problem. It can be initialized with several terms (see children of
EquationTerm
). The equation is interpreted as- Parameters:
terms (list) – List of object(s) of type EquationTerm.
name (string) – Name of this weak form.
dominant_lbl (string) – Name of the variable that dominates this weak form.
- get_parabolic_robin_backstepping_controller(state, approx_state, d_approx_state, approx_target_state, d_approx_target_state, integral_kernel_ll, original_beta, target_beta, scale=None)¶
Build a modal approximated backstepping controller , for the (open loop-) diffusion system with reaction term, robin boundary condition and robin actuation
such that the closed loop system has the desired dynamic of the target system
where are controller parameters.
The control design is performed using the backstepping method, whose integral transform
maps from the original system to the target system.
Note
For more details see the example script
pyinduct.examples.rad_eq_const_coeff
that implements the example from [WoiEtAl17] .- Parameters:
state (list of
ScalarTerm
’s) – Measurement / value from simulation of .approx_state (list of
ScalarTerm
’s) – Modal approximated .d_approx_state (list of
ScalarTerm
’s) – Modal approximated .approx_target_state (list of
ScalarTerm
’s) – Modal approximated .d_approx_target_state (list of
ScalarTerm
’s) – Modal approximated .integral_kernel_ll (
numbers.Number
) –Integral kernel evaluated at :
original_beta (
numbers.Number
) – Coefficient of the original system.target_beta (
numbers.Number
) – Coefficient of the target system.scale (
numbers.Number
) – A constant to scale the control law: .
- Returns:
- Return type:
[WoiEtAl17]Frank Woittennek, Marcus Riesmeier and Stefan Ecklebe; On approximation and implementation of transformation based feedback laws for distributed parameter systems; IFAC World Congress, 2017, Toulouse
- scale_equation_term_list(eqt_list, factor)¶
Temporary function, as long
EquationTerm
can only be scaled individually.- Parameters:
eqt_list (list) – List of
EquationTerm
’sfactor (numbers.Number) – Scale factor.
- Returns:
Scaled copy of
EquationTerm
’s (eqt_list).
- split_domain(n, a_desired, l, mode='coprime')¶
Consider a domain which is divided into the two sub domains and with the discretization and a partition .
Calculate two numbers and with such that is odd and is close to
a_desired
.- Parameters:
n (int) – Number of sub-intervals to create (must be odd).
a_desired (float) – Desired partition size .
l (float) – Length of the interval.
mode (str) –
Operation mode to use:
’coprime’: and are coprime (default) .
’force_k2_as_prime_number’: is a prime number ( and are coprime)
’one_even_one_odd’: One is even and one is odd.