This documentation describes the operating mode of the Lenze "ApplicationTemplate PackML"
which serves as a basis for programming a Lenze automation system. The used "Controller-based
automation" system consists of a Lenze Controller and drive components which are connected via
the bus system.
Note!
This documentation is a supplement to the »PLC Designer« online help.
Tip!
Information and tools regarding the Lenze products can be found in the download area at:
http://www.Lenze.com
This manual is part of the "Controller-based Automation" manual collection. The manual collection
consists of the documents:
Type of documentationSubject
System manualsSystem overview/example topologies
• Controller-based Automation
• Visualisation
Communication manualsBus systems
• Controller-based Automation EtherCAT®
Online helps/
software manuals
• Controller-based Automation CANopen®
• Controller-based Automation PROFIBUS®
• Controller-based Automation PROFINET®
Lenze Engineering tools
• »PLC Designer«: Programming
• »Engineer«: Configuration of controllers
• »VisiWinNET® Smart«: Visualisation
• »Backup & Restore«: Backing up/restoring data
4Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Further information on Lenze products which can be used in connection with Controller-based
Automation can be found in the following documentation:
Mounting & wiringIcons
Mounting instructions
• Controller
• Communication cards (MC-xxx)
• I/O system 1000 (EPM-Sxxx)
•Inverter
•Communication modules
Using sample applications/an application template
Online help/software manuals
• i700 Application Sample
• Application Samples
• ApplicationTemplate
• ApplicationTemplate PackML
Parameterisation, configuration, commissioning
Online help/software manuals
• Controller
• i700 servo inverter
• Servo Drive 9400 HighLine/PLC/
regenerative power supply module
• Inverter Drive 8400 StateLine/HighLine/TopLine
• 1000 I/O system (EPM-Sxxx)
Online help/communication manuals
• Bus systems
•Communication modules
Target group
This documentation addresses to all persons who plan, commission, and program a Lenze
automation system on the basis of the Lenze "ApplicationTemplate PackML" as part of the
"Controller-based Automation".
Printed documentation
Online help in the Lenze Engineering
tool/
software manuals and communication
manuals are provided as PDF files on
the Internet.
Screenshots/application examples
All screenshots in this documentation are application examples. Depending on the firmware
version of the Lenze devices and the software version of the engineering tools installed (»PLC
Designer«), the screenshots in this documentation may deviate from the screen representation.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/20145
Please observe the following safety instructions when you want to commission a controller or
system.
Read the documentation supplied with the controller or the individual components of
the system carefully before you start commissioning the devices!
The device documentation contains safety instructions which must be observed!
Danger!
According to today's scientific knowledge it is not possible to ensure absolute freedom
from defects of a software product.
If necessary, systems with built-in controllers must be provided with additional
monitoring and protective equipment complying with the relevant safety regulations
(e.g. law on technical equipment, regulations for the prevention of accidents) in each
case, so that an impermissible operating status does not endanger persons or facilities.
During commissioning persons must keep a safe distance from the motor or the
machine parts driven by the motor. Otherwise there is a risk of injury by the moving
machine parts.
Stop!
If you cha nge par ameter s in the »PLC De signer« whil e an onl ine con nectio n to the devic e
is established, the changes are directly accepted in the device!
A wrong parameter setting can cause unpredictable motor movements. By an
unintended direction of rotation, a too high speed, or jerky operation, the driven
machine parts may be damaged!
10Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
The Lenze ApplicationTemplate PackML is an application template for standardised and convenient
programming in the »PLC Designer« according to PackML standard in compliance with the OMAC
("The Organization for Machine Automation and Control").
• From »PLC Designer« version 3.8 onwards, the ApplicationTemplate PackML is included as
project template. Create a new project - open the ApplicationTemplate PackML
•The L_EATP_ApplicationTemplate.compiled-library library includes the structure and
functionality of the standardised Lenze application template and the extension for the
ApplicationTemplate PackML. Die Bibliothek L_EATP_ApplicationTemplate
4.1Targets of the ApplicationTemplate PackML
The ApplicationTemplate PackML...
• ...helps to implement the mechatronic structure of an automation system (which has been
previously implemented as tree topology) in a modular manner according to the PackML
standard.
( 33)
( 89)
• ...enables the integration of predefined machine modules with prepared applications/
technology modules (for instance the functionality for cross-cutting).
• ...simplifies and speeds up the creation of PLC programs in the long term by re-use of a
standardised project structure in the form of a modularised folder structure.
What are the advantages of the ApplicationTemplate PackML?
The ApplicationTemplate PackML facilitates programming with the »PLC Designer« ...
• ...by the defined folder structure which "cleans up" and which can be extended individually.
• ...renders the navigation for extending or creating machine programming easier.
• The ApplicationTemplate PackML contains ready-made, re-usable machine modules and
module applications which minimise the risk of compilation errors in order to thus reduce time
and costs.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201413
What is the ApplicationTemplate PackML?
Features of the Application Sample PackML at a glance
In order to map the desired automation system in the »PLC Designer« using the
ApplicationTemplate PackML, the structure of the whole machine application must be created in
the »PLC Designer«.
• In a first step, the electronic machine structure (total functionality of the machine) has to be
divided into machine modules (subfunctions of the machine).
•The A10_MachineModuleTree machine module tree (MMT) shows the machine modules in
the form of a tree structure from left to right.
• The top module is the machine control module. The other functions of the machine are
subordinated to the machine control module.
[4-1]Illustration example: Machine structure tree (MMT) in the ApplicationTemplate, folder A10_MachineModuleTree
The ApplicationTemplate PackML...
• ...supports two to five hierarchy levels of machine modules.
• ...supports up to 30 machine modules.
[4-2]MMT (Machine Module Tree) with up to five possible hierarchy levels of machine modules
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201415
The overall functionality of the automation system is structured in a modular manner in the
ApplicationTemplate PackML. This means that every subfunction of the machine is included in one
of the machine modules. Due to the modular structure, individual (or multiple) subfunctions of a
machine can be reused
further machine parts.
• A machine module represents the function of a machine part; for instance a conveying belt, or
a cross cutter.
• The overall functionality of, for example, a bag form, fill, and seal machine, contains the "Cross
cutter" and "Transport unit" subfunctions. The two subfunctions are to be converted to a
separate machine module each.
Machine module in the ApplicationTemplate PackML
. Advantage: The respective function does not have to be recreated for
[4-3]Structure of a machine module
• Every machine module contains the BaseChannel ("Base Data") which serves as a data
channel for the basic functions of the ApplicationTemplate PackML.
• The basic functions of the ApplicationTemplate PackML are the State machine and the Error handling.
Every machine module has an AppChannelData structure (ACD structure). An ACD structure can be
defined in a machine module if necessary.
• Via the ACD structure, data are provided to/received from the higher-level machine module.
• Via the ACD structure, process data can be exchanged between the user's own module
applications.
A machine module (MFB) always contains at least one module application (MAP). Up to three MAPs
per MFB are possible.
•Via the MM_IO, MM_Par; MM_Vis, MM_PD structures, the module application (MAP) is to be
connected to the "outside world" (the respective sub-function of the automation system).
•By means of the MM_IO structure, the inputs/outputs of the terminals/the fieldbus are to be
connected.
•The MM_Par structure contains all variables that are to be managed by the recipe manager.
•The MM_Vis structure contains all variables that can be controlled or are to be displayed via an
external visualization.
•The MM_PD structure contains all persistent variables.
16
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Every machine module has an
MM_Address input which
serves to assign the relativeaddress to the machine
module.
[4-4]Illustration example: Sample illustration MMT in the L_ApplicationTemplate sample project
The following must be observed when relative addresses are assigned to the machine modules:
•The relative address is to be assigned to every machine module (value range: 1...29).
• During the initialisation phase, the »PLC Designer« generates an absolute address for every
machine module.
• Example of the relative
The diagram shows the absolute module address (black) and the relative module address (white).
• In the event of an error, the absolute address enables an error analysis. This for instance makes
it possible to retrace the module which has caused the error in each case. Alarm handling
(error handling) ( 76)
4.3.4Module application (MAP)
The module application (MAP) contains the function of the corresponding machine module.
• The ApplicationTemplate Pack ML supports up to three
used per machine module.
and absolute module addressing:
tasks. Hence, up to three MAPs can be
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201417
•In the A11_ModuleAppCalls folder, the MAPs are to be assigned to the tasks:
ModuleAppCalls (MAC).Assigning the module application (ModApp) to the task
4.3.5Modes: Machine operating modes
In the ApplicationTemplate PackML, the following machine operating modes are firmly defined:
Producing, Maintenance and Manual. Further modes can be added individually.
[4-5]The ApplicationTemplate PackML includes three firmly defined operating modes, more can be freely defined.
Each operating mode includes a separate state machine.
• If required, more operating modes can be defined. Creating own modes
• The modes and the respective state machine are integrated in the ModApp 1 module
application.
• The behaviour of the states is defined in the A12_PackML_Configuration folder in
PackMLConfig. There, it is defined, for instance, which state is when active and in which
states a changeover of the modes is permissible. Predefined operating modes in ModApp1
( 20)
• When another operating mode is created, the desired features of the states have to be defined
in the PackMLConfig area.
4.3.6Communication between the machine modules
The machine modules (MM_xxx) communicate with each other via the higher-level MM_Machine
machine control module by means of the BaseChannel communication channel and the
AppChannelData structure.
( 21)
18
• The communication channels provide for a bidirectional data exchange.
• The BaseChannel is defined as a structure in the ApplicationTemplate PackML.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
One or several slave modules are always exactly connected to one higher-level master module.
However, the master only always communicates with one slave module. Slave modules cannot
communicate directly with each other, but only via the higher-level master module.
The higher-level machine module (master) communicates with the lower-level machine modules
(slaves) via data channels (channels). During the initialisation, the ApplicationTemplate PackML
generates a BaseChannel and an AppChannelData(ACD) structure.
[4-6]Exchange of information between the machine modules (L_ApplicationTemplate)
Bus (data): Exchange of control and state data (basic data Control/Status)
Basic functions in the ApplicationTemplate PackML are...
• ...the control / status information of the state machine.
Each machine module contains the predefined operating modes Producing, Maintenance and
Manual.
The operating modes are located in the machine module template in the folder
A66_EmptyModule_PackML ModApp1\Modes.
The mode FBs are declared in the MAP-FB in the \ModApp1 folder.
Call of the mode FBs in the respective modes method
• The module application App1 contains the instances of the mode blocks Producing,
Maintenance and Manual.
• The mode block instances are called in the modes method.
Where can the operating modes be defined?
The configuration of the operating modes is defined in the A12_PackMLConfiguration folder.
There, it is defined, for instance, which state is active and in which states a changeover of the mode
is permissible.
20
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
[4-7]Defined PackML operating modes in the folder A12
• In this area, the states to be used within the single modes can be defined so that individual state
machines can be created by parameterisation (example: xDisableState…) which can be defined
in the PackML configuration.
• The transition of the single modes can also be defined in this block. The corresponding inputs
(example: xEnableModeTrans…) enable the changeover from the respective state into another
mode of the same state. The block base defines the initial mode and state. This configuration is
identical in all machine modules of the application.
4.3.6.2Creating own modes
If required, further operating modes can be defined.
How to create a mode:
1. Enter the desired name for the additional mode in the A71_LocalSources. folder
in the ENUM L_UserModes_PackML by replacing "UserDefined", example: Replacing
UserDefined01.
2. Create an instance and set the configuration for the new mode.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201421
Checks if a changeover of the mode is permissible in the
current state.
An overview of the methods
4.3.7State machine
Each machine module has an own state machine. The state machine of a mode can be created
individually: By deactivating single states in the entire state machine.
More information: State machine in detail
4.3.7.1State transitions - overview
The following status diagram illustrates the possible state transitions of the state machine:
( 91)
( 65)
[4-8]State machine in the ApplicationTemplate PackML
The current state of the state machine is highlighted in red.
• Active state in the illustration: "Idle"
• "Idle" corresponds to the "Waiting" state and is thus highlighted in yellow.
The colouring in the state machine distinguishes the following states:
• Yellow: Waiting state
• Green: Acting state
• Blue: Dual state (can be "waiting" or "acting")
The "waiting" states "Stopped", "Aborted" and "Execute" cannot
Deactivating a state simultaneously switches off the respective (outbound) transitions. If it is the
"Wait" state, it also switches off its "Active" state.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201423
[4-9]Example: State machine with deactivated "Complete" state.
Example: Deactivating the "Complete" state deletes the respective "Reset" edge, the "Completing"
state and its post edge.
4.3.7.2Methods for changing over the states
The ApplicationTemplate PackML contains predefined methods to change over the states of the
state machine. The following section provides an overview of all methods: An overview of the
methods ( 91)
4.3.8Alarmhandling (error handling)
The ApplicationTemplate PackML contains a predefined alarm handling. This error handling
provides mechanisms which serve to define and trigger reactions (errors, warnings, messages) in
the module applications (ModApps) of the machine modules (MM).
Further mechanisms of the alarm handling are:
• The forwarding of error states in the MachineModuleTree (MMT).
• An application-global error list with the current error status of all machine modules contained
in the MMT.
• Transmission of errors and events to the central logbook of the controller.
Further information can be found under: Alarm handling (error handling)
( 76)
24
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Structuring the automation system: Standard procedure
5Structuring the automation system: Standard procedure
This section describes the standard procedure to create an application with the »PLC Designer«
based on the ApplicationTemplate PackML.
• Use the following recommendations as a guide in order to be able to then create a PLC project
in the »PLC Designer« in a structured manner using the ApplicationTemplate PackML and to
program it effectively.
• Due to the structured layout of the ApplicationTemplate PackML (the consistency in these
structures and the compliance with these structures), applications can be created more quickly
and hence integrated in an existing PLC program more quickly.
[5-1]Recommended procedure for creating a project efficiently.
StepActivityWhat has to be done?Description
Gain an overview of the
overall functionality of the
machine structure.
• Divide the overall
functionality of the
machine structure into
subfunctions.
• Transfer the identified
subfunctions of the
machine structure to
machine modules.
In this project phase, programming
is not yet required! Assign the
relative address to the machine
modules. ( 27)
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201425
Structuring the automation system: Standard procedure
Create machine modules
containing the subfunctions
of the machine structure in
each case: one subfunction =
one machine module.
• Define the interfaces for
the module applications
(MAPs).
• Optionally create the
visualization for the
respective machine
module.
• Each machine module is
provided with a state
machine. Irrespective of
the active status, the
module application (MAP)
calls a corresponding
action. The action is
subordinated to the
module application.
• Within these actions,
create the logic which is to
be executed if the
machine module (MM) is
in the corresponding
status.
• In order to be able to call
machine functions in different
tasks, corresponding module
applications have to be created.
• More information about
structuring within a module
application: Structuring
within a machine module:
Assigning MAP subfunction to
the tasks ( 28)
• Define variables.
• Declare variables in the
(MM_IO, MM_Par, MM_Vis,
MM_PD) variable lists.
• Integrate newly created
machine modules into the MMT
(machine module tree).
• Assign the relative address to
the machine modules.
Creating module applications
( 53)
26Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Structuring the automation system: Standard procedure
Assign the relative address to the machine modules.
5.1 Assign the relative address to the machine modules.
In order to modularise programming of a machine system, the individual subfunctions of the overall
functionality of the automation system have to be mapped in the form of machine modules.
Example: Bag form, fill, and seal machine ("Flow Packer")
• It is helpful to outline the machine structure with t he indi vidual subfun ctions in a tree st ructur e.
• For this, the individual sub functions of the machine have to be transferred to corresponding
machine modules.
Examples of machine modules
•"Virtual master"
•"Infeed" (feeder)
•"Outfeed" (extractor)
• If the individual subfunctions are structured in the form of machine modules, the interfaces are
to be assigned to the module application (MAP).Creating machine modules: Copy/insert
machine module templates ( 41)
• Assign the input and output variables...
...in variable lists MM_IO, MM_Par, MM_Visu and MM_PD and
...to the variables of the AppChannelData (ACD) structure.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201427
Structuring the automation system: Standard procedure
Structuring within a machine module: Assigning MAP subfunction to the tasks
5.2Structuring within a machine module: Assigning MAP subfunction to the tasks
In order to create a clearly arranged module application, it is advisable to divide the module
applications (MAPs) into subfunctions and to structure them correspondingly.
• Each machine module contains three module applications MAP 1-3 which can be assigned to
tasks differently prioritised.
• Task and module application are assigned in the A11_ModuleAppCalls folder. The
assignment can be made by right-clicking the folder: With command Create Task Call .
Assigning the module application (ModApp) to the task
In a first step, the functions are to be assigned to the individual tasks. The ApplicationTemplate
PackML supports multitasking with three tasks. More information can be found under:
Multitasking
Predefined tasks
Task/priorityStandard valueTo be used for... (example)
"High"
"Mid"
"Free"
One module application can be used per task.
• Task and module application are assigned in the A11_ModuleAppCalls folder.
( 82)
2 msExecution of Motion functions
HighPriority
6 msConversion for an external visualization
MidPriority
UnsolicitedCommunicating via NRT Ethernet
Unsolicited
( 43)
28
•The MAC_Task_High program part for instance calls all module applications which are to
pass through a high priority task Task_High.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Structuring the automation system: Standard procedure
Structuring within a machine module: Assigning MAP subfunction to the tasks