Tag Archives: rockwell-automation

How to Write a Big PLC Program

Staring down the barrel of a big automation programming project is intimidating. It’s hard to even know where to start. Even when you’ve done a few before, you’re only marginally more confident the next time.

I have quite a few big automation programming projects under my belt, so I think I can generalize the process a bit. Here goes:

1. Get the Prints

There’s almost no point in starting to program unless you have an almost final set of electrical drawings. If you don’t have them yet, push for them, and go do something else productive until you get them.

2. Create a Functional Specification

You don’t always have to write out a functional specification, but it at least needs to exist very clearly in your head. If at any point, you don’t know exactly how the machine is supposed to work in excruciating detail, stop writing code and go figure it out. Ask stakeholders, talk to operators, whatever it takes. Functional specifications are best written as a list of “user stories”. If you’re not sure what a functional spec should look like, check out Painless Functional Specifications by Joel Spolsky.

3. Shamelessly Copy

Identify what other projects you can find with logic that you can steal. Any code that works in another machine has the advantage of already being debugged. Don’t re-invent the wheel. (At the same time, never blindly copy logic without understanding it. Copying the code by re-typing it one rung at a time is still faster than writing it from scratch, and it’s a form of software review.)

4. Structure Your Project

Now you break open the ladder logic programming software and start creating your project. Pick your CPU type, setup the I/O cards based on the electrical drawings. Map your inputs. Plan out your program by creating programs or routines for each functional unit of the machine. Setup your fault summary rungs and your alarm logic.

5. Write the Manual Mode Logic

PLC logic is typically written “bottom up.” Manual mode logic is the lowest level of logic because it deals directly with individual functions in the machine. Advance cylinder. Retract cylinder. Home axis. Jog axis. While you’re writing the manual mode, this is when you take extreme care making sure that actions are interlocked so the machine can’t crash. If you’re using the Five Rung Pattern, this means paying attention to what goes in the Safe rung. Does cylinder A always have to advance before cylinder B can advance? The Safe rungs should reflect that. Make sure that even in manual mode, the operator (or you) can’t break the machine. Make sure to hook your faults and alarms into the applicable fault summary rungs and alarm logic.

6. Write Part Tracking Logic

Now that manual mode is complete, write the logic that tracks parts (and their state) through the machine. Remember, you should be able to run the machine in manual mode, and the part tracking should (ideally) work correctly. I know this isn’t always the case but surprisingly part tracking in manual mode can work 95% of the time. That means part tracking works based on the state of the machine. Closing the gripper with the robot in the pick position and the part present in fixture sensor on should latch a bit “remembering” that the gripper has a part in it.

Once you’ve written your part tracking logic, go back and use the part tracking and state bits to condition your Safe rungs. Don’t let the operator (or you) mistakenly open the gripper if the gripper has a part and isn’t in a safe position to let go of the part. Of course, you may need to add a way to manually override this (that’s what output forcing was created for), but in most cases you want to prevent improper operation.

Part of writing the part tracking logic is adding “ghost buster” screens. Operators often need to remove parts from a cell, and if the machine can’t detect their removal, then you have to provide the operator with a way to clear these “ghosts.”

At this point you’re actually ready to dump the program in and start testing out the machine electrically and mechanically. While it’s ideal to have a fairly complete program when you go onsite, we all know that’s not always entirely possible. At the very least you want to get to this point before startup begins.

7. Write the Auto Mode Logic

The complexity of your auto mode logic depends on what type of machine you’re programming. You’ll always need a cycle start and a cycle stop feature. Even if you’re in auto mode, you usually don’t want the machine to start until the operator specifically tells it to start. Once it’s running, we call this “in auto cycle.”

In simple machines, you can write the auto logic by filling in the Trigger rungs in your Five Rung logic. Start by putting the In Cycle contact at the beginning of the rung, and then writing logic after that which expresses when the action should take place. For instance, an advance reject part cylinder’s Trigger rung could be as simple as In Cycle, Part Present, and Part Rejected. As long as the Part Present tracking bit gets cleared once the cylinder is in the advanced position, then this is all the auto mode logic you need for this motion. Have the retract Trigger rung be In Cycle, No Part Present and Not Retracted.

