# Why does this Lyapunov Controller not converge to its reference state?

I am working with a three phase inverter. I have done a model of the system in DQ axis as follows:

$$\begin{gather} \dot{I}_{d} =-\frac{R}{L} I_{d} +\omega I_{q} +\frac{V_{dc}}{2L} S_{d}\\ \dot{I}_{q} =-\frac{R}{L} I_{q} -\omega I_{d} +\frac{V_{dc}}{2L} Sq\\ \notag\\ \notag \end{gather}$$

I have then used a Lyapunov controller to control the states as follows:

$$\begin{gather*} W=\frac{1}{2} e_{1}^{2} +\frac{1}{2} e_{2}^{2}\\ \dot{W} =e_{1}\dot{e}_{1} +e_{2}\dot{e}_{2} \end{gather*}$$

Where

$$\begin{gather*} \dot{e}_{1} =\dot{x_{1}} -\dot{x}_{1desired}\\ \dot{e}_{2} =\dot{x_{2}} -0 \end{gather*}$$

I then set the states

$$\begin{equation*} \dot{W} =-k_{1} e_{1}^{2} -k_{2} e_{2}^{2} \end{equation*}$$ by

$$\begin{gather*} \dot{e}_{1} =-k_{1} e_{1}\\ \dot{e}_{2} =-k_{2} e_{2} \end{gather*}$$

Finally I get the control inputs as

$$\begin{gather} S_{d} =\frac{2L}{V_{dc}}\left(\dot{x}_{1d} -\omega x_{2} +\frac{R}{L} x_{1} -k_{1} e_{1}\right)\\ S_{q} =\frac{2L}{V_{dc}}\left(\dot{x}_{2d} \ +\omega x_{1} +\frac{R}{L} x_{2} -k_{2} e_{2}\right) \end{gather}$$

I am using simulink to test this out, because I want to use a hardware in loop simulation on this. However I keep getting an offset in the output when I simulate this with simulink components.

Model Based:

Component Based:

This is quiet a high switching frequency as well, about 20KHz.

Any thoughts on what could be causing this and how I could rectify it ?

Thanks

• How are you simulating this, what ode solver, time step settings, ect.? Furthermore, what are the values of $k_1$, $k_2$ and what is $x_{1desired}(t)$? Commented Sep 14, 2022 at 20:43
• Hi Kwin, k_1 and k_2 are both at 10, x_1desired is constant 5. Solver I have tried is 45, 23 and 115 all at variable step - They seem to all produce this offset. If I increase k_1 I can get closer to x_1desired. However there is always the slight offset. I am trying to develop an observer and the higher I raise k_1 and k_2 the more it effects the observer. So I want to keep them as low as possible.
– SS1
Commented Sep 14, 2022 at 20:52
• If the theory is right, all what remains is a code mistake.
– KBS
Commented Sep 15, 2022 at 9:03
• What exactly do you mean with "component based"? How is it different to your "model based" simulation which is Simulink as well? Commented Sep 15, 2022 at 15:21
• The component block, universal bridge, PWM generator. Rather than model based, which is integrator blocks - the math way. I am unsure what this is called normally.
– SS1
Commented Sep 16, 2022 at 7:57