Sign in to follow this  
Followers 0
waterboy

How to monitor 50 words for change

15 posts in this topic

I need to monitor 50 words and if any of them changes - set a bit. How can I monitor that many words?

Share this post


Link to post
Share on other sites
Please give the PLC model. Are the words in a single adressable group? How often do you want to test? What is the maximum time in one scan can you devote to doing this test?

Share this post


Link to post
Share on other sites
PLC-5 Words are sequential , N100:0 through N100:49 There are 35 of these sequences i.e. N100, N101, N102 etc Each sequence will trigger the same bit in their datafile i.e. change in N100:0 - 49 will trigger N100:100/0 Test once per second.

Share this post


Link to post
Share on other sites
Now I'm confused. Are there only 50 words which may change? Or are there 35 sets of 50 words (1750 words)? And I don't understand this at all.

Share this post


Link to post
Share on other sites
35 sets of 50 words each set tested separately (using a loop?) each set will trigger a bit of its own, nothing common between sets. each set is a group of control variables, if any one in a group changes, I want to trigger a MSG to send those 50 words to a destination.

Share this post


Link to post
Share on other sites
You could try The file bit compare instruction (can't quite remember but i think the plc5 has it) The source would be your set of 50 words (#N100:0), (#N101:0) etc. The reference would be another set of 50 words ie #N200:0 which you set to zero or any mask you wish (this could be common to all the sets to be monitored) The result can be any word file you want (this stores the bit position the mismatch was found) The Length would be 800 (50words*16bits) If the found bit is set (.FD) then trigger your MSG block you would need 35 of these (keep an eye on the scan time and watchdog values) Hope this helps Steve Edited by nehpets

Share this post


Link to post
Share on other sites
Could you add all 50 words together and save the total, then compare this scans total to last scan total and if different, set bit.

Share this post


Link to post
Share on other sites
Ken, if one of the group's number changed (let's say the least significant bit) such that it turned on and another's LSB turned off, the changes would not be detected by adding all the words.While the likelihood of this happening is very low it could happen and we know the perversity of machines is such that it will find a way to do just that. Edited by b_carlton

Share this post


Link to post
Share on other sites
thought about that, I think that would probably work, the odds of the LSB changing on only 2 words is remote, yet it is certainly conceivable. But if I could add all those, it would be a really large number. I wish there was a Hash function for PLC5.

Share this post


Link to post
Share on other sites
Take a look at the "FSC" instruction. I have not used it but it looks like it might give you what your looking for. See PDF below. FSC.pdf

Share this post


Link to post
Share on other sites
the problem with FSC, FBC, or FAL is that it will double your memory requirement since you will need an entire reference file for each file compare operation to check data against. So if you have 35 files of 50 words each of actual data, you will need another 35 files just like them and you will need to initialize them (COP), and have 35 FSC or FAL instructions. Is there anyway to nip this bud further up on the branch and detect changes at their source? If they are HMI entries can the HMI be programmed to set the bit for you? A checksum as suggested would be ideal, but you need more than the most simple implementation to take care of issues such as mentioned by Bernie. Maybe this link can generate some ideas: http://en.wikipedia.org/wiki/Checksum

Share this post


Link to post
Share on other sites
Yes, its just an extra line of code at each entry point, but thats 50x35 lines of code so I was hoping to avoid that. Perhaps I am just asking too much of these little guys.

Share this post


Link to post
Share on other sites
You'd have to double the data storage to store the "previous" values for all 50x35 registers. Seems like it would be more efficient to simply MSG the data every second no matter what. Offset each of the 35 clumps of data so they don't all go out at once. 1s/35messages = one message every 28ms.

Share this post


Link to post
Share on other sites
OkiePc This is not strictly true - you only need one reference file which can be initialized on first scan - all the other files N100, N1010, etc can be referenced against that. JRoss Whereas this is a nice simply answer to the problem - depending what else is on the comms. highway ie plc multidrops, display units, etc this could dramatically slowdown any inter communications better to condition the triggering of the communication. Steve

Share this post


Link to post
Share on other sites
So it would seem. I guess I will have to do this from the HMI. Thanks for all the feedback

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0