Help with studio 5000

This is exactly the situation I find myself in. Sign up for PLC class at local college and the lab supervisor cannot be bothered to get up from his YouTube videos to attempt to help out or teach anything. Literally the only things I do know are from on the job training with an experienced controls tech.
 
I think other replies here are correct, to give you a bit of a start I suggest you get a sheet of paper & think about the sequence of events, from there you should be able to put some code together.
Without actually showing you code here is a way of doing it.
Assume PLC is first powered up, & it is not in auto run.
So the first thing is the auto start latch (seal in circuit).
The logic needs the following:
The start button is pressed. and providing the count is less than 20 (i.e. a compare) and the stop button is on (N/C & not pressed) then it outputs the internal memory bit "Auto Run", this is ORED with the start button to seal it in.
Explanation: you need to drop out the auto if stop button pressed or the count = 20 (Counter.DN bit).
Then the solenoid that extends the stamp logic:
If we are in Auto Run, AND NOT Stamp Extended, out the stamp solenoid
Then we need to retract it:
If in auto AND the stamp is extended, Retract it.
Then we need to count the number of stamps:
Increment the count.
After the counter reaches 20 then the auto drops out.
A reset operation on the reset switch resets the count and allow the system to re-start.
This takes 5 rungs of simple code.
Rung 1 Auto Stop/Start latch
Rung 2 Extend stamp
Rung 3 Retract Stamp (memory bit as only single acting solenoid)
Rung 4 Counter
Rung 5 Ink out lamp

Thank you for your input, I appreciate it !
 
@Baconwrapcrunch,

Seriously, this forum contains a plethora of experience that has written programs similar if not identical to these dozens if not hundreds of times. These problems are trivial to that wealth of experience even if they are opaque to you, and that experience is more than willing to share.

But beware: mocking that experience with what could be a transparently minimal effort in an attempt to get a solution will not end well.

I did not enjoy writing that, but I feel it needed to be said.

And if your attempts were indeed genuine then I apologize as it only means you have a longer, though certainly navigable, path ahead.

With that out of the way, as a start, especially as it appears the ladder logic is beyond you at this point, please describe in prose what you are doing on each of those rungs.

Start with the last one, which should be the simplest of the entire program. I.e. what events or states cause the lamp L1 to be either on or off? Don't be concerned yet with how those events or states come to be or not to be, that is not the question ;); just describe them in words.

Every long journey begins with a single step, and working backwards from there might be a workable path to the complete solution.

@Dr. Boybits,

I am truly happy that you have such a plethora of knowledge , and that things that seem opaque to me in my ignorance are but trivial matters to you. I am glad that you are willing to share said knowledge if only I had not mocked you all with my clear and concerted lack of effort in my original post.


To be clear , I was not mocking you at that time.

Writing ladder logic is not something I am good at by any means. I’ve been trying to get better at it but my end goal is not to be a controls engineer , my goal is to be able to use ladder logic as a troubleshooting tool for my profession as a maintenance mechanic. I can get by reading logic and understanding it but I am definitely not very good at writing my own, as I’m sure you have discerned from my ignorant, deceitful, very lackadaisical efforts.

So yes , I’d agree that writing ladder logic fluently is beyond me at this point.
That’s why I came here for some help. The instructor at the college I am attending is a very lazy arrogant individual who cannot be bothered to stop watching YouTube to come over and give me some guidance or to teach in general.

Also just as an aside , I am not some young kid just starting out in the maintenance field. I’m in my mid 40s and signed up for this class of my own accord to try and increase my knowledge and skill set. I really do respect what you guys can do and that you are good at it. I just seem to be running into a lot of people in this field that are very condescending and it honestly makes it not even fun to try and learn.
I agree I could have been more clear in what I was asking in my original posts , but I was strapped for time and I just did not write a well worded explanation of what I was looking for.
 
@Dr. Boybits,
I am glad I was wrong, and again I apologize. My intention was not to mock you, only to find out your true intent. If you are serious, then great, let's get this done.

So, what do you need to become fluent in these "languages?"

Lots of reading. Memorize @Ron Beaufort's boot camp video series. See the links in Post #11; if your instructor is as bad as all that, and I don't doubt it, then the first half hour of those videos will be far more valuable than that course. Lots of coding.

The first thing is to recognize that programming PLCs is about detecting and managing time and time-dependent events. The Start/Stop Circuit (Latch) patter that you put at the top of your attempts are perfect examples of this: there is a Start event, followed in time by a Stop event; the state of the output is dependent on which of those events was the most recently evaluated. Another aspect of this time concept is the PLC scan cycle. Did your instructor ever mention it or describe it? It is well covered in @Ron's boot camp videos above, even though their focus was more on a model for reading ladder logic; watch them over and over until you can teach someone else (e.g. your instructor ;)_ what a scan cycle is.

Have you coded in any language before? If you have, you may recognize this aphorism: the PLC (computer, device, whatever) cares not a whit what you want it to do, but it will inexorably and mercilessly do exactly what you told it to do. That will save you a lot of time debugging your code because instead of asking "what is wrong with the PLC" you will ask "what is wrong with my code?"

