Assert_ArrayOfLReal_Equal (FUN) ¶ FUNCTION Assert_ArrayOfLReal_Equal : BOOL Assertion function to check that two ARRAY OF LREAL are equal. Two arrays are equal if all of the following conditions are met: * the two array have the same bounds * for each index the values of both arrays are equal InOut: Scope Name Type Initial Comment Return Assert_ArrayOfLReal_Equal BOOL TRUE if the assertion passes succesfully, FALSE otherwise Input context IBaseIecUnitTest The instance of the test function block calling this function. This instance can be provided by using THIS^ . referenceArray POINTER TO LREAL The reference array to check actualArray POINTER TO LREAL The array to check precision LREAL 0.0 A value to specify an allowed deviation. Default is 0.0 wsErrorMsg WSTRING(Constants.WSTRING_LENGTH) “” A custom error message, that is added to the error message of the assertion itself. If this parameter is used, it is recommended to adapt the value of the library parameter Constants.WSTRING_LENGTH .
Assert_ArrayOfReal_ContainsNoneOf (FUN) ¶ FUNCTION Assert_ArrayOfReal_ContainsNoneOf : BOOL Assertion function to check that an ARRAY OF REAL contains none of the specified values. InOut: Scope Name Type Initial Comment Return Assert_ArrayOfReal_ContainsNoneOf BOOL TRUE if the assertion passes succesfully, FALSE otherwise Input context IBaseIecUnitTest The instance of the test function block calling this function. This instance can be provided by using THIS^ . referenceValues POINTER TO REAL An array with all values that should not be contained. actualArray POINTER TO REAL The array to check precision REAL 0.0 A value to specify an allowed deviation. Default is 0.0 wsErrorMsg WSTRING(Constants.WSTRING_LENGTH) “” A custom error message, that is added to the error message of the assertion itself. If this parameter is used, it is recommended to adapt the value of the library parameter Constants.WSTRING_LENGTH .
Assert_ArrayOfReal_ContainsNot (FUN) ¶ FUNCTION Assert_ArrayOfReal_ContainsNot : BOOL Assertion function to check that an ARRAY OF REAL does not contain a specific value InOut: Scope Name Type Initial Comment Return Assert_ArrayOfReal_ContainsNot BOOL TRUE if the assertion passes succesfully, FALSE otherwise Input context IBaseIecUnitTest The instance of the test function block calling this function. This instance can be provided by using THIS^ . referenceValue REAL The value that should not be contained actualArray POINTER TO REAL The array to check precision REAL 0.0 A value to specify an allowed deviation. Default is 0.0 wsErrorMsg WSTRING(Constants.WSTRING_LENGTH) “” A custom error message, that is added to the error message of the assertion itself. If this parameter is used, it is recommended to adapt the value of the library parameter Constants.WSTRING_LENGTH .
Constants ¶ TextBlockSize (ParamList)
TextBlockSize (PARAMS) ¶ InOut: Scope Name Type Initial Comment Constant iBlockSize INT 22800 Block size of the string to be encoded; must be divisible through 3
Controller ¶ PD (FunctionBlock) PID (FB) Temperature control with PID and LIMIT PID_FIXCYCLE (FunctionBlock)
PD (FB) ¶ FUNCTION_BLOCK PD Represents a PD controller A PD controller continuously calculates an error value e(t) as the difference between a desired set point and a measured process variable. The PD controller applies a correction based on proportional and derivative terms (sometimes denoted P and D respectively) which give their name to the controller type. Y_OFFSET , Y_MIN and Y_MAX are used for the transformation of the manipulated variable within a prescribed range. MANUAL can be used to switch on and off manual operation. RESET serves to reset the controller. In normal operation ( MANUAL = RESET = LIMITS_ACTIVE = FALSE ) the controller calculates the controller error e as difference SET_POINT – ACTUAL , generates the derivation with respect to time \(\frac{\delta e}{\delta t}\) and stores these values internally. The output, that is the manipulated variable Y , is calculated as follows: \(Y = KP \cdot (e + TV \frac{\delta e}{\delta t}) + Y_{OFFSET}\) So besides the P-part also the current change of the controller error (D-part) influences the manipulated variable. Additionally Y is limited on a range prescribed by Y_MIN and Y_MAX . If Y exceeds these limits, LIMITS_ACTIVE will get TRUE . If no limitation of the manipulated variable is desired, Y_MIN and Y_MAX have to be set to 0. As long as MANUAL=TRUE , Y_MANUAL will be written to Y . A P controller can be easily created by setting TV=0 . For more information see: PID . InOut: Scope Name Type Initial Comment Input ACTUAL REAL Actual value, process variable SET_POINT REAL Specified value, set point KP REAL Proportionality constant P TV REAL Rate time, derivative time D [sec]. If set to 0, than it works a P controller Y_MANUAL REAL Y is set to this value as long as MANUAL = TRUE Y_OFFSET REAL Offset for manipulated variable Y_MIN REAL Minimum value for manipulated variable. If no limitation is desired, it must be be set to 0 Y_MAX REAL Maximum value for manipulated variable. If no limitation is desired, it must be be set to 0 MANUAL BOOL TRUE : Manual: Y is not influenced by controller FALSE : Controller determines Y RESET BOOL TRUE : Set Y output to Y_OFFSET Output Y REAL Manipulated variable, set value LIMITS_ACTIVE BOOL FALSE TRUE : Y has exceeded the given limits Y_MIN , Y_MAX and is limited to these values
PID (FB) ¶ FUNCTION_BLOCK PID Represents a PID controller Note The PID controller itself measures the elapsed time between two calls, however with a maximum accuracy of milliseconds. This might lead to rough running in case of short cycle times: For example in case of a cycle time of 1ms the PID sometimes might measure 2 ms, sometimes 0 ms. So if possible, for such cases better use PID_FIXCYCLE , where the cycle time can be set precisely. See PID_FIXCYCLE Note Consider that the controller parameters only get applied when used in the manual mode at a start, a reset or at a change down. A PID controller continuously calculates an error value e(t) as the difference between a desired set point and a measured process variable. The PID controller applies a correction based on proportional, integral, and derivative terms (sometimes denoted P, I, and D respectively) which give their name to the controller type. P accounts for present values of the error. For example, if the error is large and positive, the control output will also be large and positive. I accounts for past values of the error. For example, if the current output is not sufficiently strong, the integral of the error will accumulate over time, and the controller will respond by applying a stronger action. D accounts for possible future trends of the error, based on its current rate of change.[1] As a PID controller relies only on the measured process variable, not on knowledge of the underlying process, it is broadly applicable. By tuning the three parameters of the model, a PID controller can deal with specific process requirements. The response of the controller can be described in terms of its responsiveness to an error, of the degree to which the system overshoots a setpoint, and of the degree of any system oscillation. The use of the PID algorithm does not guarantee optimal control of the system or even its stability. Y_OFFSET , Y_MIN and Y_MAX serve for transformation of the manipulated variable within a prescribed range. MANUAL can be used to switch to manual operation; RESET can be used to re-initialize the controller. In normal operation ( MANUAL = RESET = LIMITS_ACTIVE = FALSE ) the controller calculates the controller error e as difference from SET_POINT – ACTUAL , generates the derivation with respect to time \(\frac{\delta e}{\delta t}\) and stores these values internally. The output Y is the manipulated variable unlike the PD controller contains an additional integral part, and is calculated as follows: \(Y = KP \cdot (e + \frac{1}{TN} \int e dt + TV \frac{\delta e}{\delta t}) + Y_{OFFSET}\) So besides the P-part also the current change of the controller error (D-part) and the history of the controller error (I-part) influence the manipulated variable. The PID controller can be easily converted to a PI-controller by setting TV=0 . Because of the additional integral part, an overflow can come about by incorrect parameterization of the controller, if the integral of the error e becomes to great. Therefore for the sake of safety a BOOLean output called OVERFLOW is present, which in this case would have the value TRUE. This only will happen if the control system is instable due to incorrect parameterization. At the same time, the controller will be suspended and will only be activated again by re-initialization. Note As long as the limitation for the manipulated variable ( Y_MIN , Y_MAX ) is active, the integral part will be adapted, like if the history of the input values had automatically effected the limited output value. If this behaviour is not wanted, the following workaround is possible: Switch off the limitation at the PID controller ( Y_MIN>=Y_MAX ) and instead apply the LIMIT operator (IEC standard) on output value Y (see an example in the figure below). Note It is not necessary to readjust the controller parameters (KP, TN, TV) if the cycle time changes. Temperature control with PID and LIMIT ¶ See in the following figure a simple example of using the PID module for temperature control and in combination with the LIMIT operator. The input of the actual temperature is simulated by giving a constant value via ActualTemperature. InOut: Scope Name Type Initial Comment Input ACTUAL REAL Current value, process variable SET_POINT REAL Desired value, set point KP REAL Proportionality const. P TN REAL Reset time I [sec] TV REAL Rate time, derivative time D [sec]. If set to 0, then it works as PI controller Y_MANUAL REAL Y is set to this value as long as MANUAL = TRUE Y_OFFSET REAL Offset for manipulated variable Y_MIN REAL Minimum value for manipulated variable Y_MAX REAL Maximum value for manipulated variable MANUAL BOOL TRUE : Manual: Y is not influenced by controller FALSE : Controller determines Y RESET BOOL TRUE : Set Y output to Y_OFFSET and reset integral part Output Y REAL Manipulated variable, set value LIMITS_ACTIVE BOOL FALSE TRUE : Y has exceeded the given limits Y_MIN , Y_MAX and is limited to these values OVERFLOW BOOL FALSE Overflow in integral part
PID_FIXCYCLE (FB) ¶ FUNCTION_BLOCK PID_FIXCYCLE Represents a PID controller for which the cycle time can be set manually A PID controller continuously calculates an error value e(t) as the difference between a desired set point and a measured process variable. The PID contoller applies a correction based on proportional, integral, and derivative terms (sometimes denoted P, I, and D respectively) which give their name to the controller type. Note For fast and fix tasks it is recommended to use PID_FIXCYCLE instead of PID, because the cycle time is defined accurately, whereas PID only can measure the cycle time with a maximum accuracy of milliseconds. In case of very short cycles (1ms) this might lead to a rough run (see PID). Note It is not necessary to readjust the controller parameters (KP, TN, TV) if the cycle time changes. For more information see: PID . InOut: Scope Name Type Initial Comment Input ACTUAL REAL Actual value, process variable SET_POINT REAL Desired value, set point KP REAL Proportionality const. P TN REAL Reset time I in sec TV REAL Rate time, derivative time D in sec Y_MANUAL REAL Y is set to this value as long as MANUAL = TRUE Y_OFFSET REAL Offset for manipulated variable Y_MIN REAL Minimum value for manipulated variable Y_MAX REAL Maximum value for manipulated variable MANUAL BOOL TRUE : Manual : Y is not influenced by controller FALSE : Controller determines Y RESET BOOL TRUE : Sets Y output to Y_OFFSET and reset integral part CYCLE REAL Time in s between two calls Output Y REAL Manipulated variable, set value LIMITS_ACTIVE BOOL FALSE TRUE : Set value would exceed limits Y_MIN , Y_MAX OVERFLOW BOOL FALSE Overflow in integral part
Datatypes ¶ GEN_MODE (Enum) POINT (Struct) PT_SIZE (Struct)