Proportionnal Resonant Controller
Introduction.
The Proportionnal Resonant
Controller
is dedicated to follow a sinusoidal reference.
It is design to minimized phase shift and amplitude error.
The \(\phi'\) variable is dedicated to reduce delay generated by the calculation and the PWM.
Parameters:
Here the continuous transfer function representation of the Proportionnal resonant.
Where:
- \(\omega_0\) is the pulsation in [rad/s]
- \(\phi'\) is the compensation delay in [rad]
controller are sampled
We show here the continuous form of the function we want to implement. But calculation are sampled. Relationship to Laplace transform
Discretization:
Using the \(z\)-transform we get the following form:
As there's a direct relation between \(z^{-1}\) and \(q^{-1}\) the delay operator, we can write the reccuring equations we will use in the code.
With:
Use of the Proportionnal Resonant Controller
.
The use of the Pr
is based on 3 steps.
- Object instanciation (declaration).
- Initialisation.
- Execution.
Example
For each Controller
like (Pid
, Rst
, Pr
) we have to define a parameter structure.
We define constants used to initialize the parameter structure.
#include "pr.h"
static float32_t Kp = 0.001F;
static float32_t Kr = 300.0F;
static float32_t w0 = 2 * PI * 50.0F;
static float32_t phase_shift = 0.0F;
static float32_t upper_bound = 1.0F;
static float32_t lower_bound = -1.0F;
static float32_t Ts = 100.0e-6F;
We define the parameter structure. Each parameter is defined here.
We define the variable prop_res
which is a Pr
object.
In the setup_routine()
of the OwnTech Power API,
you must initialize the Pr
with its parameters.
In the loop_critical_task()
you can call the method calculateWithReturn()
which have two arguments:
- the reference
- the measure.
Remind that the loop_critical_task()
is called every 100µs.
new_command
is the result of the pr calculation for one step.
Example
You can find the use with a grid forming example which generate an AC voltage source.