Although you are disappointed in your instructor's approach or lack thereof, since you are no spring chicken this will not stop you because you know that you are the only one who can teach you anyway.

Do you have a minimal PLC setup e.g. IDE and either an actual PLC or an emulator that can run on the PC where you write the code. Most manufacturers have a zero-cost option to go the emulator route (Click; Rockwell has a freebie version of CCW and RSLogix Micro Starter Lite; etc.). I have yet to see a PLC programming environment that does not have an online mode, where you can watch the program run and the values and states of the tags in near real-time, and also allow you to flip bits and otherwise generate events over time.

Can you read a flowchart? The Allen-Bradley Logix Instruction Set manual (here) has a detailed description and a flowchart of almost every complex instruction (e.g. counters, timers, FIFO, LIFO, etc.) that are similar if not identical to instructions from other manufacturers.

Running tests on single instructions while watching in online mode is a very worthwhile exercise: what happens to a FIFO array if we load (append) an integer, e.g. the free-running clock value, on every odd second, and unload an integer on every even second?

And that is just the tip of the PLC coding iceberg.

There are other floes: hooking up inputs and outputs, sinking, sourcing, VFDs, messaging, HMIs, etc.
_
 
I don't worry about people "Stealing" my code, they can use it as much as they like if they find it usefull otherwise I would not post it, in some way, I try to limit it to the basics so that any learner can learn to improve it, bearing in mind a number of things, If I post ideas, these are quickly coded, usually takes me an hour to produce something like I posted, that includes simulation code & simple HMI to just see it working, yes there will be possible bugs, better ways to do it & probably more consise given time I would normally put in if I was doing a real project.
Also, not having some IDE's for other PLC's means I try to give a sort of close representation that can be interpreted into other platforms.
This is especially important when the poster is a learner.
I do feel for students who decide on attending a colledge or university especially when it is at their cost & having to fit it in around their own job & family, I think I was lucky, my main tutor was very dedicated, had a unique way of teaching, had been in industry before becoming a tutor, one other tutor (on a different course I was not even part of) came to me asked me to sign for an exam on C&G digital electronics techniques and pay the exam fees, I was stunned, I was not even on the course, it turned out that because on the course I was on I had designed & built a colour bar, crosshatch generator for colour television servicing. apparently, my tutor had shown this to another tutor who was in the computing department. While others were holding up the students bar after the evening sessions I spent my time with books from the unit library (no internet in those days) determined to at least get a grade for that exam, I passed with 92% distinction level.
since then, being involved with apprentices who attend colledge or university I have realised that the competency, knowledge of many tutors seems to be lacking or perhaps the timescales, class sizes etc. is limiting their abilities.
 
Just like Mueller34, I would like to test my skill.
Would you guys take a look at my program?
I did the Skill 5 one. With 2 presses.

Here are some assumptions I make.

- All limit switches are N.O. and are closed when the press is extended/retracted all the way.
- SOL 1 when ON extends press 1, when OFF retracts Press 1
- Also I tried to make it so that both cylinders finish there extend/retract cycle and return to the retracted state when the stop button is pushed, instead of stopping in the middle of a stroke.

* Also sorry for the bad .pdf, it is like that because that is the only way I could come up with to block out the PC location.
* Anyone have a better idea on that aspect?
 
This is exactly the situation I find myself in. Sign up for PLC class at local college and the lab supervisor cannot be bothered to get up from his YouTube videos to attempt to help out or teach anything. Literally the only things I do know are from on the job training with an experienced controls tech.


Took a typing class at the local community college to improve my 30 WPM rating from being self-taught and using the 2 finger pecking method.


The teacher said to do chapter xx today then sat at her desk reading romance novels - and don't bother her as everything you need to know is printed in the book.


By the time I dropped that class there was only 4 other students left that hadn't dropped out, every student that did filed a written complaint and half of them demanded a refund and the class be removed from their record and not marked incomplete.


Plus, my 30WPM dropped to 6 WPM until I went back to my way.
 
Just like Mueller34, I would like to test my skill.
Would you guys take a look at my program?
I did the Skill 5 one. With 2 presses.

Nice; it should mostly work. Comments below.

  • Rungs 0/1/2 appear, at first blush, to implement a start-dominant latch circuit
    • To be fair, it should work (too much noise to be certain),
    • But it could almost certainly be reduced to some form or the State Coil Circuit pattern (cf. here) on a single rung,
    • It does however beg the question of why it is not a more conventional stop-dominant latch using the Start/Stop Circuit pattern (cf. here), but the problem statement does not specify which button, Start or Stop, should be dominant.
  • In Rung 2,
    • either the [XIO Start_Push_Button] is redundant (i.e. unnecessary),
    • or the seal-in [XIC Cycle_Stop] is redundant,
    • which is where I would start reducing the Rung 0/1/2 cacophony
  • In Rung 5, the [XIC S:FS] would be better placed in a branch in parallel with the Start condition [XIC Punch_Press_2_Extended] and Seal-in condition [XIC Press_2_Retract] branches
    • Where it is now, there will be an unnecessary one-scan-cycle pulse of a retract directive to Press 2 if Press 2 is already retracted,
    • This would also make the rung it more clear.
  • The Good_Part_Count is not updated when the Total_Part_Count increments, but is only updated on Rung 7 when the Bad_Part button is pressed.
  • The purpose of Auto_Run is not clear, other than perhaps preventing an increment of Total_Part_Count on Rung 6 if the PLC starts up with either press's extend switch active, but the pre-scan logic of the ONS instructions would prevent that anyway.
  • On Rung 5, if the PLC was started with neither limit switch on Press 2 active, then there is no way to move Press 2.
 
