Author Topic: Data Collection  (Read 1302 times)

Gadelric

  • Newbie
  • *
  • Posts: 11
    • View Profile
Data Collection
« on: July 06, 2020, 02:53:06 PM »
Team,

I built a tracking report in excel a while back with a lot of vba background code. It works, but it crashes every couple months and runs very slow. I want to make it better and I believe advanced HMI will do what I want, the limiting factor is my knowledge.

I've spent quite a bit of time going over the forums here, and everyone here gives great details.
I enjoy the struggle, and find I learn things better if I dig a hole and try to get out of it.

Just in case I am going about this wrong, I thought I would ask a few questions that might get me back on track.

1.) The PLC (1768-L43 Compact Logix5343) collects the following data:
Tracked_Bypass[0].Time        (nested udt, contains hour, min, sec) Time is not required but I collect this anyways.
Tracked_Bypass[0].Bypassed  (String)
Tracked_Bypass[0].Trace       (Dint)
Tracked_Bypass[0].User        (Dint)
Tracked_Bypass[0].Machine   (String)
I collect up to 1000 instances.
Ive attempted to the datasubscriber1 and 2, I get the file with the time the scan was performed, I just don't get any data listed after the time stamp.

     Do I need to break these apart and rebuild the code for the data sub to collect this data? Or can I pull the entire array?
I have my current excel file pulling the data at a set time every morning, but if it is easier for the program, I can set it to pull when my indexer changes values.( I am able to get the trigger to work)
     
2.) Is there a built in feature that confirms I have pulled the data and write a 1 back to the PLC to clear the data collection on the PLC side? (low priority, more than 1 way to skin this cat if needed)

I have some down time over the next 2 weeks that gives me plenty of time to hammer away at this. This is not a required project, just one that will teach me some new tricks and hopefully make the reporting more reliable.


It is quite possible that I have chosen to take the hardest road possible. If there is another way of going about this, using Advanced HMI, feel free to point me in a new direction.


Thanks,

Gad

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5320
    • View Profile
    • AdvancedHMI
Re: Data Collection
« Reply #1 on: July 06, 2020, 03:06:59 PM »
One way I typically do something like this is to have the PLC set a bit when new data is available. I monitor that bit with a DataSubscriber. When the bit changes to 1, I then use code to read all of the data I want. After that reading all the data, the original bit being monitored is then written to be a 0.

This is kind of a handshaking method that tells the PLC the data was read successfully. There are other time I have made a FIFO in the PLC to hold the data. A bit would tell the HMI when there is data. The HMI then writes a bit saying the current block is read, which in turn the PLC removes it from the FIFO and sets the bit again if more data is in the FIFO.

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: Data Collection
« Reply #2 on: July 06, 2020, 11:52:31 PM »
Also check this topic to see if there might be any useful info for your case:

https://www.advancedhmi.com/forum/index.php?topic=2545.0


MajorFault

  • Guest
Re: Data Collection
« Reply #3 on: July 07, 2020, 12:02:23 AM »
I recommend using an integer trigger (counter) vs BOOL trigger.  If for some reason it's missed, simply increment.  A BOOL can cause issues from time to time.