More complicated machines need more complicated auto mode logic. If your machine has to perform a series of steps (even if some of them are in parallel) then consider using the Step Pattern. If your machine needs to choose between several possible courses of action (commonly seen in a storage and retrieval system) then consider using the Mission Pattern.

8. Review

It’s hard to write correct logic. Review your functional specification, point by point, and make sure your logic meets all of the requirements. Check your logic for errors. A fresh look often uncovers incorrect assumptions, typos, and outright mistakes. The earlier you find and fix problems, the easier they are to fix.

Make a list of everything you have to do during startup. Starting up a machine is time consuming and therefore expensive. Anything you can do to prepare saves you time and money.

Good luck, and keep your fingers out of the pinch points!


Rockwell Automation Responds

After my recent rant about Rockwell Automation and their frustrating online support, I received an email from Joe Harkulich, Global Quality Leader at Rockwell Automation. The first thing he did was, helpfully, get me straightened out with my TechConnect ID. Apparently the one we were given wasn’t our real TechConnect ID, and it happened to be the ID of another company in Mexico, which caused some confusion on my end. Once that got straightened out, I could access the article I was looking for (a bit late, but better than never).

Joe then invited me to join a conference call with Esther Beris (Rockwell Knowledgebase), Jon Furniss (TechConnect), and Rob Snyder (Senior Manager for Rockwell’s remote support). I’m thankful for them taking the time to do this, as I’m really only a moderate user of Rockwell Automation products. (I really don’t think they’re very concerned about my legions of blog readers and twitter followers). I’ll relate a few of the details of the call here, and I really want to express my gratitude to everyone involved for their time.

The first item on the agenda was Joe addressing some misinformation in my previous blog post. I had made a comment about Beckhoff’s 350MB knowledge-base available for download, and I had suggested that Rockwell should do something similar. It turns out that Rockwell does offer TechConnect subscribers the ability to receive 3 DVD’s full of all their product manuals and their entire knowledge base. Joe offered to send me a copy, and I accepted. I received them yesterday and installed them on the laptop at work. This will be nice pending an on-site trip that’s scheduled next month. I’m a bit concerned that the discs are dated May of 2008. I was expecting them to be about 6 months old. We did discuss the idea of making them automatically download updates of the knowledge base, etc., so your offline copy is always up to date, but they pointed out that this would be a huge amount of information so it probably couldn’t happen, but they would take the idea into consideration. Personally I think a solution like that would have a lot of value.

We then turned our discussion towards some of the issues I had raised with Rockwell’s online support in my previous post. I certainly made it clear that I have always been impressed with Rockwell’s paid telephone support, and I really have nothing to complain about there; they are simply awesome! When it comes to the online support, we talked about these issues:

  • Single sign-on
  • Expiry of your account if you don’t log on for 6 months
  • Access to product manuals, EDS files and support directly from the product page
  • Paid vs. unpaid content

Single Sign-On

It makes no sense to me why you have to sign on separately at www.rockwellautomation.com and at their knowledgebase. Apparently it doesn’t make a lot of sense to the folks at Rockwell either, and they’re working on it. However, there’s no time-line for the resolution of it (or at least they couldn’t give me one). I think it’s one of those cases where the politics of a big organization are getting in the way of doing something really simple, and I can appreciate that. I did get the impression that the people involved do care, and it will get done, eventually.

Expiry of your account if you don’t log on for 6 months

In past years I would frequently do a lot of automation work, and then switch to PC programming for a project or two, and then switch back to automation work as I’ve recently done. I always found it a bit frustrating the first time I tried to download some EDS file and Rockwell had canceled my account because it had been longer than 6 months since I’d signed in. Apparently I’m not the only customer to complain about this, and Rockwell is in the process of changing this. Bravo!

