Sign in to follow this  
Followers 0
scsteve

please grade me

18 posts in this topic

Hello, my first post. Been lurking around here for a month. A lot of good info here. Here's my background. Been an electrician all my life. My industrial experience started fifteen years ago. I understand "real world relay logic"(old school). I remember control cabinets with so many relays it would make your head spin. My experience with plc's is mostly taking care of and trouble shooting the inputs and outputs. The plant engineer always took care of the actual programming and tweeking of it. Now, I need to learn the programming end of it. Volunteered for a project. Here's my first program. Just follow the link. Any constructive input is appreciated. I'm a big fan of kiss(keep it simple stupid). lol I used rs logix starter. Thanks, Steve http://www.carpron.com/multisite/v/Upload/...y/plc0.jpg.html http://www.carpron.com/multisite/v/Upload/...y/plc1.jpg.html

Share this post


Link to post
Share on other sites
Steve, Thats very hard to read. You would be better off to just post the .RSS file here. Scroll down to add this attachment.

Share this post


Link to post
Share on other sites
Let me second Mickey and say post the rss it is much easier to read, that or print the program to a pdf. As far as the grade. A for effort, but C for finished quality. I counted 5 timers on the first page with no symbol or comment. The input and output symbols may mean something to you, but the next guy sure would appreciate a full description, at least I would.

Share this post


Link to post
Share on other sites
I see what you guy's mean. This is a train crossing, where pedestrians cross. This is a kiddie ride. Train approaches, hits momentary contact limit switch. This initiates the bell ringing, the lights flashing and a gate to come down. The gate is on a delay, to give people a chanc to get out of the crossing. When the train leaves the crossing, it hits another momentary contact limit switch. This initiates a delay off so the train can clear the crossing. End of program. I went through and added descriptions to all the inputs and outputs. While doing this, it looked like to me, limit switch 1 is too redundent. ?? Seems like I have too many rungs for such a simple operation. What cracks me up, is, I can make this work with a few 8 pin relays and timing relays. I refuse to go down that path. I need reliability and versatility. Edited by scsteve

Share this post


Link to post
Share on other sites
Hi Steve, Firstly welcome to MrPLC and also welcome to the wonderful world of PLC programming, after doing a few projects you will never look back......well done for sticking your hand in the air to take on this train project there is no better way of learning something than jumping in with both feet.......as my old boss used to say "out of the deep end come the best swimmers"......another boss said "the only way to tackle something is to take a huge bite and chew like hell" they both had nervous break downs but thats beside the point.....anyway I digress. I must agree with BobL on the grade.....big A for effort from me too but the commenting has alot to be desired. When commenting programs you are not only looking out for the next poor soul that has to come and have a look at your code but also 6 or 12 months down the track when you yourself come back to the code and try to wade through and make sense of it all. On a simple few lines of code stringent commenting might not seem such a huge deal but as the program becomes larger and more complex good comments are crucial....it is a good idea to get into the habit of commenting from the very start of your programming life. Since you have been gutsy enough to throw your code out there for all to see and critique (good on you!) I will put mine out there too. It is raining where I am here in Ozzie land at the moment so I thought I might put together a program of how I would tackle the train crossing project. There are many ways to skin a cat and my example is just one way...bear in mind I don't have a plc here at home so I haven't tested the code there could be a couple of gremlins lurking but in general I think it is pretty solid. I have used the concept of command and status bits (I dropped the status bits cos there really is no feedback from gate position limit switches or anything else). This basically means that the control sequence and outputs are completely separate modules and they interact by relaying commands from the control sequence to the outputs and status info back to the control sequence. By keeping both separate you can chop and change the control sequence as you wish during the commissioning process or if new changes or expansion occurs. All you have to do is energise the lamp flash trigger for example the output module will take care of the rest. It might seem a bit long winded and all over the place at first but in the long run and as the program becomes much larger this modular approach really starts to come into its own. Compared to embedding outputs into sequences and creating one massive sprawling program modules are far superior.....that is only my humble opinion. I also I used the plc free running clock to manage the pulsing of the lamps it is simple and takes care of a basic task like flashing a lamp nicely...you had 1 second as your on time and 1 second as your off time unfortunately the free running clock (see help files in RSLogix500) doesn't have a 1 second on/off timebase but I figured 1280ms would do for this project. I was also thinking about some sort of checking of the limit switches to see that they are not on at the same time or some checking to see that they actually turn off (it is called back checking with pneumatic cylinder position sensors) in case of failure but I don't know enough about how they are triggered by the train to go down this track....pardon the pun . I also thought about a manual function so you could drive the bell, lights or gate separately to check operation. As I said there are many ways to achive this project mine is just one....all I am trying to do is give you a few ideas on how to approach it from a different angle. Hope it helps Cheers Train_Crossing_R01.RSS Edited by KidPLC

Share this post


