2. Sort by SCL in Siemens 1200PLC
1. In 1200PLC, sort the indefinite-length array, and the data type of indeterminate-length array can only be built on the InOut pin
2. Create an arbitrary number of Array type integer data type variables, after runningThe result of
Three, summary
1, twoThe ideas are the same.They all exchange positions through cyclic comparison, and push the data features to the end, or it can be the first.
2. In terms of specific implementation, python uses the While loop and the len() method to get the number of loop rounds and the number of comparisons; scl uses FOR loop, LOWER_BOUND() and UPPER_BOUND() to determine the lower limit and upper limit of the comparison array, and then select the first one in the outer loop and compare them one by one in the inner loop.
4. Extension: Use the existing functions in scl to find the maximum and minimum values in the array
1. To find the maximum and minimum values for a fixed-length Array, you can directly use the FC function block
2. Running result
3. Improve, find the maximum and minimum values for Arrays of variable length
4. The modified scl uses the Upper limit of the Static pin, so the FB function block is used.
5. Running result