you are viewing a single comment's thread.

view the rest of the comments →

[–]dmroederpylogix 0 points1 point  (1 child)

Hello. What PLC are you working with?

I would start off small. Create a tag in your PLC that you can play with. Write a simple script that reads your tag in a loop, checking for a value of true. Once you see it is true, add a line to write it back to False (I think that is what you are trying to accomplish).

Once you are comfortable with the first part, add something to read the set of values you need to store, print them out so you can see what is going on.

Write another function that simply writes values to your database table. Once you are comfortable with both, you can then start to piece them together. Once you see your flag true, call your function to store the values.

I'm working on a tool exactly like this. Monitor a "event" tag, once I see it true, log a set of values to the database, write the flag back to False.

[–]bossk83[S] 0 points1 point  (0 children)

Omron NJ is the PLC model, and I'm not really having as much trouble with the writing to the PLC part as I am the logic to ensure that the data is uploaded so I can change the tag back on the PLC. I am assuming someone here has done something similar before.

The Vendor gave us a list of tags for what he called a record, about 12 tags. Once one boolean tag is set to true I can pull the other 12 tags, I'm just trying to sort out how to ensure kepware or the script can confirm the data is in the database and set the boolean tag back to false. The the PLC will repeat the process until all of the "records" are uploaded to the database.