Link to post
Share on other sites
I understand about the description. I can not open your file. I'm using the RS logix starter. It will not let me open it. Would love to see it. I'm doing this project for the Cincinnati Zoo. They survive on donations and taxpayer support. They are a non-profit organization. So far got all the material donated. Just lacking a micrologix 10 point plc. I'll probably just try to get one off ebay. I don't mind spending my own money. The zoo does a lot for the community. I understand real world cascading relay timers. And that's why i used them in my program. I need to figure out the real time plc clock. The gate has a pneumatic cylinder on it. I'm bleeding the air off to lower the gate. And in case of a power failure, the gate will bleed off and lower itself. I was thinking about safety. Train out on the track, power failure, no bell or lights for the pedestrians, but, they still have a gate in their way. I have seen reed switches used on pneumatic cylinders. They would sense the edge of the pneumatic piston as long as your cylinder was aluminum. Thanks for the input.

Share this post


Link to post
Share on other sites
Here is my 2 cents! I am not really new to logic just new to actually having to program, it has always been easier to gripe about somebody else's program , as I tend to have to look at somebody else's logic to troubleshoot problems. Nothing worse than going in to say a program that has been running for many years and has had many quick fixes and workarounds added in a hurry by more than one programmer and then never went back and cleaned it up or took the trouble to add descriptors. Kidplc your solution is pretty slick! I agree that there are a lot unknown variables. I have attached my version of Steve's program. Feel free to gripe about it! John TrainCross.RSS

Share this post


Link to post
Share on other sites
Hi Steve, Not sure why starter won't open the program?? anyway I have attached it as a pdf. I think safety is a genuine concern with your project, I am not sure what your "occupational health and safety" regulations are like in the States but here in Australia they are quite onerous, there would be a swag of risk assessments and paperwork that would need to be generated to support the safety rating selected. I have never done a project like this with safety gates in a pedestrian enviroment mine is mainly custom made automated machinery in a factory enviroment which, as luck would have it, is safe by nature during a power failure, recovery after power failure is the headache. Would the zoo's insurance company impose any specific requirments for the expected performance of your gates?? if they are not operational during power failure would this void your insurance??? might be worth looking into....just a suggestion. You could have a pneumatic receiver to store enough air to delay the lowering of the gates while a UPS backed up plc flashed lights for the required time. No gripes what so ever zarky44 your program looks good, as I said in my earlier post my cut was only one way to skin a cat. The only comment I would make is that there is no delay from turning the bells and flashers on to when the gate is lowered. I was under the impression that a delay was required on the lower and again on the raise?? Also on your program steve and yours zarky I can't see the value of latching I:0/1 when the train arrives?? is it driving some external device?? if not an internal B3:0/x bit would do the job nicely. Steve can you give us a bit more info about what you would like to do with the real time clock?? we can then offer more assistance. Also with regard to cylinder sensors it is a magnet attached to the cylinder rod itself that triggers and external reed switch, the cylinder can be aluminium or stainless steel it makes no difference. It is handy to have a small magnet in your kit to trigger sensors manually when fault finding. TRAIN_CROSSING_R01.pdf

Share this post


Link to post
Share on other sites
Skipping the code, if a person isn't driving the train, then you need to add a bit more to it. You need to have a safety relay to kill the train if it enters the zone where it has a chance of striking a person who is stuck on the tracks. Even with a person driving, real trains have a red light that comes on to indicate when the tracks aren't cleared and/or the gates are open to indicate to the engineer to stop. You CAN do these things with a PLC but if there's any risk whatsoever of a person getting anything beyond first aid, then you need to incorporate a safety PLC. There's a whole mess of rules of doing this risk assessment properly. The procedure is pretty straight forward and I highly recommend the RIA (Robot Industries Association) Codes for doing this. They are the best available (fewer vague terms) currently. They are recognized by ANSI. No mention of how much force the gates have either. They need to be either the garage door (bumper) type or else be weak enough (I forgot the force limit) that they can push against a person and it won't matter. Think parents getting a stroller caught under the gate. I also have a general concern about using 2 limit switches at the end points. These will notoriously have problems. What happens if the train stops on the tracks and backs up, crossing the first limit switch twice? What if it then pulls forward again? How are you keeping track of each wheel? Or does the same to the second one? Or derails or a power failure happens and it never hits the second one? I've written code that does just this sort of thing lots of times and unless you have some built in redundancy or take care of various "illegal" states, all kinds of goofy failures can and will occur. For the same reason, I have a huge concern about using a bunch of timers. Timers allow you to eliminate a lot of sensors. But they are also timers. If real world circumstances don't ALWAYS fit your timers, then things can go terribly wrong. The classic example is using a pneumatic or hydraulic cylinder to stroke forward and then backward. If the cylinder is sluggish for any reason at all (mechanical, hydraulic viscosity, pressure, unexpected load, wear, etc.), your timer system can and will fail frequently and you will waste a lot of time on "tuning". Where timers are useful in this regard is for timeouts and such to detect sensor or other real world FAILURES....it "should" have reached the limit switch.

Share this post


Link to post
Share on other sites
Skip the Code! I thought that was what this was about. You bring up all the points and then some that I summed up as unknown variables. I work with industrial equipment. We have a safety mgr., safety coordinator, and designated safety contacts per shift. They basically look at everything and procede to "what if" all the systems. Always coming up with something new to prevent somebody from getting hurt. We call it idiot proofing from my side . Some of the things they discover are excellent modifications. I guess it is a neccessary evil This is a kiddie train in a public zoo so safety of public would be a concern and need to addressed. Puttting up a crossing with bells, lights, and gate is a good start. Not to mention the charity of Steve to volunteer his time and money. John

