Jay(n3ow) (Customer) asked a question.

Click to do average where should this be placed on the ladder

Good day

I have a program that monitors the input from 3 TC and doing a simple average using the math function generates the value and writes it to a Df memory location to control the opening and closing of a valve.

Should the math function be placed at he start of the program or the end or placed in a sub routine ?

Thank you

Jay

 


  • Tinker (Customer)

    Since the inputs are read at the beginning of the scan, the data is the same no matter where in the program it is used. You might think you'd want to do the averaging before the point where the numbers is used to control the valve. However, the conversion time of the thermocouple module is SO much longer than a typical scan time that it really wouldn't matter if you were using the number form the previous scan, because odds are you using numbers many many scans old, The single channel update on a C0-04THM is 400ms, times three channels is over a full second. Could be hundreds of scans for a short program, or a dozens for a rather long program.

    A subroutine is may be a reasonable option, since the data won't change all that often you don't really need to compute the average much more than once a second I suppose.

    Expand Post
  • Todd Dice (Customer)

    I write my PLC code so it updates and writes in the same scan. If this was my program, it would be:

    1. Read analog inputs.
    2. Perform math.
    3. Write to your analog output(s).

     

    Now what I don't know is, are your TCs using PID? If so, it appears from the training videos for Click, PID is processed separately from PLC scan, so my response may be moot.

    Expand Post