Better design or coding?

Davek0974

Member
Join Date
Nov 2014
Location
Hertfordshire, England
Posts
145
I am making massive headway into the PLC replacement i have mentioned in various threads, its all running and even the AB stepper drive was easy in the end.

The troubles appeared when it came to stopping and restarting or just starting simetimes ;)

It will occasionally start in a zombie state where the cutter will cut out of step or other odd things happen.

The machine is a printing process consisting of PRINT - ADVANCE MATERIAL - CUT steps, when the cut instruction is made, the next PRINT cycle starts.

I'm just a bit baffled as to how to de-bug the process or to simplify it. Its all written in 48 rungs of code but is pretty complicated in places which makes me think I wandered off in the wrong direction possibly??

Any ideas for easy to understand design or how compartmentalise a series of steps??
 
Is there a possibility here to use a seperate file for each stage and use an input trigger bit then wait for an output reply bit?

The main SYS ladder would then contain the stop, start and sequence control only

Just thinking....
 
Davek0974,

it sounds like you have a timing issue in which the print cycle is started when the cut cycle is started.

several suggestions for you.
#1 if this is a dual cutter, look at each cut command. maybe something is different on one cycle.

#2 can you install sensors at the end of the cut stroke and use that signal to start the print cycle?

#3 insert a time delay before the print command. i don't recommenmd this step since there are air flow and cylinder variables that come into play when someone adjusts the air flow or replaces the cylinder.

regards,
james
 
Davek0974,

it sounds like you have a timing issue in which the print cycle is started when the cut cycle is started.

several suggestions for you.
#1 if this is a dual cutter, look at each cut command. maybe something is different on one cycle.

#2 can you install sensors at the end of the cut stroke and use that signal to start the print cycle?

#3 insert a time delay before the print command. i don't recommenmd this step since there are air flow and cylinder variables that come into play when someone adjusts the air flow or replaces the cylinder.

regards,
james

Hi, yes it is a bidirectional cutter, it parks at either end but the anomaly appears regardless of which end the cutter starts from. It does have sensors at each end, these are used to tel the process that the cutter has parked after a move.

It does seem to be timing related, something is not rock solid in the logic maybe and it lets the sequence start wrong?

I might try a re-write using more compartmentalised structure, focus on each section then join them together?
 
which plc are you using?

if this is an older slc500 series, then I would look at the following rules I have gone by.

1. no more than 20 in series commands. the initial program manuals said 14.
2. no more than 10 parallel branches.
3. no more than 8 nested branches in the logic.

I had a 5/03 that worked perfect until I went from 10 to 12 parallel branches. I then got erratic results as you are describing.

if the code looks ok, I would insert a time delay on each cut cycle. say .01 or .02 sec. just enough time to let the processor scan a cycle or 2.

regards,
james
 
which plc are you using?

if this is an older slc500 series, then I would look at the following rules I have gone by.

1. no more than 20 in series commands. the initial program manuals said 14.
2. no more than 10 parallel branches.
3. no more than 8 nested branches in the logic.

I had a 5/03 that worked perfect until I went from 10 to 12 parallel branches. I then got erratic results as you are describing.

if the code looks ok, I would insert a time delay on each cut cycle. say .01 or .02 sec. just enough time to let the processor scan a cycle or 2.

regards,
james

I think we might be putting the cart before the horse here. Before you get too far into changing your code, you should debug it. If you just keep changing it until something works, (a) that will take a long time and possibly not work at all, and (b) you will learn nothing about why it wasn't working, or how to debug it next time it stops working.

You may even find that there's a physical level problem, in which case no amount of rewriting code will help you. The "change things until something works approach" is useless for effective troubleshooting. It's like using a shotgun where you should be using a scalpel.
 
That is, it's on a 12 year old SLC5/03 unit.

I have been doing some armchair coding and looking at using subroutines for each critical process step, the subroutines would be called by a set of checks -
print one image,
is image printed?
If Yes then advance the web,
Has the web finished moving?
If yes then make the cut,
Has the cut finished?
If yes then back to 1st step.

