FB_CTRL_STEPPING_MOTOR_OUT

FB_CTRL_STEPPING_MOTOR_OUT 1:

This function block generates a control value for a stepper motor.

Behaviour of the output:

FB_CTRL_STEPPING_MOTOR_OUT 2:

VAR_INPUT

VAR_INPUT
    fIn         : FLOAT; (* controller output = STEPPING_MOTOR_OUT input [ fCtrlOutMin ... fCtrlOutMax ] *)
    bUpperLimitSwitch       : BOOL;
    bLowerLimitSwitch       : BOOL;
    fManSyncValue   : FLOAT;
    bSync       : BOOL;
    eMode       : E_CTRL_MODE;
END_VAR

fIn : control value of the controller (controller output).

bUpperLimitSwitch : limit switch: TRUE if the upper stop is reached.

bLowerLimitSwitch : limit switch: TRUE if the lower stop is reached.

fManSyncValue : input with which the internal state of the motor position can be adjusted, or whose value is adopted in manual mode.

bSync : with a rising edge at this input the internal step counter is set to the step that corresponds to the value fManSyncValue.

eMode : input that specifies the operation mode of the function block.

FB_CTRL_STEPPING_MOTOR_OUT 3:

For synchronization with the current valve position, this function block has the mode "eCTRL_MODE_SYNC_MOVEMENT". In this mode, pulses for closing the valve are output until the valve is safely closed. The function block is then synchronized with this valve position.

Once the synchronization process is completed, "eCTRL_STATE_ACTIVE" mode is automatically activated!

VAR_OUTPUT

VAR_OUTPUT
    bOutBitPos      : BOOL; (* output signal to move to the maximum *)
    bOutBitNeg      : BOOL; (* output signal to move to the minimum*)
    nActualStep     : DINT; (* Actual state of the motor [ 0 ... nMaxMovingPulses ] *)
    eState      : E_CTRL_STATE;
    eErrorId        : E_CTRL_ERRORCODES;
    bError      : BOOL;
END_VAR

bOutBitPos : Output required to drive the motor in a positive direction.

bOutBitNeg : Output required to drive the motor in a negative direction.

nActualStep : Actual step at which the motor is positioned.

eState : State of the function block.

eErrorId : Supplies the error number when the bError output is set.

bError : Becomes TRUE, as soon as an error occurs.

VAR_IN_OUT

VAR_IN_OUT
    stParams        : ST_CTRL_STEPPING_MOTOR_OUT_PARAMS;
END_VAR

stParams : Parameter structure of the function block. This consists of the following elements:

TYPE
ST_CTRL_STEPPING_MOTOR_OUT_PARAMS:
STRUCT
    tCtrlCycleTime         : TIME     := T#0ms; (*
controller cycle time [TIME] *)
    tTaskCycleTime         : TIME     := T#0ms; (* task
cycle time [TIME] *)
    tOnTime            : TIME;          (*
impulse length *)
    tOffTime               : TIME;          (*
delay between two impulses *)
    nMaxMovingPulses           : DINT;          (*
necessary pulses to move from closed to open or v. v. *)
    nMinMovingPulses           : UINT := 0;     (* min
pulses to start movement *)
    bHoldWithOutputOn          : BOOL;          (* if
TRUE then a ouput is on when no pulses are generated *)
    nAdditionalPulsesAtLimits      : DINT;          (* add
these pulses to ensure that the limits are reached*)
    bMoveOnLimitSwitch         : BOOL;
    fCtrlOutMax            : FLOAT := 100.0;    (*
controller output to move to the max limit *)
    fCtrlOutMin            : FLOAT := 0.0;      (*
controller output to move to the min limit *)
END_STRUCT
END_TYPE

tCtrlCycleTime : Cycle time with which the control loop is processed. This must be greater than or equal to the TaskCycleTime. The function block uses this input value to calculate internally whether the state and the output values have to be updated in the current cycle.

tTaskCycleTime : Cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the task cycle time of the calling task.

tOnTime : Pulse length.

tOffTime : Pause length.

nMaxMovingPulses : Pulses required to move from one limit to another.

bHoldWithOutputOn : If this parameter is set to TRUE, then an output remains set when the drive is stationary. This will result in braking.

nAdditionalPulsesAtLimits : Pulses that are additionally output to safely reach the limits.

bMoveOnLimitSwitch : If this is TRUE, then pulses are output when the control value is either 0% or 100% until a limit switch is reached.

fCtrlOutMax : Control value for which the valve will be driven to 100%.

fCtrlOutMin : Control value for which the valve will be driven to 0%.

fMinCtrtlDeltaToStartMovement : Minimum difference in control value that must be exceeded in order to generate movement of the motor.

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.8

PC (i386)

TcControllerToolbox.lib

TwinCAT v2.9 from Build 947

BC

TcControllerToolbox.lb6

TwinCAT v2.9 from Build 956

BX

TcControllerToolbox.lbx