Hi,

With a quick look, I couldn't make anything out of the formula. Explain in details about U seems to be the desired voltage, K constant, e error, what about A and B. Are they the P and I .

How are you tuning k ?

Post Code.