This function searches, in an array of the data type DInt, for the maximum and minimum value and the respective index in the array.
The following data types of the array elements are supported:
Int, DInt, UInt, UDInt, USInt, SInt, and Real.
LGF_SearchMinMax (FC) | ||||||||
---|---|---|---|---|---|---|---|---|
Variant | variableArray | Ret_Val | Void | |||||
minValue | Variant | |||||||
minValueIndex | DInt | |||||||
maxValue | Variant | |||||||
maxValueIndex | DInt | |||||||
error | Bool | |||||||
status | Word | |||||||
subfunctionStatus | Word | |||||||
Identifier | Data type | Description |
---|---|---|
variableArray | Variant | Array in whose fields the maximum and minimum are searched |
Identifier | Data type | Description |
---|---|---|
Ret_Val | Void | Void - Function has no return value |
minValue | Variant | Minimum value found in the array |
minValueIndex | DInt | Index of the minimum found value in the array. The start index of the array plus `minValueIndex` results in the array index of the smallest value. The index starts with 0. |
maxValue | Variant | Maximum value found in the array |
maxValueIndex | DInt | Index of the maximum found value in the array. The start index of the array plus `maxValueIndex` results in the array index of the smallest value. The index starts with 0. |
error | Bool | FALSE: No error TRUE: An error occurred during the execution of the FB |
status | Word | 16#0000-16#7FFF: Status of the FB 16#8000-16#FFFF: Error identification (see following Table) |
subfunctionStatus | Word | Status or return value of called FB's, FC's and system blocks |
Code / Value | Identifier / Description |
---|---|
16#0000 | STATUS_NO_ERROR Execution finished without errors |
16#8200 | ERR_NO_ARRAY Error: At input `variableArray` the actual parameter is not an array |
16#8201 | ERR_WRONG_TYPE Error: The data type of the elements in the array is not supported. Only the data types Int, UInt, DInt, UDInt, USInt, SInt and Real are supported. |
16#8202 | ERR_NOT_EQUAL_TYPES Error: The elements of the array do not have the same data type as the outputs `minValue` and `maxValue` |
16#8203 | ERR_MOVE_BLK_VARIANT Error: Subfunction `MOVE_BLK_VARIANT` executed with and error - check `subFunctionStatus` code |
subFunctionStatus
. In this case, the output value in status
indicates which command caused the error. In this case, refer to the TIA Portal Online Help section for information on the respective commands.An array of any size is connected via the variableArray
input. After a data type query in the block, the elements are copied one after the other into a variable of the appropriate type and compared. The smallest and largest values, as well as their corresponding index are output to the array.
Version & Date | Change description | |
---|---|---|
01.00.00 | Siemens Industry Online Support | |
19.08.2015 | First released version | |
01.00.01 | Siemens Industry Online Support | |
02.01.2017 | Upgrade: TIA Portal V14 Update 1 | |
01.00.02 | Siemens Industry Online Support | |
17.08.2018 | Upgrade: TIA V15 Update 2 | |
01.00.03 | Siemens Industry Online Support | |
23.11.2018 | Upgrade: TIA V15.1 | |
01.01.00 | Siemens Industry Presales Support | |
08.11.2019 | Code refactoring, regions and more comments added | |
03.00.00 | Siemens Industry Support | |
23.04.2020 | Set version to V3.0.0, harmonize the version of the whole library | |
03.00.01 | Simatic Systems Support | |
09.02.2021 | Rework constants and comments Insert documentation |