Hisotrical data storage

I know the following will probably need some amount of scripting I am just curious of ease and implimentation.

In FSQL I recently made a group for what I will refer to as hourly counts. Every hour on the hour it sends a signal to all the PLC units to send in and store the result they have at that current time. I also have it claused to watch the logged in status bit. If no one is logged into that machine or if that machine is not available online then it will not signal those units. This SQL query works quite well. But it has one draw back that I did not plan on. Lets say at 1:55 the machine shut off with a fault. The mechanic is working on it but it is still not running at 2:00 when the hourly fires off. At this time the PLC is going to send the same data it sent at 1:55. So it will record the fault again. Now when you go into the status screen I have setup the fault count will be incorrect. So in this scenario the faults and some of the other historical data could be off by upto 12 counts. Figure 12 hour shift if it were to happen at every hour for the duration of the day. I am not sure how this will affect production. So I am thinking ahead.

The two theories that I came up with that could solve the problem is as such and I wanted to post them and see what the general consensus is.

  1. After the machine goes from a start to a stop, and the software has collected the data. Send a clear command to the PLC to clear out the fault codes and such. This way if it does trigger again it will not record any additional fault information.

  2. After the machine goes from a start to a stop monitor the run stop bit which is reported back to the SQL table. If the signal for hourly is given and this status bit has not changed just duplicated the last entry for that machine center.

Unless someone has a better different way to look at it. Would appreciate hearing some feedback.

HAPPY NEW YEAR!!!
Have a great day.

Mark,
Could you take a step back and describe what you want to accomplish instead of your proposed implementation? Short bullet points would be a good way to convey conditions. Why do you only want to log records when the machine “logged in bit” is true?

Your suggestion #1 sounds reasonable. This is typically done with the handshake bit setting in FactorySQL, which sets a PLC register to some predetermined value after the group executes. That’s a great opportunity for the PLC to clear out old data. It works best if the PLC is accumulating the values that you’re looking at.

A lot comes back to your process and how you want it to behave.

We should get in touch directly and I’ll help you out over Gotomeeting. Send me an email to na boeger AT inductiveautomation DOT com, no spaces.