Last edited:
Nice; it should mostly work. Comments below.
And to be fair, you did more or less mention the issue with Press 2 being stuck between its limit switches.

Additional general comment: you know how to combine logic primitives in ladder; you could focus on thinking about the process more, with the goal of clearer code and better operation.
 
Last edited:
Thank you drbitboy for taking the time to look over my program. The comments you made helped me clean up the code and have a better understanding of the project.
Rungs 0/1/2 appear, at first blush, to implement a start-dominant latch circuit

To be fair, it should work (too much noise to be certain),
But it could almost certainly be reduced to some form or the State Coil Circuit pattern (cf. here) on a single rung,
It does however beg the question of why it is not a more conventional stop-dominant latch using the Start/Stop Circuit pattern (cf. here), but the problem statement does not specify which button, Start or Stop, should be dominant.

I agree to much noise it is just confusing. Your suggestion of the Start/Stop circuit pattern is much more effective here. ( Thanks for the links.)
I cleaned up those rungs and reduced it to just one rung.
In Rung 5, the [XIC S:FS] would be better placed in a branch in parallel with the Start condition [XIC Punch_Press_2_Extended] and Seal-in condition [XIC Press_2_Retract] branches
-Nice this looks much better and easier to understand.
The Good_Part_Count is not updated when the Total_Part_Count increments, but is only updated on Rung 7 when the Bad_Part button is pressed.
Great catch, now it adds 1 to the Good_Part_Count and Total_Part_Count each time a press is extended.
The purpose of Auto_Run is not clear, other than perhaps preventing an increment of Total_Part_Count on Rung 6 if the PLC starts up with either press's extend switch active, but the pre-scan logic of the ONS instructions would prevent that anyway.
It was intended to not allow toggling of the extend limit switch to increment the part counters. (Should have been put in the rung comment. Comments are there now.)
On Rung 5, if the PLC was started with neither limit switch on Press 2 active, then there is no way to move Press 2.
I have implemented some code to combat this problem. (it is assuming we have an e-stop circuit). When the e-stop circuit is reset it will retract the cylinder.

I am going to attach my new version V2!
 
nice.

I love those four start/stop circuit patterns that make it so easy to recognize and grok; and the rest are input map patterns with one-shots (and rung 6 doesn't even need the one-shot).

one minor issue: I am pretty sure the total part counts will never increment; drop the ANDed extend commands (.5 on the upper branch of rung 4 and .6 on the lower), realistically if an extend command is not 1, then it is unlikely that the corresponding extend limit switches will trigger; or move rung 4 to before current rung 2, in which case you can get rid of the one-shots.
 
Gosh darn it you are right about the part counts not incrementing.
I think I would have to move rung 4 to before current rung 1. In order to have both of them work. Or do the other option that you suggested.

Thanks again for the helpful comments. It is nice to get constructive feedback.
 
Gosh darn it you are right about the part counts not incrementing.
I think I would have to move rung 4 to before current rung 1. In order to have both of them work. Or do the other option that you suggested.

Thanks again for the helpful comments. It is nice to get constructive feedback.




Yup, I had that wrong, it needs to go before Rung 1. Note that you can also get rid of the one-shot instructions if you do that.
 
@Eddy D: I was thinking about it some more, and I wonder the simpler logic of Rung 3 in the image below would be better for the retract command on Press 2; the extend command of Rung 2 now has exiting [Auto Run] mode as a stop condition. It retracts if [Auto Run] mode is entered while Press 2 is between the limit switches, and of course when the extend is finished, but not otherwise.

It drops the two behaviors that retract Press 2 either on PLC startup or on recovery from an E-Stop. We could debate whether the former was necessary, and the latter would make the system move immediately and by design when an E-Stop is reset, which is I think considered an anti-pattern.
Untitled.png
 

Similar Topics

Please see attached file. I need this program in Function Block form but I am totally lost on this. Any help would be appreciated. Thanks!
Replies
8
Views
303
does anyone know how to fix the icons on the tool bar they disappeared about a week ago this is on studio 5000 any help would be grate?
Replies
7
Views
1,914
Hello, We are beginning to use the View Designer software for the newer Panelview 5500 and 5300 HMIs. I one we are starting with is the 5300 10"...
Replies
1
Views
1,207
Hey everyone. I'm new to programming and am currently the only one who does any in my workplace. I have access to rs logix 500 pro, and ccw, but...
Replies
6
Views
2,031
Has anyone used the "MAJ" motion command? I'm trying to move an injector in the reverse direction. I would appreciate some help. THanks.
Replies
5
Views
2,174
Back
Top Bottom