SLC scan time problem?

PLC_NEWBIE

Member
Join Date
Mar 2007
Location
Illinois
Posts
35
Right now I'm trying to use a SLC 5/05 to control a 21 lane sorter. I'm INDIRECTLY moving words (integer files) by using shift registers; for example N17:[N5:1]. Does the SLC have scan time issues because of indirect addressing? This has never been an issue because ive used Control Logix. Were running around 15ms can time. The memory is 32K and we have 800 words of memory left. Any advice and input is appreciated.
 
I'd strongly doubt that - indirect addressing is supported at the very lowest level of all modern processors. You can test it though for yourself by temporarily disabling any blocks that use the indirect addressing then reading the scan time again.

Regarding speed, it's hard to know whether you have a scan time problem or not until you describe the problem to us a bit more. Is the sorter failing to swap lanes fast enough or something?
 
Indirect addressing adds to the scan time. For example for N17:[N5:1] you would have to add 56.15us per access. That is significant, for example an integer MOV instruction uses normally 1.125us.
So you have to use indirect adressing sparingly, and you should execute code with indirect adressing conditionally rather than cyclically.

If the above means that you have a problem with the total cycle time will depend on how much indirect adressing you will do, and what your requirements for scan times are.
 
response

what im doing is tracking an image with using a shift register the i drop the info into another register and this would be the hitpoint (divert the shoes to a certain lane). When i use the indirect addressing method the timing is off like 5 or 6 shoes. BUT, when i manually drop a number in without using a shift register the timing is perfect and there is no timing issue. I can't go in specific details how the sorter program works because of trade reasons but i hope this helps. Thanks in advance for your inputs.
 
Indirect addressing can add significantly if your parsing a block of data, but I would not think 15ms scan times would create a problem unless your line is running very fast. Examine your logic to be sure there is not another error. You could also compare you line speed with your scan time and determine if the line moves faster than the processor can see.


Good luck.
 
When i use the indirect addressing method the timing is off like 5 or 6 shoes. BUT, when i manually drop a number in without using a shift register the timing is perfect and there is no timing issue.
Newbie, I would guess that there is an error in your shift register setup. Read the programing manual and make sure you understand how the shift register works, then review that part of the program yet again.

Is it always off by the same number (5 to 6) of shoes? If so, probably it is not a scan-time issue.
 
I just replaced a bunch of junk code used in a sorting machine that was based on FIFO stacks...

It would get "off" by a box or two at least once every 36-48 hours of production at up 21 cases per minute. The operators had to manhandle a bunch of product and perform an HMI reset sequence while the upstream conveyors accumulated product. The robot cell would keep palletizing sometimes unnoticed 'til quite a bit of stuff was in the wrong stack.

Sometimes this would halt our sausage packing department if it happened several times in quick succession, or the operator was busy doing paperwork or something and didn't baby sit the area really carefully.

I found to my surprise that cardboard cases are highly reflective and were fooling the fixed field photocells and therefore fouling up the FIFO stacks even with debounce timers in the PLC. It was quite erratic too, seemed to be affected by lots of environmental variables beyond my scope of control. Sometimes it would hiccup 6 or 8 times during a single day shift, and then run a whole 24 hours just fine.

I arrived at the conclusion (<- opinion) that dependence on multiple photocells with simple FIFO stacks to drive the PLC model of the product positions is a flawed design.

The PLC can estimate the product positions much more accurately with a more carefully put-together abstraction.

In my new logic, each box is "birthed" into PLC memory by being qualified by a single, reliable, polarized retroreflective photocell. The speed of the conveyor can be calculated or measured or both, so the PLC can easily predict the distance travelled based on time of birth and rate of travel.

I didn't have an encoder to drive my replacement logic as I have done in the past with fantastic results, so I used a handheld tach to build PLC "pseudo" encoders which keep the PLC informed as to the distance travelled by each belt during each PLC scan.

