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:
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:
- Choose Mission
- Mission 1 Sequence
- Mission 2 Sequence
- Locking Cylinder
- Hydraulic Pump
- Tank Temperature Control