I need a logical hint...

briana banks

Member
Join Date
Jul 2005
Posts
242
Hi all

Using RSlogix 5k( but may be applicable to any other plc)

in my project i have 6 devices (it can be motors or any other heavy machinery.

I take a DINT variable to represent an array of these items

I use the first 0..5 bit as a cyclic array and able to know which of the 6 devices are in fault mode.

for example (the first 2 devices are in fault):

0 0 1 1 1 1

There is a pivot(index) to this array which represent the first item in this cyclic array and its position is changed every 2 days (if a device is in fault it should skip it).

there are 6 setpoints and in each setpoint, an additional device
is turned on (if a device is in fault it should skip it)

In other word i need to manipulate arithmetically,a stack and
a queue using these bits.

How can i do that ?
 
Last edited:
Briana,

Because you only have 6 items, I suggest 6 simple comparison insructions:

"If Bit 0 of DINT Variable = 1, then DO SOMETHING to Device 0 (otherwise do nothing about this device)".

"If Bit 1 of DINT Variable = 1, then DO SOMETHING to Device 1 (otherwise do nothing about this device)".
----
And so on, for all 6 devices.

Now, your question is not clear to me whether Bit 0 always represents Device 0. If Bit 0 swaps to a different device every two days, then you should use indirect addressing to determine which device Bit 0 now corresponds with.

Because the fault condition is a random event, it would be difficult to use a Sequencer instruction. Sequencers work best on a set of fixed steps, or in other words, a sequence of pre-determined events. A fault is not a fixed pre-determined event.
 
Last edited:
If you were using a S7 this would be trivial

Code:
while DeviceBits and BitTable[index] == 0
   Index = ( Index + 1 ) mod 6;  
end

// Index now points to the next device to run and BitTable[Index] can be used to turn it on.

BitTable has one bit set for each index and it is 1 shifted left b the index index
1
2
4
8
16
32

If you can do multiple shifts then

while DeviceBits and ( 1 shl index ) == 0
   Index = ( Index + 1 ) mod 6;  
end
 
Hi All

Well,i think it is not that trvial.
I need to do a routine that will work for 3 items as well as for
100 items.the routine should be generic in a way that it'll be
very easy to add or subtract items.

it is trvial to create an index that will be the first item
in the queue (and increment it by one each ceratin period) and add items to it according to setpoint.
the problem is to scatter duty so faulted items
when they are repaired get the highest priority for the next round.
 
Look at the FSC instruction (File Search and Compare). It should accomplish what you want. It behaves like Peter's WHILE loop and "bails" out when it finds a match, leaving it's control word x.POS holding the value of the index for the matching array element. You can program it to search all at once or select the number of elements to operate on during each program scan.
 
Last edited:
Run time per item is not relevant as i mentioned
there might be 100 and more items.

DINT type
p1 p2 p3 p4 p5 ...
activation_array X X X X X .... (activation_array.0 ..)

avilable array 0 1 1 1 0 (not in fault)

maybe i can subtract the faulted items(number)
and use an expression for the available items
 
Last edited:
I believe you can use the OTE instructino with indexed addresses even to the bit level...I wouldn't want to troubleshoot it, but in your special situation, it may be the best method.

I am not sure if you can dynamically modify the array size. You may just have to create an array of the maximum forseeable size, and only operate on the part that is in use at any given time.
 
It sounds like we are attempting to make a PLC act like a 'C' routine, it is not very efficient. You may be better off breaking your DINT into a 32 bit array and manipulate the bits with indirect addressing.
I may not understand what/why you need this 'mathematical' means of turning bits ON/OFF but I know that PLC's are not designed to make this easy or efficient.
It does appear to be an interesting challenging exercise though.
 
Nope

On the contrary,PLC is designed to work with bits.
thus manipulating it through bits arithmetics is the easiest
way of doing so.
 
Why did I bother to answer?

briana banks said:
Hi All

Well,i think it is not that trvial.
It is as stated above.

briana banks said:
Hi All
I need to do a routine that will work for 3 items as well as for
100 items.
You did say that above. You said 6

the routine should be generic in a way that it'll be
very easy to add or subtract items.
You didn't say that either.

the problem is to scatter duty so faulted items
when they are repaired get the highest priority for the next round.
[/quote]
You didn't say that either.
 
briana banks said:
Nope

On the contrary,PLC is designed to work with bits.
thus manipulating it through bits arithmetics is the easiest
way of doing so.

This might have been true for most PLC's at one time but it is certainly not true for Control Logix/L5K which works with DINT's by default.
 
OK.

I appolgy.

I didnt mention all the above but bit manipulation
should solve all problems.
 
Last edited:

Similar Topics

So i've been at this for a long while, i have Citect Scada 2018, i have full access to everything but i can't seem to find any option or...
Replies
0
Views
59
I've got this 3-phase 575V motor that we're controlling with a VFD (Variable Frequency Drive), which has been quite the learning curve in itself...
Replies
10
Views
294
I'm fairly new to Rockwell software, I've had some basic training in the past but nothing too advanced. My company and I use Reliable products for...
Replies
11
Views
351
Hi all, I am having issues accessing my Cimplicity software - the site code changed after re-install and I am no longer able to attain a new key...
Replies
10
Views
177
Good day all! Can someone help me with the procedure to update Beijers E700 firmware? The Panel I am working on is firmware 2.04v and I would...
Replies
1
Views
82
Back
Top Bottom