
adccommunitymod (AutomationDirect) asked a question.
Created Date: May 12,2016
Created By: rheem
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
I'm sure there is some way to accomplish this, but I cannot find it in the documentation. I'm not new to programming, but new to automation controls and the Productivity Series. I'm working on a P3-550 and looking for a way to take a sample of a thermocouple input every minute, and then average this value over 30min (30 samples, depending how you look at it). I have found software instructions for averaging across channels, or averaging a single channel for ALL time, but nothing that lets me choose a specific channel and average it over a set time limit. My work around is savings each 1 min sample to a tag/variable, and then averaging over those 30 tags, but that seems very inefficient. Thanks for any guidance! :)
Created Date: May 12,2016
Created by: rheem
I'm sure there is some way to accomplish this, but I cannot find it in the documentation. I'm not new to programming, but new to automation controls and the Productivity Series. I'm working on a P3-550 and looking for a way to take a sample of a thermocouple input every minute, and then average this value over 30min (30 samples, depending how you look at it).
I have found software instructions for averaging across channels, or averaging a single channel for ALL time, but nothing that lets me choose a specific channel and average it over a set time limit. My work around is savings each 1 min sample to a tag/variable, and then averaging over those 30 tags, but that seems very inefficient.
Thanks for any guidance! :)
Created Date: May 12,2016
Created by: azathoth
Create a 30 column array. Every minute, use the shift array command to shift the values and fill in the thermocouple value. The array statistics command allows for averaging the values in an array.
There may be a better method, but this is off the top of my head.
Created Date: May 12,2016
Created by: techme
You can create a couple of flasher coils 1 for one minute and one for 30 min( actually 30 sec and 15 min since you wish to see the transition and it will be on for 30 sec and off for 30 sec) then use a NOE of the 30 sec flasher to a MATH instruction that takes your tag and adds it to an accumulated tag. Then have another rung that a NOE contact off the 15 min flasher takes the accumulated value and divides by 30 and loads to an average value tag in a MATh box and paralleled with it you can copy a 0 into your accumulated value so the average starts for the next 30 min.
Created Date: May 12,2016
Created by: rheem
These are both great ideas! Thank you for helping me think outside the box. :)
Created Date: May 13,2016
Created by: Ridgeline Mach
So, the average command (AVG) doesn't work for this?
Created Date: May 13,2016
Created by: techme
AVG instruction only allows for 1 time constant so you can average a sample every minute or every 30 minutes, but not an average 1 minute samples over 30 minutes. The AVG instruction is averaging off of 2 samples set to whatever constant you set them apart. This guy wants to average 30 samples that are accumulated 1 minute apart.