PLCnext on LinkedInPLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

  1. jaredhatt
  2. PLCnext Engineer
  3. Monday, 16 November 2020

Totalizer Function Block Using Level Sensor

We are currently using a level sensor with 4-20mA input into our AXC 2152... trying to find a good way to totalize the volume change so we can see total volume that has been dosed with a system as well as average dosage rates (per last 24 hours) using this data. Any ideas on how to do this?

Any help would be much appreciated, thanks!

iasnhtest Accepted Answer Pending Moderation

// xAnalog_scaled is the input value from 4-20mA scaled to your process
// xAnalog_hold1 is used to hold the reset value
// xSet is used to set the totalizer start
// xTotalizer is the difference between the saved value and current value
// xHour is the RTC clock INT
// xHour_totalizer is the array of real numbers holding the last 24 hours

// You will need to make an array of REAL numbers [0..24]

xAnalog_hold1 := xAnalog_scaled;
xSet := False;

xTotalizer := xAnalog_hold1 - xAnalog_scaled

x := xHour-1;

// Moves values into the Array the hour dictates the position in the array it will roll over and only hold the last 24 hours in this configuration.
// The final value of the hour is stored in the xHour_totalizer[array number]

IF xHour <> xHold_hour THEN
xHour_totalizer[x] := xTotalizer;
xHold_hour := xHour;


This is very crude but should give you an idea of where to start

  1. one week ago
  2. PLCnext Engineer
  3. # 1
  • Page :
  • 1

There are no replies made for this post yet.
However, you are not allowed to reply to this post.