Hallo!
Meiner Meinung nach fehlt im FB METER das ständige neusetzen der Variable last, ich glaube dass der Zähler dann korrekt funktioniert?
Also z.B. die vorletzte Zeile in der Berechnung:
(* reset )
IF rst THEN
mr.R1 := 0;
mr.RX := 0;
ELSE
( current consumption measurement )
IF I1 THEN MX1 := M1; ELSE MX1 := 0; END_IF;
IF I2 THEN MX2 := M2; ELSE MX2 := 0; END_IF;
( add up the current values in a double real )
MR := R2_ADD(MR,(mx1+mx2)/DTC);
(* set the current output value )
MX := mr.RX;
( renew last *)
last := tx;
END_IF;
lg Willi