soft4pes.control.mpc.solvers.utils#
Utility functions for MPC solvers.
Functions#
|
Check if a candidate three-phase switch position violates a switching constraint. |
|
Compute the squared weighted second norm of a vector. The elements of the norm are weighted by |
|
Create the QP matrices. |
|
Make Gamma matrix for the QP. |
|
Make Upsilon matrix for the QP. |
Module Contents#
- soft4pes.control.mpc.solvers.utils.switching_constraint_violated(nl, u_abc, u_km1_abc)[source]#
Check if a candidate three-phase switch position violates a switching constraint. A three-level converter is not allowed to directly switch from -1 and 1 (and vice versa) on one phase.
- Parameters:
nl (int) – Number of converter voltage levels.
u_abc (1 x 3 ndarray of ints) – three-phase switch position.
u_km1_abc (1 x 3 ndarray of ints) – Previously applied three-phase switch position.
- Returns:
Constraint violated.
- Return type:
bool
- soft4pes.control.mpc.solvers.utils.squared_weighted_second_norm(vector, Q)[source]#
Compute the squared weighted second norm of a vector. The elements of the norm are weighted by the weighting matrix Q, i.e. sqrt(x.T * Q * x)^2 = x.T * Q * x.
- Parameters:
vector (ndarray) – Vector.
Q (ndarray) – Weighting matrix.
- Returns:
Squared weighted second norm.
- Return type:
float
- soft4pes.control.mpc.solvers.utils.make_QP_matrices(sys, ctr)[source]#
Create the QP matrices.
- Parameters:
sys (system object) – System model.
ctr (controller object) – Controller object.
- Returns:
Namespace containing the QP matrices.
- Return type:
SimpleNamespace
- soft4pes.control.mpc.solvers.utils.make_Gamma(Np, C, A)[source]#
Make Gamma matrix for the QP.
- Parameters:
Np (int) – Prediction horizon.
C (ndarray) – Output matrix of the system.
A (ndarray) – State matrix of the system.
- Returns:
Gamma matrix.
- Return type:
ndarray
- soft4pes.control.mpc.solvers.utils.make_Upsilon(Np, C, A, B)[source]#
Make Upsilon matrix for the QP.
- Parameters:
Np (int) – Prediction horizon.
C (ndarray) – Output matrix of the system.
A (ndarray) – State matrix of the system.
B (ndarray) – Input matrix of the system.
- Returns:
Upsilon matrix.
- Return type:
ndarray