what is causing me plc to going in cycle loop

jg1423

Member
Join Date
Aug 2022
Location
canada
Posts
10
Good Day everyone

I am currently writing a program for a 4 cylinder press i have it mostly done.

just have one issue with my program where i put it in auto and i flick the switch for it to start its cycle. the 4 cylinder press just goes down for 2.5 sec then comes back up to home postion and then goes back down and keeps doing this till i put it in manual or press the e stop.

what is suppose to happen is that once it goes down for the 2.5 sec and comes back to home that should end the cycle or be its full cycle till i flick the switch again for it to then start its cycle again.

im not sure what i am missing maybe for the plc to tell it to stay home till i do flick the switch again to start its cycle but as of now it just keeps looping in cycle as i can see it and cant find where it can stay home and end its cycle.

there are only 4 sensors on this press which are home sensors.

i will attached the project file or maybe attached screen shots to have a better look. the main logic is in the cycle sequence and press logic under OP10A
 
To be honest I am more surprised that it runs at all.

Based on rungs 5-8, SEQUENCE.2 will never become true as CYC_COMPLETE will be triggered as soon as SEQUENCE.1 is true and reset all the sequence bits.
 
Also, is your start switch maintained or momentary? If not momentary then you need a one shot instruction after it.
 
on rung 5 sequence 2 does become true but seems to stay on or its stuck on i think the unlatch also turns on but does not reset if i see it correctly because it stays stuck in cycle
 
the start switch is momentary for .5 sec as shown in the screen shot

man i really need to resolve this lol

start switch.PNG
 
The code is a bit of a mess, but as mentioned before, on the very first scan after you initiate a cycle, your code is going to turn on the cycle complete at rung 7, then resets the cycle complete in rung 8, and by the time it comes around for the next scan, the cycle will initiate again because the switch will likely still be on and you also have the TOF, and you have the cycling bit latching this rung on. So it seems you might be able to keep the cycling bit on and it won't turn off.



As for the rest of what's happening it's hard to say but I would fix that part first and see where you're at after that.
 
That's a start but keep in mind your cycling bit will go off and you need it on for Rung 0 in the 2nd routine that keeps OP10A_Press.Work_Auto on. Unless "Auto PB" stays on? But it says PB so I assume not.



Also, your cycle now ends after the press has advanced for 2.5 seconds. IE the cycle ends before the press retracts. Is that what you want or you want it to start from home, advance for 2.5s, then retract, then cycle complete? If so then you need another step in your sequencer.
 
i might have found out that the sequence 1 which is lowering the press is staying latched on so if i can maybe do a one shot one that every cycle and have it rest would that work
 
maybe this could help it from looping in its cycle

"Help" it? This is discrete ladder logic; it

  • mercilessly and inexorably does exactly what we tell it to do,
  • cares not a whit what we want it to do, and
  • does not need help to perform those functions.
This needs less logic, not more. We must tell it exactly what we want it to do; trying to "help" a computer figure out what we want it to do is never going to work.

This is why some people avoid latches and unlatches: the actions resulting from latches hang around like a stale f@rt, making it hard to figure out why what we told it to do is different from what we want it to do.

Look at these two HH (Hopefully Helpful ;)) rungs:
CS4.PNG
  • If the XICs, including OP10A.HOME, on Rung 7 evaluate to True, then OP10A.CYC_COMPLETE will become 1 by the latch.
  • Then when Rung 8 executes immediately after that during the same scan cycle, since the third XIC of Rung 7 evaluated to True, and OP10A.CYC_COMPLETE is 1, the first two XICs of Rung 8 must all evaluate to True, so all of the unlatches will fire, resetting OP10A.CYC_COMPLETE back to 0.
  • So OP10A.CYC_COMPLETE can only ever* have a state of 1 between Rungs 7 and 8 on a single scan.
    • So the XIO OP10A.CYC_COMPLETE on Rung 2 (CS5.PNG) will always evaluate to True and can be removed.
  • Would it not be simpler to just put the last four OTUs from Rung 8 where the OTL is on Rung 7, and bypass OP10A.CYC_COMPLETE altogether?