The new logic calculates the distance travelled every 100ms STI scan by all four conveyors including estimated accel and decel times and a routine in the main PLC scan cycle updates an array containing "Boxes_In_Process". I need to do away with the STI routine and just update the whole array every scan, but it was easy to implement that way and plenty accurate enough for this application, since I could easily convert motor starter statuses and carefully measured speed to 100ms chunks.



The array is a set of files: N (integer) file to hold the ID code for the box, N file for the lane assignment, F (floating point) file for the current position past the primary eye in inches, (and three more N files for the unnecessary redundant barcode readers my boss forced me to install....)
He still thinks that all four readers are involved in the tracking, but it has been running almost flawlessly in single reader mode for 3 months. Once in a while they break a kicker cylinder or valve or that one critical eye gets dirty, but no boxes get mis-sorted anymore.






If not for those added readers, the whole improvement only required the purchase of one $75 photocell and reflector.



I use that one single primary measuring eye to qualify the length of each product.

Now it cannot get out of sync unless a conveyor belt breaks (which has never happened, but a coupling broke once and it sent one wrong box down a lane and then stopped due to a photocell alarm). If the eye detects an "Irregular Size" box (outside my qualification limits) the line stops, and there is only one eye/reflector to check.

So I replaced a bunch of SLC code and one of the fixed field photocells with a polarized retroreflective style to eliminate more than 99% of the systems' previous problems.

My new logic uses indexed addressing liberally to update a hand-made SLC UDT that keeps up will all the boxes in transit between the redundant (4) barcode readers and the final lane conveyors.

I don't shift much data, just a pair of pointers that tell me where to POKE in the next new carton detected, and the index pointer for the farthest one on the sort belt. Each time a box is born (qualified), the low pointer is decremented (with wraparound) and the length value is popped into that Fn:Low_Pointer.

Each time a box is kicked into a lane, it's position is added to put it out of range of the update logic. If the high pointer position is greater than my end conveyor position, the high pointer is decremented (with wraparound).

So this way, I don't have to update 200 case positions unless there are really 200 cases in process. My system usually only has 6 or eight boxes in transit at any given moment, which makes this apprach very feasible. I have another method for situations where much more product is in process which uses less CPU time, but is more difficult for the layman to follow.

The barcode readers are triggered when this position reaches their trigger window limits, and then they populate the ID field for that array item. So I do dozens of indexed compares, and a lot of limit checks with indexed sources to manage all the products, the diverter assignments

I DO still rely on the old photocells to time the kicker SV outputs, but that's all they do.

Now you can't make the thing mis-sort. If you flag an eye and try to fool the system, it "knows" there isn't a box in that position range assigned to that eye and will halt the cartons and let them accumulate upstream until the PV+ "Photocell x Alarm" is ack'd.

The original code without STI routine and with sparse indexed addressing was about 25ms.

Now it averages about 40ms and peaks out around 50 once in a while when there are multiple interfaces beating up the DH+ on the 5/04.

Still, that is plenty fast enough for my box stops and kickers on local I/O to catch and kick boxes off. I was able to bump up throughput to 25 cases per minute and virtually eliminate line stoppages. The main sort belt runs at 91FPM and my products are from 14 to 30 inches in length, with about a 2' required gap required by the mechanical swing-down style box stopper and kicker design, or it could run much more product.

That's how this Okie does product sorting in a nutshell...
Paul
 
Last edited:
OkiePC said:
and three more N files for the unnecessary redundant barcode readers my boss forced me to install....)
He still thinks that all four readers are involved in the tracking, but it has been running almost flawlessly in single reader mode for 3 months.​

OkiePC,

Does your boss read this forum?o_O
Or will a barcode reader that has been smashed by a forklift give up your secret?o_O


 
My Boss is a hardhead under pressure to please a "less than technically expert" upper

My Boss is a hardhead under pressure to please a "less than technically expert" upper management group. He's a great guy, he knows everything I think is wrong with all the stuff by now. As engineering assistant director he has to please all aspects of the company and makes good decisions. He is also one of those show-me types, difficult to convince, but it pays dividends in his role to be that way...

He is too busy to read this forum...

milldrone said:
OkiePC,

