PLC API 4 PLC API 4.1 General operating principle The following sections provide a generation description of the function blocks in the TwinCAT controller toolbox. Discretization The continuous transfer functions of the transfer elements assembled in this library are transformed to discrete values using the trapezoidal rule (Tustin formula). The Tustin formula: 1 1 2 1 T z s z + = - Function block inputs eMode The operation mode of the majority of function blocks can be selected with this input. This makes it possible to select one of the following operation modes: stParams The necessary parameters are passed to the function block with this structure.
The variables tTaskCycleTime and tCtrlCycleTime are contained in all the parameter structures. These parameters function in the following way: The parameter tTaskCycleTime specifies the cycle time with which the function block is called. If the function block is called in every cycle this corresponds to the cycle time of the calling task. If it is only called in every second cycle, the time must be doubled accordingly. The parameter tCtrlCycleTime indicates the control loop's sampling time. This time must be greater than or equal to the parameter tTaskCycleTime . If the sampling time is set equal to tTaskCycleTime then the function block is executed with every call.
If the selected value is larger by a factor of 5, the function block is only processed in every fifth call. This makes it possible to implement slow control loops even in a fast task. The parameters tTaskCycleTime and tCtrlCycleTime are of type TIME and therefore do not permit inputs of less than 1ms. In order to use the controller in a fast PLC task with a cycle time of less than 1ms, a global base time can be specified as reference for the specified cycle times. The use of the base time is explained in the following examples. It is assumed that the function block is called in every task cycle. TF4100 18 Version:
2.2.4 eCTRL MODE PASSIVE _ _ The output or outputs of the function block are set to zero, but the internal states are retained. eCTRL MODE ACTIVE _ _ The function block is executed in accordance with its description, and appropriate output values are calculated (normal operation). eCTRL MODE RESET _ _ In this operation mode all internal states are reset and the error bit is cleared. eCTRL MODE MANUAL _ _ The value of the input value fManSyncValue is provided at the output (manual operation).