* unless it is also latched somewhere else i.e. post the entire program, PDF preferred, if you want help.
 
Memorize these patterns:

Note that

  • The Start/Stop Circuit pattern is a form of programmed hysteresis
    • A Start event or condition at a given time triggers entry into a certain state*
    • That state is maintained even after the Start condition is no longer True*
    • That state is terminated when the Stop event or condition occurs
  • Multiple Start/Stop Circuit patterns are the building block of the Step pattern
Programming PLCs is about time; programming is concerned with more than input, output, and internal bitbox values per se, it is far more concerned with what those values are and how they change over time.

* as long as the Stop condition is not blocking it
 
CAVEAT: this is only a proof of concept that does not include safety features for the press or pay any attention to safety; those features must be added separately.

One issue with OP's code is that it mixes the business logic of a cycle with the press control output and other features, which makes it harder to read and understand. Separation of Concerns is a design pattern that isolates distinct (seperable) parts of the logic for clarity.

Rather than try to fix that code, the process is simple enough that a complete refactor makes sense. So here is a minimal approach to the business logic of the press. These rungs set bits which could be used to drive outputs in concert with other inputs e.g. light curtain, E-Stop, Auto/Manual Mode switch, etc.

TL;DR

These rungs, most of which use the Start/Stop Circuit pattern,

  • detect a button press to arm the process prepatory to a work cycle
  • detect a button release to command a press work cycle for 2.5s,
  • detect the end of the work cycle to command the press home,
  • detect press at home to end the home command,
  • prevent the cycle from arming again for 5s after the later of a start button release and of the press arriving at the home position.
    • This last feature is not a requirement, but demonstrates what can be done.
The ordering of the rungs, from later (return home) to earlier (arm process for a cycle) is what makes this work so simply. Waiting an extra few milliseconds for the next scan is insignificant compared to the clarity achieved.
Also, for a ControlLogix/CompactLogix application, it would make sense to precede this code with a call (JSR) to a routine that implements an input map to fix, for the current scan cycle, the detected values of all inputs and ensure they do not change while the program is executing.

The Auto mode state should probably be part of the initial arming rung.

The second image implements an in-PLC simulation model of the press position and home sensor, for testing the code.

Untitled.png Untitled2.png
 
This seems so simple why all the complex logic, other things that concern me is the so called press, most presses I have worked on the start of cycle (two hand switch) has to be held on i.e. both hands on switches for operation, a safety curtain in front etc.
so oneshot a latch (to be unlatched on release of cycle button or light curtain broke) debatable if press cylinders should return on loss of curtain or buttons released.
Assume some sort of guard then the two handed initiation perhaps is not needed, from what I make of the code, the cylinders have double acting solenoids so it could be assumed these are centre off i.e. if the down solenoid is initiated while held on will send the press down, if the solenoid is turned off the cylinders stay where they are. Is this just some sort of experiment or is it a real application.
Attached is what I think based on what I have gathered.
No idea if switched out of auto it should stop until press back at position but assumed that, so only 4 rungs, added a light curtain (or guard) .

Press.png
 

Similar Topics

Hello everyone, I am trying to change the IP address of the Omron PLC (NJ30-1200) and HMI (NB7W-TW01B) to fetch the network on our network...
Replies
7
Views
286
Have a system that has been running for over a year and all of a sudden getting a ExcessiveVelocityFault on one of the drives when the MSO command...
Replies
2
Views
142
I am working with a 1768-ENBT and I was able to connect to it through my laptop. My laptop IP is 192.168.1.10 subnet 255.255.255.0 and the PLC...
Replies
12
Views
1,569
After watching The Universe is Hostile to Computers from Veritasium, I suddenly remembered a lost weekend years ago trying to reproduce the same...
Replies
12
Views
4,385
Good Morning , We had our 2nd episode in 4 weeks with a 1756-L62 processor causing a backplane communication issue , that caused us to...
Replies
7
Views
2,534
Back
Top Bottom