Author Topic: Totalizer for Analog channel Nano-10  (Read 13028 times)

asitsaha

  • Newbie
  • Posts: 4
  • I'm a llama!
    • View Profile
Totalizer for Analog channel Nano-10
« 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

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Totalizer for Analog channel Nano-10
« Reply #1 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

Email: support@triplc.com
Tel: 1-877-TRI-PLCS

asitsaha

  • Newbie
  • Posts: 4
  • I'm a llama!
    • View Profile
Re:Totalizer for Analog channel Nano-10
« Reply #2 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 ?  


garysdickinson

  • Hero Member
  • Posts: 502
  • Old PLC Coder
    • View Profile
Re:Totalizer for Analog channel Nano-10
« Reply #3 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