Does your boss read this forum?o_O
Or will a barcode reader that has been smashed by a forklift give up your secret?o_O


[/indent]

I guess I need to just market my code and quit trying to give it away here...

Problem is, it's not as refined as it needs to be. Each implementation I mold it to fit the existing system...

So I can't easily describe it clearly enough for someone else to try to implement....it's a paradigm shift in approching bit-diddling based on my experiences since 5th Grade maximizing the I/O control of 16K 'pukers...too big a leap for most to grasp without some sort of visual aid other than my rambling text...

The first implementation had an encoder and still runs flawlessly for months on end with no readers of any kind.

I used all my I/O to give the little SLC spidey-vision and used pointers to map it's digital retinal contents. I added twelve lines of code to the exisiting logic, and 16 branches to populate the visual cortex of the tire line...pure beauty...my 1st employer owns that code and I will not violate the agreement I had with them during my employment there. They don't own my brainpower though, so I will come up with a cleaner, newer version of the Concept someday when I can get a good PLC editor at home...

I am not worried about the new boss reading this. He knows every expert opinion, they were committed, had already spent the money, and didn't want to appear wasteful.

He said paraphrasing 'The owner will be pleased when he sees multiple readers even if they don't do anything...we cannot afford to have Wal-Mart getting McDonald's or especially McD's getting a box intended for Burger King! So we ARE going to use them...' A little CYA on his part...that was several months ago...now I can get away with MY way...

I think next shutdown day I will jerk the old Adaptascan outa there and mothball it. Then I can move one of the three new Datalogic scanners to the front of the line and spare out the third one.

Then I can eliminate the impending purchase of a spare and give them full time dual redundant readers.

The cool part, is in the SLC I only have to delete two subroutines and change my position limit window for the reader I move, and it will not skip a beat.:whistle:

Okie

EDIT: As long as they don't take out both the first 2 readers, all lanes still work. The 2nd reader is too close to the first diverter and sometimes returns late reads, allowing the box to fall out the reject lane (end dead rollers) when they knock over the 1st reader, and when they get tired of hand reinserting them, they will call me and I will go re-aling it. It has happened twice. No production stops though.

It's original mount is an old ball-vise machinist style but occasionaly gets hits with a spray hose at night or something...

Bring them truckers! They feed the world 300,000lbs of sausage 6 days a week! Let 'em break something once in a while, just keep the food flowing!

:)
 
Last edited:
Ot...

Okie,

Just have to ask if the truckers are soon going to come in by way of the Trans Texas Corridor. Looks like Mayer Mick Cornett has been doing some backtracking.

CeCo3
 
I was questioning the advice of our equipment manufacturer’s engineer after seeing unexplained fluctuations in the process. The rotary machine operates at a very consistent speed of 1,200 pieces per minute, which equates to 50msec per piece (the product cycle) with one rotation taking 2.5sec (50 product positions per rotation). Analog measurement of a critical quality specification is performed once per product cycle and consistent triggering of the measurement is the key to repeatability. After each revolution, the machine calculates statistics based on measurements obtained from each of the 50 positions. I was seeing unexplained deviation in these calculations and began questioning the capability of the measurement system. Although the SLC5/04 does report the average and highest scan rate, it couldn’t help me determine if the scan rate was an issue or not. So....



I programmed a rung to alternate the state of a spare output once per scan. I then placed an o’scope (actually, a data analyzer) on this output as well as the input/output signals related to the critical measurement (analog signal, measurement trigger, etc.). The results were very interesting to say the least.



The SLC was producing a very consistent 4ms scan rate square wave on the spare output. Under this condition the standard deviation calculation was very low, meaning there was very little variation between each piece, revolution-by-revolution. Analysis of the analog signal and trigger confirm the product was being fabricated properly. At certain times though, I would notice a rogue 11msec scan cycle asserting once every 12 scans or so, which had an effect on the standard deviation calculation (it increased). Long story short, it was a result of CONNECTING THE STUPID LAPTOP! Yes, just the act of going online across DH+ was enough to increase the scan rate as data was exchanged between my laptop node and the SLC5/04 node. When I went offline, the 11msec scan cycle would disappear; go online, it would come back. All I was doing online was monitoring various addresses.



