Professional Documents
Culture Documents
PLC Lib: Tc3 - Packml - V2: Manual
PLC Lib: Tc3 - Packml - V2: Manual
TwinCAT 3
Version: 1.1
Date: 2017-02-01
Table of contents
Table of contents
1 Foreword .................................................................................................................................................... 4
1.1 Notes on the documentation........................................................................................................... 4
1.2 Safety instructions .......................................................................................................................... 5
4 Appendix .................................................................................................................................................. 29
4.1 Example Tc3_PackML_V2 ........................................................................................................... 29
1 Foreword
The responsible staff must ensure that the application or use of the products described satisfy all the
requirements for safety, including all the relevant laws, regulations, guidelines and standards.
Disclaimer
The documentation has been prepared with care. The products described are, however, constantly under
development.
We reserve the right to revise and change the documentation at any time and without prior announcement.
No claims for the modification of products that have already been supplied may be made on the basis of the
data, diagrams and descriptions in this documentation.
Trademarks
Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE®, XFC® and XTS® are registered
trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own
purposes could violate the rights of the owners.
Patent Pending
The EtherCAT Technology is covered, including but not limited to the following patent applications and
patents:
EP1590927, EP1789857, DE102004044764, DE102007017835
with corresponding applications or registrations in various other countries.
The TwinCAT Technology is covered, including but not limited to the following patent applications and
patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.
EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH,
Germany
Copyright
Exclusion of liability
All the components are supplied in particular hardware and software configurations appropriate for the
application. Modifications to hardware or software configurations other than those described in the
documentation are not permitted, and nullify the liability of Beckhoff Automation GmbH & Co. KG.
Personnel qualification
This description is only intended for trained specialists in control, automation and drive engineering who are
familiar with the applicable national standards.
Description of symbols
In this documentation the following symbols are used with an accompanying safety instruction or note. The
safety instructions must be read carefully and followed without fail!
Risk of injury!
Failure to follow the safety instructions associated with this symbol endangers the life and
health of persons.
WARNING
Personal injuries!
Failure to follow the safety instructions associated with this symbol can lead to injuries to
persons.
CAUTION
Tip or pointer
This symbol indicates information that contributes to better understanding.
Note
It is expected that application-specific logic such as state transitions are programmed in external function
blocks and that the “Packaging Machine State” function block takes over the central logic of the state
machine and the state display. For that reason there is a recommendation for this function block with regard
to how it can be combined with other logic.
The state transition in a machine application is always application-specific. For that reason it is best to
design linked “State” function blocks with PackML State Machine V3 in order to simplify the standardization.
The “State” function blocks acquire application-specific signals and represent the transition logic to adjacent
states (see PackML state model). The “State” function blocks supply feedback to
PS_PackML_State_Machine_V3, as a result of which a standard state machine and a state message are
possible. The “State” function blocks contain the machine execution code and the application-specific
transition logic.
The “State” function blocks are listed below and are programmed by the application programmer in such a
way that the integrity and functionality of the PackML State Machine are retained:
Requirements
2.1 Interfaces
2.1.1 ITF_UnitState
This interface can be implemented in the unit function blocks of the application and makes available all
methods of the Packaging State Model, which can then be filled as required with application code.
M_Aborted
M_Aborting
M_Clearing
M_Complete
M_Completing
M_Execute
M_Held
M_Holding
M_Idle
M_Resetting
M_Starting
M_StateComplete
M_Stopped
M_Stopping
M_Suspended
M_Suspending
M_Undefined
M_Unholding
M_Unsuspending
2.2.1 E_PMLCommand
E_PMLCommand
TYPE E_PMLCommand :
(
(* states according to PackTags v3.0 *)
ePMLCommand_Undefined := 0,
ePMLCommand_Reset := 1,
ePMLCommand_Start := 2,
ePMLCommand_Stop := 3,
ePMLCommand_Hold := 4,
ePMLCommand_Unhold := 5,
ePMLCommand_Suspend := 6,
ePMLCommand_Unsuspend := 7,
ePMLCommand_Abort := 8,
ePMLCommand_Clear := 9
);
END_TYPE
Requirements
2.2.2 E_PMLState
E_PMLState
TYPE E_PMLState :
(
(* states according to PackTags v3.0 *)
ePMLState_Undefined := 0,
ePMLState_Clearing := 1,
ePMLState_Stopped := 2,
ePMLState_Starting := 3,
ePMLState_Idle := 4,
ePMLState_Suspended := 5,
ePMLState_Execute := 6,
ePMLState_Stopping := 7,
ePMLState_Aborting := 8,
ePMLState_Aborted := 9,
ePMLState_Holding := 10,
ePMLState_Held := 11,
ePMLState_Unholding := 12,
ePMLState_Suspending := 13,
ePMLState_Unsuspending := 14,
ePMLState_Resetting := 15,
ePMLState_Completing := 16,
ePMLState_Complete := 17
);
END_TYPE
Requirements
2.2.3 E_PMLProtectedUnitMode
E_PMLProtectedUnitMode
TYPE E_PMLProtectedUnitMode :
(
ePMLUnitMode_Invalid := 0,
ePMLUnitMode_Production := 1,
ePMLUnitMode_Maintenance := 2,
ePMLUnitMode_Manual := 3
);
END_TYPE
Requirements
2.2.4 ST_PMLSubUnitInfoRef
ST_PMLSubUnitInfoRef
TYPE ST_PMLSubUnitInfoRef :
STRUCT
pArray : POINTER TO ST_PMLSubUnitInfo;
nArraySize : UDINT;
nNoOfSubUnits : UDINT;
END_STRUCT
END_TYPE
Requirements
2.2.5 ST_PMLSubUnitInfo
ST_PMLSubUnitInfo
TYPE ST_PMLSubUnitInfo :
STRUCT
bActive : BOOL;
eState : E_PMLState;
END_STRUCT
END_TYPE
bActive Signals that this subordinated machine part is active and follows the state
presets of the state machine.
eState Enumeration that reflects the current state of the subordinated machine part.
Requirements
2.2.6 ST_PMLStateMachineOptions
ST_PMLStateMachineOptions
TYPE ST_PMLStateMachineOptions :
STRUCT
END_STRUCT
END_TYPE
Requirements
2.3.1 PML_StateMachine
In the updated form the PML_StateMachine function block has a common interface with the PackML
Machine State Model V3. It is assumed that application-specific logic, such as state transitions, is
programmed in external function blocks and that the PML_StateMachine function block deals with the central
logic of the state machine and the state representation. The Machine State Model has a different
appearance due to the currently active UnitMode (eMode). Three basic modules are preconfigured for this
(E_PMLProtectedUnitMode [} 8]).
ePMLProtUnitMode_Production
ePMLProtUnitMode_Maintenance
ePMLProtUnitMode_Manual
Furthermore, other user-specific models can be created in a simple manner with the aid of the function block
PML_UnitModeConfig [} 14] and are thus very flexible in use.
The logic for transitions, in particular between production, maintenance and manual mode, depends on the
application. The states in which UnitMode changes are permissible for the basic models are described more
precisely in the description of the function block PML_UnitModeManager [} 16].
Inputs
VAR_INPUT
eMode : DINT;
eCommand : E_PMLCommand;
stSubUnitInfoRef : ST_PMLSubUnitInfoRef;
stOptions : ST_PMLStateMachineOptions;
END_VAR
eCommand: Enumeration [} 7] with the various PML commands of the function block.
stSubUnitInfoRef: Structure [} 9] that points to an array of the current PML states of subordinated machine
units
Outputs
VAR_OUTPUT
eState : E_PMLState;
bError : BOOL;
nErrorId : UDINT;
END_VAR
eState: Enumeration [} 8] that delivers the current PML state of the automatic state machine.
nErrorID: Supplies the error number when the output bError is set.
Requirements
2.3.2 PML_UnitModeConfig
Machines may have unit modes other than "Production", "Maintenance" and "Manual". This function block
enables the user to configure further models (UnitModes).
The number of the new model, the existing states and the states in which a model change is possible can be
freely defined.
Inputs
VAR_INPUT
eMode : DINT;
bDisableClearing : BOOL;
bDisableStarting : BOOL;
bDisableSuspended : BOOL;
bDisableStopping : BOOL;
bDisableAborting : BOOL;
bDisableHolding : BOOL;
bDisableHeld : BOOL;
bDisableUnholding : BOOL;
bDisableSuspending : BOOL;
bDisableUnsuspending : BOOL;
bDisableResetting : BOOL;
bDisableIdle : BOOL;
bDisableCompleting : BOOL;
bDisableComplete : BOOL;
bEnableUnitModeChangeStopped : BOOL;
bEnableUnitModeChangeIdle : BOOL;
bEnableUnitModeChangeSuspended : BOOL;
bEnableUnitModeChangeExecute : BOOL;
bEnableUnitModeChangeAborted : BOOL;
bEnableUnitModeChangeHeld : BOOL;
bEnableUnitModeChangeComplete : BOOL;
END_VAR
Outputs
VAR_OUTPUT
bError : BOOL;
nErrorID : UDINT;
END_VAR
nErrorID: Supplies the error number when the output bError is set.
Requirements
2.3.3 PML_UnitModeManager
Machines have system modes other than “Production”. Each unit mode is defined by its own state model. A
"Mode Manager" must be defined for transitions between the modes. The “Mode Manager” decides how and
in which state a machine can change unit modes; i.e. built-in barriers prevent the machine from changing to
unsuitable states. These barriers are permanently defined for the base modes “Production”, “Maintenance”
and “Manual”, as the illustration below shows. This can be individually specified for other modes defined via
the PML_UnitModeConfig [} 14] function block.
NOTE! The logic for transitions between the modes depends on the application, especially for
transitions between "Manual" and "Production" mode. In addition, hardware barriers or safety
equipment may be necessary for such mode changes. The responsibility for proper mode changes lies
with whoever implements them.
Inputs
VAR_INPUT
bExecute : BOOL;
eModeCommand : DINT;
ePMLState : E_PMLState;
END_VAR
bExecute: On a rising edge at this input, an attempt is made to perform the mode change.
ePMLState: Enumeration [} 8] that delivers the current PML state of the automatic state machine.
Outputs
VAR_OUTPUT
eModeStatus : DINT;
bDone : BOOL;
bError : BOOL;
bErrorID : UDINT;
END_VAR
bDone: Becomes TRUE as soon as the mode change has been successfully carried out.
nErrorID: Supplies the error number when the output bError is set.
Requirements
3.1 Introduction
PackTags provides a uniform set of naming conventions for data elements that are used in the procedural
elements of the Base State Model. As described, the Base State Model provides a uniform set of machine
states, so that all automated machines can be considered in the same way. PackTags are data elements
provided with names for the interoperable data exchange between automated machines with open
architectures. This documentation contains the key names of the data elements, data types, values, fields
and data structures, if applicable. PackTags are used for machine-to-machine communication, e.g. between
a bottle filler and a cap fitter. PackTags can also be used for the exchange of data between a machine and
superordinated information systems such as Manufacturing Operations Management and Enterprise
Information Systems.
The documentation describes all PackTags for the navigation through a state model and for the definition
and actuation of the system control mode. Furthermore, this documentation defines a list of PackTags, which
may describe important machine information. All PackTags must be used in order to conform to the
principles of integrated connectivity with systems with the same implementation.
The tags required are those that are needed for the function of the automated machine or for the connectivity
to control or remote systems.
The grouping of data should take place in adjacent registers, in order to optimize the communication.
Information data are usually transferred via OPC in an Ethernet-based communication network.
3.4.1 Alarm
3.4.1.1 ST_Alarm
Collection of tags for the description of alarm events.
TYPE ST_Alarm :
STRUCT
Trigger : BOOL;
Id : DINT;
Value : DINT;
Message : STRING;
Category : DINT;
DateTime : ARRAY [0..6] OF DINT;
AckDateTime : ARRAY [0..6] OF DINT;
END_STRUCT
END_TYPE
Requirements
3.4.1.2 ST_DateAndTime
This structure is used for saving the date and time of an event or for the acknowledgement of an event.
TYPE ST_DateAndTime :
STRUCT
Year : DINT;
Month : DINT;
Day : DINT;
Hour : DINT;
Minute : DINT;
Second : DINT;
mSec : DINT;
END_STRUCT
END_TYPE
Requirements
3.4.2 Common
3.4.2.1 ST_Count
Collection of tags for the description of parameters in the machine.
TYPE ST_Count :
STRUCT
Id : DINT;
Name : STRING;
Unit : STRING(5);
Count : DINT;
AccCount : DINT;
END_STRUCT
END_TYPE
Requirements
3.4.2.2 ST_Descriptor
Collection of tags for the description of parameters in the machine.
TYPE ST_Descriptor :
STRUCT
Id : DINT;
Name : STRING;
Unit : STRING(5);
Value : REAL;
END_STRUCT
END_TYPE
Requirements
3.4.2.3 ST_Equipment
Collection of tags for the description of parameters in the machine.
TYPE ST_Descriptor :
STRUCT
Blocked : BOOL;
Starved : BOOL;
END_STRUCT
END_TYPE
Requirements
3.4.2.4 ST_Ingredient
Collection of tags for the description of the raw materials required for the product.
TYPE ST_Ingredient :
STRUCT
IngredientId : DINT;
Parameter : ARRAY [1..MaxIngredientParameters] OF ST_Descriptor;
END_STRUCT
END_TYPE
Requirements
3.4.2.5 ST_Interface
Collection of tags for the description of materials in the machine.
TYPE ST_Interface :
STRUCT
Number : DINT;
ControlCmdNumber : DINT;
CmdValue : DINT;
Parameter : ARRAY [1..MaxInterfaceParameters] OF ST_Descriptor;
END_STRUCT
END_TYPE
Requirements
3.4.2.6 ST_Product
Collection of tags for the description of the product manufactured on the machine.
TYPE ST_Product :
STRUCT
ProductId : DINT;
ProcessVariables : ARRAY [1..MaxProductProcessVariables] OF ST_Descriptor;
Ingredients : ARRAY [1..MaxIngredients] OF ST_Ingredient;
END_STRUCT
END_TYPE
Requirements
3.4.3 ST_PMLa
Collection of all Administration tags of the PackTag structure.
TYPE ST_PMLa :
STRUCT
Parameter : ARRAY [1..MaxAdminParameters] OF ST_Descriptor;
Alarm : ARRAY [1..MaxAlarms] OF ST_Alarm;
AlarmExtent : DINT := MaxAlarms;
Requirements
3.4.4 ST_PMLc
Collection of all Command tags of the PackTag structure.
TYPE ST_PMLc :
STRUCT
UnitMode : DINT;
UnitModeChangeRequest : BOOL;
MachSpeed : REAL;
MaterialInterlock : DINT;
CntrlCmd : DINT;
CmdChangeRequest : BOOL;
RemoteInterface : ARRAY [1..MaxCommandRemoteInterfaces] OF ST_Interface;
Parameter : ARRAY [1..MaxCommandParameters] OF ST_Descriptor;
Product : ARRAY [1..MaxCommandProducts] OF ST_Product;
END_STRUCT
END_TYPE
Requirements
3.4.5 ST_PMLs
Collection of all state tags of the PackTag structure.
TYPE ST_PMLs :
STRUCT
UnitModeCurrent : DINT;
UnitModeRequested : DINT;
UnitModeChangeInProcess : BOOL;
StateCurrent : DINT;
StateRequested : DINT;
StateChangeInProcess : BOOL;
MachineSpeed : REAL;
CurMachineSpeed : REAL;
MaterialInterlock : DINT;
EquipmentInterlock : ST_Equipment;
RemoteInterface : ARRAY [1..MaxStatusRemoteInterfaces] OF ST_Interface;
Parameter : ARRAY [1..MaxStatusParameters] OF ST_Descriptor;
Product : ARRAY [1..MaxStatusProducts] OF ST_Product;
END_STRUCT
END_TYPE
Requirements
(* PMLc *)
MaxCommandRemoteInterfaces : INT := 2
MaxCommandParameters : INT := 10
MaxCommandProducts : INT := 5
(* PMLs *)
MaxStatusRemoteInterfaces : INT := 2
MaxStatusParameters : INT := 10
MaxStatusProducts : INT := 5
(* PMLa *)
MaxAdminParameters : INT := 10
MaxAlarms : INT := 10
MaxHistoryAlarms : INT := 10
MaxStopReasons : INT := 10
MaxWarnings : INT := 10
MaxConsumedCounts : INT := 10
MaxProductCounts : INT := 10
Requirements
Requirements
4 Appendix
http://infosys.beckhoff.com/content/1033/TcPlcLib_Tc3_PackML_V2/Resources/zip/3414434955.zip