Call a Method
-
-
Verify the Create a Method andDefine Method Parameters procedures are completed before calling a method.
Methods can be called from either:
- The parent UDFB implementation.
- Another Program through a UDFB instance.
The call methods are:
Call a Method from a Parent UDFB
Method Definition
Method Name: ValidateVelocity
Input(s):
RequestedVelocity : LREAL;
Output(s):
IsValid : BOOL;
Method Implementation
IsValid := RequestedVelocity <= MaxVelocity;
UDFB Implementation
ValidateVelocity(RequestedVelocity := UserVelocity);
IF ValidateVelocity. IsValid THEN
ExecuteMove := TRUE;
END_IF;
Call a Method from a Program
Methods can be invoked from programs through a UDFB instance using this syntax:
UDFB_Instance.MethodName(...)
UDFB Example
UDFB Name: MotionAxisController
UDFB Method Name: CalculateMoveTime
Method Definition
Input(s):
Distance : LREAL;
Velocity : LREAL;
Output(s):
MoveTime : LREAL;
METHOD Implementation
MoveTime := Distance / Velocity;
Program Example
Program Variables
Inst_MotionAxisController : MotionAxisController EstimatedTime : LREAL
Program Implementation
Inst_MotionAxisController. CalculateMoveTime(
Distance := 250.0,
Velocity := 50.0,
MoveTime => EstimatedTime );
-
-
- In this example, the method is executed through the MotionAxisController’s UDFB instance.
See Also