When the 11msec cycle occurred, it would cause the PLC to sample the analog signal 7msec later and that was enough delay to cause a lower value to be measured for that position, which adversely affected the standard deviation calculation (because 4 of the 50 measurements encountered a 11msec scan). The factory engineer didn't think there was any issue with the scan rate... until I showed him the data. For most SLC5 users, this 7msec wouldn’t make a difference, but in our case, accuracy and repeatability are very important fo the process.

But wait, what happens when management wants to make the machine go faster, say 25% faster? Arrgghh... Now the product cycle drops to 40msec and one revolution takes 2.0sec (total of 1500 pieces per minute). Another long (very long actually) story short, I discovered that small variations in the 4msec scan rate are adversely affecting measurement as well. I was seeing some 4.5 msec scans that I hadn’t noticed before when the product cycle was 50msec. At 40msec, these 500usec variations began having a more pronounced affect on measurement accuracy and repeatability. At 50msec, they had an affect then also, but a far smaller one.


Needless to say, with such a short product cycle, the SLC5/04 is at the very limit of being in control of the process. Believe it or not, we did not increase the speed based on the findings (data-driven decision making works sometimes).



To 100% confirm whether indexed addressing is affecting your system, create a scan rate heartbeat on a spare DC output if you have one and put an oscope on the signal.

O:3/15 O:3/15

------] /[-------------------( )---

You will need to connect a resistor between the output (4K-10K ohms will work) and DC return (pulldown) or VDC (pullup). Alternate your addressing method and observe the results.


Okie,

Great write-up on how to deal with an unsynchronized conveying system without an encoder! We have a very precise encoder which makes it so much easier to track position.

CeCo3

 
4ms rising and falling edge frequency from a SLC flip flop?

Wow, impressive diagnostic methodology!

A 4ms scan rate on a local output from a 5/04?

That alone is impressive...using the poor little SLC to sync high speed analog data with an encoder is pushing it's limit...

You would have to write code to monitor the STI overlap bit and react accordingly to be able to withstand comms hits in a SLC. Or instead interrupt routines, are you using the HSCE card cofig or outputs to strobe in the analog signals? I am very curious about the program flow that acheives 4ms...

C-Logix would be an easy cure...

Better off putting that algorithm in a motion controller that can strobe the analog signals faster based on encoder feedback...

I hate working on processes that are excessively PLC scan time dependent. On my box sorter system, my little increase from 25 to 50ms peak scan, randomly caused one of my kickers to fault out for not seeing the extend prox during the extend storke. I discovered the out position prox was about two inches from end of stroke and was sometimes missed following my sorter logic change. The pulse on duration was only about 40ms.

I put in an extend time limt to work in parallel with the out prox to trigger the kicker to retract and keep the line running smooth...I really need to extend the prox flag, or just remove it entirely. To make our process fast as possible, I have to start retracting before end of stroke anyway, so a simple timer works just fine...
OkiePEC
 
Last edited:

Similar Topics

I have a slc 552 which uses up to 220 ms in scan time. Memory used 7990 and 2070 memory free. There is some indirect programming in the code. Will...
Replies
9
Views
2,752
Scan question for ton timer If a TON is on a output branch and rung is true. The next branch has a XIC contact off of that .DN bit to an OTE The...
Replies
6
Views
8,070
SLC 5/04 Does anyone know what the typical scan time is for the Compute instruction? The manual states "The execution time of a CPT instruction...
Replies
24
Views
5,905
I just changed out an AB 5/04 to a 5/05 on one of my lines. I had the program all configured offline, loaded into a new 5/05 chasis, powered down...
Replies
10
Views
5,731
Hi, I've inherited an old machine that makes widgets. it runs well at 300Widgets per min, but any higher it gets flakey. This is a scan time...
Replies
31
Views
10,095
Back
Top Bottom