Data transmission program design for pharmaceutical cold chain monitoring system (Part 2)

2 Monitoring system functional module software design

2. 1 Anti-interference and anti-collision module design

In the process of data collection and transmission, there are two main problems with data integrity: signal interference and signal conflict. The system designs an anti-interference module based on the cyclic redundancy check (CRC) method and uses an anti-collision algorithm to solve the signal conflict problem [8].

2. 1. 1 Anti-interference module design CRC check code uses linear coding theory [9-12]. At the sending end, according to the k bits of the information field to be sent, a verification field (i.e. CRC code) r bits are generated according to the agreed rules, and are appended to the information field to form a new binary code sequence number (kr) bits. The new (kr) bit is sent; at the receiving end, it is checked according to the agreed rules to determine whether there is an error in the transmission.

In the interface communication protocol used in the data collection and transmission process (see Table 1), SN (packet auto-increment) is used to filter duplicate or lost data packets during the CRC check process; Head (data packet header) content is fixed is 0x02030405, used to identify the legality of the tag identity; Length is the length of the data packet; DeviceID is the ID of the reader/writer uploading the data packet; CMD is the command code, the range is 0x000xff; data[ ] is the parameter field; CheckSum is the CheckSum byte The cumulative sum of all previous bytes modulo 256 is used together with Length to verify the integrity of the data.

DTU/Edge Gateway/IoT Platform/Gateway Module

2. 1. 2 Anti-collision module design There are multiple tags within the scope of the reader/writer. If they communicate at the same time, they will occupy the channel at the same time, causing the sent data to conflict, resulting in data collision between electronic tags. The system uses a binary tree search algorithm to solve the tag conflict problem [13-15]. Each tag has a unique serial number (UDI). The solution to the tag conflict problem is based on UDI.

The binary tree search algorithm model is shown in Figure 3. First, the conflict position is recorded, and the label at that position is divided into two subsets: 0 and 1; secondly, the 0 subset is queried. If there is no conflict, the label is correctly identified. If there is still a conflict, then the label is identified again. Split, divide the 0 subset into two subsets: 00 and 01, and so on, until all labels in subset 0 are identified, and then follow this step to query subset 1.

The binary tree search algorithm uses Manchester encoding. Taking tag 1——11000001, tag 2——11101011, and tag 3——11001001 as an example, the binary tree search algorithm process is as follows. 1) The reader will send the 11111111 command to the tag to request a response. After encoding, the decoding result of the reader is 11X0X0X1, and the D1, D3, and D5 bits collide. 2) Set the highest collision bit D5 to 0, the bits higher than D5 remain unchanged, and the bits lower than D5 are set to 1. 3) The reader sends 11011111 to the tag command again, and the decoding result of the reader after encoding is 1100X0X1. 4 ) Set the highest collision bit D3 to 0, the bit higher than D3 remains unchanged, and the bit lower than D3 is 0. 5) The reader sends the 11000111 command to the tag again. At this time, tag 2 does not collide with other tags and responds to the reader. The reader performs read and write operations on tag 2. 6) Repeat the above process until all tags respond to the reader. During the above process, there will be situations where the tag that has completed the response will respond again. The system sets the judgment mechanism to prohibit the tag from responding repeatedly. The programming is:

Contact Us