The application
I want to implement the control of a photovoltaic inverter. The goal would be to keep the consumption of a microgrid (the power absorbed from the grid) to a constant value.
Notes:
- I can only measure the grid load and the PV inverter setpoint. I cannot measure the PV production.
- My measuring frequency is about 1s
Some numbers: let's say that I have a load varying (quite fast) between 500
and 1000W
and a 500W
solar panel, and I want to keep the power absorbed from the grid at ~500W
(this is my target). Thus, if the measured grid load is at 769W
, the PV inverter should provide 769-500=269W
(inverter setpoint).
This would seem trivial, in the sense that I can control the inverter and tell it to provide exactly 269W
. However, due to several delays (communication latency, inverter command reception time and the time it takes to adjust to the new inverter setpoint), it might take several seconds for the new command to actually take place: by the time the 269W
setpoint is reached, the new requested value will probably be different (as the measured load varies).
The algorithm
I tried implementing a PID-like algorithm to fix this, and it seems to work more or less fine. However, compared to normal PIDs, there is a key difference. In my algorithm, I measure the grid load (PV = Process Variable) and calculate the correction that needs to be applied to the inverter setpoint (SP) based on how far the PV is from the target (T):
$E = PV - T$
$C_P = k_P \times E$
$C_I = k_I \times \int_{0}^{now} E(t) \, dt $
$C_D = k_D \times \frac{\partial E}{\partial t}$
$newSP = SP - (C_P + C_I + C_D) $,
where $k_P$, $k_I$ and $k_D$ are tuning constants and $newSP$ is my new setpoint (control signal) for the PV inverter. This is different from the usual PID process, since I calculate a correction to apply to the current setpoint, and not the setpoint directly. I can do this since the PV and the SP refer to the same physical quantity, and it seems to make more sense this way. This also actually reduces or eliminates the need for an integral component, since by design we have no steady-state error that needs to be compensated for.
However, I do not have any PID training, nor I have tried producing a first-order plus deadtime model of this system. I might be completely wrong.
Testing
I've been testing this setup and it works well for this application, better than I could make a normal PID work (but to be fair I have zero experience on tuning a PID). As expected, I found that in this algorithm the integral component is mostly harmful, as it only leads to oscillations: the P and I components do not need to balance each other anymore like on a normal PID, since the P correction goes to 0 once we reach the desired target, and the setpoint becomes stable. Thus, I have found myself using mostly a PD control.
Questions
- Does this PID-like algorithm make any sense in this case? In particular, the choice to act on the correction value instead of the PV value itself?
- Is this a standard control method? I would like to find some base-level theory on this.
- Is this application more suited to some other control mechanism?