Access to product manuals, EDS files and support directly from the product page

Let’s say I go to the ControlLogix Product Page. On a normal website when I look at a product I see exactly what that one component looks like, a link directly to the datasheet or user manual, a tab with all the specs on it, and all the information I need to buy that product. But the ControlLogix page is a brand page, not a product page. It’s almost completely useless to me as an Engineer. There is a Literature link, and that has a selection guide and something else, but then it tells me I have to go to the literature library to find all the good documentation.

When I explained this on the conference call I got some good laughs, because again, I’m not the first person to complain about this. Apparently this is being resolved, and they do have a time-line: September 2010. That’s great news and I’m really happy to hear it.

Paid vs. Unpaid Content

I’m afraid the issue of paid vs. unpaid content is still a sticking point for me. They explained to me that they chose a paid model for their support because they can provide better support. There’s no question in my mind that the quality of Rockwell’s telephone support comes through time and again, but I have to disagree with the pay-wall model they’re using for online support. I really think what’s happened is that the technical support group within Rockwell is literally scared of what could happen if they didn’t maintain a strangle-hold over the information that guys like me need to do their job.

I’ve talked before about vendor lock-in in the industrial automation industry, so I’m not going to go into that again. But this is a case where a company is selling me upwards of $10,000 of automation equipment per project and once they’ve done that, they want to charge me extra for access to the information I need to make it work the way it was supposed to work in the first place. I understand the paid telephone support model because there’s a one-to-one relationship between the amount of time I spend on the phone and the amount of time they have to pay someone to talk on the phone. But while they’re doing that, they’re already creating a knowledge-base of information. As smarter people than I have pointed out repeatedly, the marginal cost of distributing that electronic information to one more person is as close to zero as humanity has ever seen. No, you don’t have to because copyright is always on your side, but if you don’t, you open yourself up to being undercut by the following business model:

  • Start an online knowledge base where the customers can build it
  • Offer subtle rewards to the people who contribute (peer recognition within the knowledge community)
  • Let Google index the site and drive traffic to it

…which is exactly what ControlsOverload is. Remember in my last post where I said that I took 3 minutes of my own time and posted the question and answer related to my problem at ControlsOverload? Check out what happens when you search for compactlogix type 01 code 01 fault or even compactlogix powerup fault. The first item in the search results is my question and answer. You can even go to that page and add more information, or correct inconsistencies and you don’t even need to sign-up!

Rockwell has one group that makes products and another group that charges people for support on those products. In order to protect the revenue model of the second, they put barriers in place to maintain a monopoly on information, even though every single industry that has relied on maintaining a monopoly on access to information is dying a slow miserable death. Meanwhile I wasted another hour of my time trying to get a product I’d already purchased to work, and they had the information to cut that time down to 2 minutes, but they put all these barriers in my way even though I’d already paid for support!

The price to hire a PLC programmer is anywhere from about $50 to $100 an hour in my experience. Let’s say $75. Every time Rockwell’s support barriers waste an hour of my time, the total cost of ownership of their equipment goes up by, on average, $75. On top of that, it frustrates me enough to blog about it, and there’s an opportunity cost as well. I could have been using that hour to improve the efficiency of the machine in some other way rather than fighting with Rockwell’s internet site.

Here’s my suggestion to Rockwell to fix the situation:

  • Create and harness a money-free and barrier-free user generated content site, just like ControlsOverload, where customers can help other customers
  • Keep the excellent telephone support, but have the support people contribute to and maintain the free site rather than the paid site
  • Move all the paid support information to the free site (this doesn’t include premium content, as described below)
  • Use the free site to advertise premium online content that users like me are willing to pay for

What do I mean by paid premium content? Tutorials. Training videos. Example applications. Code review services (a support person can review your automation program and offer advice). E-books. Insider news & tips. Access to beta versions of upcoming software releases. In short, something I’m willing to pay for above and beyond what I believe I’ve already paid for.

Good luck Rockwell – the next few years are going to be interesting.

