1 The manual management mode is not suitable for the requirements of streetlight management. To build a perfect streetlight monitoring communication system, not only to meet the current business management needs, but also to consider the future information processing growth and the adaptability of technology upgrades. In recent years, wireless transmission technology has made great progress, and GPRS technology has received extensive attention in the industry. GPRS is a new packet data bearer service developed on the existing GSM system. It has the advantages of low one-time investment, simple installation, low usage fee, strong anti-interference ability, and smooth transition to GPRS wireless packet and 2.5G broadband service. At present, almost all cities in China have opened GSM/GPRS services, which is the mainstream transmission resource used by remote monitoring systems in the future, and is also a good choice for communication methods of street lighting monitoring systems.

The structure of the street lamp monitoring system is as shown in Fig. 1. The street lamp terminal communicates with the monitoring center via the GPRS network and the INTERNET network. In this process, communication connection is required. The system designs the communication protocol by itself to meet the specific requirements of street lamp monitoring communication. .

2 system communication protocol design

In the street lamp monitoring communication system, the upper layer software and the underlying hardware communicate by commanding data packets, and there are many communication protocols in the world, but there are problems of complexity and backwardness in technology. The system street lamp distribution box controller GPRS module street lamp monitoring center mobile communication center INTERNET network GPR network adopts a customized communication protocol to ensure the security and stability of the system and realize street lamp monitoring communication.

2.1 instruction packet format

68 45 04 ID_low ID_high Type D_low D_high Data verify end Instruction packet structure description: The first three bytes 68, 45, 04 indicate the country code number, of which 68 means China, 45 means Guangxi, 04 means Cangzhou, and ID_low means GPRS data transmission and reception. The module is in the low byte of a city number, the length is 1 byte; ID_high indicates the high byte of the GPRS data transceiver module in a certain city, the length is 1 byte; 68, 45, 04, ID_low, ID_high constitute the GPRS data transceiver module Total number; Type indicates the instruction type, length 1 byte; D_low indicates the low byte of the instruction data, length 1 byte; D_high indicates the high byte of the instruction data, length 1 byte; Data indicates the instruction data to be sent or received Length design according to need; Verify indicates check byte, is the result of XOR of all data bytes except check byte, length 1 byte; End indicates package tail, set to a fixed value 0x03; Type The types of instructions indicated are as follows: (1) Login packet: The value of Type is 0x01. The login packet is the data packet sent by the GPRS data transceiver module to the upper layer software for the first time. (2) Heartbeat packet: The value of Type is 0x02, and the heartbeat packet is the data packet of the GPRS data transceiver module in order to maintain the TCP connection with the upper layer software, in order to prevent the GPRS network from transmitting data for too long after the GPRS data transceiver module is connected to the GPRS network. And disconnect the connection between them, so the GPRS data transceiver module is set to send a heartbeat packet to the upper layer software within a fixed time, and the heartbeat packet can also be sent to know whether the GPRS data transceiver module has been disconnected from the GPRS network. (3) Voltage and current data query request packet: The value of Type is 0x03, and the voltage and current data query request packet is the upper layer software to query the current control point voltage and current value to the underlying hardware. (4) Loop state request packet: The value of Type is 0x04, and the loop state request packet is the switch state of the upper layer software to query the control point loop to the underlying hardware. (5) Time list request packet: The value of Type is 0x05, and the time list request packet is the switch light time set by the upper layer software to the underlying hardware to query the control point. (6) Time list download package: The value of Type is 0x06, and the time list download package is the switch light time set by the upper layer software to the lower layer hardware download.

(7) Loop Control Packet: The value of Type is 0x07. The loop control packet is the upper layer software that sends the instruction packet to the underlying hardware to control the loop on or off.

2.2 instruction packet decomposition

After receiving the data sent by the GPRS data transceiver module, the upper layer software shall identify the instruction data packet, and then execute the corresponding processing program according to the corresponding instruction, and the flow chart of decomposing the data packet is as follows 2.

3 key technologies of system communication

3.1 Implementation of the communication system

The communication system is based on the TCP/IP protocol and encapsulates a custom protocol for communication. Due to the use of the TCP/IP protocol, the communication between the monitoring center and the GPRS module must first be assigned two IP addresses. The GPRS module actively connects to the GPRS network after power-on, and the mobile center assigns an IP address to the GPRS. After obtaining the IP address, the GPRS module actively connects to the monitoring center host through the INTERNET network through the mobile center. After the connection is successful, the monitoring center can communicate with the GPRS module. Since the communication between the monitoring center and the GPRS module passes through the INTERNET network and the GPRS network, as long as one of the two networks is abnormal, the communication between the monitoring center and the GPRS module will be affected. In order to ensure that the street lamp can normally switch the lamp, the controller of the system sets a system clock. The monitoring center only needs to download the time list of the downlink according to the time request data packet and time list, and the controller can switch according to the system clock of the system. Light action. This greatly reduces the reliance on the communication network, thereby reducing the number of times the lights cannot be turned on.

3.2 communication retransmission mechanism

The system realizes the transmission and reception of command data through the GPRS network, but the packet loss rate of transmitting data through the GPRS network is relatively high.

