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
7.1Create a new project - open the ApplicationTemplate PackML
The ApplicationTemplate PackML is included as a project template (*.project, ) im »PLC Designer«
from .3.8 onwards. In order to call the ApplicationTemplate PackML, a new project has to be created,
taking the ApplicationTemplate PackML as template.
7.2Updating the controller in the project (optional)
Cases in which the project must be updated
The controller in the »PLC Designer« must be updated if ...
• ...the project contains firmware information that is older than the hardware to be used or
• ...a controller other than the integrated 3200 C controller is desired (example: p500).
If the controller is marked with the icon after the project is opened, the device information of
the »PLC Designer« project have to be updated.
Determining the firmware of the controller
How to proceed:
• Use the »WebConfig« to check which firmware is used by the controller to select the
appropriate device information in the »PLC Designer«.
7.3Going online
In order to be able to establish an online connection to the controller, the communication settings
(Set active path) must be commissioned before. Setting up communication to the Controller
( 11)
7.3.1Compiling the project data
To compile the project data, select the BuildBuild menu command or press the <F11> function
key.
• If errors occur during the compilation, they are to be localised on the basis of the »PLC Designer«
error messages and corrected correspondingly. Recompile the project data afterwards.
• If no errors occur during the compilation, the »PLC Designer« project must be saved:
FileSave project
7.3.2Transferring the project to the control - "Log in"
Note!
To "log in" the PLC program must be error-free. For this it must be possible to execute the
BuildBuild (F11) menu command without an error message.
The desired project must be transferred to the PLC device by "Logging in" to the controller: Call menu
command OnlineLog in.
7.4Downloading and starting the PLC program
• Load the PLC program to the controller: Call OnlineLoad menu command.
34
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Opening the ApplicationTemplate PackML
Getting started - operating the ApplicationTemplate PackML
selected, the fields Al[01...04] of
L_EATP_Alarm_PackML serve to trigger
alarms.
• Possible reactions (Reac.) are: Abort, Stop,
Error, SystemFault, Warning, Information.
• The machine module transmits the
reaction type to the higher-level machine
module. The desired response to the alarm
can be programmed individually, except
for the commands Abort/Stop.
• If no error response has been programmed,
the state machine remains in the current
state.
•The Modules button calls the detailed view
for the machine modules.
• Click the desired machine module to show
the respective status and further details.
• All alarm messages are visible in the global
alarm list which can be called via the Alarm List button. The global alarm list provides
an overview of all alarms occurred.
•The Alarm Quit button has to be pressed to
reset the error. The reason for the tripping
has to be removed. Then, the
corresponding alarm can be reset.
36
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
This chapter provides information on how to create machine modules in the ApplicationTemplate
PackML using the machine module template EmptyModule_PackML. EmptyModule_PackML is a
template for making the creation of your own machine modules easier.
Programming with the ApplicationTemplate PackML: What has to be done?
StepActivityDetailed information
1stStructuring the automation system
• The overall functionality (machine
application) of the automation system is to
be mapped modularly:
One subfunction = one machine module
• In this project phase, programming is not
yet required!
2ndStarting the ApplicationTemplate PackMLOpening the ApplicationTemplate PackML
3rdUpdating the project (optional)
• Adjust the device information version in the
»PLC Designer« project to the firmware
version of the controller.
• Integrate another controller in the project if
required. The controller included is the
3200 C.
4thMapping the actual machine structure in the
»PLC Designer«
6.Creating/integrating individual machine
modules
7.Integrating devicesInserting an axis
8.Going onlineGoing online
9.Starting the PLC programDownloading and starting the PLC program
Assign the relative address to the machine modules.
( 27)
Updating the controller in the project (optional)
( 34)
Mapping the actual machine structure: Add devices
( 38)
8.1Mapping the actual machine structure: Add devices
The ApplicationTemplate PackML contains a predefined structure that can be extended by the
individual requirements. Carry out the following steps to map the actual machine structure.
Note!
Before creating an EtherCAT configuration in »PLC Designer«, ensure that the following
conditions have been met:
• The sequence of the EtherCAT slaves in the device view must correspond to the
physical arrangement of the EtherCAT topology.
• Select the cycle times according to the technical data, from 1 ... 10 ms.
How to create the control configuration in the »PLC Designer«:
1. Open the context menu of the target system and execute the command Append device
in order to extend the control configuration with "EtherCAT Master".
38
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
2. Add an EtherCAT slave below the EtherCAT Master: Right-click the EtherCAT Master
Add device:
Select the desired device from the selection list .
The »PLC Designer« provides a "fieldbus scan" during which the devices connected to the
fieldbus are automatically detected.
Further information is provided in the "Controller-based Automation EtherCAT" section of
the online help for the »PLC Designer« and in the Controller-based Automation EtherCAT communication manual (KHB).
Repeat the Add device until all slaves connected to the fieldbus are implemented in the
device view.
Allocate unique designations to the slaves inserted
(example: "L_94_HL_ActuatorSpeed").
The names can be selected freely and must …
•only
contain the characters "A ... Z", "a ... z", "0 ... 9", or "_";
•not
start with a digit.
You can enter a name by clicking the element.
Example:
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201439
• The value for the EtherCAT master cycle time has to be defined according to the cycle
time of the quickest task.
• The icon in front of the respective device indicates the successful
EtherCAT communication.
Note: The EtherCAT cycle time is to be set to the quickest task cycle time set. In this
ApplicationTemplate PackML, the quickest task cycle time is set to 2 ms, therefore 2000 μs
have to be set here.
• If the "Distributed Clocks" option is activated for all controllers and communication is
successful, the EtherCAT Master provides the "DC In-Sync" message:
40
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
A machine module (created on the basis of the EmptyModule_PackML machine module template)
has to be integrated into the MachineModuleTree (MMT) in order to integrate it functionally into
the ApplicationTemplate PackML.
[8-1]Example: MachineModuleTree in the ApplicationTemplate PackML
How to proceed:
1. Double-click the A10_MachineModuleTree folder in the device view.
•Double-click MMT (PRG).Note: The programming language of MMT (PRG) is CFC (Continuous Function Chart).
•In the Tools dialog window, click the Block button.
• Create the new FB via drag-and-drop.
• Double-click the area of the FB, click the button.
Use the Input assistance from the Application element...
• ...to assign the MFB_CrossCutter FB.
• ...to assign the CrossCutter instance.
Note: Go to the Input assistant and select the Insert with namespace prefix when
assigning the instance name.
2. Specify the relative address for the machine module.
•In the Tools dialog window, click the Input button.
• Add the new input at MM_Address
• Assign the relative address (example: "3").
42
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Working with the ApplicationTemplate PackML
Assigning the module application (ModApp) to the task
3. Connect FBs MFB_MachineControl and MFB_CrossCutter to each other.
•Example:
Note: After inserting a machine module, the processing order
which results after inserting the further machine module is to be checked.
For changing the Processing order
the corresponding machine module.
• For this, call the Processing order menu item in the context menu of the element
number (right mouse button).
Note: If the "Structured view" option is deactivated, an FB (example:MFB_CrossCutter) can
be reached via the input assistance (category: Instances).
8.4Assigning the module application (ModApp) to the task
For machine modules that have been created using the EmptyModule_PackML machine module
template, the MAP and task can be easily assigned via a dialog window.
, adapt the element number in the top right corner of
Tip!
For creating machine modules, use the EmptyModule_PackML machine module template
in the A66_EmptyModule_PackML folder to easier assign module application and tasks.
How to proceed:
of the machine modules
1. Right-click the A11_ModuleAppCalls folder:
•Call Create Task Call.
2. The module applications have to be assigned to the different tasks. Go to the following
dialog window and mark the module application in the area (example:
MM_NewModule) and in area mark the task to be assigned to the MAP.
• Assign/unassign the task to the respective MAP using <</>>.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201443
Working with the ApplicationTemplate PackML
Assigning the module application (ModApp) to the task
4. Assign the name of the instance (example: MM_Dcl.Module2.App1) to the module
application:
5. Assign the axis to the module application. The precondition for this is that the actual
machine structure is mapped in the »PLC Designer« project. Mapping the actual machine
structure: Add devices ( 38)
(The dwTestCounter input does not receive a transfer variable.)
• Select the desired axis (example: SM_Drive_ETC_9400HL)
•Click OK to insert the axis.
• The axis is connected to the machine module:
50
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Working with the ApplicationTemplate PackML
Integrating I/O modules of the I/O system 1000 with a machine module
This chapter describes how to create a module application.
Tip!
In the ApplicationTemplate PackML, all positions that are to be edited if a new module
application is to be created are marked with the
AT_ACTION_CREATE_NEW_MODULEAPPLICATION keyword.
The search function in the »PLC Designer« makes it easier to find the positions to be edited:
• Execute the menu command EditFind&replaceFind
• Enter the required keyword and search/continue to search in order to navigate to the
corresponding positions in the ApplicationTemplate PackML.
Example: Extend the MM_Module1 machine module by a module application.
• Initial situation:
• A machine module (example:
MM_Module1) is to be extended by a
module application.
• Create the module application in the
following folder of the machine module:
MM_Module1\ModApp1
How to create a module application:
1.Copy the MM_Module1\ModApp1 folder (right click: Copy) and insert it in the
MM_Module1 folder (right click: Paste).
Rename the following elements (by right clickProperties):
•The folder name (previously: ModApp1): ModApp2
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201453
This section describes the procedure for integrating a newly created module application into a
machine module.
Tip!
In the ApplicationTemplate, all positions that are to be edited if a new module application
is to be integrated are marked with the AT_ACTION_ADD_MODULEAPPLICATION keyword.
The search function in the »PLC Designer« makes it easier to find the positions to be edited:
• Execute the menu command EditFind&replaceFind.
• Enter the required keyword and search/continue to search in order to navigate to the
corresponding positions in the ApplicationTemplate PackML.
Example: Integration of the module application into the Task_Mid task.
How to integrate a module application:
Taking the MM_Module1 machine module as a basis, the example shows how the newly created
App2 module application is to be integrated into the ApplicationTemplate PackML.
1. Call of the newly created module application in the corresponding task
(A11_ModuleAppCalls folder, MAC_Task_Mid block).
• Highlight the MAP_Module block.
• Copy and Paste the block (right click: Copy/Paste)
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201455
The structures of the machine modules contain the input and output variables of the machine
modules for integrating data in the complete system:
•I/O data: Structure MIO
• Parameters / data of the recipe manager: Structure MPar
• Persistent data: Structure MPD
• Visualization data: Structure MVis
Structures (Structs) for ...
...IOs
...parameters (recipe manager)
...persistent data
...external visualization
The following example shows how a structure variable for an external visualization (assigned to the
MAP) within a module application is to be called (when a module with automatically matching
names is assigned, the matching entries will be added automatically):
// MVis_scMachineControl_PackML
// for MAP1
diPieces : DINT;
// for MAP2
diLength : DINT;
[9-1]Extract from the MVIS_scMachineControl_PackML structure
[9-2]Extract from the "Manual" operating mode of MM_MachineControl_PackML
58
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
[9-6]Example: Access to all slave modules, without the own machine module.
• Writing of a UserTag element into the own machine module and all slave machine
modules.
[9-7]Example: Writing of a UserTag into all slave modules, including the own module.
9.1.3Accessing structures of other machine modules
The global machine module structures are instanced in the A55_VarLists folder.
• Like this, the structures and machine modules of the ApplicationTemplate PackML can be
reused.
• The structure variables of an optional machine module can be used from another machine
module.
• In order to be able to use the variables of a global structure of machine module 1 (example:
MM_Module1) in another machine application of machine module 2 (example: MM_Module2),
the following program call is required:
diPiecesModul1 := MM_Vis.scModule1;
[9-8]Sample program: Accessing the MM_Vis structure of module 1.
9.2The AppChannelData structure(ACD)
60
If required, the data structure of MACD_scModulename type can be assigned in the desired machine
module (MFB). The data structure inherit the L_EATP_ACD_Base structure contained in the
L_EATP_ApplicationTemplate PackML library. Die Bibliothek L_EATP_ApplicationTemplate
•The MACD_scModule1 structure defines the diCounter variable of the DINT data type.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
( 89)
Architecture: The ApplicationTemplate PackML in detail
[9-9]Configuration of the ACD structure with an inherited L_EATP_ACD_Base structure
•The MACD_sc<Module name> can be individually extended by the data types required.
• By the inherited structure, specific control and status bits are provided in the ACD structure.
• In the structure, the L_EATP_CriticalSection block which ensures a consistent data exchange is
instanced (if the FB is used correctly).
More information about the L_EATP_ACD_Base structure: L_EATP_ACD_Base
( 106)
9.2.1Declaring/recording the ACD structure in the MFB
In order to be able to use the ACD structure in the modes of an MFB and its master, the instance of
the ACD structure has to be declared locally in the MFB.
[9-10] Declaration of the ACD structure in the MFB_Module1
The ACD structure is recorded in the program part of the MFB; by this, safety mechanisms are
activated.
• The instance name and size of the structure are to be transferred to the RegisterACD() method.
• The structure is to be newly recorded during every cycle. (A missing recording triggers an
infrastructure error.)
[9-11] Recorded ACD structure in the MFB_Module1
9.2.2Accessing the ACD structure of the master module - by means of the MFB module
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201461
Architecture: The ApplicationTemplate PackML in detail
[9-16] Schematic diagram: Accessing the ACD structure of the slave modules from the modes of the master (Machine Control)
Access to the slave modules
• In order to access the ACD structure of a lower-level slave machine module from the modes of
the master module, a pointer and a reference to the ACD structure of the slave have to be
declared.
• Pointer and reference have to be declared in the module application (ModApp) of the master.
[9-17] Declaration of the POINTER and REFERENCE to the ACD structure in the mode M03_Manual of MM_MachineControl_PackML
In the program part of the module application (MAP), access to the ACD structure by the
AccessACD() method is to be ensured:
[9-18] Example: Program part of mode M03_Module1_PackML_Manual: Certify access to the ACD structure
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201463
Architecture: The ApplicationTemplate PackML in detail
[9-23] Complete state diagram according to PackML standard
The condition for switching the state transitions is that the result of the
Command_StateBusy(xAllOrSlaves:=TRUE) method is FALSE, except for the transitions "Abort" and
"Stop".
• The "Stop" transition enables a transition to the "stopping" state from all areas without
Command_StateBusy (xAllOrSlaves:=TRUE) being =FALSE.
• The "Abort" transition enables a transition to the "Aborting" without
Command_StateBusy (xAllOrSlaves:=TRUE) being = FALSE.
• All other state transitions can be found in the following section with the related
Command_CtrlCmds _xxx. The state transitions in detail: Command_CtrlCmds() method
( 68)
9.3.2Methods for changing over the state transitions
The following section provides an overview of all methods in the ApplicationTemplate PackML:
The possible states of the state machine are stored in the enumerations L_EATP_CtrlCmds_PackML
and L_EATP_States_PackML.
Command values/state values
• The command values of the state values
are stored in ENUM
L_EATP_CtrlCmds_PackML.
• The state values are stored in ENUM
L_EATP_States_PackML.
Possible states
StateCategoryColourDescription
ABORTEDWaitingYellowThe state keeps the relevant information of the machine relevant for an
abortion. The machine can only leave the ABORTED state after a
triggered CLEAR command if the reason for the error in the machine has
been removed/reset.
ABORTINGActivegreenThis state can always be achieved as response to an ABORT command.
The abort logic causes a quick and safe stop of the machine.
CLEARINGActivegreenThis state triggers the acknowledgement of errors which have been
triggered in the ABORTING state and still are available in the ABORTED
state. Subsequent change to the STOPPED state.
COMPLETEWaitingYellowThe machine has exited the COMPLETING state and waits for the RESET
command. Subsequent change to the RESETTING state.
COMPLETINGActivegreenIt is automatically changed to this state after the EXECUTE state. The
machine shuts down, the product supply is stopped for this purpose.
ExecuteDualBlueAs soon as the machine processes material, it is in the EXECUTE state.
The different operating modes contain specific activities that are
possible in the EXECUTE state. The "Producing" operating mode, for
instance, causes the machine to produce/the "Clean out" operating
mode causes the machine to be cleaned, both in the EXECUTE state.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201469
Architecture: The ApplicationTemplate PackML in detail
HELDWaitingYellowThis state is reached as described for the HOLDING state. In the HELD
HOLDINGActivegreenThis state is reached if INTERNAL machine states causes the production
IDLEWaitingYellowThis state indicates that the RESETTING has been completed. The IDLE
RESETTINGActivegreenThis state is active after the RESET command has been triggered in the
STARTINGActivegreenThis state comprises the steps required for starting the machine and is
STOPPEDWaitingYellowAfter the STOPPING state has been left, the machine is switched on and
stoppingActivegreenThis state carries out steps that stop the machine in a controlled manner,
SUSPENDEDWaitingYellowThis state is reached as described for the SUSPENDING state. In this state,
state, the machine is stopped either by a complete stop or by a
continuous "dry running".
• As soon as the INTERNAL machine state changes/the operator
triggers the UNHOLD command, the machine changes to the
UNHOLDING state.
• Usually, the Performance Management/OEE system considers the
HELD state (waiting for the entry of the operator) as "not available".
of the machine to stop. This means that the machine leaves the EXECUTE
state due to an INTERNAL trigger/state.
• Usually, the HOLDING state takes place in case of regularly occurring
machine states that require an action of the operator in order that
the machine is able to continue the production.
• The HOLDING state can be automatically or manually triggered/
retracted again by the operator. The regular filling of material, for
instance, needs an action of the operator, as the filling of adhesive
dispensers or cardboard storages. This may be required if due to the
mechanical construction of the machine a certain action is only
possible when the machine is stopped.
• Filling up material is a regular working sequence in the production
process. Thus, it is an integral part of the machine. (If it was an
external part, this subfunction would bring the machine to a
standstill by ABORTING/STOPPING). Usually the machine is stopped
in a controlled manner in the HOLDING state and then changed to the
HELD state.
• In order to restart the machine in a controlled manner after the HELD
state, all relevant process setpoints/return states of the procedures
have to be saved that are available at the time of the HOLD command
in the machine control.
state keeps the current state of the machines that have been reached
during RESETTING state and executes the requested operations.
RESET/STOPPED state.
• Error and stop events are reset.
• Usually, the RESETTING state safety appliances. The machine changes
to the IDLE state to wait for the START command. This ensures that
the machine does not carry out any dangerous movements in this
state.
caused by a START command. After a successful start: Change to the
EXECUTE state.
at standstill. The communication with other systems is fully functional.
The RESET command triggers the change to the RESETTING state.
see STOPPED state. The machine cannot be started again until a restart
is executed.
the machine stops either by a complete stop or by continuously moving
without producing until the external state has normalised.
• Typically, the state changes from SUSPENDED to UNSUSPENDING
without the operator having to trigger a command.
• Usually, the Performance Management/OEE system considers the
SUSPENDED state (blockade/supply shortfall) as "available".
70
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
SUSPENDINGActivegreenThis state has to be used if it is not possible with the EXTERNAL process
UNHOLDINGActivegreenThis state is reached as described for the HOLDING state. In this state,
UNSUSPENDINGActivegreenThis state is reached as described for the SUSPENDED state. The
state to let the machine continue the production. This means that the
upstream or downstream machine in a line leaves the EXECUTE state.
Possible triggers are blockades or supply shortfalls in the machine.
• The SUSPENDING state could be triggered by a local sensor in the
machine or by a external control system. Usually, the machine is
stopped in a controlled manner in this state and then changes to the
SUSPENDED state.
• In order to restart the machine in a controlled manner after the
SUSPENDED state, all relevant process setpoints/return states of the
procedures have to be saved that are available while the SUSPEND
command is triggered.
the machine is stopped either by a complete stop or by a continuous "dry
running".
• As soon as the INTERNAL machine state changes/the operator
triggers the UNHOLD command, the machine changes to the
UNHOLDING state.
• Usually, the Performance Management/OEE system considers the
SUSPENDED state (blockade/supply shortfall) as "available".
UNSUSPENDED state can be reached as soon as the external state of the
machine has normalised.
• The UNSUSPENDING State initiates all necessary actions/sequences
in order that the machine can change to the EXECUTE state.
• For a restart of the machine, the data has to be restored that has been
previously saved while the SUSPEND command was triggered (see
SUSPENDING state).
9.4Standard coupling of the machine modules
The state machine in the ApplicationTemplate PackML is provided with a standard behaviour. This
section describes how a lower-level slave machine module can be decoupled from the master
module if required.
• The higher-level machine module specifies setpoint states for the lower-level slaves and, in
doing this, checks the current actual states of the slaves.
• If a lower-level slave module detects a triggered alarm...
• ...this module responds with an alarm response (according to the alarm response
programmed), and
• ...forwards this information to the higher-level machine module.
• If there is another higher-level machine module, the information is forwarded to the top
level.
The standard coupling of the machine modules in the ApplicationTemplate PackMLcan be changed
by appropriate programming.
9.4.1Predefined standard mechanism of the state machine
In the ApplicationTemplate PackML the top master machine module controls/switches by default
the connected lower-level slave machine modules with their state machines and operating modes.
• Based on the master module on the top level, the state machine or the operating mode is
changed over by switching the module of the lowest level first. Only if all slave modules have
changed to the requested state, the master module changes to this state as well.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201471
Architecture: The ApplicationTemplate PackML in detail
The Command_DisableModule method enables the slave module to be decoupled by the master.
• This decouples the state machine and mode of the decoupled module from the higher-level
master: The machine module keeps the current state and the operating mode and the operating
mode. After the corresponding module is decoupled ("disabled"), the state machines of the
master and the decoupled module can be operated independently of each other.
• From the time of decoupling, the decoupled module is the master for the slave modules that are
subordinated to this module.
9.4.1.2Renewed coupling of machine modules
In order to couple the module to the master again, the different states/operating modes of the state
machines of master and slave have to be adapted. In order to enquire the current state and the
operating mode of the master, the methods Status_MasterUnitModeCurrent and
Status_MasterUnitStateCurrent have to be used.
•The L_EATP_CtrlCmds_PackML command and the Command_UnitMode method adjust the
state machine and the operating mode of the decoupled module with the master module.
• After the master and slave module are in the same state and operating mode, the module can
be coupled using the Command_DisableModule method.
More information on the methods: An overview of the status methods: Status_xxx
The Command_SendAlarmReactionIfDisabled method: Alarm reaction to the master
Decoupling a module with the Command_DisableModule method deactivates the standard
forwarding of the alarm reaction to the master module.
• In order to transmit the reaction type of a deactivated module to the master, the
Command_SendAlarmReactionIfDisabled method has to be used and the respective reaction
type has to be set to "TRUE".
Example: Parameter "xSendFault:=TRUE" to only forward the reaction type Fault to the master.
• As long as a state of a slave module has xStateBusy= TRUE , the changeover of the state machine
is prevented. An exception is the triggering of the commands "Abort" or "Stop".
By default, the module is set to the respective state with the command in the first cycle of state.
Command_StateBusy(xStateBusy:= TRUE)
If all tasks are done in this state, xStateBusy can be reset again to enable the changeover to
another state.
The following program line enquires the state:
Status_StateBusy(xAllOrSlaves:=TRUE)
"xAllOrSlaves:=TRUE" also enquires the own module, "xAllOrSlaves:=FALSE only the slaves of the
module.
9.6Stater machine: Query examples
This section shows (by the use of program examples) how...
• ...to access the state machine.
• ...to query the states.
Objective/callExample
Querying the current state
•IF condition
• Subordinated module status
enquiry by method
(example: Slave, address = 1)
IF Status_UnitStateCurrent (MM_Address:= 1)=
L_EATP_States_PackML.Execute THEN
// Do something if Statemachine is in state EXECUTE
END_IF
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201473
Architecture: The ApplicationTemplate PackML in detail
IF Status_UnitStateCurrent (MM_Address:=
L_EATP_CONST.OWNID)= L_EATP_States_PackML.Execute THEN
// Do something if Statemachine is in state EXECUTE
END_IF
CASE Status_UnitStateCurrent (MM_Address:=
L_EATP_CONST.OWNID)OF
L_EATP_States_PackML.Execute:
// Do something if Statemachine is in state EXECUTE
L_EATP_States_PackML.Complete:
// Do something else if Statemachine is in state
COMPLETE
L_EATP_States_PackML.Stopped:
// Do something else if Statemachine is in state STOPPED
END_CASE
IF AlarmInformation.eReaction=
L_EATP_AlarmReactionType.Warning THEN
// Do something if warning is active
ELSE
// Do something else if warning is not active
END_IF
IF Status_UnitStateCurrent
(MM_Address:=L_EATP_CONST.OWNID) =
L_EATP_States_PackML.Execute THEN
IF Status_StateRequested(MM_Address:=
L_EATP_CONST.OWNID) = L_EATP_States_PackML. Completing
THEN
// Do something if actual state is EXECUTE and set
state to COMPLETING
;
END_IF
END_IF
74
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
Where can the response of a machine module be programmed?
9.7Where can the response of a machine module be programmed?
The individual PLC application has to be programmed in the state machines of the single operating
modes. Structuring within a machine module: Assigning MAP subfunction to the tasks
9.7.1State transition (state entry/state exit)
Every change of a status-related action (within an action or from an action) sets a specific flag for a
task cycle to "TRUE".
• xStateEntry: The status-related action sets this flag to "TRUE" during the entry for one task cycle.
• xStateExit: The status-related action sets this flag to "TRUE" during the exit for one task cycle.
( 28)
[9-27] Predefined states: Example program frame with xStateEntry/xStateExit
Note!
The following procedure is to be taken into consideration for task timing-related
program commands:
• At a state transition, actions are assigned to the individual task cycles in the same way
as for the sequential function chart AS.
• In case of "Idle""Execute" state transition the task cycle...
...first passes the Idle action with set xStateExit flag.
...and then the Execute action with set xStateEntry flag.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201475
Architecture: The ApplicationTemplate PackML in detail
The ApplicationTemplate PackML contains an alarm handling for providing alarms. The alarm
handling defined by default can be changed individually. Errors/warnings/information can be
defined in the module applications (MAP) of the machine modules.
The alarm handling has the following functions:
• Forwarding of alarm states within the MachineModuleTree (MMT).
• An application-global alarm list with the current alarm state of all machine modules contained
in the MMT.
• The alarm handling is connected to the logbook of the controller, so that the error messages can
be viewed in the logbook.
9.8.1Defining alarms
The SetAlarms method defines the alarms with the corresponding properties in the respective
module application.
For changing the alarm handling, the ApplicationTemplate PackML provides the FB
L_EATP_Alarm_PackML. Application-specific errors can be triggered at the xAlarmTrigger input.
The FB L_EATP_Alarm_PackML has four inputs xAlarmTrigger[1...4] for setting alarms. One alarm
each can be set per xAlarmTrigger input. L_EATP_Alarm_PackML
[9-28] Insert further instances of this FB if more than four error inputs are required per instance.
An alarm can be defined on the FB by the following characteristics:
CharacteristicDescriptionFurther information
wAlarmIDUnique alarm number (ID).16 bit alarm number, data type: WORD.
dwAlarmValueDetailed alarm information: For each
alarm, an additional attribute of
DWORD type can be used which (in
connection with the alarm number)
can be interpreted.
sAlarmMessageText description of the error.The alarm text is stored in the table of attributes. The
dwAlarmCategoryCategory/type of the alarm.
eAlarmReactionAlarm reaction: Can be selected from the list.
For a "Drive Error" group alarm, for instance, the
detailed alarm information of the corresponding
controller can be used.
alarm text always is to be used if no
mechanism for implementing the error number in
national languages is activated (example: Higherlevel visualisation).
( 98)
higher-level
76
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
dwAlarmPriorityAssign priority for alarms of the same error reaction type.
xAlarmAckNeededAcknowledgement behaviour:
Information (yes/no) stating
whether the alarm tripped is to be
acknowledged.
9.8.2Acknowledging alarms
Acknowledging alarms deletes all messages/causes defined as subject to acknowledgement from
the Alarm List. The acknowledgement of alarms can be activated by means of the following
procedures:
1. Permanent activation: Within the module application via the following program command:
ErrorHandler.xQuitErrors := TRUE; //error acknowledgement active as long as value =
TRUE
The acknowledgement behaviour cannot
be changed for all alarm reaction types.
2. Activation for one cycle: Via the Command_AlarmQuit method, rising edge FALSE
method sets the xQuitErrors input to TRUE for one cycle.
If multiple alarms occur, they cannot
L_EATP_ModuleErrorHandler_PackML
be acknowledged individually. Further information:
( 103)
9.8.3Acknowledging alarms: Response in the machine module
The xErrorQuitActive output on the L_EATP_ModuleErrorHandler_PackML block can be used within
a module application to acknowledge alarms on an integrated function block.
Defining alarms - standard procedure
•The SetAlarms is to be extended
•The MAP_EmptyModul_App1 FB
•The xAlarmTrigger[1...4] method
TRUE. The
by one function block.
has to be extended by the
corresponding declaration.
has to be connected to the module
application.
• Assign the corresponding
parameter to the respective alarm
input:
•Number,
•text,
•priority,
•category,
• Acknowledgement response
•More information:
L_EATP_Alarm_PackML
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201477
( 98)
Architecture: The ApplicationTemplate PackML in detail
Example: Triggering / forwarding alarms - within a machine module
Program line for triggering an alarm within the machine application:
scMAL.AlarmsA.xAlarm1Trigger:=True;
[9-29] Example: Trigger Alarm1 of FB AlarmsA
There is a predefined coupling between the alarm handling and the state machine for the alarm
reactions "Stop" and "Abort".
• The alarm reactions trigger a PackML command "STOP" or "ABORT" in the module in which the
error occurred.
• These alarm types automatically deactivate the module which has no direct impact on the
master module.
• The alarm reaction types of the slaves and the own module can be defined individually so that
the desired state change in the state machine is possible.
Example: Triggered alarm with "Abort" reaction type in case of module 1
The following example shows what happens if an alarm of the "Abort" reaction type is triggered at
a slave module. The example contains two lower-level slave modules.
• The state machine is located in the "Execute".
• The current state of the state machine is
highlighted in red.
• An alarm of the "Abort" reaction type is
triggered in the Module_1 slave module. The
Al. 1. input is highlighted in red.
78
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
• The state machine of the Modul_1 slave
module is decoupled automatically from the
master module. "Module Disabled" is
highlighted in red.
• The state machine changes to the
"ABORTING" state.
•The Machine Control master module remains
unchanged in the "EXECUTE" state.
In order to couple the Modul_1 slave module to the master again, first the reason for the alarm has
to be removed.
• By means of a procedure, both state machines of master and slave module have to be
synchronised.
• The deactivated slave module has to be coupled again to the state machine of the master
module using the Command_DisableModule method. Renewed coupling of machine
modules ( 72)
9.10Central management of alarms
The alarm handling transmits all alarms that occur in the machine modules to the global Alarm List.
• The machine modules forward the
messages to the Alarm List Handler.
• All current alarms are visible in the
global Alarm List.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201479
Architecture: The ApplicationTemplate PackML in detail
2. Click the Alarm List button to display the global error list.
•In the Alarm List area, the alarms defined as "subject to acknowledgement" that are still
pending/to be acknowledged are visible.
9.11The alarm information block
This block can be used to receive an alarm group information for the own machine module and all
lower-level slave modules.
An Alarm information instance is predefined in the GetAlarmInformation method in each mode FB
for the machine module that can be used without any further programming.
Default assignment of the inputs:
• xEnable:=TRUE
• xIncludeOwnModule:=TRUE
9.12Export overview of the alarms of all machine modules: CSV file
The ApplicationTemplate PackML provides the possibility to create a list of all errors/error
definitions in one *.CSV file.
• The CSV-based text file contains the error definitions of all machine modules integrated in the
machine module tree (MMT).
80
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
• The CSV file (file name: AT_DefinedErrors.CSV) after creation from the »PLC Designer« can be
found in the main directory of the controller (volatilely in the flash memory of the controller).
Thus the file can be used during the project planning phase of a machine application (example:
for an external visualization system).
How to write the CSV file:
On the visualization interface of L_Main, click the Create CSV File button.
[9-30] Example: Structure of the exported CSV file
For experts: Export of the CSV file via application
• Alternatively, the file export via xExecuteCreateCSVFile of the Error List Handler L_EATP_GVL.ErrorListHandler can be called from the application program (FALSE->TRUE edge).
• The following outputs provide information on the progress:
xBusyCreateCSVFile, xDoneCreateCSVFile, and sInfoCreateCSVFile .
9.13Logbook
The ApplicationTemplate PackML transmits the error events to the logbook function of the
Controller. The logbook entries are visible in chronological order in the logbook of the controller.
How to display the logbook of the controller:
1. Double-click the controller in the device view.
2. Call the Log tab to show the contents of the logbook:
• Example: Logbook view (two warnings/errors). Click the button to update the view.
The Description column contains information about the cause of the respective message.
The logbook entries (Description) column have the following structure:
<(absolute) machine module address>, <module name>, <error response with error ID>,
<error text> <(optional) detailed error information >
Example:
M1.2, Module2, F12002, Demo: Drive Error of drive 2
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201481
Architecture: The ApplicationTemplate PackML in detail
[9-31] According to the task configurations, the associated programs (CallFree, CallHigh, and CallMid) are to be called, which, in
turn, call the ModulAppCall programs (MAC_Task_Free, MAC_Task_High, and MAC_Task_Mid).
[9-32] The ModulAppCall program contains machine module applications which are assigned to the corresponding task.
• The connection to the interface system (like for example the I/O system and visualization) is to
be carried out in the corresponding ModulAppCall program (MAC).
• The module applications which are assigned to the corresponding tasks are stored...
• ...in the A70_MachineModuleSources folder or
• ...in the corresponding module libraries.
In order to be able to use the multitasking
functionality in a machine module, the
machine module is provided with three
module applications (ModApp).
9.16Consistent data transfer
A defined data area is exchanged between two tasks so that it is transferred consistently to the
other task.
Data consistency...
• ...is ensured depending on the data, or
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201483
Architecture: The ApplicationTemplate PackML in detail
• ...to be ensured for specific application cases. Depending on the application case, proceed as
follows:
Application caseData element/data typeDescription
Data consistency within individual
data elements
Data consistency within one data
element
Data consistency for more than one
data element
Integer
Bit fields
WORD
DWORD
Floating point
Direct access is permissible.
INT
DINT
When the controller is used, data
consistency of an LREAL variable is
LREAL
ensured.
The data areas have to be...
• ...inhibited for others tasks before
the first access, using the Lock()
method.
•...re-enabled after
using the Unlock() method.
the last access,
Reserving/inhibiting data areas of the AppChannelData(ACD) structure
The ACD structure contains an L_EATP_CriticalSection block which, by means of the following
methods, ensures the data consistency of real time-critical data.
• If several blocks are required, further instances of the block can be use in the ACD structure.
MethodFunction
Lock()Reserve data area of the ACD structure.
Unlock()Enable reserved data of the ACD structure.
LockState()Query locked status of a data area.
Note!
Avoiding performance loss
Avoid inhibiting real time-critical data of the ACD structure by several MAPs within the
same machine module by the CriticalSection.
• Reserve an individual area
structure, in order to avoid that the module application (MAP) of a low-priority task
(Task_Mid) slows down the MAP of a higher-priority task (Task_High).
1. Before the data area to be transmitted can be accessed consistently, the Lock() method has to
be called in a task. The Lock() method returns a BOOL value if...
• ...another task has already called the method ("TRUE").
• ...no task has called the method yet ("FALSE").
for every MAP for real time-critical data in the ACD
84
Note!
A task may only use the data area (reading or writing) if the appChannelLock() method
has returned the TRUE value.
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/2014
Architecture: The ApplicationTemplate PackML in detail
The ApplicationTemplate PackML contains the predefined L_Main
visualization in the A20_Visualisation folder
In order to create further visualization from the visualization elements in the ApplicationTemplate
PackML, the steps described in the following section have to be executed.
10.1Extending the visualization
In this section you'll learn about how the L_Main visualisation can be extended by further
visualisation pages.
• The precondition for extending the
visualisation in this example is that first
other machine modules have to be
implemented into the
MaschinenModulTree (MMT).
Integrating machine modules in the
MMT ( 42)
• The other module application has to be
integrated in the program part in the
A75 UserTags 59
Accessing structure variables of machine modules 58
Accessing structures of other machine modules 60
Accessing the module's intrinsic structure variables 58
ACD structure 60, 64
Acknowledging alarms 77
Acknowledging errors - response in the machine module 77
Adding further devices - EtherCAT bus system 38
Addressing the machine modules 17
Alarm information 80
appChannelLock 84
appChannelUnlock 84
Application notes (representation) 8
AT_ACTION_ADD_MODULE 42
AT_ACTION_ADD_MODULEAPPLICATION 55
AT_ACTION_CREATE_NEW_MODULE 41
AT_ACTION_CREATE_NEW_MODULEAPPLICATION 53
B
BaseChannel 18
C
Changing over transitions, methods 66
Command methods 92
Command_AlarmQuit 92
Command_CmdStateBusy 91
Communication between the machine modules 18
Compiling the project data 34
Consistent data transfer 83
Conventions used 7
Creating a machine module 41
Creating a project - standard procedure 25
Creating an additional operating mode 21
Creating module applications 53
D
Defining alarms - standard procedure 77
Document history 6
Downloading and starting the PLC program 34
E
Elements of the ApplicationTemplate 15
E-mail to Lenze 98
Error handling 24, 76, 79
Defining errors 76
Triggering errors 78
Error List
Export CSV file
Error response types 76
Establishing communication with the controller 11
Extending the visualization 86
80
F
Feedback to Lenze 98
G
Getting started - operating the ApplicationTemplate 35
I
Influencing state transitions 72
Inserting an axis 49
Integrating a created machine module 42
Integrating a module application 55
Integrating I/O modules 51
Querying the state machine (IF condition)
Querying the TARGET status of the state machine of the
higher-level master
Query examples
State machine
74
73
R
Renaming a module 42
Renewed coupling of machine modules 72
S
Safety 10
Safety instructions (representation) 8
Screenshots 5
Standard response 71
Starting the ApplicationTemplate 32
State entry 75
State exit 75
State machine 23, 65
State machine - program examples 73
State transitions and conditions - overview 23
State transitions in detail 68
States 69
Status methods 94
Structure of a machine module 16
Structuring within a machine module 28
74
T
Target group 5
Target of the ApplicationTemplate 13
Transferring the functionality of the machine structure to
machine modules
Transferring the project to the control system (logging in) 34
27
U
UserTags 59
V
Validity of the documentation 6
Visualisation
Defining buttons
Visualisation of the machine modules 36
88
W
Working with the ApplicationTemplate 37
Lenze · ApplicationTemplate PackML · 1.0 EN - 05/201497
Your opinion is important to us
)(('%$&.
These instructions were created to the best of our knowledge
and belief to give you the best possible support for handling
our product.
If you have suggestions for improvement, please e-mail us to: