soft4pes.control.mpc.controllers#

Model predictive control (MPC) for power electronic systems.

Submodules#

Classes#

LCLVcMpcCtr

Model predictive control (MPC) for the control of the capacitor voltage.

IMMpcCurrCtr

Model predictive current control for an induction machine. The controller aims to track

RLGridMpcCurrCtr

Model predictive control (MPC) for RL grid. The controller aims to track

Package Contents#

class soft4pes.control.mpc.controllers.LCLVcMpcCtr(solver, lambda_u, Np, I_conv_max=1.2, xi_I_conv=1000000.0, disc_method='exact_discretization')[source]#

Bases: soft4pes.control.common.controller.Controller

Model predictive control (MPC) for the control of the capacitor voltage.

Parameters:
  • solver (solver object) – Solver for an MPC algorithm.

  • lambda_u (float) – Weighting factor for the control effort.

  • Np (int) – Prediction horizon steps.

  • disc_method (str, optional) – Discretization method for the state-space model. Default is ‘exact_discretization’.

  • I_conv_max (float) – Maximum converter current [p.u.].

  • xi_I_conv (float) – Slack variable weight for the current constraint.

solver#

Solver for MPC.

Type:

solver object

lambda_u#

Weighting factor for the control effort.

Type:

float

Np#

Prediction horizon.

Type:

int

disc_method#

Discretization method for the state-space model.

Type:

str

u_km1_abc#

Previous (step k-1) three-phase switch position or modulating signal.

Type:

1 x 3 ndarray of floats

state_space#

The state-space model of the system.

Type:

SimpleNamespace

vg#

Grid voltage [p.u.].

Type:

1 x 2 ndarray of floats

R#

Weight matrix for the soft constraints.

Type:

1 x 1 ndarray of floats

c#

State constraints.

Type:

1 x 1 ndarray of floats

C_constr#

Output matrix for the constrained states.

Type:

2 x 6 ndarray of ints

C#

System output matrix.

Type:

2 x 6 ndarray of ints

Q#

Weighting matrix for the output variables.

Type:

2 x 2 ndarray of ints

execute(sys, kTs)[source]#

Perform MPC and save the controller data.

Parameters:
  • sys (system object) – System model.

  • kTs (float) – Current discrete time instant [s].

Returns:

SimpleNameSpace containing the converter three-phase switch position or modulating signal.

Return type:

SimpleNamespace

get_next_state(sys, xk, u_abc, k)[source]#

Get the next state of the system.

Parameters:
  • sys (system object) – The system model.

  • xk (1 x 6 ndarray of floats) – The current state of the system.

  • u_abc (1 x 3 ndarray of floats) – Converter three-phase switch position or modulating signal.

  • k (int) – The solver prediction step.

Returns:

The next state of the system.

Return type:

1 x 6 ndarray of floats

class soft4pes.control.mpc.controllers.IMMpcCurrCtr(solver, lambda_u, Np, disc_method='forward_euler')[source]#

Bases: soft4pes.control.common.controller.Controller

Model predictive current control for an induction machine. The controller aims to track the stator current in the alpha-beta frame. The current reference is calculated based on the torque reference.

Parameters:
  • solver (solver object) – Solver for an MPC algorithm.

  • lambda_u (float) – Weighting factor for the control effort.

  • Np (int) – Prediction horizon.

  • disc_method (str, optional) – Discretization method for the state-space model. Default is ‘forward_euler’.

lambda_u#

Weighting factor for the control effort.

Type:

float

Np#

Prediction horizon steps.

Type:

int

disc_method#

Discretization method for the state-space model.

Type:

str

u_km1_abc#

Previous (step k-1) three-phase switch position or modulating signal.

Type:

1 x 3 ndarray of floats

state_space#

The state-space model of the system.

Type:

SimpleNamespace

solver#

Solver for MPC.

Type:

solver object

C#

Output matrix.

Type:

2 x 4 ndarray of ints

execute(sys, kTs)[source]#

Perform MPC.

Parameters:
  • sys (system object) – System model.

  • kTs (float) – Current discrete time instant [s].

Returns:

Three-phase switch position or modulating signals.

Return type:

1 x 3 ndarray of floats

get_next_state(sys, xk, u_abc, k)[source]#

Get the next state of the system.

Parameters:
  • sys (system object) – The system model.

  • xk (1 x 4 ndarray of floats) – The current state of the system.

  • u_abc (1 x 3 ndarray of floats) – Converter three-phase switch position or modulating signal.

  • k (int) – The solver prediction step.

Returns:

The next state of the system.

Return type:

1 x 4 ndarray of floats

class soft4pes.control.mpc.controllers.RLGridMpcCurrCtr(solver, lambda_u, Np, disc_method='forward_euler')[source]#

Bases: soft4pes.control.common.controller.Controller

Model predictive control (MPC) for RL grid. The controller aims to track the grid current in the alpha-beta frame.

Parameters:
  • solver (solver object) – Solver for an MPC algorithm.

  • lambda_u (float) – Weighting factor for the control effort.

  • Np (int) – Prediction horizon steps.

  • disc_method (str, optional) – Discretization method for the state-space model. Default is ‘forward_euler’.

lambda_u#

Weighting factor for the control effort.

Type:

float

Np#

Prediction horizon.

Type:

int

disc_method#

Discretization method for the state-space model.

Type:

str

u_km1_abc#

Previous (step k-1) three-phase switch position or modulating signal.

Type:

1 x 3 ndarray of floats

state_space#

The state-space model of the system.

Type:

SimpleNamespace

solver#

Solver for MPC.

Type:

solver object

vg#

Grid voltage [p.u.].

Type:

1 x 2 ndarray of floats

C#

Output matrix.

Type:

2 x 2 ndarray of ints

execute(sys, kTs)[source]#

Perform MPC and save the controller data.

Parameters:
  • sys (system object) – System model.

  • kTs (float) – Current discrete time instant [s].

Returns:

Three-phase switch position or modulating signals.

Return type:

1 x 3 ndarray of floats

get_next_state(sys, xk, u_abc, k)[source]#

Get the next state of the system.

Parameters:
  • sys (system object) – The system model.

  • xk (1 x 2 ndarray of floats) – The current state of the system.

  • u_abc (1 x 3 ndarray of floats) – Converter three-phase switch position or modulating signal.

  • k (int) – The solver prediction step.

Returns:

The next state of the system.

Return type:

1 x 2 ndarray of floats