Contact and Coil | Nearly In Control

Mission

The Mission Ladder Logic Programming Pattern is used for higher level decision making in a machine. While many machines are so simple that they only have one sequence of steps for their Automatic Mode, some are more complex.

A good example of such a complex machine is an Automated Storage and Retrieval System or AS/RS. This type of machine can perform several tasks, such as storing incoming bins of material in the storage racks, or picking up bins from storage and bringing them to an outgoing station. It’s typical to break these kinds of problems into smaller tasks, such as:

  • Pick up bin from incoming station
  • Place bin in storage location X
  • Retrieve bin from storage location X
  • Place bin in outgoing station

In the Mission pattern, each of these higher level tasks is called a “Mission”. The logic is responsible for choosing the appropriate mission to perform next, and monitor for the completion of that mission, or abort the mission if appropriate. Here is some typical Mission pattern logic:

Mission

Mission

This is a system with only two missions, but as you can see it can be expanded to many more. One critical feature is that the logic must ensure that mutually exclusive missions are never active at the same time. In most cases this means that there is only one mission active at a time, but there are some systems where two different missions can overlap, if they don’t both need access to the same resources.

The Mission pattern is typically used with the Step pattern. Specifically, the Mission 1 coil becomes the Sequence Start condition for the Mission 1 sequence. Similarly, the Seq. Complete coil from the Step pattern becomes the Mission 1 Done condition in the logic above.

When organizing your ladder logic, consider putting the mission logic in a single routine, or ladder logic file. Then put the sequence logic for each individual mission in its own routine. Finally, put the low level logic that handles the control of each physical device in a routine named for that device. For example, one routine for a cylinder that extends and retracts, another routine for a motor that starts and stops, and a third routine for the temperature control logic for a heater. This is a good way to make your logic more “modular”, and it will help someone reading your program find the logic related to the device they’re interested in. So your ladder logic routines might look like:

  1. Choose Mission
  2. Mission 1 Sequence
  3. Mission 2 Sequence
  4. Locking Cylinder
  5. Hydraulic Pump
  6. Tank Temperature Control

More Patterns of Ladder Logic Programming.


6 comments

  • Andrei · June 5, 2016 at 10:02 am

    Hi Scott!
    Thank you for your work!
    Actually I didn’t see difference between Step and Mission patterns. Can you point them?

  • Author comment by Scott Whitlock · June 5, 2016 at 11:38 am

    @Andrei – The Mission pattern is responsible for choosing (typically) one mission out of many to perform next. So in the case of a material handling machine, you might have missions like “Pick from table A”, “Pick from table B”, “Place in Machine”, “Pick from Machine”, and “Place on Outfeed Conveyor”. Only one “mission in progress” bit should be on at any one time. So the mission pattern decides what job to execute next.

    The Step pattern is for doing a sequential series of steps. So the steps for “Pick from Machine” would be something like “1. Move to Machine Pounce Position”, “2. Open Gripper”, “3. Move to Machine Pick Position”, “4. Close Gripper”, and “5. Move to Machine Pounce Position”.

    Think of the Mission as “what to do” and the Step as “how to do it.”

  • Andrei · June 6, 2016 at 11:30 am

    Ok, I think I got it now, thanks! )

  • Matt F. · June 9, 2016 at 7:43 pm

    Hi Scott – just want to say thanks for publishing these articles. Stumbled across your site when looking up C vs Ladder Logic programming and have been reading your different articles for over an hour now! Great work!

  • Rory · September 4, 2017 at 7:20 pm

    Hi Scott,
    I have a machine here with multiple missions and step sequences. One of the missions is to start a lamp. The mission drives a step sequence (the lamp startup procedure is quite complicated).
    Question 1:
    The lampStart mission that I’ve made is never “done”. it is always “inProgress”, because I don’t want the lamp to stop once it has reached the last step. In my step sequence, the final step “Complete” bit and the mission “done” bit NEVER come on. When the lamp is warmed up, the final step “inProgress” bit stays on. Is that how you would do it?
    Question 2:
    I have a safety bit and if it goes low, the lamp must stop. I have put this safety bit immediately before the “auto running” bit shown in your diagram above. Is that where you would put it? How do you normally exit a step sequence like this one?

  • Author comment by Scott Whitlock · September 5, 2017 at 7:00 am

    @Rory – I would only use Missions to choose between alternatives where you can only run one of several missions at one time (such as choose which task a robot should do next). In this case, it sounds like you only have one resource (the lamp), so I wouldn’t use a mission controller for the lamp. I would just have a lamp sequence with a bunch of steps. In the case where you need to abort a sequence, I usually drop out the first two rungs (the in progress and done coils of the first step) and that will drop out all the remaining coils on the same scan.

Leave a Reply

Theme Design by devolux.nh2.me