Internet PLC Forum

General => Technical support => Topic started by: asitsaha on May 14, 2014, 05:23:23 AM

Title: Totalizer for Analog channel Nano-10
Post by: asitsaha on May 14, 2014, 05:23:23 AM
How to create a totalizer for analg channel for nano-10 PLC?  Is there any integrate function to achieve this ? Also any function to get the exact execution time of one cycle of ladder program
Title: Re:Totalizer for Analog channel Nano-10
Post by: support on May 15, 2014, 09:30:35 AM
You can always use a 32-bit variable keep the cumulative values.

E.g.  

A = A + ADC(1)

A will increment each time the above statement is run and a new ADC reading is captured. You can then compute the average readings.

E.g.

A = 0

FOR I = 1 to 100
    A = A + ADC(1)
NEXT

B = A / 100

Title: Re:Totalizer for Analog channel Nano-10
Post by: asitsaha on May 16, 2014, 12:49:13 AM
I want to totalize an analog channel value. Let us assume , we have have a gas flow rate signal  (m3/min) connected in a analog channel. We want to inetgrate that flow rate and find the actual gas consumed.  

Hence we need to add
Total = Total + ADC(1) * Scan time of program

How to I get the scan time of program in milli second ?  

Title: Re:Totalizer for Analog channel Nano-10
Post by: garysdickinson on May 17, 2014, 10:10:43 AM
Two suggestions for measuring time between ADC readings:

1.  Use ladder logic to call your integrate special function based on a clock signal.  Say every 100ms.   This way the period between ADC readings is fixed.

2. Use the status(21) function to return a raw CPU time at each ADC reading. You can then compute the time from the previous reading.

Gary d