MPPT P&O algorithm implementing on RT BOX1

Hi

I had finished P&O by C-script to control boost converter , and the power provided by solar panel will flow through three-phase inverter control by spwm, then feed to grid.

My question is :
When I was running simulation, everything is fine . Then observe P-V curve make sure that it working on maximum power point successfully.

But when implementing on RT box. Even thought it can generate correct AC current to the grid. But because maximum power point is unstable, so it leads AC current variation.

How to fix it ?

Best regards

MPPT.plecs (236 KB)

The main driver for the issue is because the PV models become unstable when connected in series and discretized. The problem is also apparent in the offline CodeGen simulation, which I used to analyze this.

There are a few drivers:

The PV model is very numerically sensitive to the terminal conditions of the PV panel due to its exponential nature.The electrical model of the PV panel has no states (i.e. no capacitors/inductors). This means that the voltage at the PV panel terminals and diodes can “jump”.The series connected PV panel immediately influences the voltage of the adjacent panel.The PV panel filter time constant is 1e-5 which is very close to your model discretization step size, meaning the filter has a limited effect. You would want this to be larger.A solution to the interfacing issue is include a snubber component, typically a capacitor, such that a jump current injection won’t force an instantaneous jump in the output voltage. In practice the snubber can represent the PV panel capacitance. The PV panel voltage is then well defined.

Some other suggestions would be to model the series connection of PV panels in one component (if you aren’t interested in partial shading). Also your P&O algorithm runs quite fast and without any numerical filtering, so it will be quite noise sensitive.

Lastly, it might be beneficial

Thanks for your respond Bryan.
I had tuned the filter time constant value, and solved the problem. PV curve becomes more stable.

extra question:
I review the demo model from 「Single-Phase PV Inverter with Partial Shading」, low pass filter inside the PV array is used to break algebraic loop,

What is the relationship between time constant of low pass filter and discretization step size ?

If I want to use variable resistor under external mode, it will suffer algebraic loop warning.
So can I use same method like PV array use low pass filter to break algebraic loop ?