This documentation describes the operating mode of the Lenze application template
"ApplicationTemplate" which serves as a basis for programming a Lenze automation system
afterwards. The used automation system consists of a PLC for the "Controller-based Automation"
system and drive components which are connected via the bus system.
Read the mounting instructions supplied with the controller first before you start
working!
The mounting instructions include safety instructions which must be observed!
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:
Documentation/abbreviationSubject
System manuals (SHB)• "Controller-based Automation"
Communication manuals (KHB)• "Controller-based Automation" EtherCAT®
Software manuals (SW)• Controller
• Visualization
• "Controller-based Automation" CANopen®
• "Controller-based Automation" PROFIBUS®
•»PLC Designer«
• »Engineer«
• »VisiWinNET® Smart«
•»Backup & Restore«
Information on the use of the controller beyond the field of "Controller-based
Automation" can be found in the system manuals tailored to the application case.
Further information on Lenze products which can be used in connection with "Controllerbased Automation" can be found in the following documentation:
Mounting & wiringSymbols:
MAs Controller Printed documentation
MA i700 servo inverter Online help / PDF file
MAs Servo Drives 9400
MAs Inverter Drives 8400Abbreviation:
MA I/O system 1000 (EPM-Sxxx)BA Operating instructions
MAs for communication cards (MC-xxx)KHB Communication manual
MAs for communication modulesMA Mounting instructions
SW Software manual
Parameterisation, configuration, commissioningSHB System manual
SW Controller
SW Servo-Inverter i700
SW Servo Drive 9400 HighLine/PLC /
Regenerative power supply module
9400 HighLine commissioning guidelines
SW Inverter Drives 8400
StateLine/HighLine/TopLine
SHB I/O system 1000 (EPM-Sxxx)
BAs for servo system ECS (ECSxE, ECSxM)
KHBs for communication modules
Programming
SW 9400 function library
Reuse
SW Application Sample i700
SW Application Samples
SW ApplicationTemplate
Target group
This documentation addresses to all persons who plan, commission, and program a Lenze
automation system on the basis of the Lenze "ApplicationTemplate" as part of the "Controller-based
Automation".
Screen shots/application examples
All screenshots in this documentation are application examples. Depending on the firmware
version of the Lenze device and the software version of the engineering tools installed (here: »PLC
Designer«), the representation of the actual screen display may deviate.
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 to commission 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.
If required, systems with integrated controllers have to be equipped with additional
monitoring and protective equipment in accordance with the safety regulations valid in
each case (e.g. law on technical equipment, regulations for the prevention of accidents),
so that an impermissible operating status does not endanger persons or equipment.
During commissioning persons must keep a safe distance from the motor or the
machine parts driven by the motor. Otherwise there would be 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!
An incorrect parameterisation can result in unpredictable motor movements. By an
unintentional direction of rotation, too high speeds or jerky operation, powered
machine parts can be damaged!
The ApplicationTemplate is a Lenze application template for standardised and convenient
programming in the »PLC Designer«.
• The ApplicationTemplate is included in the »PLC Designer« (from version 3.3) as project
template. Create a new project - open the ApplicationTemplate
•The L_EATP_ApplicationTemplate.compiled-library library includes the structure and the basic
functionality of the ApplicationTemplate. The L_EATP_ApplicationTemplate library
4.1Objective of the ApplicationTemplate
The ApplicationTemplate...
• ...helps to implement the mechatronic structure of an automation system (which is available as
a tree structure) in a modular manner.
• ...enables the integration of predefined machine modules with prepared applications (for
instance a cross cutter).
• ...simplifies and speeds up the creation of PLC programs in the long term by re-use of a
standardised and modularised folder structure.
( 31)
( 110)
What are the advantages of the ApplicationTemplate?
The ApplicationTemplate facilitates programming with the »PLC Designer« ...
• ...by a predefined folder structure which "cleans up" and which can be extended individually.
• ...renders the navigation for extending or creating machine programming easier.
• The ApplicationTemplate 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.
In order to map the desired automation system in the »PLC Designer« on the basis of the
ApplicationTemplate, the structure of the whole machine application must be created in the »PLC
Designer«.
• In a first step, the machine structure must be divided into machine modules.
•The A10_MachineModuleTree machine module tree (MMT) shows the machine modules in
the form of a tree structure from left to right.
[4-1]Machine structure tree (MMT) in the ApplicationTemplateCounter, A10_MachineModuleTree folder
The ApplicationTemplate...
• ...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
The overall functionality of the automation system is structured in a modular manner in the
ApplicationTemplate. 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
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
. Advantage: The respective function does not have to be recreated for further
[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.
• The basic functions of the ApplicationTemplate 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.
Every machine module has an
MM_Address input which
serves to assign the relativeaddress to the machine
module.
[4-4]Illustration: Sample illustration MMT in the sample project L_ApplicationTemplateCounter
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. Error handling
4.3.4Module application (MAP)
The module application (MAP) contains the function of the corresponding machine module.
• The ApplicationTemplate supports up to three
machine module.
and absolute module addressing:
( 92)
tasks. Hence, up to three MAPs can be used per
•In the A11_ModuleAppCalls folder, the MAPs are to be assigned to the tasks:
ModuleAppCalls (MAC).
The machine modules (MM_xxx) communicate with each other via the MM_Machine machine
control module by means of the BaseChannel communication channel and the AppChannelData
structure.
• The communication channels provide for a bidirectional data exchange.
• The BaseChannel is defined as a structure in the ApplicationTemplate.
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 generates
a BaseChannel and an AppChannelData(ACD) structure.
[4-5]Exchange of information between the machine modules (L_ApplicationTemplateCounter)
BaseChannel: exchange of control and status data (Control/Status basic data)
The BaseChannel...
• ...contains the control / status information of the state machine.
• ...contains the error handling.
The ACD structure...
• ...serves to exchange application process data between machine modules.
• ...is a data structure for the definition of own process data.
• ...must always be derived from the L_EATP_ACD_Base
Every machine module features one state machine. State machine ( 77)
• If a machine module is integrated in the machine module tree (if it is not decoupled from the
MMT), the state machine of the master module controls all state machines of the lower-level
machine modules.
• When all slave modules have changed to the requested state, the master module also changes
to the requested state.
Exception: During the initialisation, all machine modules are in the "INIT" state and,
independently of the slave or master, change to the "READY" state if it is enabled:
SMEnableInitToReady(TRUE);
State transitions - overview
The following status diagram illustrates the possible operating states of the state machine:
• After the start (switch-on / re-initialisation), the module is in the "Init" state.
• In standby/waiting mode, the module is in the "Ready" state.
• "Warning" is a special status (independent, "orthogonal" state), which does not influence the
operational performance of the machine module.
The error handling of the ApplicationTemplate provides mechanisms by means of which responses
(errors, warnings, messages) can be defined and triggered in the module applications (MAP) of the
machine modules (MM)
Further mechanisms 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: Error handling
( 92)
22
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 23
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.
• 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 and to program it
effectively.
• Due to the structured layout of the ApplicationTemplate (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.
StepActionWhat 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. ( 25)
Lenze · ApplicationTemplate · 1.3 EN - 04/201323
Page 24
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
( 26)
• 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
( 62)
24Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 25
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 your own machine modules: Copy/
insertMM_EmptyModule ( 51)
• 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 · 1.3 EN - 04/201325
Page 26
Structuring the automation system: Standard procedure
In order to create a clearly arranged
module application, it is advisable to
divide the module applications (MAP)
into subfunctions and to structure
them correspondingly.
5.2.1Assigning the MAP subfunctions to individual tasks
In a first step, the functions are to be assigned to the individual tasks. The ApplicationTemplate
supports multitasking with three tasks. More information can be found under: Multitasking
( 98)
• Task "High" (standard value: 2 ms)
• Task "Mid" (standard value: 6 ms)
• Task "Free" (unsolicited)
One module application can be used per task.
• Task and module application are assigned in the A11_ModuleAppCalls folder.
•The MAC_Task_High program part for instance calls all module applications which are to
pass through a high priority task Task_High.
[5-2]ApplicationTemplateCounter sample project: MAC_Task_High calls the Module1_App1 module application.
26
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 27
Structuring the automation system: Standard procedure
For easy structuring, Lenze recommend to use the Actions of the ApplicationTemplate.
•The Actions must be lower level to the module application.
• Actions are marked with the icon.
Example of structuring a module application:
[5-3]The SMDispatcher method calls the S01-S11 actions. The actions can be viewed in the ModApp1/Statesfolder.
An Action is always connected to a POU (example: function block of an MAP module application).
• Thereby the action only uses the data of function block. This means that the action does not
feature an own declaration part. The variables used in the action are declared in the function
block (i.e. in the MAP module application).
• The action does not feature any
local variables.
28
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 29
Overview - the structure of the ApplicationTemplate
The ApplicationTemplateCounter includes a sample program with three machine modules and a
predefined visualization. The sample program serves to test the basic functions of the
ApplicationTemplate. The sample program in the ApplicationTemplateCounter
Standard procedure
The main steps are summarised in the following table:
StepAction
1.Create a new project - open the ApplicationTemplate
2.Update the controller in the project (optional)
3.Going online
• Compiling the project data
• Transferring the project to the control - "Log in"
4.Loading and starting the PLC program
5.Getting started - operating the ApplicationTemplate
( 33)
( 33)
( 33)
( 31)
( 32)
( 33)
( 35)
( 134)
Further information on the parameter setting and configuration of the respective bus
system can be found in the following communication manuals (KHB):
• Communication manual EtherCAT: "Controller-based Automation" EtherCAT
• Communication manual CANopen: "Controller-based Automation" CANopen
Detailed commissioning steps
The following section describes the individual commissioning steps in detail.
Follow the instructions specified step by step to commission your automation system.
• Communication manual PROFIBUS: "Controller-based Automation" PROFIBUS
30Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 31
Opening the ApplicationTemplate
Create a new project - open the ApplicationTemplate
7.1Create a new project - open the ApplicationTemplate
The ApplicationTemplate is included as a project template (*.project, ) im »PLC Designer« from
V3.3 onwards. In order to call the ApplicationTemplate, a new project has to be created, taking the
ApplicationTemplate as template.
In order to be able to establish an online connection to the controller, the communication settings
(Set active path) must be commissioned before. Establishing communication with the controller
( 13)
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.4Loading and starting the PLC program
• Load the PLC program to the controller: Call OnlineLoad menu command.
• Start the PLC program: Call OnlineStart menu command.
• As an alternative, you can execute the DebugStart menu command or press <F5>.
Tip!
In order to load a project automatically after a device is restarted, it can be defined as
"boot project".
Setting up the project as boot application
How to install the project as boot project:
1. Select the OnlineGenerate boot project for L-force Controller menu command.
Lenze · ApplicationTemplate · 1.3 EN - 04/201333
Page 34
Opening the ApplicationTemplate
Simulation (valid for the ApplicationTemplateCounter)
7.5Simulation (valid for the ApplicationTemplateCounter)
Note!
In order to be able to use the simulation mode in the "ApplicationTemplateCounter", the
"Watchdog" monitoring must be deactivated (corresponds to the standard setting in the
ApplicationTemplate).
An activated "Watchdog" monitoring results in an error message so that the simulation
mode cannot be activated.
How to deactivate the "Watchdog" monitoring:
1. Double-click the A90_Resources folder in the device view.
This chapter provides information on how to create modular machine functions / machine modules
with the machine module template in the ApplicationTemplate. The MM_EmptyModule machine
module is a template for the creation of individual machine modules.
Programming with the ApplicationTemplate: What has to be done?
StepActionDetailed information
1.Structuring 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!
2.Starting the ApplicationTemplateOpening the ApplicationTemplate
3.Updating 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.
4.Mapping the actual machine structure in the
»PLC Designer«
Assign the relative address to the machine modules.
( 25)
Update the controller in the project (optional)
Mapping the actual machine structure in the »PLC
Designer« ( 40)
( 30)
( 32)
• Adding devices - EtherCAT bus system
• Adding devices - CANopen bus system (optional)
( 43)
• Setting of CAN parameters and PDO mapping
6.Creating/integrating individual machine
modules
7.Integrating devicesInserting an axis
8.Going onlineGoing online ( 33)
9.Starting the PLC programLoading and starting the PLC program
Carrying out an online changeOnline change
Creating your own machine modules: Copy/
insertMM_EmptyModule ( 51)
( 58)
Integrating I/O modules of the I/O system 1000 with a
machine module ( 60)
Integrating a module application
( 68)
( 66)
( 40)
( 33)
( 48)
Lenze · ApplicationTemplate · 1.3 EN - 04/201339
Page 40
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
8.1Mapping the actual machine structure in the »PLC Designer«
The ApplicationTemplate contains a predefined structure that can be extended by the individual
requirements. Carry out the following steps to map the actual machine structure.
8.1.1Adding devices - EtherCAT bus system
Note!
The following points have to be observed before starting to set up an EtherCAT
configuration in the »PLC Designer«:
• 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. Go to the context menu of the target system and use the Add Device command to
extend the control configuration by "EtherCAT master".
40
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 41
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
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.
Lenze · ApplicationTemplate · 1.3 EN - 04/201341
Page 42
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
3. 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:
4. Setting the cycle time
• 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, the quickest task cycle time is set to 2 ms, therefore 2000 μs have to
be set here.
42
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 43
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
• If the "Distributed Clocks" option is activated for all controllers and communication is
successful, the EtherCAT Master provides the "DC In-Sync" message:
8.1.2Adding devices - CANopen bus system (optional)
In order to map the desired machine structure on the basis of the ApplicationTemplate, the
corresponding devices have to be added in the Device view.
How to proceed:
1. Select the controller
• In the context menu, execute the Add device command to add "CANbus" to the bus
system.
Lenze · ApplicationTemplate · 1.3 EN - 04/201343
Page 44
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
Note: The value of the transfer rate set in the »PLC Designer« overwrites any existing
transfer values of the devices (set via »WebConfig«/»Engineer«).
3. In a CANopen network, set the same baud rate for all nodes.
4. Use the Add Device command to extend the control configuration by "CANopen
Manager".
44
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 45
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
6. Use the Add Device command to insert a logic device (slave) under the
CANopen_Manager (master).
Select the desired CAN node from the selection list.
Tip!
A general device description is provided for the integration of inverters: Lenze Generic
Drive.
Repeat the Add device command until all slaves connected to the bus are implemented
in the device view. Optionally, you can Copy and Paste a node already inserted into the
context menu of the device. The communication settings (node ID and baud rate as well as
further parameters) must be adapted manually afterwards.
46
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Page 47
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
By default, the PDO mapping is optimised for the corresponding application. It is possible
to change this mapping (set checkmark ). Du e to the limited bandwidth of the CAN bus, this
is only sensible in special cases. The PDO properties are pre-assigned sensibly as well and
should not be changed.
By double-clicking a single PDO, you can see its transmission properties.
•The Transmission Type "cyclic - synchronous (type 1-240)" and the information
at which sync the PDOs are to be transmitted must not be changed.
• The settings of the Inhibit time and the Event time are not evaluated.
• Confirm the settings with OK.
The CANopen I/O Mapping tab serves to assign PLC variables to the process image.
Note!
Bus operation without CAN synchronisation
• The controller always transmits asynchronous PDOs from an unsolicited task in an
event-controlled way. To achieve a time-controlled transmission of asynchronous
PDOs by the controller, you must assign the CAN master to a cyclic task.
• The controller does not support any monitoring times for asynchronous receipt PDOs.
These monitoring times have to be set in the devices.
Lenze · ApplicationTemplate · 1.3 EN - 04/201349
Page 50
Working with the ApplicationTemplate
Mapping the actual machine structure in the »PLC Designer«
The machine module (created on the basis of the MM_EmptyModule template) has to be integrated
into the MachineModuleTree(MMT) to implement it in the ApplicationTemplate in a serviceable
state.
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).
3. Connect FBs MFB_MachineControl and MFB_CrossCutter to each other.
• Example (ApplicationTemplate Counter):
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
Lenze · ApplicationTemplate · 1.3 EN - 04/201353
, adapt the element number in the top right corner of
of the machine modules
Page 54
Working with the ApplicationTemplate
Assigning the module application (MAP) 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 in the »PLC Designer« ( 40)
(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:
Lenze · ApplicationTemplate · 1.3 EN - 04/201359
Page 60
Working with the ApplicationTemplate
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, 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.
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):
8.10.2Frequently asked question: Connection between MFB and MAP
MFB_Module1 function block
The MachineModuleTree (MMT) maps the mechatronic structure of the automation system by
means of the MFB function blocks (MFB_Modulexx).
• Instancing of the MFB_Module1 must be executed in the MM_Dcl structure of the
A55_VarLists folder.
• Insert the instance in the desired position of the MMT.
[8-3]Example: Machine module tree in the ApplicationTemplateCounter
• A machine module encloses the module applications in the machine module.
• Therefore the module applications are to be declared within the machine module.
Instance the MAP_Module1_App1 module application with the following declaration line, so that
the instance can be called according to the task in the module application of ModuleAppCalls:
•The parentModule:= THIS^ instruction connects the App1 module application to the basic
functions of all machine modules (e.g. state machine, error handling, BaseChannel). That way,
the App1 module application can access the basic functions of the ApplicationTemplate.
• Assign the ACD structure manually. The AppChannelData structure(ACD)
[8-5]Linkage of machine module MFB, module structure tree (MMT), and task assignment of the module application (MAC)
Note!
A machine module must contain at least one module application which is assigned to a
ModulAppCall (and thus to a task)!
8.10.3Programming with the module application
In order to structure the subfunction of a module application, the ApplicationTemplate actions are
to be used. Programming recommendations for structuring
Tip!
For programming with the ApplicationTemplate it is recommended to use the methods
included in the ApplicationTemplate.
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.
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.
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)
An "Online change" is only possible if a compiler listing is available. After the Clean all
and Clean application commands have been executed, an "Online change" is not
possible, since the cleaning process deletes all compile information (compiler listing).
8.11.1When can an "Online change" be used in the ApplicationTemplate?
In the following application cases, an "Online change" can be executed without restrictions:
• Changes on the Program code and application data which have no
areas:
...the Machine Module Tree (MMT) structure
...the integration of machine module basic functions (for example the L_EATP_ErrorSet
function block for triggering errors).
• When the structure is changed and when machine module basic functions are integrated into
the ApplicationTemplate, an Online change is not to be used!
8.11.2When is it not possible to use an "Online change" in the ApplicationTemplate?
Note!
Especially with regard to time-critical Motion applications, an Online change must only
be executed if all controllers with Motion function are at standstill.
If they are at standstill, a short-time interruption of the task timing (normally) does not
take effect.
In the following application cases, it is to be avoided that an "Online change" is executed:
• If the structure of the MMT is changed: e.g. when machine modules are added / removed.
• If the access to basic function blocks is changed: e.g. additional instances of the
L_EATP_ErrorSet function block for triggering errors.
Technical background information
A regeneration of the ApplicationTemplate structure (due to changes regarding the structure) is
only possible after a restart (at least warm restart). This requires a new Log in including a download.
• An "Online change" executes the changes on the application program during the "task interval"
(all tasks have completed their process).
• The exchange of the corresponding program blocks/data blocks by the runtime system causes
a time delay, so that negative effects on the task timing might occur.
Information regarding the time response
The following factors have the effect that the task process immediately after the online change
starts with a delay/is ineffective.
In the case of a high task utilisation (ratio of the task runtime and the task interval) and a resulting
short
task interval
and/or
the shifting of variables required for an Online change.
8.11.3General programming recommendations which enable an "Online change"
The following factors must be observed during programming to enable an online change:
• Avoid pointers and references
Basically avoid the use of pointers and references. Then no special precautions have to be made for
an online change to ensure normal operation of the application.
• Avoid pointers and references in every clock cycle
If pointer and reference values have to be re-assigned in each clock cycle, it has to be ensured
that the referenced memory addresses have the correct value in the first clock cycle after an
online change.
Please note that, when assigning a reference or pointer value to another cycle, the source value
has to be updated in the clock cycle first, since otherwise the target of the assignment will show
the previous (old) value for at least one clock cycle.
Reference or pointer variables (as well as other variables) provided with this attribute will be set
to their initial value after an online change.
• Thus the occurrence of an online change can be identified.
• Thus the initialisation processes can be executed again
completed).
• Use interface references
During an online change, interface references (interfaces) are automatically checked and adapted.
When interfaces and interface references are used for the ApplicationTemplate, please note that
the use is not required in a purely functional way and that it is only required for the purpose of the
online change.
In order to be able to access an FB instance, an additional method call of the interface (pointer/
reference to the FB instance) is required.
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_scMachine
// for MAP1
diPieces : DINT;
// for MAP2
diLength : DINT;
[9-1]Extract from the MVIS_scMachine structure
VAR_IN_OUT
/// ------------------ START OF USER SPECIFIC BLOCK ---------------------
/// Add the needed declarations of Par, Vis, IO and PD access here
The associated program call in the machine application has the following syntax:
Vis.diPieces := 4711;
[9-3]Sample program which assigns the value 4711 to the diPieces visualization variable.
9.1.2Accessing 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 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-4]Sample program: Accessing the MM_Vis structure of module 1.
If required, the data structure of the MACD_sc type module name can be assigned within the desired
machine module (MFB).
The data structure must inherit the L_EATP_ACD_Base contained in the
L_EATP_ApplicationTemplate library. The L_EATP_ApplicationTemplate library
•The MACD_scModule1 structure defines the diCounter variable of the DINT data type.
[9-5]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.
( 110)
• 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
9.2.1Declaring/recording the ACD structure in the MFB
In order to be able to use the ACD structure in the module applications (MAPs) of an MFB and its
master, the instance of the ACD structure has to be declared locally in the MFB.
[9-6]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.)
In the program part of the module application (MAP), access to the ACD structure by the
AccessACD() method is to be ensured:
[9-10] Program part of the MAP_Module1_App1 module application: Certify access to the ACD structure
This renders a read/write access by means of the reference and the Intellisense function to the data
contents of the ACD structure possible:
[9-11] Command for writing data to the ACD structure
9.2.3Accessing an ACD structure - by means of the module application of the MFB master
module
[9-12] Schematic diagram: Accessing the ACD structure from the master module application (MAP) (MM_Machine)
In order that an application of the master module can access the ACD structure of a lower-level
machine module, a pointer and reference to the ACD structure of the slave have to be declared in
the declaration part of the master module application.
The machine module (which is on the highest level of the MachineModuleTree MMT) controls the
state machine of all lower-level machine modules.
• The resulting state transitions have an impact on the subordinated machine modules.
9.3.1State transitions and conditions - overview
This section illustrates the individual state transitions of the ApplicationTemplate state machine.
For each state transition, the conditions required in each case are specified. The state transitions are
numbered and then described in the text:
Labelled withState/identifierDescription
Initialisation
Idle state
...
Manual operation
Manual
ServiceService operation for maintenance purposes
AutomaticAutomatic operation
Initialisation of the module / module application is always required.
Init
• After a RESET, the "Init""Ready" state transition is inhibited.
• Then the "Init""Ready" state transition is to be enabled by the
module application (when initialisation has been completed).
• The SMEnableInitToReady(TRUE/FALSE) method enables /
inhibits the state transition.
Enable/inhibit mechanism
• ...permits the module applications to inhibit/enable the
respective state transition.
Ready for operation. This is the basic state of the state machine.
Ready
Enable/inhibit mechanism
• In this state, the controller can be controlled in manual mode, for
instance for cleaning or changing the tool.
• By setting the individual control bits, the controller can be
controlled manually (Jog1, Jog2, QSP, ErrorReset...).
• This state permits the module applications to inhibit/enable the
underlying state transition.
The different states of the state machine are mapped in the L_EATP_SMStates enumeration.
L_EATP_SMStates
( 130)
9.3.5Activating the states - baseChannelSetNominalState method
The ApplicationTemplate provides methods to set the machine modules to a specific state.
Note!
This method can be used if...
• ...the .DisableDefaultCouplingSlave function (module's intrinsic target status)
The "DisableDefaultCouplingMaster" function
• ...the .DisableDefaultCouplingMaster function (target status of a slave module) is
activated. The "DisableDefaultCouplingSlave" function
• ...the machine control module (MM in the top level of the MachineModuleTree
(MMT)) sets itself to a specific state, so that the subordinated modules change to the
same
status.
( 85) is activated, or
( 86)
Method nameTransfer value/data typeDescription
baseChannelSetNominalStateSet the target status of the state
MM_Address
L_EATP_MM_Address
eState
L_EATP_SMStates
machine for the corresponding slave
module/own module.
• Address of the module the current
state of which is to be queried.
• The value "0" and the
L_EATP_CONST.OWNID constant
address the module's intrinsic ID.
An overview of all BaseChannel methods can be found under: Method overview -
ApplicationTemplate ( 131)
9.4Default coupling
The state machine in the ApplicationTemplate is provided with a standard response. In this section
you'll be provided with information about how subordinated (slave) machine modules are to be
decoupled from the standard response.
• 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 subordinated slave module detects an error...
• ...this module responds with an error response (according to the error response
programmed), and
• ...forwards this information to the higher-level machine module which then changes to the
"Quick stop" status.
• If there is another higher-level machine module, the information is forwarded to the top level
and this module correspondingly responds with the "Quick stop" status. The top machine
module then transfers the information back to its subordinated machine modules, which
change to the "Quick stop" status.
This standard coupling can be deactivated by corresponding programming. This requires that the
user defines the error behaviour by programming.
9.4.1Standard mechanisms of the ApplicationTemplate
• The standard behaviour is active if the module in the machine module tree (MMT) is provided
with at least one subordinated slave module.
• The standard behaviour can be controlled by means of the corresponding methods ("TRUE" is
the initial value):
• Individual programming of the module application is not required.
Rules defined by the standard mechanism:
1. If at least one slave module or the machine module itself shows an error status ("Quick stop",
"Fault", or "System fault"), the machine module sets the actual state to "Quick stop". All slaves
receive the request to adopt the "Quick stop" state.
Example:
A machine module M features four subordinated slaves: S1, S2, S3, S4.
• S2 goes to the "ErrorState FAULT" error status; S4 to "Quick stop".
By this,
• ...M changes to the "Quick stop" status,
• ...S1, S2, S3 receive the request to change to the "Quick stop" status (S4 already is in the "Quick
stop" status)
2. If no error is pending, the machine module forwards the module's intrinsic status request to all
slaves. The module's intrinsic actual state transition only takes place when all slaves have
changed to the status.
Example:
A machine module M features four subordinated slaves: S1, S2, S3, S4.
• By the higher-level master module, M receives the request to change from the "Ready" status
to the "Automatic" status.
• Machine module M forwards the state transition to all slaves.
• If all slaves (S1 ... S4) have completed the state transition and the module's intrinsic
conditions for the state transition have been met, M changes to the "Automatic" status.
The "DisableDefaultCouplingMaster" function (during operation) decouples the state machine of
the higher-level master module from the associated slave modules.
• This function is required if...
• ...specific machine parts / machine modules are to be decoupled specifically (during
operation).
• ...a different status is required for the decoupled machine parts / machine modules than for
the other machine modules.
• Due to the addressed method access of the master, the state machine of the slave can be
influenced. Alternatively, the state machine can be programmed within the slave. The error
handling of the slave does not
Example
affect the state machine of the master.
: "Disable" = "TRUE"
[9-17] Example of a machine structure with three hierarchy levels.
The M1.2 master decouples its state machine from the state machines of the subordinated slaves
M1.2.1 and M1.2.2. This means that the setpoint states for the subordinated slave modules M1.2.1
and M1.2.2 have to be programmed manually in the M1.2 machine module.
•The SMDisableDefaultCouplingMaster(TRUE) method call from a module application (MAP)
activates the function.
•The SMDisableDefaultCouplingMaster(FALSE) method call deactivates the function.
• The method call has no impact on the connection to the ACD structure of the respective
machine module.
•Optionally, the baseChannelSetErrorQuit method forwards the error acknowledgement to the
slaves. The L_EATP_GVL.xDisableGlobalErrorReset variable serves to activate / deactivate a
global error reset:
• Address of the module the current
state of which is to be queried.
• The value "0" and the
L_EATP_CONST.OWNID constant
address the module's intrinsic ID.
• TRUE: of the master is
deactivated
• FALSE: The standard coupling of
the master is activated.
• TRUE: Deactivate the standard
coupling of the master
• FALSE: Activate the standard
coupling of the master
The "DisableDefaultCouplingSlave" function has the effect that the slave module decouples from
the state machine of the master module (during operation).
• This function is required if...
• ...specific machine parts / machine modules are to be decoupled (during operation).
• ...a different response is required for the decoupled machine parts/machine modules than for
the higher-level machine module.
: "Disable" = "TRUE"
•The SMDisableDefaultCouplingSlave(TRUE) method call of a module application (MAP)
activates the function to decouple the slave from the master.
•The SMDisableDefaultCouplingSlave(FALSE) method call deactivates the function.
• The module's intrinsic state machine cannot be coupled to the higher-level master module.
• The state machine can control the subordinated slave modules (locally from the module
application) via the BaseChannel methods.
• That way, the MFB_MachineControl state machine of the lower-level slave modules acts just
like the machine module with the activated SMDisableDefaultCouplingSlave method.
• The higher-level master module ignores the status of a slave module for which the
DisableDefaultCouplingSlave function is activated.
86
• Optionally, the error acknowledgement can be set via the higher-level master:
• The method call has no impact on the connection of the ACD structure of the respective
machine module.
• The master of the state machine can read out a decoupled module via the corresponding
baseChannelGetActualState methods.
Accessing the state machine - the methods of the BaseChannel
• The master of the respective state machine can read out the status of a decoupled module (via
the corresponding methods). The use of this mechanism is advisable if the module is provided
with at least one
higher-level master module.
Error response - response for the occurrence of an error
( 131)
: Error response to "Fault" status of M1.2.2 by
•The DisableDefaultCouplingSlave method decouples the slave module from the state machine
of the master module; example: decoupling M1.2.2 from M1.2.
•The Quick stop error status of M1.2 has no
decoupled from M1).
• The state machine of the master module M1 no longer has an impact on the module M1.2
(due to the decoupling).
• Error acknowledgement by the M1 master module no longer has an impact on M1.2 and its
The methods of the ApplicationTemplate can inhibit and re-enable the state transitions.
• All methods are provided with a request parameter of the BOOL data type. By setting "TRUE",
the function of the respective methods (according to the method name) is executed.
SMDisableServiceToReady(TRUE)
[9-20] Sample program: Inhibiting the "Service"->"Ready" state transition
SMDisableServiceToReady(FALSE)
[9-21] Sample program: Enabling the "Service"->"Ready" state transition
Controlling the state transitions - an overview of the methods
9.6Displaying the states of the state machine - FB L_EATP_SMAccess
The Statemachine FUP method serves to display the current state of the state machine from a
module application (MAP). L_EATP_SMAccess
• In the ApplicationTemplate, every machine module features one module application for which
an instance of this block with the SMAccess instance name is created.
•The Statemachine FUP method calls the instance of the L_EATP_SMAccess(SMAccess) block.
9.7Stater 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
• Module's intrinsic/subordinated
module status enquiry by method
•IF condition
• Query the module's intrinsic
status
• CASE instruction
• Module's intrinsic/subordinated
module status enquiry by method
IF baseChannelGetActualState (MM_Address:= ) =
L_EATP_SMStates.Manual THEN
// Do something if Statemachine is in state MANUAL
END_IF
IF StateMachine.xActStateIsAutomatic THEN
// Do something if Statemachine is in state AUTOMATIC
END_IF
CASE baseChannelGetActualState (MM_Address:= ) OF
L_EATP_SMStates.Ready:
// Do something if Statemachine is in state READY
;
L_EATP_SMStates.Service:
// Do something else if Statemachine is in state SERVICE
( 126)
L_EATP_SMStates.Quickstop:
// Do something else if Statemachine is in state
QUICKSTOP
;
END_CASE
Querying an active warning
•IF condition
• Query the module's intrinsic
warning
Querying the setpoint state of the master
•IF condition
• Based on signals with eSetState
signal
Enabling state transition from "Init" to "Ready" (initialisation completed)
IF StateMachine.xWarning THEN
// Do something if warning is active
ELSE
// Do something else if warning is not active
END_IF
IF StateMachine.xActStateIsAutomatic THEN
IF StateMachine.eSetState = L_EATP_SMStates.Ready
THEN
// Do something if actual state is AUTOMATIC and set
9.8Where can the response of a machine module be programmed?
The response of a machine module (in a
specific state) can be programmed in the
prepared Actions of the ApplicationTemplate.
•Actions are marked with the icon.
During every cycle, always the action
representing the current status of the machine
module's state machine is passed through.
• Program parts which are only required if
the machine module is in a specific state
have to be stored directly within these
predefined actions.
•The MM_EmptyModule module template
contains a predefined structure with
(empty) actions.
[9-22] Example: Status-related actions of the MAP_Module1_App1 FB
9.8.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.
IF xStateEntry THEN
// Put state entry code here
// ...
END_IF
// Put cyclic code here
// ...
[9-23] Program example: S04_SERVICE action
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:
• At the "Ready""Automatic" state transition, the task cycle...
• ...first passes through the S02_READY action with a set xStateExit flag.
• ...then passes through the S05_AUTOMATIC action with a set xStateEntry flag.
The ApplicationTemplate contains an error handling for the output of error messages. It is defined
by default and can be changed if required.
The error handling has the following functions:
• Errors/warnings/information can be defined in the module applications (MAP) of the machine
modules.
• Forwarding of error states within the MachineModuleTree (MMT).
• An application-global error list with the current error status of all machine modules contained
in the MMT.
• The error handling is connected to the logbook of the controller, so that the error messages can
be viewed in the logbook.
9.9.1Defining errors
The SetErrors method defines the errors with the corresponding properties in the respective
module application.
The ApplicationTemplate contains the L_EATP_ErrorSet FB for changing the error handling. At thexSetError input of the L_EATP_ErrorSet FB, application-specific errors can be triggered.
L_EATP_ErrorSet
( 119)
•The L_EATP_ErrorSet FB has four inputs, xSetError[1...4], for setting errors.
• For every xSetError input, one error can be set.
[9-24] FB L_EATP_ErrorSet: Add further instances of the FB if more than four error inputs per instance are required.
An error can be defined on the FB by the following characteristics:
CharacteristicDescriptionFurther information
Error numberUnique error number (ID)16 bit error number (WORD data type)
Error responseError response
• Can be selected from the list.
Acknowledgement
response
Information (yes/no) stating
whether the error tripped is to be
acknowledged.
Configuring an error response
The acknowledgement response cannot be changed
for all error response types.
Configuring an error response
Acknowledging errors
Error textText description of the error.The (English) error text is stored in the table of
Detailed
error information
PriorityAssign priority for errors of the same error response type.
For each error, an additional
attribute (type: DWORD) can be
used, which (in connection with the
error number) can be interpreted.
More information:
attributes.
The error text always is to be used if no
mechanism for implementation of the error number
in national languages is activated (example: higherlevel visualization).
For a "Drive Error" group error, for instance, the
detailed error information of the corresponding
controller can be used.
higher-level
L_EATP_ErrorSet
L_EATP_ModuleErrorHandler ( 124)
( 119)
9.9.2Configuring an error response
The error response types of the error handler define the state of the module's intrinsic application.
If an error occurs, the standard behaviour triggers the configured error response in the other
machine modules.
If a different error response of the machine module is desired, the possibility of programming the
desired error response in the corresponding machine module is provided.
• Further information on the DefaultCoupling (predefined standard response) can be found in the
following section: Default coupling
• The error states that can be defined in the module applications (MAP) are divided into the
following error categories:
Error response (in order of ascending
priority)
InformationWrites information in the logbook of the controller.
Quick stop (fault)Error response in the case of which the machine module involved changes to
WarningThe machine module/the application remains in the same status.
ErrorCauses the machine module involved to trip a response (for example setting
System faultFatal error.
( 83)
Description / acknowledgement behaviour
• No acknowledgement required.
the "Stop" status.
• The acknowledgement behaviour is parameterisable.
• The acknowledgement behaviour is parameterisable.
controller inhibit/pulse inhibit).
• The acknowledgement behaviour is parameterisable.
Restart of the application required (by mains switching or device reset).
• No acknowledgement possible.
9.9.3Acknowledging errors
The acknowledgement of errors deletes all error messages / error causes that have been defined as
requiring acknowledgement
The acknowledgement of errors can be activated by 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
2. Activation for one cycle: Via the baseChannelSetErrorQuit method, rising edge FALSE
method sets the xQuitErrors input to TRUE for one cycle.
If multiple errors occur, they cannot
L_EATP_ModuleErrorHandler
( 124)
be acknowledged individually. Further information:
9.9.4Acknowledging errors: Response in the machine module
The xErrorQuitActive output on the L_EATP_ModuleErrorHandler block can be used within a module
application to acknowledge errors on an integrated function block.
Defining errors - standard procedure
ÊTRUE. The
•The SetErrors method is to be
extended by one function block.
•The MAP_EmptyModul_App1 FB is
to be extended by the
corresponding declaration.
•The xSetError[1...4] inputs must be
connected to the module
application.
• Assign the corresponding
parameter to the respective error
input:
Example: Triggering / forwarding errors - within a machine module
Program line for triggering an error within the machine application:
ErrorsA.xSetError1 := TRUE;
[9-25] Example: Trigger error Error1 of the Errors A FB
Within the respective machine module, the error handling transfers the error response with the
highest priority of the current errors to the module's intrinsic state machine.
• By this, the state machine changes to the defined status of the error response type with the
highest priority.
• Then the module application processes the state change (just like every further state change).
9.11Central error management in the ApplicationTemplate
The error list handler of the ApplicationTemplate transmits all errors which occur in the machine
modules to the global error list, Error List.
• The machine modules forward the
error messages to the error list
handler.
• The current errors can be viewed in
the global Error List.
How to start the global error list:
1. Call the A20_Visualisation folder, L_Main.
2. Click the Error List button to display the global error list.
Lenze · ApplicationTemplate · 1.3 EN - 04/201395
Page 96
Architecture: The ApplicationTemplate in detail
Export error overview of all machine modules: CSV file
• The error list shows the errors defined as "requiring acknowledgement", which are still
pending/to be acknowledged.
9.12Export error overview of all machine modules: CSV file
The ApplicationTemplate 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).
• 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-26] Example: Structure of the exported CSV file
96
For experts:
• 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 .
The ApplicationTemplate transfers the error events to the logbook function of the controller.
• The logbook entries can be viewed 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
ElementSource
M1.2Absolute ID of the machine module
Module2Name of the machine module
F12002Error ID, response type: error
Demo: Drive Error of drive 2Error text
9.14Module diagnostics
For the module diagnostics, a visualization is provided.
•The M.-Modules button calls the detailed
view for the machine modules.
• Click the desired machine module to show
the respective status and further details.
• The visualization for module diagnostics is
provided as a separate visualization
L_EATP_VisModuleList (for instance for
own visualization processes).
• The following tasks are defined in the ApplicationTemplate:
Task levelPriorityTypeCycle time
Task_HighHighCyclicShort (1, 2, 4 ms)
Task_MidMediumCyclicMedium (4, 6, 8, 16
Task_FreeLowUnsolicitedUnsolicited
•In the A11_ModuleAppCalls folder, the respective module applications can be assigned to
the corresponding task.
• ModuleAppCalls (MAC) are the calls of a module application (MAP) by the associated
machine modules (MM) of the corresponding task.
(bold = default value)
ms)
[9-27] 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-28] 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 order to be able to use the multitasking
functionality in a machine module, the
machine module must be provided with more
than one module application.
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
• ...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
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).
for every MAP for real time-critical data in the ACD
1. Before the data area to be transferred can be consistently accessed, 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").
Note!
A task may only use the data area (reading or writing) if the appChannelLock() method
has returned the TRUE value.
IF Lock() THEN
For i:=0 TO 2000 by 1 DO
rACDOwn.aCAMData[i] := aCAMData[i];
END_FOR
[9-1]Example: The Lock() method inhibits real time-critical data of the ACD structure.
2. After the last exclusive access to the data area, a task must call the Unlock() method to enable
the data area.
IF Lock() THEN
For i:=0 TO 2000 by 1 DO
rACDOwn.aCAMData[i] := aCAMData[i];
END_FOR
Unlock()
[9-2]Example: The UnLock() method enables a reserved data area der ACD structure.
Program in machine module 1 (TaskMidPriority = 4 ms):
100
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.