FB_MTP_Procedure

FB_MTP_Procedure 1:

The function block FB_MTP_Procedure contains all attributes and methods for describing a procedure. A procedure is an execution variant of a service and can therefore only be assigned to one service. All procedures receive a unique ProcedureID in the service. You must describe these using a natural number, but you may not use the number 0.

The Boolean variable IsSelfCompleting specifies whether the function(s) related to process technology of a procedure can terminate on their own (e.g., after a certain amount of time has elapsed, upon reaching a certain state, etc.).

If IsSelfCompleting = TRUE, the internal logic automatically exits the Execute state as soon as the internal termination condition is met. In addition, you can exit Execute at any time by using the commands Stop or Abort.

If IsSelfCompleting = FALSE, the system exits the Execute state exclusively via external control commands (e.g., Complete or Stop).

CommandInfo is encoded according to and indicates which control commands are currently enabled.

The variable CommandAdapt is coded according to . You can use this feature to further restrict the enabling of control commands in CommandInfo.

FB_MTP_Procedure 2:

The variable CommandAdapt is not part of the MTP guideline. It has been implemented additionally. This variable is not listed in the MTP file and is not made available via OPC UA.

FB_MTP_Procedure 3:

The FB_MTP_Procedure is an abstract function block. This cannot be instantiated, but must be derived (see Syntax section).

FB_MTP_Procedure 4:

For using procedures, we recommend using TwinCAT 3 MTP Engineering and its built-in automatic code generation feature.

Required parameters and equipment

The function block receives the process parameters ProcParameters required for execution as Array[0..(cProcParameters-1)] OF I_MTP_ParameterElement. The required equipment RequiredEquipment is transferred as Array[0..(cRequiredEquipment)] OF I_MTP_DataAssembly.

FB_MTP_Procedure 5:

If no ProcParameter or RequiredEquipment is required, you must transfer an empty array!

Services state machine

The states of the service state machine are executed in the methods of the same name in this function block. The methods are called by the service state machine.

FB_MTP_Procedure 6:

Some of the methods include predefined logic (see the description of the methods). You can override these by recreating the method.

Calling the procedure

The procedures can be called by the higher-level service. A possible call is described in the function block FB_MTP_ServiceControl.

Further properties

WQC

Syntax

// ************************************************************************
// * This file was automatically generated by TwinCAT 3 MTP Engineering.  *
// *                                                                      *
// * INFO: Implement service states in methods. Variables related to      *
// * this procedure should be added here. This function block can extend  *
// * existing procedure function blocks.                                  *
// *                                                                      *
// * Generated on: 12.34.5678 01:23:45                                    *
// * TwinCAT 3 MTP Engineering Version: 1.1.0.0                           *
// ************************************************************************
FUNCTION_BLOCK FB_MTP_Volume_Filling
VAR_GENERIC CONSTANT
   cProcParameter_Volume_Filling     : UINT := 1;
   cRequiredEquipment_Volume_Filling : UINT := 1;
END_VAR
EXTENDS FB_MTP_Procedure<cProcParameter_Volume_Filling, cRequiredEquipment_Volume_Filling>

FB_MTP_Procedure 7: Inputs

Name

Type

Description

OPC UA access

TagName

STRING

Name of the interface

-

TagDescription

STRING

Description of the interface

-

WQC

BYTE

Worst Quality Code

Read

CommandInfo

DWORD

Currently enabled control commands

Read

ProcParameters

ARRAY [0..(cProcparameters-1)] OF I_MTP_INTERNAL_ParameterElement

Required procedure parameters

-

RequiredEquipment

ARRAY [0..(cRequiredEquipment-1)] OF I_MTP_DataAssembly

Required equipment

-

IsSeIfCompIeting

BOOL

1: Procedure is self-completing.

0: Procedure is completed via the control command.

Read

ProcedureID

DWORD

Unique identification of the procedure within the service.

Read

CommandAdapt

DWORD

Variable for blocking state transitions.

-

FB_MTP_Procedure 8: Methods

Name

Type

Description

Aborted

BOOL

Implementation of the logic for the Aborted state of the service state machine. By default, no logic is predefined, and no value is returned.

Aborting

BOOL

Implementation of the logic for the Aborting state of the service state machine. The logic of this method calls the method Stopping and returns the result of the method Stopping.

Completed

BOOL

Implementation of the logic for the Completed state of the service state machine. By default, no logic is predefined, and no value is returned.

