Sign in to follow this  
Followers 0
gixer

Compare command

9 posts in this topic

Guys, I have 5 transducers measuring the depth of water. They are all in and working fine. What I want to do now is raise an alarm if one of the sensors goes deeper than say 100mm than any of the others. I know how I could do it with comparing them one at a time but was wondering if there was a command that would compare all 5 at the same time. Steve

Share this post


Link to post
Share on other sites
1. Assuming : you only need to check the highest or lowest values. On the Q/FX2 you can do a SORT and then compare the two highest or lowest values. On the FX1 you could sort the data yourself somehow then compare the highest and lowest.

Share this post


Link to post
Share on other sites
Veganic's idea is probably the simplest. If that won't work for you, let us know what model of PLC you are using so we can be more directed in our responses.

Share this post


Link to post
Share on other sites
there are different ways to skin the cat. i think you maybe trying to detect which value deviates from the group. if so: 1. calculate average (add all four inputs and then divide by four) 2. find the difference between each value and the average. 3. you can sort the results to see which value (values) is the suspect 4. if needed trip alarm, simply create absolute value of results in step 2, then set proper alarm if any exceeds the limit

Share this post


Link to post
Share on other sites
Hi guys, thanks for your responses. I am using a FX2n with 2 FX2n-4ad's to collect the data. The data goes onto D100,D101,D102,D103 and D104 with the differential going into D105 via an E1101. I have done the software to calibrate the sensors so that they give out an exact depth in millimeters on the E1101, so I know that eveything is working. Basically what I need to do is set M60 when any one of the sensors go out by more than D105, either deeper or shallower. I've never used the sort command, though I have just read the manual, but still cant understand how I could use this in the above situation. Thanks Steve

Share this post


Link to post
Share on other sites
I can post some code later unless someone beats me too it.

Share this post


Link to post
Share on other sites
something like this:

Share this post


Link to post
Share on other sites
I had nothing like that in mind Edited by Veganic

Share this post


Link to post
Share on other sites
The sort is 'merely' to order the list so that any method of getting the difference between two values does not result in negative values. (is there an equivalent of a ABS() function for mitsubishis?) I understood the problem as follows: D105 = 'the differential' = 100 L1 = 550 -----------Diff = 30 L2 = 520 -----------Diff = 70 L3 = 450 -----------Diff = 50 L4 = 400 ----------Diff = 50 L5 = 350 I assumed that this would be a NO FAULT condition as the difference between each level is <100. D105 = 'the differential' = 100 L1 = 550 -----------Diff = 30 L2 = 520 -----------Diff = 70 L3 = 450 -----------Diff = 50 L4 = 400 ----------Diff = 101 L5 = 299 This would be a FAULT condition as the difference between two of the levels exceeds 100. Is this correct or would the first one be a fault condition due to the the difference between L2 and L4 being >100? Even if you want it that way comparing all 5 values only takes 9 'comparison' operations. But I'm not sure of an easy way to do this without sorting first.* I've done the code but there's no point posting if it's not what you want. *Edit : If the difference is >100 or <-100 obviously! In which case the sorting wouldn't be necessary but the answer to your original question would be no there isn't a command to compare 5 values at the same time. Edited by Veganic

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