0526pv.plecs (136.5 KB)
Hi
My PV MPPT model behaves differently between offline simulation and RTBox2 real-time testing. We have referred to the photovoltaic module in the demo, yet we are required to implement control via MPPT. We are unsure where the problem lies.Could you share advice on mitigating calculation delay for consistent results?
Thanks
Discrepancy between offline simulation and RTBox2 real-time test results for photovoltaic MPPT model
Hi liuwenj,
Your control strategy appears to be heavily dependent on the three Memory blocks and having the correct initialization conditions when the simulation starts at `t = 0`.
In an offline simulation, this often works well because the controller and plant start simultaneously. However, in a real system (such as a HIL platform), the controller and plant do not necessarily start at the same time. As a result, algorithms that rely heavily on previous-step values can behave very differently than they do in simulation.
Consider using the following structure instead, as it may be more robust to startup conditions and less dependent on the initialization of the previous-step values.
0526pv_MA_edits.plecs (155.5 KB)
You will need to connect to the controller via external mode and toggle the SW.
Of course, this is simply a like-for-like replacement that I put together, as I am not familiar with the details of the algorithm you are trying to implement. Given how sensitive the controller appears to be, I would strongly recommend thinking carefully about startup behavior and fault protection before deploying the algorithm to real hardware.
Additionally, I noticed that the output voltage appears somewhat unrealistic even when no PWM is running. This suggests that there may be an issue with the PV model itself. It may be worth investigating that behavior separately, as it could also be contributing to the challenges you are seeing.
Hope this helps!
Thank you very much for your reply.
However, I encountered a new confusion after adjusting my model. I use the output signal nRst from the TI C2000 Powerstage Protection block as the reset signal for the P&O MPPT control loop, as shown in the three red-boxed parts of my schematic.
My expected logic is:
- When nRst = 0, the Signal Switch should output the initial constant value (0.1 / 0.5) to initialize the delay unit z^-1;
- When nRst = 1, the Signal Switch should switch to the opposite branch and feed the previous sampling value from z^-1into the control loop for normal MPPT iteration calculation.
But in this case, the simulation results are wrong.
My revised model is given.
0526pv_MA_edits.plecs (174.5 KB)
Hi liuwenj,
That is correct. One slight modification to your statement: currently the Signal Switch is only changing the output of the delay unit. It does not affect the input. If you need to control what is being fed into the delay element, then the switch needs to be placed before the z⁻¹ block.
I ran the simulation file you provided and observed the following:
- When
nRst = 0, the output is correctly initialized to0.1 / 0.5, as expected. - When
nRst = 1, the output correctly comes from thez⁻¹block.
This behavior is consistent with your stated implementation.
It is possible I am misunderstanding the intended behavior. Could you clarify what you were expecting to see differently in the results?
Thank you very much for your reply.
Our offline simulation runs correctly, while errors persist in online real-time operation. Waveforms are inconsistent and errors occur during online operation.
Thank you very much for your reply.
Our offline simulation runs correctly, while errors persist in online real-time operation. Waveforms are inconsistent and errors occur during online operation.In fact, our original issue remains unresolved. The offline and online waveforms obtained from our MPPT simulation are still inconsistent.






