Current and Voltage control

Hello everyone,

I am currently working on an inverter model for a microgrid research project using a cascade PI control structure (Outer Voltage Loop and Inner Current Loop). While the Vd tracking is working, I am experiencing severe, diverging oscillations on the Vq axis whenever the control is activated, and I cannot seem to stabilize it.

Here are the hardware parameters of my 10 kVA system:

  • Power Rating (S): 10 kVA

  • DC Voltage: 800 V

  • Grid Voltage: 400 V (L-L rms), 50 Hz

  • Switching Frequency: 10 kHz

  • LC Filter: L = 5 mH, C_f = 4.72 micro F

  • Resonance Frequency: 1035 Hz

Control Strategy & Tuning:

To maintain stability, I mathematically bound the bandwidths as follows:

  • Inner Current Loop Bandwidth Fbp : Set to 25% of the LC resonance frequencyOuter Voltage Loop Bandwidth (Fbv): Set to be 10 times slower than the inner loop

Here is the exact MATLAB script I used to generate the PI gains:

My Questions:

  1. Is the extremely small capacitor value (4.72 micro F) causing an inherent numerical or solver instability in PLECS when calculating the cascade loops?

  2. Are there any hidden delays (e.g., in the PWM, measurements, or dq transformations) in PLECS that typically cause this specific Vq explosion, and how should I compensate for it?

My Plecs :

GFL_woMC_henry_voltage Control.plecs (134.5 KB)

Hi @henry_01 Great simulation! But since I test some of the variables you’re presenting the error in Vq is not asymptotically zero, to answer your questions 1. PLECS do not cause any numerical or solver instability, but instead of have a time step of 1e-3 and your switching frequency is 10k I’ll change it for a small step. 2. Due to you are using ideal blocks, there are no hidden delays.

In my personal opinion the problem is the tuning of your controllers, are you already tested with simple transfer functions in Simulink? I’ll do that at first to have an insight.

Another thing I’ll look at it after test the linear representation would be some requirements for the integrators in the inner loop, remember that thing evolves at least 10x faster than the outer loop, so you must reset the integrators.

Greetings,

Erick.

Hello @erick, thank you for the suggestions! I actually tried implementing them, but the results were not entirely satisfactory. Since then, I’ve overhauled several parts of my model—specifically by transitioning entirely to discrete blocks and recalculating both the LC filter and the control parameters.

While there is definitely a noticeable improvement, the performance still isn’t quite where it needs to be. I am still experiencing a significant ripple, particularly on the q-axis voltage (Vq). Do you have any further advice on how to mitigate this specific issue? I have attached my updated simulation file for your reference. Any insights would be greatly appreciated!

GFL_woMC_henry_tegangan Control3.0.plecs (148.5 KB)

In your updated simulation model the sample time Ts for your digital controller is not related to your switching frequency. If I set Ts=1/fsw (and optionally add a ZOH block after the theta integration so theta is quantized too) then the controls behave much better. Before, the switching frequency noise was coupling into the control loops.

That helps you better analyze lower frequency effects. There still is a second harmonic in the ABC domain (third harmonic in DQ) that I believe is due to filter/control level effects (for example it is sensitive to the value of Rf).

Thank you, @Bryan_Lieblick . Thanks to your help, I can take further steps in my research on grid-forming inverters with droop control. I previously used another simulation platform and struggled a bit when transitioning to PLECS, but learning little by little finally led to some successful experiments.

However, may I ask another question? I am currently building the droop control stage and inputting every parameter I obtained from the journals into my PLECS plant. Yet, I cannot seem to find a solution to my current problem, where I am once again stuck in controlling the active and reactive power output as well as the voltage. Is it possible that I missed certain parameters, and could you perhaps help me find them so they can be fixed?"

GFM_DROOP_PL.plecs (189.7 KB)

Hello @Bryan_Lieblick,

It seems there were a few mistakes in my previous droop simulation. I managed to identify and fix some of them, which has yielded much better results than before. The improved droop control is now functioning well and no longer shows significant ripples. Additionally, the voltage and current are starting to stabilize now that the PI control is working properly.

However, I feel there are still some missing pieces and a few things I do not fully understand:

  • Droop Control & Power Deviation: The active and reactive power deviations are still not tracking the references I set. Are there any additional settings I need to adjust, such as the integrator or PI saturation limits, to resolve this issue?

  • Anti-Windup Settings: Do I need to configure specific anti-windup settings on the cascade PI control if I want to implement this on a microcontroller? Could the lack of this be affecting my droop control?

  • Phase Shift: I noticed that Vpcc and Ipcc are not in phase. Could this be caused by the controller?

Here is my updated simulation

GFM_control.plecs (180.8 KB)

I really appreciate your time, help, and advice.:folded_hands:

Hi Henry,

Others on the forum are welcome to chime in with their thoughts on your model, but my role as a Plexim employee is to make sure you’re well informed of the software’s capabilities and can use it effectively. However supporting with detailed design work and reviews isn’t part of what I can offer. This is best discussed with your colleagues and advisors if you are a student.

With that said, I can make helpful initial suggestions given my experience for you to investigate further:

Droop Control & Power Deviation: The active and reactive power deviations are still not tracking the references I set. Are there any additional settings I need to adjust, such as the integrator or PI saturation limits, to resolve this issue?

Apart from small oscillations around the set point the only issue that jumps out is that your Q loop integral gain is very slow. If you zoom in you’ll see the controller output slowly decay towards the set point, but at that rate it will take many second to reach it. If I change the value from 1e-4 to 0.2 then it reaches close to the desired value.

You don’t have any anti-windup in your model as far as I can tell, but naturally the actuators could hit their practical limits. In that case you’ll see your regulator outputs move upwards without any corresponding change in the input error.

Anti-Windup Settings: Do I need to configure specific anti-windup settings on the cascade PI control if I want to implement this on a microcontroller? Could the lack of this be affecting my droop control?

Yes, anti-windup is an important practical consideration for real systems. I would highly recommend it in your real implementation, but I don’t think it’s a main driver why your offline model isn’t working the way you expect.

Phase Shift: I noticed that Vpcc and Ipcc are not in phase. Could this be caused by the controller?

Yes. Well your Q setpoint is 1 kW so that would cause it. Once you dial in the Q loop and set the reference to zero things should work out better.

Two other suggestions:

  • Have you tried adding a low pass filter after the power measurement calculations to remove noise in the power measurements?
  • Perhaps using the analysis tools would be helpful in extracting the various loop gains in your model so you can verify them against theory.

Regards,
Bryan