Lenze PLC Designer ApplicationTemplate User Manual

Engineering Tools
PLC Designer
Application Template _ _ _ _ _ _ _ _ _ _ _ _ _ _
Software Manual EN
Ä.LN7ä
13434522
L

Contents

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
1 About this documentation _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 6
1.1 Document history _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 8
1.2 Conventions used _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 9
1.3 Notes used _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 10
1.4 Terminology used (presented according to the order in the device view) _ _ _ _ _ _ _ _ _ _ _ _ _ _ 11
2Safety instructions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 12
3Requirements _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 13
3.1 System requirements _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 13
3.2 Establishing communication with the controller _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 13
4 What is the ApplicationTemplate? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 15
4.1 Objective of the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 15
4.2 Features of the ApplicationTemplate at a glance _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 16
4.3 Elements of the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 17
4.3.1 Machine Module Tree - MMT _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 17
4.3.2 Machine modules (MM) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 18
4.3.3 Addressing the machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 19
4.3.4 Module application (MAP) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 19
4.3.5 Communication between the machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 20
4.3.6 State machine _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 21
4.3.7 Error handling _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 22
5 Structuring the automation system: Standard procedure _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 23
5.1 Assign the relative address to the machine modules. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 25
5.2 Structuring within a machine module _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 26
5.2.1 Assigning the MAP subfunctions to individual tasks _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 26
5.2.2 Programming recommendations for structuring _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 27
6 Overview - the structure of the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 29
7 Opening the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 30
7.1 Create a new project - open the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 31
7.2 Update the controller in the project (optional) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 32
7.3 Going online _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33
7.3.1 Compiling the project data _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33
7.3.2 Transferring the project to the control - "Log in" _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33
7.4 Loading and starting the PLC program _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 33
7.5 Simulation (valid for the ApplicationTemplateCounter) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 34
7.6 Getting started - operating the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 35
7.7 Visualisation of the machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 37
8 Working with the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 39
8.1 Mapping the actual machine structure in the »PLC Designer« _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 40
8.1.1 Adding devices - EtherCAT bus system _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 40
8.1.2 Adding devices - CANopen bus system (optional) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 43
8.2 Creating your own machine modules: Copy/insertMM_EmptyModule _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 51
8.3 Integrating a machine module into the MMT _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 53
8.4 Assigning the module application (MAP) to the task _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 54
8.5 Remove the instances of a machine module _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 56
8.6 Removing machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 56
8.7 Module ID _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 56
8.8 Inserting an axis _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 58
8.9 Integrating I/O modules of the I/O system 1000 with a machine module _ _ _ _ _ _ _ _ _ _ _ _ _ _ 60
Contents
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
8.10 Creating module applications _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 62
8.10.1 Adapting the function of the module application inserted - overview _ _ _ _ _ _ _ _ _ _ _ 63
8.10.2 Frequently asked question: Connection between MFB and MAP _ _ _ _ _ _ _ _ _ _ _ _ _ _ 64
8.10.3 Programming with the module application _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 65
8.10.4 Integrating a module application _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 66
8.11 Online change _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 68
8.11.1 When can an "Online change" be used in the ApplicationTemplate? _ _ _ _ _ _ _ _ _ _ _ _ 68
8.11.2 When is it not possible to use an "Online change" in the ApplicationTemplate? _ _ _ _ _ 69
8.11.3 General programming recommendations which enable an "Online change" _ _ _ _ _ _ _ 69
9 Architecture: The ApplicationTemplate in detail _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 71
9.1 Accessing structure variables of machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 71
9.1.1 Accessing module's intrinsic structure variables _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 71
9.1.2 Accessing structures of other machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 72
9.2 The AppChannelData structure(ACD) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 73
9.2.1 Declaring/recording the ACD structure in the MFB _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 73
9.2.2 Accessing the ACD structure - by means of the MFB module application _ _ _ _ _ _ _ _ _ 74
9.2.3 Accessing an ACD structure - by means of the module application of the MFB master module 75
9.3 State machine _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77
9.3.1 State transitions and conditions - overview _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 77
9.3.2 Initial state of the state transitions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 78
9.3.3 The state transitions in detail _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 79
9.3.4 Mapping of the states - Enum L_EATP_SMStates _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 82
9.3.5 Activating the states - baseChannelSetNominalState method _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 82
9.4 Default coupling _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 83
9.4.1 Standard mechanisms of the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 83
9.4.2 The "DisableDefaultCouplingMaster" function _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 85
9.4.3 The "DisableDefaultCouplingSlave" function _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 86
9.5 Influencing state transitions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 88
9.6 Displaying the states of the state machine - FB L_EATP_SMAccess _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 89
9.7 Stater machine: Query examples _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 89
9.8 Where can the response of a machine module be programmed? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 91
9.8.1 State transition (state entry/state exit) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 91
9.9 Error handling _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 92
9.9.1 Defining errors _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 92
9.9.2 Configuring an error response _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 93
9.9.3 Acknowledging errors _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 93
9.9.4 Acknowledging errors: Response in the machine module _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 94
9.10 Triggering errors _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 95
9.11 Central error management in the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 95
9.12 Export error overview of all machine modules: CSV file _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 96
9.13 Logbook _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 97
9.14 Module diagnostics _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 97
9.15 Multitasking _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 98
9.16 Consistent data transfer _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 99
9.17 Internal Control _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 101
9.17.1 Exiting the Internal Control _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 102
9.17.2 What does the Internal Control do? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 102
10 Visualising in the ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 104
10.1 Extending the visualization _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 104
10.2 Defining the properties of buttons _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 106
10.3 Adding a visualization: Standard procedure _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 107
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 3
Contents
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
11 The L_EATP_ApplicationTemplate library _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 110
11.1 Automatically generated functions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 111
11.1.1 GetBooleanProperty (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ 111
11.1.2 GetCompany (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 112
11.1.3 GetNumberProperty (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ 112
11.1.4 GetTextProperty (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 113
11.1.5 GetTitle (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 113
11.1.6 GetVersion (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 114
11.1.7 GetVersionProperty (automatically generated by »PLC Designer«) _ _ _ _ _ _ _ _ _ _ _ _ _ 114
11.2 1_POUs - Program Organization Units _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115
11.2.1 L_EATP_Application _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 115
11.2.2 L_EATP_CriticalSection _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 117
11.2.3 L_EATP_ErrorListHandler _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 118
11.2.4 L_EATP_ErrorSet _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 119
11.2.4.1 Adapting the error handling system _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 120
11.2.4.2 Acknowledging errors _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 120
11.2.5 L_EATP_Module _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 121
11.2.5.1 Base() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 121
11.2.6 RegisterACD() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 122
11.2.7 setCompIDAndVersion() _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 122
11.2.8 L_EATP_ModuleDiag _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 123
11.2.9 L_EATP_ModuleErrorHandler _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 124
11.2.10 L_EATP_ModulRelations _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 125
11.2.11 L_EATP_SMAccess _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 126
11.3 2_Structs_Types _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 127
11.3.1 L_EATP_ACD_Base _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 127
11.3.2 L_EATP_BaseChannel _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 128
11.3.3 L_EATP_ErrorList _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 128
11.3.4 L_EATP_ErrorListEntry _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 128
11.3.5 L_EATP_MM_Address _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 129
11.3.6 L_EATP_MVis _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 129
11.3.7 L_EATP_scBase _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 129
11.4 3_Enums _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 129
11.4.1 L_EATP_ErrorReactionType _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 129
11.4.2 L_EATP_SMStates _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 130
12 Appendix _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131
12.1 Method overview - ApplicationTemplate _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131
12.1.1 Accessing the state machine - the methods of the BaseChannel _ _ _ _ _ _ _ _ _ _ _ _ _ _ 131
12.1.2 Inhibiting/enabling module-specific state transitions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 133
12.1.3 Activate / deactivate quick stop response of the state machine _ _ _ _ _ _ _ _ _ _ _ _ _ _ 133
12.1.4 Activating/deactivating default coupling _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 134
12.2 The sample program in the ApplicationTemplateCounter _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 134
12.2.1 Sample programs in the machine module MM_Module1/MM_Module2 _ _ _ _ _ _ _ _ _ 135
12.2.1.1 "Automatic" status _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 136
12.2.1.2 "Mode1" status _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 136
12.2.1.3 "Mode2" status _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 136
12.2.1.4 "Service" status _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 137
12.2.1.5 "Fault"/"System fault" status _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 137
12.2.2 Sample program MM_Machine machine module _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 138
12.3 Tips&tricks _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 139
12.3.1 Renaming a machine module _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 139
12.3.2 Next steps: Renaming the visualization buttons _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 140
Contents
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
12.4 Recipe manager _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 142
12.4.1 Precondition _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 143
12.4.2 Creating the recipe definition _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 143
12.4.3 Recipe definition - assigning variables _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 144
12.4.4 Inserting recipes into a recipe definition _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 145
12.4.5 Managing recipes with RecipeManCommands _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 146
12.4.5.1 Create Recipe _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 146
12.4.5.2 ReadAndSaveRecipeAs _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 147
12.4.5.3 LoadFromAndWriteRecipe _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 148
12.4.5.4 WriteRecipe _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 149
12.4.5.5 ReadRecipe _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 150
12.4.5.6 GetRecipeCount _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 151
13 Application example: Flying saw _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 152
13.1 Preparation: Modularising the automation system into subfunctions _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 152
13.1.1 Identifying subfunctions of the machine structure _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 153
13.1.2 Representing subfunctions of the machine structure as machine modules _ _ _ _ _ _ _ _ 153
13.1.3 Representing machine modules in a tree structure _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 153
13.2 Mapping the actual machine structure in the »PLC Designer« _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 154
13.2.1 Device structure: Adding master and slave _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 154
13.2.2 Setting the cycle time _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 155
13.3 Creating and integrating machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 155
13.3.1 Creating machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 155
13.3.2 Integrating machine modules in the machine structure tree _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 157
13.3.3 Managing module applications of the machine modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 158
13.3.4 Inserting an axis into the module application _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 159
13.3.5 Assigning the module application to the tasks _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 159
13.4 Setting up communication between master modules and slave modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ 161
13.5 Application example: Extending the visualization _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 163
13.6 State machine _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 166
13.6.1 Controlling the state transition in the machine control module _ _ _ _ _ _ _ _ _ _ _ _ _ _ 166
13.6.2 Controlling state transitions in the slave modules _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 168
13.7 Manual jog of the axes _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 169
13.8 Error handling: Configuring the error handling _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 170
Your opinion is important to us _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 176
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 5
About this documentation
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

1 About this documentation

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/abbreviation Subject
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.
About this documentation
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Further technical documentation on Lenze products
Further information on Lenze products which can be used in connection with "Controller­based Automation" can be found in the following documentation:
Mounting & wiring Symbols:
MAs Controller Printed documentationMA i700 servo inverter Online help / PDF fileMAs Servo Drives 9400MAs Inverter Drives 8400 Abbreviation:MA I/O system 1000 (EPM-Sxxx) BA Operating instructionsMAs for communication cards (MC-xxx) KHB Communication manualMAs for communication modules MA Mounting instructions
SW Software manual
Parameterisation, configuration, commissioning SHB 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.
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 7
About this documentation
Document history
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Information regarding the validity
The information in this documentation applies to the following Lenze software:
Software From software version
»PLC Designer« 3.5
Valid for the following Lenze templates:
• "ApplicationTemplate Counter" sample project: L_ApplicationTemplateCounter
• "Application Template" application template: L_ApplicationTemplate

1.1 Document history

Version Description
1.0 04/2012 TD11 First edition
1.1 07/2012 TD11 Updated to M5 of the ApplicationTemplate
• General correction
• Adaptation to VISU layout according to the Lenze programming style guide for FBs.
1.2 11/2012 TD11 Updated to »PLC Designer« V3.3.2
• New: ApplicationTemplateCounter sample project (Lenze standard)
1.3 04/2013 TD11 Updated to »PLC Designer« V3.5
• Software update of ApplicationTemplateCounter/ApplicationTemplate.
• New: Application example "flying saw".
8
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
About this documentation
Conventions used
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

1.2 Conventions used

This documentation uses the following conventions to distinguish between different types of information:
Type of information Display Examples/notes
Numbers
Decimal separator Point The decimal point is generally used.
Example: 1234.56
Text
Version information Text colour blue All pieces of information that only apply to or from a certain
Program name » « »PLC Designer«...
Window Italics The Message window... / The Options ... dialog box
Variable name By setting bEnable to TRUE...
Control element Bold The OK... button / The Copy... command / The Properties...
Sequence of menu commands
Shortcut <Bold> Use <F1> to open the online help.
Hyperlink underlined
Symbols Page reference (9) Reference to further information: Page number in PDF file.
Step-by-step instructions
controller software version are identified accordingly in this documentation.
Example: This function extension is available as from
software version V3.0!
tab / The Name ... input field
If the execution of a function requires several commands in a row, the individual commands are separated by an arrow: Select File
If a key combination is required for a command, a "+" is placed between the key identifiers: With <Shift>+<ESC>...
Reference to further information: Hyperlink to further information.
Step-by-step instructions are marked by a pictograph.
Open to...
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 9
About this documentation
Notes used
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

1.3 Notes used

The following signal words and icons are used in this documentation to indicate dangers and important information:
Safety instructions
Structure of safety instructions:
Pictograph and signal word!
(characterises the type and severity of danger)
Note
(describes the danger and explains how to avoid it.)
Pictograph Signal word Meaning
Danger! Danger of personal injuries through electrical voltage
Danger! Danger of personal injury through a general source of danger
Stop! Danger of damage to material assets
Reference to an imminent danger that may result in death or serious personal injury unless the corresponding measures are taken.
Reference to an imminent danger that may result in death or serious personal injury unless the corresponding measures are taken.
Indicates a potential danger that may lead to material damage unless the corresponding measures are taken.
Application notes
Pictograph Signal word Meaning
Note! Important note for trouble-free operation
Tip! Useful tip for easy handling
Reference to other documents
10
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
About this documentation
Terminology used (presented according to the order in the device view)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

1.4 Terminology used (presented according to the order in the device view)

Term/abbreviation Position in the device view Function
Machine module tree
MMT
ModuleApplicationCalls
MAC
Machine module
MM
Machine module application
MAP
Machine function block MFB
A10_MachineModuleTree
A11_ModuleAppCalls
A70_MachineModuleSources
The "MachineModuleTree" (MMT) maps the structure of the automation system in the form of machine modules.
• In the "MachineModuleTree", all machine modules required for the machine are interconnected hierarchically according to the mechatronic interaction.
The module applications are to be assigned to the corresponding task within the "ModuleApplicationCalls".
• Thus it is defined which module application is to be processed within the individual tasks.
A machine module maps a unit of the real machine structure in the »PLC Designer«.
• The machine module is part of the MachineModuleTree(MMT) within which the individual machine modules are interconnected.
The machine module application provides the functionality of a machine module.
• A machine module can contain one or several machine module applications.
The machine function block represents the machine module in the machine module tree (MMT).
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 11
Safety instructions
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

2 Safety instructions

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!
Requirements
System requirements
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

3 Requirements

3.1 System requirements

Engineering PC Controller
Hardware PC/notebook PLC (Logic) from firmware V3.3
Operating system Windows XP Windows CE
Required Lenze software »PLC Designer« from V3.3
•Contains the ApplicationTemplate
• Contains the Lenze library "L_EATP_ApplicationTemplate.co mpiled-library"
Further requirements - Depending on the application case:

3.2 Establishing communication with the controller

• Connect the Engineering PC with the controller via a network cable. The »PLC Designer« accesses the controller via Ethernet.
• Make the IP settings with the »PLC Designer«.
How to check the communication settings:
1. Double-click the desired controller in the Devices view.
2. Make the desired settings on the Communication settings tab.
•Click the Add gateway button to insert a gateway.
Runtime software
•Logic
• Motion (this requires updating the project information: "Update devices")
• CAN or EtherCAT bus system
• CAN or EtherCAT node
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 13
Requirements
Establishing communication with the controller
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
•Enter the desired IP address of the controller.
[3-1] Example: Enter the IP address of the controller.
3. Click OK to add the controller as gateway.
4. By double-clicking the desired channel (or clicking the Set active path button), set the
channel selected in the device view below the gateway as active path to the controller.
• Thus, all communication actions directly refer to this channel.
• The currently active path is represented in bold in the list and "(active)" is attached:
5. A device represented in italics is set as active path but has not been found during the last
network scan.
Note!
• During initial commissioning, observe the following predefined IP addresses of the
controllers:: 192.168.5.99
Further information can be found in the following documentation:
Controller - Parameter setting & configuration
14
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
What is the ApplicationTemplate?
Objective of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4 What is the ApplicationTemplate?

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.1 Objective 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.
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 15
What is the ApplicationTemplate?
Features of the ApplicationTemplate at a glance
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.2 Features of the ApplicationTemplate at a glance

The following functions facilitate implementing a machine application in a PLC:
State machine
Error handling (92)
Multitasking (98)
Further advantages if the ApplicationTemplate is used:
(21)
Consistent data transfer
• Diagnostic function for every machine module ("generic module diagnosis").
• A defined standard response ("DefaultCoupling") of the state machine. Default coupling
(83)
• Decouples one (or several machine modules.Internal Control (101)
For more information on the respective functions, please see the corresponding subchapter.
between the tasks.
16
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
What is the ApplicationTemplate?
Elements of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.3 Elements of the ApplicationTemplate

4.3.1 Machine Module Tree - MMT

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
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 17
What is the ApplicationTemplate?
Elements of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.3.2 Machine modules (MM)

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.
18
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
What is the ApplicationTemplate?
Elements of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.3.3 Addressing the machine modules

Every machine module has an MM_Address input which serves to assign the relative address 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.4 Module 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).
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 19
What is the ApplicationTemplate?
Elements of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.3.5 Communication between the machine modules

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
structure.
20
Lenze · ApplicationTemplate · 1.3 EN - 04/2013
What is the ApplicationTemplate?
Elements of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.3.6 State machine

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.
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 21
What is the ApplicationTemplate?
Elements of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4.3.7 Error handling

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
Structuring the automation system: Standard procedure
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

5 Structuring 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.
Step Action What 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/2013 23
Structuring the automation system: Standard procedure
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Step Action What has to be done? Description
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)
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/2013 25
Structuring the automation system: Standard procedure
Structuring within a machine module
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

5.2 Structuring within a machine module

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.1 Assigning 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
Structuring the automation system: Standard procedure
Structuring within a machine module
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Recommendation - which function is to be called in which task?
Task/priority Function (example)
"High"
HighPriority
"Mid"
MidPriority
"Free"
Unsolicited

5.2.2 Programming recommendations for structuring

The following table presents the structuring possibilities of the ApplicationTemplate as a decision recommendation:
Which features of the ApplicationTemplate should I use and for what purpose?
Execution of Motion functions
Conversion for an external visualization
NRT Ethernet communication
What do you want to do? FB Action Method More suitable
Work with local variables z Local variables are to be
Debugging zzNo local variables Action, FB
Reuse: In the event of an error (when creating the user software), error handling can be executed at one point.
Instancing z --Action,
Access all data types zz zAction, FB,
z - To a limited extent - for
declared in the FB
assigned.
Local variables (if possible) are to be declared in the FB assigned.
instance if FBs are integrated in the method.
Example: "Statemachine" in the ApplicationTemplate
is...
-
FB
method
method
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 27
Structuring the automation system: Standard procedure
Structuring within a machine module
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Actions
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
Overview - the structure of the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

6 Overview - the structure of the ApplicationTemplate

The Lenze ApplicationTemplate facilitates programming with the »PLC Designer«.
• The ApplicationTemplateCounter has the following predefined structure:
A10_MachineModuleTree (MMT)
•The Machine module tree maps the mechatronic
functionality of the machine structure in the form of machine modules (MM).
A11_ModuleAppCalls (MAC)
• ...contains the assignments of module applications (MAP) to the tasks.
A20_Visualisation
• ...contains the visualizations for the device-independent functions. Getting started - operating the
ApplicationTemplate (35)
A55_VarLists
• ...contains the declarations of the global variables:
• Machine modules used: MM_Dcl
•IO variables: MM_IO
• Parameters: MM_Par
• Variables for an external visualization: MM_Vis
• Persistent data: MM_PD
A60_MotionObjects
• ...predefined folder for motion-relevant data, example: CAM profiles.
A65_EmptyModule
• ...contains the machine module sources
•...contains the EmptyModule template for creating your own machine modules. Creating your own machine
modules: Copy/insertMM_EmptyModule (51)
A70_MachineModuleSources
• ...contains the individually created machine modulesMachine modules (MM)
• ...contains the visualization of the machine modules.
ApplicationTemplateCounter:
• ...contains two predefined machine modules.
A71_LocalSources
• ...storage location for machine-independent enumerations, function blocks, structures, visualizations.
A80_Documentation
• ...predefined folders for "project history" documents, example: version information, changes.
A90_Resources
• ...contains the system information such as:
•Task settings,
• Libraries used,
• Recipe manager,
•Visualization manager.
(18)
Tip!
Combine the "local sources" from the A71_LocalSources folder in one library.
Lenze · ApplicationTemplate · 1.3 EN - 04/2013 29
Opening the ApplicationTemplate
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

7 Opening 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:
Step Action
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
Loading...
+ 147 hidden pages