Integer arithmetic, no decimalpoint

Thanks everyone.

After searching around alot I found an algorithm that adds the modulus/remainer of the previous calculation to the regulator output.

Code:
error[0] := setpoint - measure; 

up := (Kp  * (error[0] - error[1])) / K;
ui := (Kp * error[0] + ui_mod[1]) / ((Ti*K)/Ts); 
ui_mod[0] := (Kp * error[0] + ui_mod[1]) MOD((Ti*K)/Ts);
			
u[0] := u[1] + up + ui; (* Output *)

u[1] := u[0]; (* Prev. output *)
ui_mod[1] := ui_mod[0]; (* Prev remainder *)
error[1] := error[0]; (* Prev error *)

Doing this I ended up without a stationary error, whats the logic behind this algorithm?
 

Similar Topics

Does anyone know of any such PLCs? Usually I'm lazy and don't want to think about precision and overflows.
Replies
20
Views
6,907
Hi. I'm using a Modbus ProSoft where I basically map data to a big INT array. Example, where GX_I_63HPU is a REAL, MNETC.DATA.WriteData[200] an...
Replies
21
Views
341
Good morning all, I'm integerating a device with a Rockwell PLC with V34 Studio 5000. The device reports error codes using a single integer to...
Replies
19
Views
1,222
Ex If I Read from Integer file N7:0 N7:0 is an 8 point input card , input 0 and 2 are on , rest off When I look at : N7:0 -7 6 5 4 3 2 1 0 I...
Replies
5
Views
704
The analog array has 16 individual bits and each bit is an alarm. SCADA is having issues getting the BIT bool value. However they can get the...
Replies
9
Views
978
Back
Top Bottom