Example: OMAC PackML State Machine
Product: CODESYS Development System
The library contains a state machine for controllers in the packaging industry based on the OMACPackML standard.
Description
PackML stands for Packaging Machine Language and defines a general approach or machine language for automated machines in the packaging industry. The primary goals of PackML are to standardize operation and implement industrial innovations. The OMAC_PackML_State_Machine
library included in the package contains an implementation of the OMAC PackML State Machine. The sample project shows how to use the library. For more information about OMAC and PackML, see: www.omac.org/
Additional information
The PackML State Machine defines machine states and corresponding state transitions. A set of machines states is called a "unit mode". A unit mode can contain a maximum of 17 machine states. The following image shows all machine states with the corresponding state transitions.
![]() |
There are three types of machine states:
Acting States
(green): Active processing states (example:ABORTING
orHOLDING
)Wait States
(olive green): States which are reached after active processing states have been completed and are waiting for an event. Example:ABORTED
orHELD
.Dual States
(blue): Machine states which are of theActing State
andWait State
type. Only one state of this type is defined in PackML:EXECUTE
.
A state transition is executed by an action, such as Start
or Stop
.
PackML also allows for the definition of custom unit modes. For example, custom unit modes can be created for setup or maintenance. The contained machine states are a subset of the maximum machine states.
Only one unit mode can be active at a time, but it is possible to switch between unit modes. This task is handled by the unit mode manager. The unit mode manager checks if the current machine state allows leaving and if the target state allows entering.
![]() |
Library: OMAC_PackML_State_Machine
The OMAC_PackML_State_Machine
library which is included in the package contains all required components including a visualization to build a state machine based on PackML.
The UnitMode
function block can be used to define your own unit modes with the corresponding machine states (dwSupportedStates
input). The permissions to switch between unit modes are handled by the two dwAllowsLeavingFromStates
and dwAllowsEnteringIntoStates
inputs. The machine state can be changed by calling the methods in the Commands
folder (Start
, Stop
, Abort
, etc.).
The UnitModeManager
function block enables the switching of unit modes. This function block is used to query the current state.
Sample project: PackML_Example
The sample project PackML_Example
includes two applications to illustrate the use of the library.
Application: PackMLUnitModeManager:
In the PackMLUnitModeManager
application, three unit modes (Production
, Semi Auto
, and Setup
) are defined and registered with the UnitModeManager
function block. A visualization displays the current state of the corresponding unit mode and allows commands to be executed and the unit mode to be switched.
![]() |
Application: PackMLAxisControl:
In the example, the states of a virtual SoftMotion axis are displayed and controlled via the PackML state machine. The unit mode is defined and the states are assigned in the AxisControl
function block.
![]() |
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.10.0 or higher) |
Runtime system | CODESYS Control Win (version 3.5.10.0) |
Add-on components | - |
Note
DOWNLOAD Project
After installing the OMAC PackML State Machine
package, you will find the sample project in the directory C:\Users\<user>\CODESYS Examples\OMAC PackML State Machine
.