Weird calculated values in rule

I don’t think that’s a Number, it’s a Quantity (with units).
See

That looks like a problem too; here a new variable named licznik_energa_rok1 is declared and created (regardless of if any other variable already exists with that name), it is set to zero, but then discarded at the end of the code block, the closing }.
So it doesn’t do anything useful at all.