P_AIN.FAIL.Val_MinToUnshelve Comparison

psgama

Member
Join Date
May 2007
Location
Canada
Posts
21
Hello all,

I'm trying to come up with an elegant solution to check an Array of Values to see if they are greater than zero but less than 15

My Array size is 820, so P_AIN[820]

This is what I'm trying to accomplish.


For i = 1 to 820

if P_AIN.FAIL.VAL_MinToUnshelve > 0 and P_AIN.FAIL.VAL_MinToUnshelve <=15 THEN
ALARM_SHELVE_EXPIRY_ALARM = TRUE
Exit For
End if
Next i


Anyone have an elegant way to implement this in RSlogix5000 using structured text or otherwise?
 
Hello all,
For i = 1 to 820

if P_AIN.FAIL.VAL_MinToUnshelve > 0 and P_AIN.FAIL.VAL_MinToUnshelve <=15 THEN
ALARM_SHELVE_EXPIRY_ALARM = TRUE
Exit For
End if
Next i



I think there are error of syntax, but the methode is corrrect. Alarm is not remind to False with this code...

Code:
For i = 1 to 820 Do
 if P_AIN[i].FAIL.VAL_MinToUnshelve > 0 and P_AIN[i].FAIL.VAL_MinToUnshelve <=15 THEN
  ALARM_SHELVE_EXPIRY_ALARM = TRUE;
 End if;
End For;
[/INDENT]
 
It may no longer be true, but I think less than is slightly faster than less than or equal to, so less than 16 is an alternative equivalent to less than or equal to 15

There is also the A-B LIM instruction, but I do not know if it is available in ST.

I don't think a bitwise AND will help
 

Alarm := FALSE;
i := 1;
While not alarm and i < 821 do
Alarm := Alarm or (array > 0 and array < 16);
i := i + 1;
End_while;



?
 
Thanks for the responses.
It looks like I won't actually be able to to implement what I was after this way, as the AOI internal tags weren't made visible external to the routine.

I can reference them in FactoryTalk View Studio and Kepware just fine, however when I try to use the FAIL.VAL_MinToUnshelve within RSlogix 5000 it reports an Unknown Tag Element.
 

Alarm := FALSE;
i := 1;
While not alarm and i < 821 do
Alarm := Alarm or (array > 0 and array < 16);
i := i + 1;
End_while;



?


Wouldn’t this work?

Code:
Alarm := FALSE;
i := 1;
While not alarm and i < 821 do
  Alarm := (array[i] > 0) and (array [i] < 16);
  i := i + 1;
End_while;
 
Last edited:
Wouldn’t this work?

Code:
Alarm := FALSE;
i := 1;
While not alarm and i < 821 do
  Alarm := (array[i] > 0) and (array [i] < 16);
  i := i + 1;
End_while;

🙃 yes, +1 :geek:.

And by switching to a REPEAT-UNTIL Alarm or i > 820 we can drop the initial assignment of Alarm.
 
Last edited:

Similar Topics

The past week we received a new piece of equipment from Germany which utilizes siemens controls. Typically in our company we use A.B. controls for...
Replies
9
Views
182
Hi, I am looking to migrate some of our Electronic Overloads off of a Troublesome Devicenet Segment. Is there any documentation confirming the...
Replies
5
Views
104
Omron AD081-V1 Analog Input Card Offset & Gain Adjustment Entering Adjustment Mode 1. Set the input card in adjustment mode (Turn ON Dip SW No-1)...
Replies
0
Views
88
How to retain Values in CCW software? I am using CCW software and I can not find the Retain function in this software. Not even local or global...
Replies
2
Views
169
and then when i open the windowmaker, intouch is shutdown... that's not work that's demo I have 30days demo
Replies
3
Views
171
Back
Top Bottom