The RSLogix 5000 Tutorial

I’ve decided to create a tutorial for beginners getting started with RSLogix 5000 from Rockwell Automation. Part 1 is already posted: Creating a New Project. I will be filling in the rest over the next few weeks. I hope new automation graduates and experienced members of the automation industry who are migrating from another platform will both find something useful.

As always, I welcome any and all constructive feedback.

Does Rockwell Automation Hate its Customers?

I recently had a problem with an Allen-Bradley CompactLogix processor. The power went out, came back on, and the processor had faulted with a major fault, type 01, code 01. The fault message said “Power lost and restored in RUN mode”. There must be a way to disable this fault, and just have it go back into run mode so the operator can recover.

I Googled for the fault message and I got a link to a helpful forum thread. In that forum thread there was a link to a Rockwell Automation Knowledgebase Article that seemed to have the information I was looking for. I clicked the link and it told me I needed to login. That’s annoying enough, but fine. I tried my normal username and password for such sites, and that didn’t work. I went into my encrypted file and pulled out the username and password I’d saved for Rockwell Automation. That didn’t work.

Ok, fine. It had an option to email me my user name. I waited a few minutes for the email – yes the username I was using was OK. I clicked on the option to reset my password. Got the email, reset the password to the one I had saved anyway. Success! I was logged in, but it had forgotten what article I was trying to get to, so I went back to the original forum post and clicked the link again. “This article has been locked, or …” blah blah blah about a TechConnect ID. Ok, so I go to my profile page and click on the tab for TechConnect support IDs. None registered. Hmm, no obvious way to register one. I go to the other profile page… TechConnect ID… excellent! I enter that, click save, and now it needs my company name, address, etc. Ok, I enter that… but now I can’t click save. I have to go backwards, re-enter the TechConnect ID, and my company name and address, and then it saved. Ok, great!

I go back to the forum and click the link again. “This article has been locked, or …” What?!? I check my list of TechConnect IDs again, and there’s nothing there. This is really annoying me at this point. Oddly, under my name it now has the name of some Mexican company, and some place in Mexico. I check my profile page again and it all looks right, and I double-check the TechConnect ID. It’s right (and I know it’s right because I’ve used it to call Rockwell tech support recently).

I go back to Google and search again for the fault code, and I see a link to the Rockwell knowledge-base article. I click on that… same message! What’s going on here? How can Google even index a page that’s behind a sign-up wall and doesn’t even show you the page unless you have a valid TechConnect ID?

Going back to the original forum post, I did find some useful information in there, but obviously the knowledge-base article would have helped me the most. How far behind is Rockwell Automation’s online support? They’re still in the 90’s. I realize there are still a lot of people in this industry who are happier to pickup a phone and call their phone support in a situation like this, but as time goes on and the Millennial Generation continues entering the workforce, self-help focused people like myself are going to be more and more commonplace. We won’t settle for getting our questions answered in hours or even 30 minutes anymore; we want to solve our stupid problems like this in minutes or even seconds, and the technology is there to let us do it. Stop putting unnecessary barriers in our way! Rockwell Automation online support: FAIL!

By the way, I just spent 3 extra minutes and entered my technical question and answer over on ControlsOverload, a website for technical questions and answers about industrial automation. A website where you don’t have to sign in, and nothing is ever blocked behind any kind of wall. If Google can see it, so can you. This is the future of finding information on the internet. Rockwell Automation: Make it easy for me to use your hardware, and maybe I’ll buy more! You know what… here’s Beckhoff’s whole 350MB knowledge-base available for download so you can take it with you onsite when you don’t have an internet connection. Brilliant isn’t it? It’s called openness and it’s the new name of the game. Wake up!

Update (9 MAR 2010): The Global Quality Leader from Rockwell has contacted me and it looks like we’re going to have a constructive discussion about some of these issues (and he also gave me a different TechConnect ID to try). +1 to Rockwell for having their ears on!

Update (20 MAR 2010): I posted a write-up on Rockwell’s response here.