Hello,
I am looking for a good way to count parts for the last 30 days to track production. Our customer frequently powers down the machine. It is OK if value represented is within a 30-day timestamp, or last 30 days of ON time.
I have attached an image representing the production screen. Each hour box shows count for that hour. The boxes at right would display historical counts for last 7 days, 30 days, etc.
I could imagine making a custom data type with a DINT for day, and the other element could be the counter for that day. Next, make an array CountData[365] of this type. Newest date is always at the top. If CountData[0].Date does not match current date, then shift data down. Assuming the machine is always on, 29 days previous should be stored in CountData[29]. Looping and summing the elements would result in desired count. Loop could exit when checked date is older than the range, which should only occur if the machine is powered off for a whole day.
After writing all of that down, it doesn't sound too bad. Is there a more efficient, or integrated way of doing this?
Any good way to store date in days when doing comparisons? Using GSV and WallClockTime, I have Year, Month, and Day, and I would probably need to store and compare all three for each element for it to work properly. It would be better to store days since 2000, for example. Perhaps this is already available using a different system variable?
5069-L306ERS2, Logix Designer 34.01.00
2713P-T12WD1, View Designer 8.02
Thanks in advance for any ideas or insights.
Kind regards,
Rafael
I am looking for a good way to count parts for the last 30 days to track production. Our customer frequently powers down the machine. It is OK if value represented is within a 30-day timestamp, or last 30 days of ON time.
I have attached an image representing the production screen. Each hour box shows count for that hour. The boxes at right would display historical counts for last 7 days, 30 days, etc.
I could imagine making a custom data type with a DINT for day, and the other element could be the counter for that day. Next, make an array CountData[365] of this type. Newest date is always at the top. If CountData[0].Date does not match current date, then shift data down. Assuming the machine is always on, 29 days previous should be stored in CountData[29]. Looping and summing the elements would result in desired count. Loop could exit when checked date is older than the range, which should only occur if the machine is powered off for a whole day.
After writing all of that down, it doesn't sound too bad. Is there a more efficient, or integrated way of doing this?
Any good way to store date in days when doing comparisons? Using GSV and WallClockTime, I have Year, Month, and Day, and I would probably need to store and compare all three for each element for it to work properly. It would be better to store days since 2000, for example. Perhaps this is already available using a different system variable?
5069-L306ERS2, Logix Designer 34.01.00
2713P-T12WD1, View Designer 8.02
Thanks in advance for any ideas or insights.
Kind regards,
Rafael