Bob1984

First fault detection

5 posts in this topic

I have 14 bits, each is set when a particular fault occurs, the problem is once 1 fault occurs and the machine stops it then causes more "red herring" faults.

I need to detect which fault happened first and report this as the reason the machine stopped.

I can do it the long way:-

A M100.0

AN M100.1

AN M100.2

etc...

but this would result in 14 very similar networks, and what if my fault list grows to say 100?

Is there a quicker/more efficient way of detecting which bit was set first?

Share this post


Link to post
Share on other sites

Are the 14 bits you are using all part of a single 16 bit word? If so, perhaps you could compare the value of the word to zero. If the word value is equal to zero then set the fault bit. This comparison would need to be included in each fault bit evaluation network. This adds a comparison in each network but eliminates the need of having to interrogate every fault bit (present or future) in each fault bit network. And marker instructions are immediate, meaning that the markers are set/reset in the current scan and do not wait for a table update (as the I/O).

I'm sure there are more elegant or simple solutions but this is the first one that popped into my mind.

Share this post


Link to post
Share on other sites

Similar to pop29684's suggestion (assuming your faults are gathered into words and no bits in those words are used for anything else):

Compare your fault words to zero.  In other words, the first condition in the network will be "any of the fault words are non-zero".

Use a "pulse" instruction and then copy all of the fault words into other memory locations. 

This will give you a snapshot of whatever happened the last time a fault came up. 

I may be able to throw together a better example later on today.

Share this post


Link to post
Share on other sites

Try something like this:

S7-FirstFault.PNG.a49f9ba68f0bcef97142a5

This assumes that your fault bits are stored in memory bytes 60-65.  On the first PLC scan after any of those bytes are not equal to zero, it copies all words to holding registers MB70-75.  I haven't tested this logic at all, so it may not even compile for your processor, but this is the kind of logic I would try first.

Share this post


Link to post
Share on other sites

Thanks for the replies, that looks very interesting I will give it a try tomorow

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