The upper layer software of the system uses TCP protocol to communicate with the GPRS data transceiver module. TCP (Transmission Control Protocol) is a reliable end-to-end connection-oriented protocol that can reliably transmit and receive data between two applications and ensure data is not available. Will be lost. Although the communication between the upper layer software and the GPRS data transceiver module uses the TCP protocol, the command data must pass through the GPRS network and the INTERNET network during the transmission process, and the data transmission instability of the GPRS data transceiver module cannot be guaranteed as the LAN. The data will not be lost during the transmission process. The system adopts the retransmission mechanism in the upper layer software to reduce the packet loss rate of the upper layer software to send the command data to the GPRS data transceiver module. In addition, when the GPRS data transceiver module is disconnected from the GPRS network, the upper layer software may not always receive the network disconnection message. In addition to the retransmission function, the upper layer software determines whether the GPRS data transceiver module disconnects the network connection with the upper layer software by continuously transmitting the command data to the GPRS data transceiver module.

Considering the processing speed of the GPRS data transceiver module and the control board, when the upper layer software sends command data to a GPRS data transceiver module, the time interval between the two command data should not be too short, and the retransmission mechanism can also handle this problem. The retransmission mechanism will record the number of the GPRS data transceiver module after sending the command data to a GPRS data transceiver module. Each time the command is sent, it is determined whether the GPRS data transceiver module has been sent during the transmission period. If it is sent, the command data will be left until the next transmission cycle. This method ensures that data is transmitted to only one GPRS data transceiver module in one transmission cycle. The method avoids the problem of hardware crash or data loss caused by continuous transmission of instruction data to the same GPRS data transceiver module, resulting in GPRS network congestion or slow hardware operation. The retransmission mechanism of the system saves the instruction data through the buffer pool established by itself, and uses the queue-like method to send the instruction data. Each time the instruction data is sent, the number of times the instruction data is sent is recorded. The flow chart of the retransmission mechanism is as follows, where T is the maximum number of times the instruction data is sent in the queue.

3.3 Communication System Security

Any system must consider security. In the streetlight communication system, one must consider the security of system communication, and the other is to consider the security of the system operation. In order to ensure the speed of the system operation, in the first case, we use XOR and check the end of the data with a specific terminator, which is enough in the street lamp monitoring system. This process is implemented when the data packet is decomposed. .

The second case is the safety of the street lamp operation, including the time of turning on the light, the current and voltage, etc. These are judged whether it is safe according to the state returned by the monitoring point, and an alarm is issued.

4 system communication key technology implementation

4.1 Implementation of retransmission mechanism

First define the global variable: Send_View: TListView, Send_View is used to save the instruction data of the issue, and T_Send is the timer to send the instruction.

Procedure F_Main.T_SendTimer(Sender:TObject);var Item:TListItem;NowSend,MaxItemCount,SendCount,i:integer;AfterSend_StrL:TStringList;begin if command packet>0 then begin AfterSend_StrL:=TStringList.Create;MaxItemCount:= Send_View. Items.Count;NowSend:=0; //Send the first line while MaxItemCount>NowSend do begin Item:=Send_View.Items.Item ;inc(NowSend);SendCount:=strtoint(Item.SubItems.Strings<2 >);//Number of times sent as if less than the maximum number of times sent first for i:=0 to AfterSend_StrL.Count-1 do begin if Item. Caption=AfterSend_StrL.Strings then Break;end;if i>AfterSend_StrL.Count-1 then begin Item.SubItems.Strings<2>:=inttostr(strtoint(Item.SubItems.Strings<2>)+1);//Send The number of command data is increased by 1.

Send instruction data.

Add the GPRS number of the sent command data.

End; end; else The number of times sent is greater than the maximum number of times sent, which is considered to be GPRS dropped.

Begin deletes the instruction data in the queue.

Handle GPRS dropped.

End;AfterSend_StrL.Free;end;

4.2 Receiving and Decomposing Data Packets

Procedure TF_Main.S_SocketClientRead(Sender:TObject;Socket: TCustomWinSocket);var RecStr:String;RecStrLen,i:integer;PacketEnd:char;Verify,Vrf,Vrf_temp,PacketType:Byte; begin RecStr:=Socket.ReceiveText;RecStrLen:= Length (RecStr); PacketEnd: = copy (RecStr, RecStrLen, 1) <1>; / / take the last 1 byte of data.

If fetched byte data = 0x03 then begin Verify: = ord (copy (RecStr, RecStrLen-1, 1) < 1>); / / take the check byte.

Vrf:=$0;for i:=0 to recStrLen-3 do all data bytes except the check byte are XORed.

Begin Vrf_temp:=ord(RecStr );Vrf:=Vrf xor Vrf_temp;end;Vrf:=Vrf xor $03; // XOR with the end of the package.

If XOR result = check byte then begin // fetch the packet type.

If PacketType=$01 then begin //Process the login package.

End; if PacketType=$02 then begin //Handle the heartbeat packet.

End; if PacketType=$03 then begin //Process voltage and current data.

End; if PacketType=$04 then begin //Process the returned loop state data.

End; if PacketType=$05 then begin //Process the returned time list data.

End;

5 Conclusion

The innovation of this paper is to design a custom communication protocol according to the special requirements of street lamp monitoring. The program has strong anti-interference, clear structure, easy to expand and modify and maintain, and considers the retransmission mechanism and security of the protocol, and the reliability is obtained. Guarantee. From the actual operating conditions, the system is stable and reliable. At the same time, it provides a good foundation for further research on various remote monitoring communication systems.

Led Point Light emit homogeneous beams in the ultraviolet, visible and infrared spectral. Power from 1watt to 11watt could have nice brightness. Application for outdoor situation, such as bridge, building, plaza, etc. Single color and RGB color work with control system make the illumination amazing.

LED Point Light

Bright Point Light,Led Pixel Point Light,Led Point Light,Led Point Light Source

ZHONGSHAN G-LIGHTS LIGHTING CO., LTD. , https://www.glightsled.com

Posted on