Completing

BOOL

Implementation of the logic for the Completing state of the service state machine. By default, this method returns the value True.

Execute

BOOL

Implementation of the logic for the Execute state of the service state machine. By default, no logic is predefined, and no value is returned.

Held

BOOL

Implementation of the logic for the Held state of the service state machine. By default, no logic is predefined, and no value is returned.

Holding

BOOL

Implementation of the logic for the Holding state of the service state machine. The logic of this method calls the method Pausing and returns the result of the method Pausing.

Paused

BOOL

Implementation of the logic for the Paused state of the service state machine. By default, no logic is predefined, and no value is returned

Pausing

BOOL

Implementation of the logic for the Pausing state of the service state machine. The logic of this method calls the method Completing and returns the result of the method Completing.

Resetting

BOOL

Implementation of the logic for the Resetting state of the service state machine. By default, this method returns the value True.

Resuming

BOOL

Implementation of the logic for the Resuming state of the service state machine. The logic of this method calls the method Starting and returns the result of the method Starting.

Starting

BOOL

Implementation of the logic for the Starting state of the service state machine. By default, this method returns the value True.

Stopping

BOOL

Implementation of the logic for the Stopping state of the service state machine. The logic of this method calls the method Completing and returns the result of the method Completing.

Stopped

BOOL

Implementation of the logic for the Stopped state of the service state machine. By default, no logic is predefined, and no value is returned.

Unholding

BOOL

Implementation of the logic for the Unholding state of the service state machine. The logic of this method calls the method Resuming and returns the result of the method Resuming.

IsActuatorsInternal

BOOL

1: All actuators assigned to the procedure are in the state Internal.

IsActuatorsManual

BOOL

1: All actuators assigned to the procedure are in the state Manual.

IsActuatorsOffline

BOOL

1: All actuators assigned to the procedure are in the state Offline.

IsActuatorsOperator

BOOL

1: All actuators assigned to the procedure are in the state Operator.

IsActuatorsAutomatic

BOOL

1: All actuators assigned to the procedure are in the state Automatic.

IsReqEqInternal

BOOL

1: PID logic and all actuators assigned to the procedure are in the state Internal

IsReqEqManual

BOOL

1: PID logic and all actuators assigned to the procedure are in the state Manual

IsReqEqOffline

BOOL

1: PID logic and all actuators assigned to the procedure are in the state Offline

IsReqEqOperator

BOOL

1: PID logic and all actuators assigned to the procedure are in the state Operator

IsReqEqAutomatic

BOOL

1: PID logic and all actuators assigned to the procedure are in the state Automatic

SetActuatorsInternal

BOOL

All actuators assigned to the procedure are transferred to the state Internal. Returns True if all the actuators assigned to the procedure are in the Internal state.

SetActuatorsManual

BOOL

All actuators assigned to the procedure are transferred to the state Manual. Returns True if all the actuators assigned to the procedure are in the Manual state.

SetActuatorsOffline

BOOL

All actuators assigned to the procedure are transferred to the state Offline. Returns True if all the actuators assigned to the procedure are in the Offline state.

SetActuatorsOperator

BOOL

All actuators assigned to the procedure are transferred to the state Operator. Returns True if all the actuators assigned to the procedure are in the Operator state.

SetActuatorsAutomatic

BOOL

All actuators assigned to the procedure are transferred to the state Automatic. Returns True if all the actuators assigned to the procedure are in the Automatic state.

SetReqEqInternal

BOOL

PID logic and all actuators assigned to the procedure are transferred to the state Internal. Returns True if all the actuators and PID logic assigned to the procedure are in the Internal state.

SetReqEqManual

BOOL

PID logic and all actuators assigned to the procedure are transferred to the state Manual. Returns True if all the actuators and PID logic assigned to the procedure are in the Manual state.

SetReqEqOffline

BOOL

PID logic and all actuators assigned to the procedure are transferred to the state Offline. Returns True if all the actuators and PID logic assigned to the procedure are in the Offline state.

SetReqEqOperator

BOOL

PID logic and all actuators assigned to the procedure are transferred to the state Operator. Returns True if all the actuators and PID logic assigned to the procedure are in the Operator state.

SetReqEqAutomatic

BOOL

PID logic and all actuators assigned to the procedure are transferred to the state Automatic. Returns True if all the actuators and PID logic assigned to the procedure are in the Automatic state.