Share this post


Link to post
Share on other sites
Checked out your work around zarky...intersting blend of counters and timers....it will certainly work. I have "Cute PDF writer" installed at work it is freeware I believe. It just appears as another printer when I go to print. Before creating the PDF document it simply prompts you to name the file it is about to create. The rest is just the report configuration in RSLogix500 itself. Back to the job at hand....I agree with your comment zarky that it is all about the program but I think we are doing the right thing by Steve to draw his attention to the safety aspects and the possible legal ramifications that go along with it. If Steve has already considered the safety aspects and has it all in hand then he can certainly tell us to back off that side of it and just focus on the programming. As paulengr has said a risk assessement will start to put everything into perspective, for all we know the safety gate could be made out of spong rubber and the train does a maximum of 2km/hr....sorry 1.242742miles/hr and the risk of injury is very very low, safe operating procedures may be all that is required.

Share this post


Link to post
Share on other sites
Hey guys, just got power back on. Been out for four days. This train has an operator on the engine. There are two plates on the train that hit the limit switches. One on the left side of the engine to hit limit switch one(train approaching). One on the right side, on the last car to hit limit switch two (train departing). Limit switch one is fifty yards before the crossing. The train moves around the track at a max speed of five miles per hour. There are four other crossings in the park. They were upgraded in 2004. The zoo ran out of money to do the last one. The other four are using micrologix controllers. And during a power outage the existing gates stay up. Which I thought was odd. I would prefer my gate to lower on power outage. The force on the existing gates is not much. You can actually lift it up. The gate I am working on is manually operated. A person is actually lowering the gate and turning on the bell and lights. This gate is right next to the train station. This train has actually broke down and had to roll back into the station, crossing two crossings. And the gates don't work backing up. A person has to walk ahead of the last car, to make sure the crossing is clear. I think this is unsafe. I'll take some pics today.

Share this post


Link to post
Share on other sites
scsteve Sorta in same boat as you. Need to get more comfortable with actually programming instead of just using it as troubleshooting tool . There was always somebody else around better at it than me.The train crossing is a good challenge for this newbie. I have done another program for the train and attached. I did change some of the conditions due to safety issues which probably will not apply. I added switch strikers to both sides of train, opposite of each other and added same limit switches to track opposing each other and same distance from crossing. This is to give safety crossing same response in either direction. I hope the train station the crossing is next to is more than 50 yards. Timers are a best guess assuming it takes about 17 secs for train to reach crossing when first approach switch is made. Also wired switches NC. It is difficult to test program with out actually downloading and testing. There ought to be a simulator program to test with, without real world connections. KidPLC, thanks for pointing the cute PDF writer out to me. That is a useful tool for me. Later, John Z_TrainCross.RSS Z2_TRAINCROSS.pdf Edited by zarky44

Share this post


Link to post
Share on other sites
Just a thought about this whole train cross situation. In the MRPLC download area I placed a copy of the 48 step sequencer some time ago. What if you used this sequencer to drive the Gate, Bells, Lights and all in the desired timings. Then create a single internal bit called train present in junction. The logic would be as follows: Case A - Train moving forward The Entrance Limit turns on the Train Present Flag which activates the sequencer. The train passes thru the junction. The Exit Limit turns off the Train Present Flag which de-activates the sequencer. Case B - Train moving backward The Exit Limit turns on the Train Present Flag which activates the sequencer. The train passes thru the junction. The Entrance Limit turns off the Train Present Flag which de-activates the sequencer. The use of a train present flag allows the limits to become dual purpose and the use of a sequencer guarantees the logic is the same in both directions and you only write it once.

Share this post


Link to post
Share on other sites
That's a perfect solution. Looks like I got some studying to do. I guess what I really need to know. The program I wrote, will it work? Was my thinking in the right direction? Steve

Share this post


Link to post
Share on other sites
You are writing your own programs so you are definitely heading in the right direction you could line up ten different people and you would have ten different ways to program this train crossing project so it is hard to say that your direction is either right or wrong, if it works then the direction is good. In my opinion an across the board common goal for all programmers should be good commenting no matter what....I know I have said this in an earlier post but believe me once the program gets big you need the comments. There are a few groups that are attempting to standardise programming methods PackmL are one such group I am not sure how their efforts are being received by industry though?. Keep us posted on how this project goes Steve or if you need any more help. Cheers Edited by KidPLC

Share this post


Link to post
Share on other sites
I found a used micrologix controller. Pulled it out of a abandoned control cabinet. Got it for free. It's a 1761-L10BWA series E. Brought it home. It powered up. No fault light. And is in run mode. After struggling with rs linx, I was able to set up communications. I was not able to go online with the processor. RS Logix says it only supports 10 point, series f processors. So the hunt is back on for a 10 point processor. If anyone comes across one, let me know. Maybe do a trade or something. Thanks for all the constructive input. It has been invalueable.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0