PlcOpenDrive
- Namespace
- ZPlatform
FUNCTION_BLOCK PlcOpenDrive (
[input] Axis : Tc2_MC2.AXIS_REF,
[input] Power : Tc2_MC2.MC_Power,
[input] Stop : Tc2_MC2.MC_Stop,
[input] ReadDriveAddress : Tc2_MC2.MC_ReadDriveAddress)
The PlcOpenMotionControl implementation in the Zeugwerk Framework allows the function blocks that are defined in the PLCopen motion-control standard to be useable in a more object-oriented way and especially to be used as Sequences. This simplifies chaining of said function blocks to logical tasks that have to be performed when issuing commands to a drive. For details about how these sequences are used see the PLCopen Axis implementation. In fact, we suggest to not directly instantiate any of the PLCopen wrapper classes of this library. Use the PLCopen Axis implementation instead.
This particular function block serves as a "drive control" and is the main interface to Beckhoff's NC motion. The function block handles the booting phase of a drive that is controlled via NC motion and provides methods that are useful for all PLCopen Sequences. These includes functions like
- Reading parameters
- Powering the axis that is connected to the drive.
- Retrieving information about the particular drive.
This implementation is a wrapper around
Inputs
AxisTc2_MC2.AXIS_REFPowerTc2_MC2.MC_PowerStopTc2_MC2.MC_StopReadDriveAddressTc2_MC2.MC_ReadDriveAddress
Constructor
FB_init
METHOD FB_init (
[input] bInitRetains : BOOL,
[input] bInCopyCode : BOOL) : BOOL
Inputs
Returns
- BOOL
Properties
Accelerating
PROPERTY Accelerating : BOOL
Property Value
- BOOL
ActualCurrent
PROPERTY ActualCurrent : LREAL
Property Value
- LREAL
ActualFollowingError
PROPERTY ActualFollowingError : LREAL
Property Value
- LREAL
ActualModuloPosition
PROPERTY ActualModuloPosition : LREAL
Property Value
- LREAL
ActualPosition
PROPERTY ActualPosition : LREAL
Property Value
- LREAL
ActualVelocity
PROPERTY ActualVelocity : LREAL
Property Value
- LREAL
AxisReference
PROPERTY AxisReference : ZCore.ZPointer
Property Value
ConstantVelocity
PROPERTY ConstantVelocity : BOOL
Property Value
- BOOL
Decelerating
PROPERTY Decelerating : BOOL
Property Value
- BOOL
DrivePowered
PROPERTY DrivePowered : BOOL
Property Value
- BOOL
NegativeMovementEnabled
PROPERTY NegativeMovementEnabled : BOOL
Set or test the negative direction lock to -> movement is allowed = TRUE, movement is locked = FALSE;
Property Value
- BOOL
PositiveMovementEnabled
PROPERTY PositiveMovementEnabled : BOOL
Set or test the positive direction lock to -> movement is allowed = TRUE, movement is locked = FALSE;
Property Value
- BOOL
Referenced
PROPERTY Referenced : BOOL
Property Value
- BOOL
Standstill
PROPERTY Standstill : BOOL
Property Value
- BOOL
Methods
BootSequence
METHOD BootSequence (
[input] startToken : ZCore.IStartToken) : BOOL
This method handles the booting sequence of a drive that is controlled with NC motion.
It has to be called cyclically until the method returns FALSE. The main purpose is to detect
if the NC motion drive has been linked correctly to the PLC (see
Link to PLC)
and if the corresponding hardware is simulated or physically available. The later information is used in
IsSimulated.
Please note that this method should be used in combination with HasFault to
test if the booting sequence was successful or failed. As soon as the booting phase finished, which is indicated by a
falling trigger of this method, the BootSequence method should no longer be called cyclically.
Inputs
startTokenIStartToken
Returns
- BOOL
HasFault
METHOD HasFault () : BOOL
This method returns TRUE if NC motion reports any error about the drive or its configuration.
In particular, this method should be used together with BootSequence
to check if booting of the drive was successful or not.
Returns
- BOOL
IsEnabled
METHOD IsEnabled () : BOOL
This method returns TRUE if the axis connected to the drive is actually powered or FALSE if it is not powered.
Powering a drive is achieved by the
Power function block and in particular with the power sequence.
Note
The power function-block, in constrast to most other function blocks that are dealing with motion control in the PLCopen standard, has to be called cyclically. This is the reason, why the function block is instantiated in drive context instead of the power sequence
Returns
- BOOL
IsSimulated
METHOD IsSimulated () : BOOL
This method returns TRUE if the drive that is Linked to the PLC
is simulated (no hardware is connected or currently not in use) or if it is physically available. This information is retrieved during
booting of this object.
Returns
- BOOL
Read
METHOD Read ()
This method has be called cyclically to retrieve status information about the drive and axis. This includes information as
- Current velocity
- Current position
- Following error
- etc.
The method is internally, automatically called during the booting phase, but has to be
called manually as soon as this phase has finished. The later is indicated by the first time that BootSequence
returns
FALSE.
Write
METHOD Write ()
This method has be called cyclically to keep an axis that has been enabled (e.g. by using PlcOpenPowerSequence) powered.