CN1901276B - Method for generating scan mark and method for scanning antenna device - Google Patents
Method for generating scan mark and method for scanning antenna device Download PDFInfo
- Publication number
- CN1901276B CN1901276B CN2006100984650A CN200610098465A CN1901276B CN 1901276 B CN1901276 B CN 1901276B CN 2006100984650 A CN2006100984650 A CN 2006100984650A CN 200610098465 A CN200610098465 A CN 200610098465A CN 1901276 B CN1901276 B CN 1901276B
- Authority
- CN
- China
- Prior art keywords
- uid
- bit
- length
- value
- converted
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
本发明公开了一种产生扫描标识的方法,该方法包含以下步骤:根据节点值生成UID和比特掩码;获取i除以UID最大字节长度后的模Pi以及i除以UID最大字节长度后结果中整数部分的值Qi,取转换后UID第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码第Pi字节中第Qi位的值为1,i为小于生成的UID有效位长度的所有自然数;转换后UID和转换后比特掩码中其余位的值均取0;将转换后UID和转换后比特掩码作为扫描标识。本发明还公开了一种对天线设备进行扫描的方法。使用本发明公开的方法,能够解决当出现一个端口下面两个天线设备的UID相同字节较多的情况下,扫描速度非常慢的问题。
The invention discloses a method for generating a scan identifier, which comprises the following steps: generating a UID and a bit mask according to a node value; obtaining the modulo Pi obtained by dividing i by the maximum byte length of the UID and dividing i by the maximum byte length of the UID For the value Qi of the integer part in the final result, the value of the Qi-th bit in the Pi-th byte of the UID after conversion is the same value as the value of the i-th bit in the generated UID, and the value of the i-th bit in the converted bit mask Pi-th byte is taken The value of the Qi bit is 1, and i is all natural numbers less than the effective bit length of the generated UID; the values of the remaining bits in the converted UID and the converted bit mask are all 0; the converted UID and the converted bit mask are used as scans logo. The invention also discloses a method for scanning the antenna device. The method disclosed by the invention can solve the problem that the scanning speed is very slow when the UIDs of two antenna devices under a port have more bytes of the same value.
Description
技术领域technical field
本发明涉及一种扫描技术,特别涉及产生扫描标识的方法以及对天线设备进行扫描的方法。The invention relates to a scanning technology, in particular to a method for generating a scanning mark and a method for scanning an antenna device.
背景技术Background technique
天线接口标准组织(AISG,Antenna Interface Standards Group)协议中规定任何一个天线设备(ALD,Antenna line device)均需要一个全球唯一的唯一标识(UID,Unique ID)。UID需要通过扫描获取,扫描过程简单描述如下:主站即天线控制器将带有比特掩码(BIT MASK)和UID的消息以广播方式下发给总线上的所有从站ALD,ALD收到此消息后,如果将自身的UID和BIT MASK做与运算后得到的值与收到消息中的UID一致,则向主站回送带有自身UID的扫描响应。两个或两个以上的设备同时回送成功响应时,主站有时可以收到所有正确响应,有时会收到错误的数据,主站如果收到错误的数据,则会认为出现冲突,并继续扫描。UID通常包含有效位和无效位,所述有效位的值可以为1,也可以为0,所述无效位的值均为0。比如:UID=00000101、且UID有效位长度为4;UID=00000001、UID有效位长度为2等。目前协议规定UID的最大长度为19个字节共152位,实际应用中,如果协议允许,UID的最大长度也可以为别的数。本文中所述UID最大长度或UID最大字节长度根据协议确定,比如为19个字节等。The Antenna Interface Standards Group (AISG, Antenna Interface Standards Group) protocol stipulates that any antenna device (ALD, Antenna line device) requires a globally unique unique identifier (UID, Unique ID). The UID needs to be obtained by scanning. The scanning process is briefly described as follows: the master station, that is, the antenna controller, broadcasts a message with a bit mask (BIT MASK) and UID to all slave stations ALD on the bus, and ALD receives this message. After receiving the message, if the value obtained after the AND operation of its own UID and BIT MASK is consistent with the UID in the received message, it will return a scan response with its own UID to the master station. When two or more devices send back successful responses at the same time, the master station can sometimes receive all correct responses, and sometimes receive wrong data. If the master station receives wrong data, it will consider a conflict and continue scanning . A UID usually includes a valid bit and an invalid bit, the value of the valid bit can be 1 or 0, and the value of the invalid bit is 0. For example: UID=00000101, and the effective bit length of the UID is 4; UID=00000001, and the effective bit length of the UID is 2, etc. Currently, the protocol stipulates that the maximum length of the UID is 19 bytes and 152 bits in total. In practical applications, if the protocol allows, the maximum length of the UID can also be other numbers. The maximum UID length or UID maximum byte length described herein is determined according to the protocol, for example, 19 bytes.
如何保证完备地生成扫描消息,同时不至于消耗很长的扫描时间,取决于采用的扫描算法,AISG协议推荐采用二叉树算法。How to ensure that the scanning message is generated completely without consuming a long scanning time depends on the scanning algorithm used. The AISG protocol recommends using the binary tree algorithm.
采用二叉树算法对天线设备进行扫描时的过程如图1所示,该过程包含以下步骤:The process of scanning the antenna device using the binary tree algorithm is shown in Figure 1, and the process includes the following steps:
步骤101:主站遍历到二叉树的一个节点。Step 101: The master traverses to a node of the binary tree.
步骤101中,主站可以采用二叉树的先根遍历法遍历到一个节点。In
所述二叉树可以如图1A所示,图1A中标出了各个节点值。所述二叉树的节点值预先生成,比如:层一的左节点11a、右节点11b的值分别为00000001和00000000;层二的四个节点从左到右的其值分别为二进制的:节点12aa为00000011、节点12ab为00000001、节点12ba为00000010、节点12bb为00000000;等等。The binary tree may be as shown in FIG. 1A, in which the values of each node are marked. The node value of described binary tree is generated in advance, such as: the value of left node 11a of layer one, right node 11b is respectively 00000001 and 00000000; Its value of four nodes of layer two is respectively binary from left to right: node 12aa is 00000011, 00000001 for node 12ab, 00000010 for node 12ba, 00000000 for node 12bb; and so on.
实际应用中,二叉树的某一层的每个节点值的有效比特位的0和1的取值可以取反,此时同一层的所有兄弟节点以及该层以下所有子节点的0和1的取值也要取反。比如层一的两个节点从左到右其值分别为00000000和00000001,则层二的四个节点从左到右其值分别为二进制的00000000、00000010、00000001、00000011,等等。所述节点值的有效比特位根据所述节点的层数决定,具体地说,如果节点的层数为第n层,则节点值中第0位至第n-1位为有效比特位。比如层一两个节点的有效比特位为第0位,层二两个节点的有效比特位为第0位、第1位等。In practical applications, the value of 0 and 1 of the effective bit of each node value of a certain layer of the binary tree can be reversed. At this time, the values of 0 and 1 of all sibling nodes of the same layer and all child nodes below this layer The value is also negated. For example, the values of the two nodes in
步骤102:根据遍历到的节点值生成UID和比特掩码,并将生成的UID和比特掩码作为扫描标识的。Step 102: Generate a UID and a bit mask according to the traversed node values, and use the generated UID and bit mask as a scan identifier.
步骤102包括了现有技术中产生扫描标识的方法,具体为:根据遍历到的二叉树节点值生成UID和比特掩码,并直接将生成的UID和生成的比特掩码作为扫描标识。
所述生成UID的方法为:使生成的UID与遍历到节点值相同。比如遍历到二叉树层一的某节点,其节点值为00000001时,生成的UID为00000001。The method for generating the UID is: making the generated UID the same as the traversed node value. For example, when traversing to a node in
所述生成比特掩码的方法为:使生成的比特掩码长度与生成的UID长度相同,生成的比特掩码中位数低于遍历到节点层数的位的值均取1,其余位的值均取0。比如:遍历到二叉树层一节点时,生成的比特掩码长度与生成的UID长度相同为1字节,其中,由于小于层数1的自然数只有0,因此生成的比特掩码中第0位值取1,第1位至第7位值均取0,即生成的比特掩码为00000001;对应于二叉树层二四个节点的比特掩码长度为1字节,其中,由于小于层数2的自然数有两个,为0和1,因此生成的比特掩码中第0位、第1位值均取1,第2位至第7位值均取0,即生成的比特掩码为00000011;等等。The method for generating the bit mask is as follows: make the length of the generated bit mask the same as the length of the UID generated, the median value of the bit mask generated is lower than the value of the bit traversed to the number of layers of nodes is 1, and the remaining bits The values are all taken as 0. For example: when traversing to a node in the binary tree layer, the length of the generated bit mask is the same as the length of the generated UID, which is 1 byte. Since the natural number smaller than the number of
步骤102中,将生成的UID和生成的比特掩码作为扫描标识时,扫描标识中还包含有效字节长度,所述有效字节长度等于生成的UID和生成的比特掩码的字节长度。比如:生成的比特掩码为00000011、生成的UID为00000010,则扫描标识中包含的有效字节长度为1字节。In
扫描标识中包含的有效字节长度,用于通知ALD所需要读取的UID字节长度。比如:扫描标识中有效字节长度为2,则ALD将只读取自身UID的最低两个字节来与扫描标识中的比特掩码进行与计算,并与扫描标识中UID进行比较。The valid byte length contained in the scan ID is used to notify ALD of the UID byte length to be read. For example, if the effective byte length in the scan ID is 2, ALD will only read the lowest two bytes of its own UID to perform AND calculation with the bit mask in the scan ID, and compare it with the UID in the scan ID.
步骤103:主站将包含扫描标识的扫描消息广播发送给总线上的所有ALD,并检测ALD的响应,如果检测结果为没有出现冲突,则执行步骤104,如果检测结果为出现冲突,则执行步骤105。Step 103: The master station broadcasts the scan message containing the scan identifier to all ALDs on the bus, and detects the responses of the ALDs. If the detection result is that there is no conflict, then perform
步骤103所述扫描消息中除了扫描标识,还包括其它内容,所述其它内容可以参见协议生成,在此不再详述。The scan message in
所述没有出现冲突可以为:检测结果为没有出现冲突且收到一个或一个以上正确响应,也可以为检测结果为没有收到任何响应。The non-occurrence of conflict may be: the detection result is that no conflict occurs and one or more correct responses are received, or the detection result is that no response is received.
如果检测结果为主站收到一个或一个以上正确响应,则表明当前节点即当前遍历到节点的扫描完成,此时可以保存扫描结果以用于扫描结束后进一步处理。If the detection result receives one or more correct responses from the master station, it indicates that the scanning of the current node, that is, the currently traversed node, is completed. At this time, the scanning result can be saved for further processing after the scanning is completed.
步骤104:截取二叉树中当前节点以下的所有分支。Step 104: Intercept all branches below the current node in the binary tree.
步骤105:判断是否遍历完整个二叉树,如果是,则结束本处理流程,否则返回步骤101。Step 105: Judging whether the entire binary tree has been traversed, if yes, then end the processing flow, otherwise return to
图1所示步骤103中,如果主站检测到的响应情况是主站收到一个或一个以上正确响应,或者检测结果为没有收到任何响应,则执行步骤104来截取二叉树中当前节点以下的所有分支。此时,在步骤105之后返回步骤101时,将不遍历该节点下属各分支,即,此时步骤101中如果利用先根遍历法进行遍历,则下一个遍历到节点为:如果当前节点有右兄弟节点,则下一个遍历到节点为其右兄弟节点;如果当前节点没有右兄弟节点,则下一个遍历到节点为其父节点的右兄弟节点,如果其父节点仍没有右兄弟节点,则下一个遍历到节点为其父节点的父节点的右兄弟节点,如此循环。如果整个树遍历完,即遍历结束,则步骤105之后,结束扫描流程。In
图1所示步骤103中,如果主站的检测结果为天线设备响应出现冲突,则直接执行步骤105,并在步骤105之后返回步骤101时,通过循环执行步骤101~步骤105,可以对当前节点的所有子节点进行遍历。比如:当前节点存在两个子节点:左子节点X、右子节点X’,步骤101中利用先根遍历法进行遍历时,可以先遍历到节点X,并在循环执行步骤101~步骤105之后,可以再遍历到节点X’。这里,如果遍历到节点X之后还是出现冲突,则会进一步扫描节点X的所有子节点。In
图1中对天线设备进行扫描的过程可以用图2所示包括扫描流程的扫描树表示。图2所示扫描树的各个扫描节点上表示出对应的扫描标识,比如:扫描树中层一左节点21a的扫描标识为BIT MASK=0...01、UID=00000001、有效字节长度(Length)=1字节;层二节点22aa的扫描标识为BITMASK=0...011、UID=00000011、有效字节长度(Length)=1字节,等等。The process of scanning the antenna device in FIG. 1 can be represented by the scanning tree including the scanning process shown in FIG. 2 . Corresponding scan marks are shown on each scan node of the scan tree shown in Figure 2, such as: the scan mark of layer one
结合图1、图1A和图2,可以对现有技术中的扫描过程进行举例说明。如根据先根遍历法进行扫描时:With reference to FIG. 1 , FIG. 1A and FIG. 2 , the scanning process in the prior art can be described with an example. For example, when scanning according to the root-first traversal method:
步骤101中,主站遍历到二叉树的一个节点,如图1A中的层一左节点11a。In
步骤102中,根据遍历到节点值生成的UID和比特掩码为:UID=00000001、BIT MASK=0...01,并把生成的UID和比特掩码直接作为扫描标识,此时,扫描标识中还包括有效字节长度(Length)为1的信息,如在图2中扫描节点21a中所示。In
步骤103中,将包含图2中扫描节点21a中所示扫描标识的扫描消息广播发送给总线上的所有ALD后,如果检测结果为没有出现冲突,则执行步骤104来截取二叉树中节点11a以下的所有分支,此时,再执行步骤105后返回步骤101时,遍历到的节点为图1A中所示层一右节点11b,并通过步骤102产生的扫描标识如图2中扫描节点21b中所示,为:UID=00000000、BITMASK=00000001、有效字节长度(Length)=1。紧接着步骤103中,将包含图2所示节点21b所示扫描标识的扫描消息广播发送给总线上的所有ALD后,如果检测结果为没有出现冲突,则扫描结束。In
就是说:根据先根遍历法进行扫描时,如果一直没有出现冲突,则扫描标识依次可以如图2中的扫描节点21a、21b所示,之后结束扫描。That is to say: when scanning according to the root-first traversal method, if there is no conflict, the scanning identifiers can be shown in turn as the
步骤103中,将包含图2中节点21a中所示扫描标识的扫描消息广播发送给总线上的所有ALD后,如果检测结果为出现冲突,则直接执行步骤105之后返回步骤101时,遍历到的节点为图1A中所示层二节点12aa,并通过步骤102产生的扫描标识如图2中扫描节点22aa中所示,为:UID=00000011、BITMASK=00000011、有效字节长度(Length)=1。紧接着步骤103中,将包含图2中节点22aa中所示扫描标识的扫描消息广播发送给总线上的所有ALD后,如果检测结果为没有出现冲突,则执行步骤104来截取图1A所示节点12aa以下的所有分支,此时,再执行步骤105后返回步骤101时,遍历到的节点为图1A中所示层二节点12ab,并通过步骤102产生的扫描标识如图2中扫描节点22ab中所示,为:UID=00000001、BIT MASK=00000011、有效字节长度(Length)=1,这里,扫描节点22ab之后没有出现冲突,则下一步轮到扫描节点21b;将包含图2中节点22aa中所示扫描标识的扫描消息广播发送给总线上的所有ALD后,如果检测结果为出现冲突,则直接执行步骤105后返回步骤101时,遍历到的节点为图1A中所示层三右节点13aaa,并通过步骤102产生的扫描标识如图2中扫描节点23aaa中所示,为:UID=00000111、BITMASK=00000111、有效字节长度(Length)=1。In
就是说:根据先根遍历法进行扫描时,如果只出现一次冲突,则扫描标识依次可以如图2中的扫描节点21a、22aa、21b所示,之后结束扫描;如果出现连续冲突,则扫描标识依次可以如图2中的扫描节点21a、22aa、23aaa....、所示。That is to say: when scanning according to the root-first traversal method, if only one conflict occurs, the scan identification can be shown in turn as the
对于出现连续冲突的情况,可以参见图2所示扫描树,其扫描情况具体可以如表一所示:For the case of continuous conflicts, refer to the scanning tree shown in Figure 2, and the specific scanning conditions can be shown in Table 1:
表一Table I
现有技术中,对一个UID的扫描过程可以概括为:In the prior art, the scanning process of a UID can be summarized as:
第一步:扫描UID第0位。这里,所述第0位值可以为1,也可以为0,通常情况下会先扫描UID第0位值是否为1,如果出现冲突,则执行第二步,如果没有出现冲突或执行第二步之后直至没有出现冲突时,则会扫描UID第0位值是否为0。表一中以扫描的UID第0位值为1时出现冲突为例进行了说明。Step 1: Scan UID bit 0. Here, the value of the 0th bit can be 1 or 0. Usually, it will first scan whether the value of the 0th bit of the UID is 1. If there is a conflict, execute the second step. If there is no conflict or execute the second step After the first step until there is no conflict, it will scan whether the value of bit 0 of the UID is 0. In Table 1, a conflict occurs when the value of bit 0 of the scanned UID is 1 as an example.
第二步:由于第一步中UID第0位值为1时出现冲突,因此第二步中进一步扫描UID第1位。这里,所述第1位值可以为1,也可以为0,通常情况下会先扫描UID第1位值是否为1,如果继续出现冲突,则执行第三步,如果没有出现冲突或执行第三步之后直至没有出现冲突时,则会扫描UID第1位值是否为0。表一中以扫描的UID第1位值为1时继续出现冲突为例进行了说明。Step 2: Since a conflict occurs when bit 0 of the UID is 1 in the first step,
第三步:由于第二步中UID第1位值为1时继续出现冲突,因此第三步中进一步扫描UID第2位。这里,所述第2位值可以为1,也可以为0,通常情况下会先扫描UID第2位值是否为1,如果继续出现冲突,则继续扫描下一位,如果没有出现冲突或继续扫描下一位后直至没有出现冲突时,则会扫描UID第2位值是否为0。表一中以扫描UID第2位值是否为1为例进行了说明。Step 3: Since conflicts continue to occur when the value of the first bit of the UID is 1 in the second step, the second bit of the UID is further scanned in the third step. Here, the value of the second bit can be 1 or 0. Usually, it will first scan whether the second bit of the UID is 1. If the conflict continues, continue to scan the next bit. If there is no conflict or continue After scanning the next bit until there is no conflict, it will scan whether the value of the second bit of the UID is 0. In Table 1, the example of scanning whether the value of the second bit of the UID is 1 is used for illustration.
可以看出,现有技术中对ALD进行扫描时,如果当前在扫描UID的第0位至第i位时出现冲突,则下一步扫描UID的第0位至第i+1位,即进一步扫描UID的第i+1位,因此现有技术中的扫描方法可以称为按位递增的扫描方法,i为自然数,且通常情况下i小于等于UID的最大位长度,比如0≤i≤151等。It can be seen that when scanning the ALD in the prior art, if there is a conflict when scanning the 0th to i-th bits of the UID, the next step is to scan the 0th to the i+1th bits of the UID, that is, to further scan The i+1th bit of the UID, so the scanning method in the prior art can be called a bit-increasing scanning method, i is a natural number, and usually i is less than or equal to the maximum bit length of the UID, such as 0≤i≤151, etc. .
现有技术的缺点是:The disadvantages of the prior art are:
现有技术中根据二叉树的节点值生成UID和比特掩码,并直接将生成的UID和比特掩码作为扫描标识,根据现有技术中的扫描标识进行扫描时,对ALD采用逐位扫描的方式进行扫描,如果碰到两个UID的某一个或者多个字节相同,就会出现很多次的冲突。比如:两个UID的前10个字节相同,则可能会出现10×8=80次冲突。当出现一个端口下面两个ALD的UID相同字符较多的情况下,扫描速度非常慢,比如:两个ALD的UID的前80位相同,则主站可能需要下发81个扫描消息才能获取一个ALD的UID。In the prior art, the UID and the bit mask are generated according to the node values of the binary tree, and the generated UID and the bit mask are directly used as the scanning identification. When scanning according to the scanning identification in the prior art, the ALD is scanned bit by bit. Scanning, if one or more bytes of two UIDs are the same, there will be many conflicts. For example, if the first 10 bytes of two UIDs are the same, 10×8=80 conflicts may occur. When there are many identical characters in the UIDs of two ALDs under one port, the scanning speed is very slow. For example, if the first 80 digits of the UIDs of the two ALDs are the same, the master station may need to send 81 scanning messages to obtain one. The UID of the ALD.
发明内容Contents of the invention
有鉴于此,本发明的主要目的在于提供一种产生扫描标识的方法,能够产生跨字节的扫描标识。In view of this, the main purpose of the present invention is to provide a method for generating scan identifiers, which can generate cross-byte scan identifiers.
本发明的另一目的在于提供一种对天线设备进行扫描的方法,能够在一个端口下面两个ALD的UID相同字节较多的情况下,提高扫描速度。Another object of the present invention is to provide a method for scanning antenna devices, which can increase the scanning speed when the UIDs of two ALDs under one port have more bytes in common.
本发明的技术方案是这样实现的:Technical scheme of the present invention is realized like this:
一种产生扫描标识的方法,该方法包含以下步骤:A method of generating a scan ID, the method comprising the steps of:
A、根据节点值生成唯一标识UID和比特掩码;A. Generate a unique identification UID and a bit mask according to the node value;
B、确定转换后UID和转换后比特掩码的字节长度;获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi,取转换后UID第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码第Pi字节中第Qi位的值为1,i为小于生成的UID有效位长度的所有自然数,Pi、Qi为自然数;转换后UID和转换后比特掩码中其余位的值均取0;B. Determine the byte length of the UID after conversion and the bit mask after conversion; obtain the modulus Pi after dividing i by the maximum byte length of UID, obtain the value Qi of the integer part in the result after dividing i by the maximum byte length of UID, and obtain After the conversion, the value of the Qi-th bit in the Pi-th byte of the UID is the same as the value of the i-th bit in the generated UID, and the value of the Qi-th bit in the Pi-th byte of the converted bit mask is 1, and i is less than All natural numbers of the effective bit length of the generated UID, Pi and Qi are natural numbers; the values of the remaining bits in the converted UID and the converted bit mask are all 0;
C、将转换后UID和转换后比特掩码作为扫描标识。C. Use the converted UID and the converted bit mask as the scanning identifier.
步骤A所述生成UID的方法为:使生成的UID与节点值相同。The method for generating the UID described in step A is: making the generated UID the same as the node value.
步骤A所述生成比特掩码的方法为:使生成的比特掩码长度与生成的UID长度相同,生成的比特掩码中位数低于所述节点的层数的位的值均取1,其余位的值均取0。The method for generating the bit mask described in step A is: make the length of the generated bit mask the same as the UID length generated, and the median value of the generated bit mask lower than the number of layers of the node is 1, The values of the remaining bits are all 0.
步骤B所述确定转换后UID和转换后比特掩码的字节长度的方法为:确定转换后UID和转换后比特掩码的字节长度为UID最大字节长度。The method for determining the byte length of the converted UID and the converted bit mask described in step B is: determining the byte length of the converted UID and the converted bit mask to be the maximum byte length of the UID.
步骤B所述确定转换后UID和转换后比特掩码的字节长度的方法为:判断生成的UID有效位长度是否小于UID最大字节长度,如果是,则转换后UID和转换后比特掩码的字节长度等于生成的UID有效位长度,否则转换后UID和转换后比特掩码的字节长度等于UID最大字节长度。The method for determining the byte length of the UID after conversion and the bit mask after conversion described in step B is: whether the UID effective bit length of judging generation is less than the UID maximum byte length, if so, UID after conversion and bit mask after conversion The byte length of the UID is equal to the effective bit length of the generated UID, otherwise the byte length of the converted UID and the converted bit mask is equal to the maximum byte length of the UID.
所述生成的UID有效位长度与生成的比特掩码中位值为1的所有位的长度相同。The effective bit length of the generated UID is the same as the length of all bits whose bit value is 1 in the generated bit mask.
步骤C所述扫描标识中包括有效字节长度;The scan identifier in step C includes a valid byte length;
所述有效字节长度等于转换后UID和转换后比特掩码的字节长度。The effective byte length is equal to the byte length of the converted UID and the converted bit mask.
所述节点值为二叉树上的节点值。The node value is a node value on the binary tree.
该方法包含以下步骤:The method includes the following steps:
A1、主站遍历到二叉树的一个节点;A1. The master station traverses to a node of the binary tree;
B1、根据遍历到的节点值生成UID和比特掩码;确定转换后UID和转换后比特掩码的字节长度;获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi;取转换后UID第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码第Pi字节中第Qi位的值为1,i为小于生成的UID有效位长度的所有自然数,Pi、Qi为自然数;转换后UID和转换后比特掩码中其余位的值均取0;将转换后UID和转换后比特掩码作为扫描标识;B1. Generate UID and bitmask according to the traversed node value; determine the byte length of UID after conversion and bitmask after conversion; obtain the modulus Pi after i is divided by the maximum byte length of UID, and obtain the maximum value of i divided by UID The value Qi of the integer part in the result after the byte length; take the value of the Qi-th bit in the Pi-th byte of the converted UID to be the same as the value of the i-th bit in the generated UID, and take the Pi-th bit of the converted bit mask The value of the Qi bit in the section is 1, i is all natural numbers less than the effective bit length of the generated UID, Pi and Qi are natural numbers; the values of the converted UID and the remaining bits in the converted bit mask are all 0; the converted UID and converted bitmask as scan identification;
C1、主站将包含扫描标识的扫描消息广播发送给总线上的所有天线设备,并检测天线设备的响应,如果检测结果为没有出现冲突,则执行步骤D1,如果检测结果为出现冲突,则执行步骤E1;C1. The master station broadcasts the scan message containing the scan identifier to all antenna devices on the bus, and detects the response of the antenna devices. If the detection result is that there is no conflict, then execute step D1. If the detection result is that there is a conflict, execute Step E1;
D1、截取二叉树中当前节点以下的所有分支;D1. Intercept all branches below the current node in the binary tree;
E1、判断是否遍历完整个二叉树,如果是,则结束本处理流程,否则返回步骤A1。E1. Determine whether the entire binary tree has been traversed, if yes, end the processing flow, otherwise return to step A1.
所述遍历采用二叉树的先根遍历法进行。The traversal is performed using the root-first traversal method of the binary tree.
步骤B1所述生成UID的方法为:使生成的UID与遍历到的节点值相同。The method for generating the UID described in step B1 is: make the generated UID the same as the traversed node value.
步骤B1所述生成比特掩码的方法为:使生成的比特掩码长度与生成的UID长度相同,生成的比特掩码中位数低于所述节点的层数的位的值均取1,其余位的值均取0。The method for generating the bit mask described in step B1 is: make the length of the generated bit mask the same as the UID length generated, and the median value of the generated bit mask lower than the number of layers of the node is 1, The values of the remaining bits are all 0.
步骤B 1所述确定转换后UID和转换后比特掩码的字节长度的方法为:确定转换后UID和转换后比特掩码的字节长度为UID最大字节长度。The method for determining the byte length of the converted UID and the converted bit mask described in step B1 is: determining that the converted UID and the converted byte length of the converted bit mask are the maximum byte length of the UID.
步骤B1所述确定转换后UID和转换后比特掩码的字节长度的方法为:判断生成的UID有效位长度是否小于UID最大字节长度,如果是,则转换后UID和转换后比特掩码的字节长度等于生成的UID有效位长度,否则转换后UID和转换后比特掩码的字节长度等于UID最大字节长度。The method for determining the byte length of the UID after conversion and the bit mask after conversion described in step B1 is: whether the effective bit length of the UID that judges generation is less than the UID maximum byte length, if so, UID after conversion and bit mask after conversion The byte length of the UID is equal to the effective bit length of the generated UID, otherwise the byte length of the converted UID and the converted bit mask is equal to the maximum byte length of the UID.
所述生成的UID有效位长度与生成的比特掩码中位值为1的所有位的长度相同。The effective bit length of the generated UID is the same as the length of all bits whose bit value is 1 in the generated bit mask.
步骤C1所述没有出现冲突为:检测结果为没有出现冲突且收到一个或一个以上正确响应,或者是检测结果为没有收到任何响应。The non-occurrence of conflict in step C1 means: the detection result is that there is no conflict and one or more correct responses are received, or the detection result is that no response is received.
本发明中,根据节点值生成UID和比特掩码后,对生成的UID和比特掩码进行转换,具体转换方法为:确定转换后UID和转换后比特掩码的字节长度;获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi;取转换后UID第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码第Pi字节中第Qi位的值为1,i为小于生成的UID有效位长度的所有自然数,Pi、Qi为自然数;转换后UID和转换后比特掩码中其余位的值均取0;将转换后UID和转换后比特掩码作为扫描标识。本发明中利用上述方法产生的扫描标识,对天线设备进行扫描。In the present invention, after generating UID and bitmask according to the node value, the generated UID and bitmask are converted, and the specific conversion method is: determine the byte length of UID after conversion and bitmask after conversion; obtain i and divide by Modulo Pi after the maximum byte length of the UID, obtain the value Qi of the integer part of the result after dividing i by the maximum byte length of the UID; take the value of the Qi-th bit in the Pi-th byte of the UID after conversion and the value of the i-th bit in the generated UID The value of the bit is the same value, the value of the Qi-th bit in the Pi-th byte of the bit mask after conversion is 1, i is all natural numbers less than the effective bit length of the generated UID, and Pi and Qi are natural numbers; UID and conversion after conversion The values of the remaining bits in the post-bit mask are all 0; the post-conversion UID and post-conversion bit mask are used as the scan identifier. In the present invention, the scanning identification generated by the above method is used to scan the antenna device.
本发明有以下有益效果:The present invention has following beneficial effect:
1)利用本发明中产生扫描标识的方法,能够产生跨字节的扫描标识。1) By using the method for generating scan marks in the present invention, it is possible to generate cross-byte scan marks.
2)本发明中将根据节点值生成UID和比特掩码进行转换,并将转换之后的UID和比特掩码作为扫描标识,扫描冲突时并不是按位递增扫描,而是跨越字节递增扫描,对于一个端口下面两个或两个以上ALD的UID相同字节较多的情况下,能够有效地提高扫描速度。2) In the present invention, the UID and the bit mask are generated according to the node value for conversion, and the converted UID and the bit mask are used as the scan identifier. When scanning conflicts, it is not a bit-by-bit incremental scan, but a byte-by-byte incremental scan. For the situation that the UIDs of two or more ALDs under one port have more identical bytes, the scanning speed can be effectively improved.
3)考虑到相同厂家的ALDUID可能比较类似,一旦出现冲突,则很可能这个字节完全一样,如在很多情况下相同厂家设备UID的前两个字节完全相同,此时利用本发明,通常可以提高扫描速度。比如两个设备UID的第0字节、第1字节完全相同,第2字节的第一位不相同,此时利用现有技术需要扫描8×2+1=17次,利用本发明只需要扫描3次,可见在这种情况下本发明显著提高了扫描速度。3) Considering that the ALDUID of the same manufacturer may be relatively similar, once a conflict occurs, it is likely that this byte is exactly the same, as in many cases, the first two bytes of the UID of the same manufacturer's equipment are completely the same, at this time, the present invention is used, usually Scanning speed can be increased. For example, the 0th byte and the 1st byte of two equipment UIDs are identical, and the first bit of the 2nd byte is different. At this time, it is necessary to scan 8×2+1=17 times using the prior art. Need to scan 3 times, it can be seen that the present invention significantly improves the scanning speed in this case.
4)天线设备中可以包含塔顶放大器,通常一个塔顶放大器包含两个UID,且所述两个UID通常仅是最后一个字节的第0位不同,这种情况下利用本发明,能够显著提高扫描速度。比如两个UID的有效字节均为6,其中,第0~第5字节完全相同,第6字节的第0位不同,此时利用现有技术需要扫描8×6+1=49次,利用本发明只需要扫描7次,可见在这种情况下本发明显著提高了扫描速度。4) The antenna device may include a tower mount amplifier, usually a tower mount amplifier contains two UIDs, and the two UIDs are usually only different in the 0th bit of the last byte, in this case, the present invention can significantly Increase scanning speed. For example, the effective bytes of the two UIDs are both 6, and the 0th to 5th bytes are exactly the same, and the 0th bit of the 6th byte is different. At this time, it is necessary to scan 8×6+1=49 times using the existing technology , using the present invention only needs to scan 7 times, it can be seen that the present invention significantly improves the scanning speed in this case.
附图说明Description of drawings
图1为现有技术中采用二叉树算法对ALD进行扫描的过程示意图;Fig. 1 is a schematic diagram of the process of scanning the ALD using a binary tree algorithm in the prior art;
图1A为二叉树的结构示意图;FIG. 1A is a schematic structural diagram of a binary tree;
图2为现有技术中对ALD进行扫描的扫描树示意图;FIG. 2 is a schematic diagram of a scanning tree for scanning ALD in the prior art;
图3为本发明实施例中对ALD进行扫描的过程示意图;3 is a schematic diagram of the process of scanning ALD in an embodiment of the present invention;
图4为本发明实施例中产生扫描标识的过程示意图;Fig. 4 is a schematic diagram of the process of generating a scan mark in an embodiment of the present invention;
图5为本发明实施例中对ALD进行扫描的扫描树示意图。FIG. 5 is a schematic diagram of a scanning tree for scanning ALD in an embodiment of the present invention.
具体实施方式Detailed ways
本发明中产生扫描标识的方法为:The method that produces scanning mark among the present invention is:
根据节点值生成UID和比特掩码;Generate UID and bitmask based on node value;
对生成的UID和比特掩码进行转换,获取转换后的UID和比特掩码,具体转换方法为:确定转换后UID和转换后比特掩码的字节长度;获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi;取转换后UID第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码第Pi字节中第Qi位的值为1,i为小于生成的UID有效位长度的所有自然数,Pi、Qi为自然数;转换后UID和转换后比特掩码中其余位的值均取0;Convert the generated UID and bitmask to obtain the converted UID and bitmask. The specific conversion method is: determine the byte length of the converted UID and the converted bitmask; obtain i divided by the maximum byte length of the UID After modulo Pi, obtain the value Qi of the integer part of the result after i is divided by the maximum byte length of the UID; take the value of the Qi-th bit in the Pi-th byte of the converted UID to be the same as the value of the i-th bit in the generated UID Value, take the value of the Qi-th bit in the Pi-th byte of the converted bit mask as 1, i is all natural numbers less than the effective bit length of the generated UID, and Pi and Qi are natural numbers; the converted UID and the converted bit mask The values of the remaining bits are all 0;
将转换后UID和转换后比特掩码作为扫描标识。Use the converted UID and the converted bit mask as the scan identifier.
本发明中对天线设备进行扫描的方法为:The method for scanning the antenna device in the present invention is:
A、主站遍历到二叉树的一个节点;A. The master traverses to a node of the binary tree;
B、根据遍历到的节点值生成UID和比特掩码,并对生成的UID和比特掩码进行转换,获取转换后的UID和比特掩码,具体转换方法为:确定转换后UID和转换后比特掩码的字节长度;获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi;获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi;取转换后UID第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码第Pi字节中第Qi位的值为1,i为小于生成的UID有效位长度的所有自然数,Pi、Qi为自然数;转换后UID和转换后比特掩码中其余位的值均取0;将转换后UID和转换后比特掩码作为扫描标识;B. Generate UID and bit mask according to the traversed node value, and convert the generated UID and bit mask to obtain the converted UID and bit mask. The specific conversion method is: determine the converted UID and converted bit The byte length of the mask; obtain the modulo Pi after dividing i by the maximum byte length of UID, and obtain the value Qi of the integer part of the result after dividing i by the maximum byte length of UID; obtain the value Qi after dividing i by the maximum byte length of UID Modulo Pi, obtain the value Qi of the integer part of the result after i is divided by the maximum byte length of the UID; take the value of the Qi-th bit in the Pi-th byte of the converted UID to be the same as the value of the i-th bit in the generated UID, Take the value of the Qi-th bit in the Pi-th byte of the converted bit mask as 1, i is all natural numbers less than the effective bit length of the generated UID, and Pi and Qi are natural numbers; the remaining bits in the converted UID and the converted bit mask The values of all take 0; the converted UID and the converted bit mask are used as the scan identifier;
C、主站将包含扫描标识的扫描消息广播发送给总线上的所有ALD,并检测ALD的响应,如果检测结果为没有出现冲突,则执行步骤D,如果检测结果为出现冲突,则执行步骤E;C. The master station broadcasts the scanning message containing the scanning identification to all ALDs on the bus, and detects the response of the ALD. If the detection result is that there is no conflict, then perform step D. If the detection result is that there is a conflict, then perform step E ;
D、截取二叉树中当前节点以下的所有分支;D. Intercept all branches below the current node in the binary tree;
E、判断是否遍历完整个二叉树,如果是,则结束本处理流程,否则返回步骤A。E. Determine whether the entire binary tree has been traversed, if yes, end the processing flow, otherwise return to step A.
以下参照附图并举实施例,对本发明进一步详细说明。The present invention will be described in further detail below with reference to the accompanying drawings and examples.
本发明实施例中,对天线设备进行扫描的过程如图3所示,包含以下步骤:In the embodiment of the present invention, the process of scanning the antenna device is shown in Figure 3, including the following steps:
步骤301与图1所示步骤101相同,具体为:主站遍历到二叉树的一个节点。Step 301 is the same as
步骤302:根据遍历到的节点值生成UID和比特掩码,对生成的UID和生成的比特掩码进行转换来产生扫描标识。Step 302: Generate a UID and a bit mask according to the traversed node values, and convert the generated UID and the generated bit mask to generate a scan identifier.
步骤303~步骤305与图1所示步骤103~步骤105相同,具体为:
步骤303:主站将包含扫描标识的扫描消息广播发送给总线上的所有ALD,并检测ALD的响应,如果检测结果为没有出现冲突,则执行步骤304,如果检测结果为出现冲突,则执行步骤305。Step 303: The master station broadcasts the scan message containing the scan identifier to all ALDs on the bus, and detects the responses of the ALDs. If the detection result is that there is no conflict, then perform
步骤304:截取二叉树中当前节点以下的所有分支。Step 304: Intercept all branches below the current node in the binary tree.
步骤305:判断是否遍历完整个二叉树,如果是,则结束本处理流程,否则返回步骤301。Step 305: Judging whether the entire binary tree has been traversed, if yes, then end the processing flow, otherwise return to step 301.
图3所示步骤302中,产生扫描标识的过程如图4所示,该过程包含以下步骤:In
步骤401:根据节点值生成UID和比特掩码。Step 401: Generate UID and bitmask according to node value.
步骤401中,根据节点值生成UID和比特掩码的方法与现有技术中相同。In step 401, the method of generating UID and bitmask according to the node value is the same as that in the prior art.
步骤402:确定转换后UID和转换后比特掩码的字节长度。Step 402: Determine the converted UID and the byte length of the converted bitmask.
步骤402所述确定的方法可以为:确定转换后UID和转换后比特掩码的字节长度为UID最大字节长度。The determination method in step 402 may be: determine the byte length of the converted UID and the converted bit mask as the maximum byte length of the UID.
步骤402所述确定的方法也可以为:判断生成的UID有效位长度是否小于UID最大字节长度,如果是,则转换后UID和转换后比特掩码的字节长度等于生成的UID有效位长度,否则转换后UID和转换后比特掩码的字节长度等于UID最大字节长度。The determined method described in step 402 can also be: whether the UID effective bit length that judges generation is less than UID maximum byte length, if so, the byte length of the UID after conversion and the converted bit mask is equal to the UID effective bit length that generates , otherwise the byte length of the converted UID and the converted bitmask is equal to the maximum byte length of the UID.
所述生成的UID有效位长度=生成的比特掩码中位值为1的所有位的长度,如:生成的比特掩码为00000111,则生成的UID有效位长度为3;生成的比特掩码为0000000111111111,则生成的UID有效位长度为9。The UID effective bit length=generated bit mask of generation=the length of all bits with a bit value of 1, such as: the generated bit mask is 00000111, then the generated UID effective bit length is 3; the generated bit mask is 0000000111111111, the effective bit length of the generated UID is 9.
步骤403步骤406:获取转换后UID和转换后比特掩码的值,具体为:Step 403 and Step 406: Obtain the converted UID and converted bitmask values, specifically:
步骤403:设转换后UID和转换后比特掩码所有位的初始值为0;设i的初始值为0,i为自然数。Step 403: Set the initial value of all bits of the converted UID and the converted bitmask to 0; set the initial value of i to 0, where i is a natural number.
步骤404:获取i除以UID最大字节长度后的模Pi,获取i除以UID最大字节长度后结果中整数部分的值Qi;取转换后UID中字节位置为Pi、在第Pi字节中第Qi位的值为与生成的UID中第i位的值相同的值,取转换后比特掩码中字节位置为Pi、在第Pi字节中第Qi位的值为1。Step 404: Obtain the modulo Pi after dividing i by the maximum byte length of UID, and obtain the value Qi of the integer part in the result after dividing i by the maximum byte length of UID; get the byte position in the UID after conversion as Pi, the first character at Pi The value of the Qi-th bit in the section is the same as the value of the i-th bit in the generated UID, and the byte position in the converted bit mask is Pi, and the value of the Qi-th bit in the Pi-th byte is 1.
步骤404中,取转换后UID中字节位置为Pi、在第Pi字节中第Qi位的值为 与生成的UID中第i位的值相同的值。比如:如果生成的UID中第i位的值为1,则取转换后UID中字节位置为Pi、在第Pi字节中第Qi位的值为1;如果生成的UID中第i位的值为0,则取转换后UID中字节位置为Pi、在第Pi字节中第Qi位的值为0。具体实现时可以判断生成的UID中第i位的值是否为1或是否为0,如果是,则取转换后UID中字节位置为Pi、在第Pi字节中第Qi位的值为1或0,否则取转换后UID中字节位置为Pi、在第Pi字节中第Qi位的值为0或1。In step 404, the byte position in the converted UID is Pi, and the value of the Qi bit in the Pi byte is the same value as the value of the i bit in the generated UID. For example: if the value of the i-th bit in the generated UID is 1, the byte position in the converted UID is Pi, and the value of the Qi-th bit in the Pi-th byte is 1; if the i-th bit in the generated UID is If the value is 0, the byte position in the converted UID is Pi, and the value of the Qi-th bit in the Pi-th byte is 0. In the specific implementation, it can be judged whether the value of the i-th bit in the generated UID is 1 or 0, and if so, the byte position in the converted UID is Pi, and the value of the Qi-th bit in the Pi-th byte is 1 or 0, otherwise, take the byte position Pi in the converted UID and the value of the Qi-th bit in the Pi-th byte to be 0 or 1.
步骤404中,取转换后比特掩码中字节位置为Pi、在第Pi字节中第Qi位的值为与生成的比特掩码中第i位的值相同的值,也可以描述为:取转换后比特掩码中字节位置为Pi、在第Pi字节中第Qi位的值为1。这里,在i为小于生成的UID有效位长度的任一自然数时,比特掩码中第i位的值实际上就是1。In step 404, take the byte position in the bit mask after conversion as Pi, and the value of the Qi bit in the Pi byte is the same value as the value of the i bit in the generated bit mask, which can also be described as: Take the byte position in the converted bit mask as Pi, and the value of the Qi-th bit in the Pi-th byte is 1. Here, when i is any natural number smaller than the effective bit length of the generated UID, the value of bit i in the bit mask is actually 1.
步骤405:判断i是否小于生成后UID有效位长度,如果是,则执行步骤407,否则执行步骤406。Step 405: Judging whether i is smaller than the effective bit length of the UID after generation, if yes, go to step 407, otherwise go to step 406.
步骤406:i取值增加1,返回步骤404。Step 406: increase the value of i by 1, and return to step 404.
通过循环执行步骤404~步骤406达到的结果为:对i为小于生成后UID有效位长度的所有自然数,获取转换后UID和转换后比特掩码中第Pi字节中第Qi位的值。实际应用中,通过对步骤404、步骤405、步骤406的先后顺序、判断内容进行合理修改,也可达到同样的结果,比如:步骤404之后,先将i的取值增加1,然后判断i是否等于生成后UID有效位长度,如果是,则执行步骤407,否则返回步骤404;或者将步骤405中判断改为:判断i是否等于(生成后UID有效位长度-1);或者是:在步骤403和步骤404之间先判断i是否小于生成后UID有效位长度,如果不是,则执行步骤407,否则执行步骤404、i取值增加1之后,再返回步骤403和步骤404之间的判断i是否小于生成后UID有效位长度的步骤,等等,在此不再一一详述。The result achieved by cyclically executing steps 404 to 406 is: for all natural numbers whose i is less than the effective bit length of the generated UID, obtain the converted UID and the value of the Qi-th bit in the Pi-th byte in the converted bit mask. In practical applications, the same result can also be achieved by reasonably modifying the sequence and judgment content of steps 404, 405, and 406. For example, after step 404, first increase the value of i by 1, and then judge whether i is Equal to the UID effective bit length after generation, if yes, then execute step 407, otherwise return to step 404; or change the judgment in step 405 to: judge whether i is equal to (UID effective bit length-1 after generation); or: in step Between 403 and step 404, first judge whether i is less than the UID effective bit length after generation, if not, then execute step 407, otherwise execute step 404, after the value of i is increased by 1, then return to the judgment between step 403 and step 404 for i The step of whether it is shorter than the effective bit length of the generated UID, etc., will not be described in detail here.
步骤402~步骤406中,先确定转换后UID和转换后比特掩码的字节长度,并设转换后UID和转换后比特掩码所有位的初始值为0,然后给i为小于生成后UID有效位长度的所有自然数时,第Pi字节中第Qi位的值赋值。实际应用中,也可以先获得i为小于生成后UID有效位长度的所有自然数时,对应的第Pi字节中第Qi位的值,然后将转换后UID和转换后比特掩码中其余位的值均取0也可,此时步骤402所述确定转换后UID和转换后比特掩码的字节长度的步骤,可以在步骤401之后、将转换后UID和转换后比特掩码中其余位的值均取0之前的任意位置执行。In steps 402 to 406, first determine the byte length of the UID after conversion and the bit mask after conversion, and set the initial value of all bits of the UID and bit mask after conversion to 0, and then give i to be less than the generated UID When all natural numbers of the effective bit length are used, the value of bit Qi in the Pi-th byte is assigned. In practical applications, when i is all natural numbers less than the effective bit length of the generated UID, the value of the Qi-th bit in the corresponding Pi-th byte can also be obtained first, and then the converted UID and the remaining bits in the converted bit mask Values all get 0 and also can, and the step of the byte length of the UID after the UID after the conversion and the bit mask after the conversion described in step 402 this moment, can be after the step 401, the remaining bits in the UID after the conversion and the bit mask after the conversion The value is executed at any position before 0.
这里,确定转换后UID和转换后比特掩码的字节长度后,获取转换后UID的方法也可以描述为:将生成的UID中第i位的值对应为,转换后UID中,字节位置为i除以UID最大字节长度后的模、且在该字节中的位数为i除以UID最大字节长度后结果中整数部分的位的值,i为小于生成后UID有效位长度的所有自然数,转换后UID中其余位的值均取0。Here, after determining the converted UID and the byte length of the converted bit mask, the method of obtaining the converted UID can also be described as: the value of the i-th bit in the generated UID corresponds to, in the converted UID, the byte position It is the modulus after i is divided by the maximum byte length of UID, and the number of digits in this byte is the value of the bits in the integer part of the result after i is divided by the maximum byte length of UID. i is less than the effective bit length of UID after generation For all natural numbers of , the values of the remaining bits in the UID after conversion are all 0.
同理,确定转换后UID和转换后比特掩码的字节长度后,获取转换后比特掩码的方法也可以描述为:将生成的比特掩码中第j位的值对应为,转换后比特掩码中,字节位置为j除以UID最大字节长度后的模、且在该字节中的位数为j除以UID最大字节长度后结果中整数部分的位的值,j为小于生成后UID有效位长度的所有自然数,转换后比特掩码中其余位的值均取0;或者是:对于j为小于生成后UID有效位长度的所有自然数,字节位置为j除以UID最大字节长度后的模、且在该字节中的位数为j除以UID最大字节长度后结果中整数部分的位的值取1,转换后比特掩码中其余位的值均取0。Similarly, after determining the converted UID and the byte length of the converted bit mask, the method of obtaining the converted bit mask can also be described as: corresponding to the value of the jth bit in the generated bit mask, the converted bit In the mask, the byte position is the modulus of j divided by the maximum byte length of the UID, and the number of digits in this byte is the value of the bits in the integer part of the result after j is divided by the maximum byte length of the UID. j is For all natural numbers that are less than the effective bit length of the UID after generation, the values of the remaining bits in the converted bit mask are all 0; or: for all natural numbers that are less than the effective bit length of the UID after generation, the byte position is j divided by the UID After the modulus after the maximum byte length, and the number of digits in this byte is j divided by the maximum byte length of UID, the value of the bit in the integer part of the result is 1, and the values of the remaining bits in the bit mask after conversion are taken as 0.
步骤407:将转换后UID和转换后比特掩码作为扫描标识。Step 407: Use the converted UID and the converted bit mask as the scanning identifier.
步骤407中,将转换后UID和转换后比特掩码作为扫描标识时,扫描标识中包括有效字节长度信息,所述有效字节长度等于转换后UID和转换后比特掩码的字节长度。比如:如果转换后UID和转换后比特掩码的字节长度为2字节,则扫描标识中有效字节长度为2字节;如果转换后UID和转换后比特掩码的字节长度为19字节,则扫描标识中有效字节长度为19字节。In step 407, when the converted UID and the converted bit mask are used as the scan identifier, the scan identifier includes effective byte length information, and the effective byte length is equal to the byte length of the converted UID and the converted bit mask. For example: if the byte length of the converted UID and the converted bitmask is 2 bytes, the valid byte length in the scan identifier is 2 bytes; if the byte length of the converted UID and the converted bitmask is 19 byte, the valid byte length in the scan ID is 19 bytes.
具体实现时,如果对进行转换之前已经生成的UID用TreeUid、已经生成的比特掩码用TreeMask、生成的UID有效位长度用TreeLen表示,并将进行转换后的UID用MsgUid、转换后的比特掩码用MsgMask、转换后UID和比特掩码的字节长度用MsgLen表示,且设UID的最大字节长度为19,则图4所述转换,可以举例为:In the specific implementation, if the UID that has been generated before the conversion is represented by TreeUid, the generated bit mask is represented by TreeMask, the effective bit length of the generated UID is represented by TreeLen, and the converted UID is represented by MsgUid and the converted bit mask The code is represented by MsgMask, the UID after conversion and the byte length of the bit mask are represented by MsgLen, and the maximum byte length of the UID is 19, then the conversion described in Figure 4 can be exemplified as:
如果,TreeUid=00000011、TreeMask=00000011、TreeLen=2If, TreeUid=00000011, TreeMask=00000011, TreeLen=2
则首先,由于TreeLen=2小于19,因此,Then firstly, since TreeLen=2 is less than 19, therefore,
MsgLen=2 (1)MsgLen=2 (1)
对于i小于TreeLen=2的所有自然数,即对i=0和i=1的情况,分别获取Pi和Qi,其中i=0时,P0=0%19=0,Q0为0/19后结果的整数值,即Q0=0;i=1时,P1=1%19=1,Q1为0/19后结果的整数值,即Q1=0。For i less than all natural numbers of TreeLen=2, promptly to the situation of i=0 and i=1, obtain Pi and Qi respectively, when wherein i=0, P0=0%19=0, Q0 is the result after 0/19 Integer value, namely Q0=0; when i=1, P1=1%19=1, Q1 is the integer value of the result after 0/19, namely Q1=0.
由于TreeUid的第0位,即i=0时的值为1,因此转换后UID中字节位置为P0=0,该第0字节中位数Q0=0位的值取1;由于TreeUid的第1位,即i=1时的值为1,因此转换后UID中字节位置为P1=1,该第1字节中位数Q1=0位的值取1;转换后UID中其余位的值均取0。因此转换后MsgUid为:Because the 0th bit of TreeUid, that is, the value when i=0 is 1, the byte position in the UID after conversion is P0=0, and the value of the 0th byte median Q0=0 bit is 1; The first bit, that is, the value when i=1 is 1, so the byte position in the UID after conversion is P1=1, and the value of the median Q1=0 bit in the first byte is 1; the remaining bits in the UID after conversion The values of all take 0. So the converted MsgUid is:
MsgUid=00000001 00000001 (2)MsgUid=00000001 00000001 (2)
且MsgMask中,第P0=0字节的第Q0=0位,以及第P1=1字节的第Q1=0位的值取1,其余位的值均取0,因此转换后MsgMask为:And in the MsgMask, the value of the Q0=0 bit of the P0=0 byte and the Q1=0 bit of the P1=1 byte are 1, and the values of the remaining bits are all 0, so the converted MsgMask is:
MsgMask=00000001 00000001 (3)MsgMask=00000001 00000001 (3)
这里,如果MsgLen不是如公式(1)所示,而是取UID最大字节长度即MsgLen=19,则MsgUid和MsgMask中低2个字节分别如公式(2)和公式(3)中所示,且MsgUid和MsgMask中高17个字节中每一位值均取0。Here, if MsgLen is not as shown in formula (1), but takes the maximum byte length of UID, that is, MsgLen=19, then the lower 2 bytes in MsgUid and MsgMask are as shown in formula (2) and formula (3) respectively , and the value of each bit in the upper 17 bytes of MsgUid and MsgMask is 0.
本发明实施例中对天线设备进行扫描的过程也可以用图5所示包括扫描流程的扫描树表示。图5所示扫描树的各个扫描节点上表示出对应的扫描标识,比如:扫描树中层一左节点51a的扫描标识为BIT MASK=0...01、UID=00000001、有效字节长度(Length)=1字节;层二最左节点52aa的扫描标识为BIT MASK=0...01 00000001、UID=00000001 00000001、有效字节长度(Length)=2字节,等等。The process of scanning the antenna device in the embodiment of the present invention may also be represented by a scanning tree including a scanning process as shown in FIG. 5 . Corresponding scan marks are shown on each scan node of the scan tree shown in FIG. )=1 byte; the scanning identification of layer two leftmost node 52aa is BIT MASK=0...01 00000001, UID=00000001 00000001, effective byte length (Length)=2 bytes, etc.
根据图5所示扫描树,本发明实施例中出现连续冲突时,扫描情况可以如表二所示:According to the scanning tree shown in Figure 5, when continuous conflicts occur in the embodiment of the present invention, the scanning situation can be as shown in Table 2:
表二Table II
表二中:In Table 2:
在第一步扫描UID第0字节第0位。这里,所述第0位值可以为1,也可以为0,通常情况下会先扫描UID第0位值是否为1,如果出现冲突,则执行第二步,如果没有出现冲突或执行第二步之后直至没有出现冲突时,则会扫描UID第0位值是否为0;表二中以扫描的UID第0位值为1时出现冲突为例进行了说明;In the first step scan UID byte 0 bit 0. Here, the value of the 0th bit can be 1 or 0. Usually, it will first scan whether the value of the 0th bit of the UID is 1. If there is a conflict, execute the second step. If there is no conflict or execute the second step After
由于第一步中UID第0字节第0位值为1时出现冲突,因此第二步中进一步扫描UID第1字节第0位。这里,所述第1字节第0位值可以为1,也可以为0,通常情况下会先扫描UID第1字节第0位值是否为1,如果继续出现冲突,则执行第三步,如果没有出现冲突或执行第三步之后直至没有出现冲突时,则会扫描UID第1字节第0位值是否为0;表二中以扫描的UID第1字节第0位值为1时继续出现冲突为例进行了说明;Since a conflict occurs when the value of bit 0 of byte 0 of UID is 1 in the first step, bit 0 of
由于第二步中UID第1字节第0位值为1时继续出现冲突,因此第三步中进一步扫描UID第2字节第0位。这里,所述第2字节第0位值可以为1,也可以为0,通常情况下会先扫描UID第2字节第0位值是否为1,如果继续出现冲突,则继续扫描下一位,如果没有出现冲突或继续扫描下一位后直至没有出现冲突时,则会扫描UID第2字节第0位值是否为0;表二中以扫描UID第2字节第0位值是否为1为例进行了说明;Since the conflict continues to occur when the value of bit 0 of
...;...;
由于第19步中UID第19字节第0位值为1时继续出现冲突,因此第20步中进一步扫描UID第0字节第1位,表二中以扫描UID第0字节第1位值是否为1为例进行了说明;Since the conflict continues to occur when the value of the 0th bit of the 19th byte of the UID is 1 in step 19, the first bit of the 0th byte of the UID is further scanned in step 20, and the first bit of the 0th byte of the UID is scanned in Table 2 Whether the value is 1 or not is explained as an example;
由于第20步中UID第0字节第1位值为1时继续出现冲突,因此第21步中进一步扫描UID第1字节第1位,表二中以扫描UID第1字节第1位值是否为1为例进行了说明;Since the conflict continues to occur when the value of the first bit of the UID byte 0 in step 20 is 1, the first bit of the first byte of the UID is further scanned in step 21, and the first bit of the first byte of the UID is scanned in Table 2 Whether the value is 1 or not is explained as an example;
由于第21步中UID第1字节第1位值为1时继续出现冲突,因此第22步中进一步扫描UID第2字节第1位,表二中以扫描UID第2字节第1位值是否为1为例进行了说明;Since the first bit of
表二为图5中出现连续冲突时的情况举例。通常情况下当前扫描到UID的第s字节第t位时出现冲突,如果第s字节为最后一位有效字节,则进一步扫描UID第0字节的第t+1位,如果该字节不是最后一位有效字节,则进一步扫描UID第s+1字节的第t位,这里,如果第s字节为最后一位有效字节,且t=7,则通常结束扫描过程。Table 2 is an example of the situation when continuous conflicts occur in FIG. 5 . Usually, a conflict occurs when the tth bit of the sth byte of the UID is currently scanned. If the sth byte is the last valid byte, further scan the t+1th bit of the 0th byte of the UID. If the word If the section is not the last valid byte, further scan the t-th bit of the s+1th byte of the UID. Here, if the s-th byte is the last valid byte and t=7, the scanning process usually ends.
可以看出,根据图5所示扫描树,对ALD进行扫描时,如果出现冲突,则通常情况下会进一步扫描UID的下一个字节的同一位,因此图5中的扫描方法可以称为跨字节递增的扫描方法。It can be seen that according to the scanning tree shown in Figure 5, when scanning the ALD, if a conflict occurs, usually the same bit of the next byte of the UID will be further scanned, so the scanning method in Figure 5 can be called a cross A scan method that increments bytes.
利用本发明实施例中的扫描方法,如果两个ALD的UID的前80位相同,第81位不相同时,主站下发80÷8+1=11个扫描消息后能够获取一个ALD的UID。Using the scanning method in the embodiment of the present invention, if the first 80 bits of the UIDs of the two ALDs are the same and the 81st bits are different, the master station can obtain the UID of an ALD after sending 80÷8+1=11 scanning messages .
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的使用范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the application scope of the present invention.
Claims (16)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2006100984650A CN1901276B (en) | 2006-07-07 | 2006-07-07 | Method for generating scan mark and method for scanning antenna device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN2006100984650A CN1901276B (en) | 2006-07-07 | 2006-07-07 | Method for generating scan mark and method for scanning antenna device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN1901276A CN1901276A (en) | 2007-01-24 |
| CN1901276B true CN1901276B (en) | 2010-09-29 |
Family
ID=37657070
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN2006100984650A Expired - Fee Related CN1901276B (en) | 2006-07-07 | 2006-07-07 | Method for generating scan mark and method for scanning antenna device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN1901276B (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20100278533A1 (en) * | 2009-04-30 | 2010-11-04 | Telefonaktiebolaget L M Ericsson (Publ) | Bit mask to obtain unique identifier |
| WO2015032058A1 (en) * | 2013-09-05 | 2015-03-12 | 华为技术有限公司 | Method and device for discovering ald |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020130766A1 (en) * | 2001-03-16 | 2002-09-19 | E-Tag Systems, Inc. | Method and apparatus for efficiently querying and identifying multiple items on a communication channel |
| US20040103086A1 (en) * | 2002-11-26 | 2004-05-27 | Bapiraju Vinnakota | Data structure traversal instructions for packet processing |
| CN1706206A (en) * | 2002-10-18 | 2005-12-07 | 赛宝技术公司 | Method for the efficient reading of a population of radio frequency identification tags with unique identification numbers over a noisy air channel |
-
2006
- 2006-07-07 CN CN2006100984650A patent/CN1901276B/en not_active Expired - Fee Related
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20020130766A1 (en) * | 2001-03-16 | 2002-09-19 | E-Tag Systems, Inc. | Method and apparatus for efficiently querying and identifying multiple items on a communication channel |
| CN1706206A (en) * | 2002-10-18 | 2005-12-07 | 赛宝技术公司 | Method for the efficient reading of a population of radio frequency identification tags with unique identification numbers over a noisy air channel |
| US20040103086A1 (en) * | 2002-11-26 | 2004-05-27 | Bapiraju Vinnakota | Data structure traversal instructions for packet processing |
Also Published As
| Publication number | Publication date |
|---|---|
| CN1901276A (en) | 2007-01-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| Choi et al. | Query tree-based reservation for efficient RFID tag anti-collision | |
| CN101334849B (en) | Symbol generation method and device of two-dimensional code label | |
| Su et al. | A time efficient tag identification algorithm using dual prefix probe scheme (DPPS) | |
| TW201303574A (en) | Method and apparatus for adapting data transmission security in serial bus system | |
| CN106650530A (en) | Enhanced quad-tree anti-collision algorithm suitable for RFID system | |
| CN102609672A (en) | Anti-collision method of radio frequency identification (RFID) system | |
| CN111131403A (en) | Message coding and decoding method and device for Internet of things equipment | |
| CN1901276B (en) | Method for generating scan mark and method for scanning antenna device | |
| CN101232516A (en) | Low-power system update method using differential compression in wireless sensor network applications | |
| CN102255687B (en) | Rate matching method and device thereof | |
| CN112468369A (en) | Error detection method for CAN communication matrix of automobile | |
| CN102447478B (en) | Encoding method and system for accident rule digital logic design of nuclear power plant | |
| CN103036641A (en) | Method and system of data exchange and deserialization method | |
| CN102663333B (en) | Tag anti-collision method based on self-adaptive hybrid query tree in RFID (radio frequency identification) system | |
| CN107784073B (en) | Data query method for local cache, storage medium and server | |
| CN104698962A (en) | Programmable logic controller (PLC) communication method and system | |
| CN104270550A (en) | A reliable transmission method of image data based on CAN bus | |
| CN108090386A (en) | A kind of multicycle RFID anti-collision algorithm decomposed based on binary tree | |
| CN111310450B (en) | Character string word segmentation method, device, equipment and storage medium | |
| CN101324915B (en) | Electronic label recognition method, radio frequency recognition system and electronic label | |
| CN107733875A (en) | A kind of data transmission method and system | |
| CN112966534B (en) | A multi-classification-based detection method for missing tags in RFID systems | |
| CN110569487B (en) | Base64 expansion coding method and system based on high-frequency character substitution algorithm | |
| CN106899312B (en) | Interleaving encoding and decoding method and interleaver | |
| CN101414345A (en) | Radio frequency identification signal response method and system, tag and reader |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20100929 |
|
| CF01 | Termination of patent right due to non-payment of annual fee |