Any instruction to store, sort of mesh ???

darkesha

Member
Join Date
Nov 2007
Location
Calgary
Posts
107
I have a set of 21 sensors to monitor size of product. This gives me one integer value that corresponds to how many sensors are seeing the product.
I also know how much of a distance is from the beginning of the product to every single sensor.
Is there a simple instruction that would read my integer value, let's say
1111
or 15
and match it to my preset distance of 763cm, or whatever it works out to be ?
If not then I need to use something like 21 rungs of compare/move rungs in order to store the right value in.

So to summarize, I would ask this instruction what is value of length (in cm) for binary value of X. Anything at all ?

Thanks
 
If the spacing is linear and all sensors from the beginning (zero bit) to the last one are made then it's a simple equation. Starting with bit zero give a list of the distances here. You'll have a simple equation in no time.
 
Thanks very much for the reply.
Sensors are wired normally close and approximately around 50 cm apart.

I created a DINT word where every sensor is making one of the bits high, so then I can use this DINT word instead words from two different cards.
(I was so sure that I can alias every bit of this word to particular input, but it is not possible so I made 21 rungs
---II----( )- with corresponding input value and the Output bit of this DINT.I am also wondering if I can find more elegant solution for this problem as well).
For a sake of example I will use only 3 predetermined distances and 3 different binary results. If this isn't enough I can edit this post later and add others.
1572 [cm] - all sensors covered - DINT value of 2097151.
1483 [cm] - all but Sensor.20 - DINT value of 1048575.
1437 [cm] - all but .20 and .19 - DINT value of 524287.
 
Can your product get into the middle of your sensor array or is it justified to the low end. For example can you have Sensor.15 covered but have Sensor.0 unconvered?

If no, then the length is simply the position of the last sensor covered. This would be 20 rungs made up of:



| MOVE
| Sensor.[X] Sensor.[X+1] __________
|------] [----------]/[--------|Sensor_X_Length
| |to
| |Product_Length




Only one of these rungs will be true so the length will be selected.

If your product can get in the middle you will need a table of distances between sensors. You will need to determine the lowest and highest sensor covered. You will then need to sum the deltas between sensors. How difficult this is depends on the plc you are using. But a very generic method would be to clear a sum at the beginning of a list of 20 deltas and if both of the sensors bounding the delta are covered add the delta to the running sum.

Keith
 
If the sensors are approximately 50cm apart why do your first two numbers differ by so much? If this isn't a linear progression then you'll have to use a lookup table.
 
Last edited:
Can your product get into the middle of your sensor array or is it justified to the low end. For example can you have Sensor.15 covered but have Sensor.0 unconvered?

If no, then the length is simply the position of the last sensor covered. This would be 20 rungs made up of:



| MOVE
| Sensor.[X] Sensor.[X+1] __________
|------] [----------]/[--------|Sensor_X_Length
| |to
| |Product_Length




Only one of these rungs will be true so the length will be selected.

Keith


This is how I can do it, but it will take another 20 rungs. As for product between sensors, we have analog transducer that will take care of the calculation.
What I am looking for is some instruction that will spit out the distance based on when next sensor is covered by transducer pushing. Then I will just subtract the distance of the product traveled up to that point.
 
If the sensors are approximately 50cm apart why do your first two numbers differ by so much? If this isn't a linear progression then you'll have to use a lookup table.

Most of them are between 40-60 but there is few that are longer.
I never heard (so far) of the lookup tables. How do you create/store one ?
 
Look into the File Bit Compare instruction to locate the bit you are looking for. The value in index 0 of the result array that is the position of the first unblocked sensor. Use this value as an index into an array of lengths that match up to the sensors.

So you would have an array containing 21 length values with index 0 being the length of product with the 1st sensor blocked, index 1 being the length of product with the 2nd sensor blocked and so on. I don't think you can use an array element as an index into an array element so you will need to move the result array index 0 value into another tag before you can use it to index into the length array.

Keith
 

Similar Topics

Hi all. Never really noticed, but I started double checking operands in the CPT instruction. I found if I have the expression N7[37,1] - N7[35,1]...
Replies
3
Views
144
I'm trying to dig to the source of a minor "recoverable" system fault throwing a fault light on a machine that has been confusing my operator...
Replies
3
Views
125
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
139
Does this instruction calculate values during a single scan, or does it require number of scans based on element count in the array? For Example...
Replies
3
Views
136
Hello All, Was hoping I could get a little help with Modicon ladder logic. This is the first time I have seen Modicon logic and currently trying...
Replies
6
Views
318
Back
Top Bottom