Maybe that will work easier?
Can't hurt to do some practice I guess;)
 
I am making massive headway into the PLC replacement i have mentioned in various threads,
It could be that someone would have solved your programming problems by now, if you had:
1. Put all your posts about this program in the same thread;
2. Posted a print-out of your program.

Trying to tie it all together:
http://www.plctalk.net/qanda/showthread.php?t=91418
http://www.plctalk.net/qanda/showthread.php?t=91466
http://www.plctalk.net/qanda/showthread.php?t=91499
http://www.plctalk.net/qanda/showthread.php?t=91525
http://www.plctalk.net/qanda/showthread.php?t=91535
http://www.plctalk.net/qanda/showthread.php?t=91574

Maybe it was best to separate it out into chunks...
 
Last edited:
It could be that someone would have solved your programming problems by now, if you had:
1. Put all your posts about this program in the same thread;
2. Posted a print-out of your program.

Trying to tie it all together:
http://www.plctalk.net/qanda/showthread.php?t=91418
http://www.plctalk.net/qanda/showthread.php?t=91466
http://www.plctalk.net/qanda/showthread.php?t=91499
http://www.plctalk.net/qanda/showthread.php?t=91525
http://www.plctalk.net/qanda/showthread.php?t=91535
http://www.plctalk.net/qanda/showthread.php?t=91574

Maybe it was best to separate it out into chunks...

Thanks for that and apologies for not doing so, the issue i have seen in the past with mega-threads is that they tend to die rapidly as it rambles on, response drops off. I was hoping that by keeping each issue alone would give me concise answers and it has until now, this forum is excellent.

But yes, as this is more a general issue, I really should have linked, thanks for doing so.
 
Step too far?

Could someone please explain why this rung would not function inside a subroutine??

BST XIC B3:0/11 XIC B3:3/6 NXB XIC B3:2/12 BND BST OTE O:4.0/12 NXB OSR B3:3/2 OTE B3:3/1 BND

If i trigger B3:2/12 nothing happens, if i trigger O4:12 it moves the ram as expected.

The subroutine is unconditionally called in the main ladder.

Thanks
 
Step too far?

Could someone please explain why this rung would not function inside a subroutine??

BST XIC B3:0/11 XIC B3:3/6 NXB XIC B3:2/12 BND BST OTE O:4.0/12 NXB OSR B3:3/2 OTE B3:3/1 BND

If i trigger B3:2/12 nothing happens, if i trigger O4:12 it moves the ram as expected.

The subroutine is unconditionally called in the main ladder.

Thanks

maybe you overwritng b3:2/12 in some other rung?
 
Yep, as they say, **** happens :)

I'm chewing on the next issue now, one setup option needs the machine to make one impression but three feed-cut cycles. For some as yet unknown reason, the first fed-cut sequence is 15mm shorter than the next two :)

This is odd as the feed length is set so is not changing, it can only be some sort of drive reset or setting that is different between the first full cycle and the subsequent repeat cuts.

On a good note though, my rewritten compartmented code seems easier and more logical, to me at least.
 

Similar Topics

Good Afternoon , It seems like we always have problems with using Type J Thermocouples with our slip rings . Would using a RTD at 10...
Replies
6
Views
1,643
I am beginner in B&R Automation Studio and TIA Portal. Have an experience in electrical part of PLC cabinets. Now its time to get a new skills...
Replies
8
Views
1,674
Bla Bla Bla, why doesn't it work, l need help and l don't understand PLC's. Or better they understand everything, but can't understand +1 -1 = 6...
Replies
22
Views
6,008
I rarely need to add a network card to the drives we install... very rarely. But my sales-guy said he needs to quote a network-connected ACH580...
Replies
6
Views
2,594
I'm currently on a research project where I can send tag read & write requests to both SLC as well as CLX controllers. Presently, there's no...
Replies
8
Views
2,413
Back
Top Bottom