controling TRIAC with variation delay

So I had project about Power Factor Corection (PFC). As we know, to give compensation for bad Power Factor we add(install) capacitor in system. Then Reactive power (VAR/capacitive) from capacitor compensate Reactive Power (VAR/Inductive) from inductor. To control that, I using TRIAC that allow how much voltage will go trough TRIAC to capacitor.

how to firing TRIAC? https://openenergymonitor.org/emon/mk2/switchdev

for example : my house had not bad Power Factor (around 0.7). with certain load. so I need trigger a little from TRIAC to allow low voltage (around 20V) flow trough TRIAC. Power Factor increase from 0.7 to 0.9 (no Problem happen) then, Suddenly my brother turn ON water pump, load increase PF turn down around 0.27 I need to trigger more voltage. I go with 220 V trough TRIAC, PF increased !!! 0.5, 0.6, 0.7..... Oops my program detect 0.7 PF. Which is good !!! then voltage loop to 20 V trigger mode but with that new load, it just turn back down to 0.3. and its just loop there over and over again

So the question is... 1. How I solve this problem? 2. I already set delay to variable,

x = 11;
x = x - 1;
delay (x)

but I think that not work. How can I set firing TRIAC effectively?

Why is power factor a problem? Its a problem for power companies because it causes excessive voltage drop across the transmission line, but it's usually not an issue for the end user. Your power meter measures the true power consumed and you only pay for true power.

If you want to switch-in a capacitor, don't use phase switching. Just switch the capacitor into the circuit when you need power factor correction. You might have to use a relay if the capacitor has to handle the whole house power.

Or, put capacitors on the pump and other motors/inductive loads so the capacitors are only used when the load is turned-on.

As far as I know, the large capacitors on power poles are not switched. The power company just compensates for the average power factor in the area.

Thanks for response.

Maybe that not big deal for customers.
But, there some benefit :

  1. decrease nominal current, (shortly that decrease true power and at least cut elec bill)
  2. power capability increased, you can add 1 or to equipment that was waste for reactive power as before

for phase control, I just wanna try that method.
Because switching capacitor is too mainstream.
I just wanna show that there another way to control capacitor, just that all.

Is there someone knew to control it?