Zero-crossing AC Power meter

Hello!

I have circuit thats detects zero-crossing and trigger Triac to regulate AC Power to 5000W resistance.

I can set the AC output in the load and change it from 0V till 220V, just need to vary i which goes from 0 to 128, 0 means full power and 128 minimum power( and so on 64 will apply 50% AC power on load)

My question is, since I know the Power applied(from 0-220), the load resistance (5000W). Is it possible to calculate kWh consumed by this load?

Thank you.

the load resistance (5000W) .......... to 5000W resistance.

Resistance is measured in ohms not watts.
If that load is resistive like a heater or incandescent lamp then the resistance will change with temperature so you can not use it in lower power calculations.

I can set the AC output in the load and change it from 0V till 220V,

No you can't, not with a triac anyway. Once a triac is on it continues to conduct until the zero crossing point, so when your triac gives anything over half power your load is getting the full 220V.

just need to vary i which goes from 0 to 128, 0 means full power and 128 minimum power

No you have no control over the current i with a triac, you can only turn it on at a specific point in the cycle.