FB_CTRL_SERVO_MOTOR_SIMULATION (only on a PC system)

FB_CTRL_SERVO_MOTOR_SIMULATION (only on a PC system) 1:

The behavior of an actuator can be simulated with this function block.

Behavior of the output:

FB_CTRL_SERVO_MOTOR_SIMULATION (only on a PC system) 2:

VAR_INPUT

VAR_INPUT
    bMovePos        : BOOL;
    bMoveNeg        : BOOL;
    fManSyncValue   : FLOAT;
    bSync       : BOOL;
    eMode       : E_CTRL_MODE;
END_VAR

bMovePos : Input that moves the simulated actuator in the positive direction.

bMoveNeg : Input that moves the simulated actuator in the negative direction.

fManSyncValue : Input with which the simulated motor position can be set, or the value to which movement takes place in manual mode.

bSync : A rising edge at this input sets the simulated motor position to the value fManSyncValue.

eMode : Input that specifies the block's operating mode.

VAR_OUTPUT

VAR_OUTPUT
    fMotorPositon   : FLOAT; (* [ fMovingRangeMin ... fMovingRangeMax ] *)
    fMotorState     : FLOAT; (* [ 0 ... 100 ] *)
    bUpperLimitSwitch       : BOOL;
    bLowerLimitSwitch       : BOOL;
    eState      : E_CTRL_STATE;
    eErrorId        : E_CTRL_ERRORCODES;
    bError      : BOOL;
END_VAR

fMotorPosition : Simulated motor position in the range [ fMovingRangeMin ... fMovingRangeMax ].

fMotorState : Simulated motor position in the range [ 0 … 100.0 ].

bUpperLimitSwitch : Simulated limit switch at the actuator's positive stop.

bLowerLimitSwitch : Simulated limit switch at the actuator's negative stop.

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_SERVO_MOTOR_SIMULATION_PARAMS;
END_VAR

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

TYPE
ST_CTRL_SERVO_MOTOR_SIMULATION_PARAMS:
STRUCT
    tCtrlCycleTime    : TIME  := T#0ms;     (* controller
cycle time [TIME] *)
    tTaskCycleTime    : TIME  := T#0ms;     (* task cycle
time [TIME] *)
    fMovingRangeMin       : FLOAT := 0;     (* min position
in the moving range, e.g. 0° *)
    fMovingRangeMax       : FLOAT := 0;     (* max position
in the moving range, e.g. 360° *)
    tMovingTime       : TIME := T#0ms;      (* time to move
from the min to the max *)
    tDeadTime         : TIME := T#0ms;      (* wait dead
time before starting the movement *)
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.

fMovingRangeMin : Minimum position of the simulated actuator.

fMovingRangeMax : Maximum position of the simulated actuator.

tMovingTime : The time required to move the simulated actuator from one stop to the other.

tDeadTime : Dead time of the simulated actuator.

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v2.8

PC (i386)

TcControllerToolbox.lib