ID : 2285
TrackBufferSort
Function
Change the sorting order of data within the tracking buffer.
This command is available in Ver.1.12.* or higher.
Syntax
TrackBufferSort Conveyor number, SortType1 [, SortType2]
Guaranteed Entry
- Conveyor number
-
Specify the conveyor number (1-16) to be used by integer type data.
- SortType1
-
Specify the sort type for all data within the tracking buffer by integer type data.
When the power is turned off, the specified sort type value returns to the default setting "0".In the sort type 1, select the combination of the following sorting method.
- Specify whether to use user data for sorting
- Other sorting method
The following shows the combination of sorting method for each setting value.
Setting Value : 0
Sorting by user data Sorting method Use Sort in order from the downstream side Sort the workpieces in order from the smallest user data. If several workpieces have the same user data, sort them again in order from the downstream side.
Sort in order from the downstream side. If TrackBufferSort command is not used, workpieces are sorted by this method.
Sorting Result
If "0" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 1
Sorting by user data Sorting method Not use Sort in order from the downstream side Sort all data in order from the downstream.
Sorting Result
If "1" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 2
Sorting by user data Sorting method Use Sort the workpieces in order from the left side against the conveyor's motion direction. Sort the workpieces in order from the smallest user data. If several workpieces have the same user data, sort them again in order from the left side against the motion direction of the conveyor.
Sorting Result
If "2" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 3
Sorting by user data Sorting method Not use Sort the workpieces in order from the left side against the conveyor's motion direction. Sort all data in order from the left side against the conveyor's motion direction.
Sorting Result
If "3" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 4
Sorting by user data Sorting method Use Sort workpiece in order from the upstream side. Sort the workpieces in order from the smallest user data. If several workpieces have the same user data, sort them again in order from the upstream side.
Sorting Result
If "4" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 5
Sorting by user data Sorting method Not use Sort workpiece in order from the upstream side. Sort all data in order from the upstream.
Sorting Result
If "5" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 6
Sorting by user data Sorting method Use Sort the workpieces in order from the right side against the conveyor's motion direction. Sort the workpieces in order from the smallest user data. If several workpieces have the same user data, sort them again in order from the right side against the motion direction of the conveyor.
Sorting Result
If "6" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 7
Sorting by user data Sorting method Not use Sort the workpieces in order from the right side against the conveyor's motion direction. Sort all data in order from the right side against the conveyor's motion direction.
Sorting Result
If "7" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 8
Sorting by user data Sorting method Use Sort in order from the largest value of attribute data. Sort the workpieces in order from the smallest user data. If several workpieces have the same user data, sort them again in order from the largest value of attribute data.
Sorting Result
If "8" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 9
Sorting by user data Sorting method Not use Sort in order from the largest value of attribute data. Sort all workpieces in order from the largest value of attribute data.
Sorting Result
If "9" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 10
Sorting by user data Sorting method Use Sort workpieces in order from the smallest value of attribute data. Sort the workpieces in order from the smallest user data. If several workpieces have the same user data, sort them again in order from the smallest value of attribute data.
Sorting Result
If "10" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : 11
Sorting by user data Sorting method Not use Sort in order from the smallest value of attribute data. Sort all workpieces in order from the smallest value of attribute data.
Sorting Result
If "11" is set to the sort type 1 and execute the sorting, workpieces are sorted as the following figure shows.
Setting Value : -1
Sorting by user data Sorting method Not use Not use Sorting is not executed for all data. The order of data in buffer is not changed.
Select this value if you want to use only the sort type 2 as a sorting condition.
- SortType2
-
Specify any data that you want to sort individually after the execution of the sort type 1 sorting and the sorting method to use.
- Within the Tracking buffer, data which have specified user data will be the sorting target. Specify the sorting method with one dimensional array of Variant type. This is an optional value.
- In the sort type 1, if user data is not used for the sorting condition, (setting value of sort type 1: 1,3,5,7,9,11), the sorting specified by the sort type 2 will not be performed.
- As the following shows, for each element, specify one dimensional array of integer type data which consists of two elements ("target user data" and "sorting method").
SortType2 = Array(Array(target user data, sorting method)[, Array(target user data, sorting method)[,…]])
The following shows the types of setting values.
Setting value | Sorting method |
---|---|
-1 | Not execute the sorting by the sort type 2. |
0 | Sort the workpieces in order from the downstream side. |
1 | Sort the workpieces in order from the left side against the conveyor's motion direction. |
2 | Sort the workpieces in order from the upstream side. |
3 | Sort the workpieces in order from the right side against the conveyor's motion direction. |
4 | Sort the workpieces in order from the largest value of attribute data. |
5 | Sort workpieces in order from the smallest value of attribute data. |
Example
The following program shows how to sort workpieces by setting the sort type 2.
The following figure shows the sorting result when the above-mentioned command is executed.
Description
Change the sorting order of data within the tracking buffer. First, sort all data within the tracking buffer, based on the sort type specified in the second argument SortType1.
When the third argument SortType2 is set, after sorting the data in the above methods, change the sorting order of the data in groups with specified user data within the tracking buffer.
Related Terms
TrackBufferDelete, TrackBufferIndexes, TrackBufferRead, TrackCurBufferSort, TrackPrepareData TrackSetSensor, TrackSetVision, TrackTargetPos, Commands for Conveyor Tracking, Commands for Circular Tracking
Attention
- This command is dedicated for conveyor and circular tracking.
- If the tracking buffer contains a large amount of data, the sort operation may take time.
- When the power is turned off, the value of SortType1 returns to the default, and that of SortType2 is cleared.
Example
- Set the sort type for all data within the buffer. Retrieve the sorted data in order from the beginning.
If I[50] = 1 Then
' Sort the data in order from the left to the motion direction of the conveyor
TrackBufferSort 1, 3
ElseIf I[50] = 2 Then
' Sort the data by the attribute value
TrackBufferSort 1, 9
Else
' Return to the default setting (sort the data in the direction of the conveyor vector)
TrackBufferSort 1, 0
End If
' Retrieve the sorted data in order from the beginning
P[10] = TrackTargetPos(1, -1)
- Set the sort type for each user data.
' Keep the current settings of the entire buffer
' Sort only the data in groups with the user data 5 by the attribute value
' Sort only the data in groups with the user data 1 in order from the left to
the motion direction of the conveyor
TrackBufferSort 1, -1, Array(Array(5, 4), Array(1, 1))
- Do not sort workpieces in each user data.
' Clear the setting values of groups with the user data 5
' Clear the setting values of groups with the user data 1
TrackBufferSort 1, -1, Array(Array(5, -1), Array(1, -1))
- Set the sort type for each group with particular user data. Retrieve the sorted data in order from the beginning.
' Sort the data within the entire buffer in the direction of the conveyor vector
' Sort only the data in groups with the user data 5 by the attribute value
' Sort only the data in groups with the user data 1 in order from the left to
the motion direction of the conveyor
TrackBufferSort 1, 0, Array(Array(5, 4), Array(1, 1))
' Retrieve the sorted data in groups with the user data 5 in order from the beginning
P[10] = TrackTargetPos(1, -1, 5)
'....
' Retrieve the sorted data in groups with the user data 1 in order from the beginning
P[10] = TrackTargetPos(1, -1, 1)
'....
' Retrieve the sorted data in order from the beginning in the direction of the conveyor vector
P[10] = TrackTargetPos(1, -1)
ID : 2285