The oil production wells in the oilfield are relatively scattered, which brings great problems to the centralized management. The use of wired network has high cost and is not easy to maintain. The opening of SMS service solves this problem. Using the oil well monitoring system based on SMS short message alarm composed of and single chip microcomputer, the wireless monitoring of the oil field is realized, which provides a guarantee for the stable and high yield of the oil field. The system has good economic benefits and high application value.
Structure and principle of monitoring system
The monitoring system consists of data acquisition system and alarm monitoring system. The data acquisition system is composed of the pressure and flow sensor of the single-chip microcomputer system, which completes the measurement of relevant parameters in the production process of the pumping well. The measured data is compared with the set value to determine whether it is normal. In case of abnormality, the single-chip microcomputer is connected with the mode of RS232 through the serial port, Send the data to the modem connected to the computer of the oilfield monitoring center in the form of mobile phone short message. The computer reads the short message into the computer management system. At the same time, it also sends the data to the mobile phones of relevant managers of the unit in the form of mobile phone short message, which has been processed in time. In addition, the data acquisition system can also provide short message query function. Relevant managers can send the agreed command to the modem developed on the single chip microcomputer for query. The query content includes whether the current work of the system is normal, whether it is powered off, whether it has been artificially damaged, etc.
1. SMS message function
GSM short message service (SMS) is a digital service provided by GMS system to users. Like voice transmission and fax, it is the main telecommunication service provided for GMS digital cellular mobile communication network. The sending and receiving of SMS occupies the signaling channel of GSM network and will not occupy the Putonghua voice channel. Moreover, it is two-way communication and has certain interaction ability; SMS has high reliability. Users at the sending end of short message can know whether the short message has reached the mobile terminal. Because the short message relies on the storage and forwarding mechanism of the SMSC short message service center, when the receiving end user shuts down or is not in the service area, SMSC will temporarily save the short message: if the receiving end user is in the working state again within the specified time (usually 24h), SMSC will immediately send a short message to the receiving end user, When the transmission is successful, a confirmation signal will be returned to the sender user. SMS makes full use of the characteristics of wide repeater coverage of GMS network and the advantages of the whole network. It has excellent mobility, so that any GSM wireless end user who has applied for short message service can obtain service in the whole network. Each short message is limited to 140 8-bit groups (7-bit encoding), 140 English bytes or 70 text symbols. If it exceeds this length, it will be sent multiple times.
1.2 composition of data acquisition system
The data acquisition system is composed of sensor, single chip microcomputer, a / D converter and GSM modem with wireless communication. In this part, the measured physical quantity is converted into analog signal through the sensor, and then converted into digital signal by the A / D conversion chip. The read data is converted into the operating state parameters of the measured well through calibration, and compared with the pre stored standard value to determine whether it is normal. If it is abnormal, The data will be sent to the mobile phone connected to the computer of the oilfield monitoring center by SMS, and then read by the computer of the monitoring center into the management system of the computer of the monitoring center. At the same time, in order to facilitate management, the abnormal data shall be sent to the mobile phone of relevant managers with preset number by mobile phone short message for timely processing.
2. Principle of sending SMS
The key and main difficulty of system development is the development of mobile phone short message interface. The development of mobile short message mainly includes the coding and decoding of user data area of mobile short message, communication mode setting and online test, sending and receiving of short message, mode matching of key commands of sending and receiving data, etc. The development of mobile phone interface mainly uses the at instruction set jointly proposed by Ericsson and Motorola. At instruction is a character based command structure, including text mode, PDU mode and block mode used in the early days. We mainly use PDU mode. PDU mode is based on characters. To be exact, it is based on hexadecimal data and code. It is encoded, so it cannot be read directly. Therefore, coding is required when sending short messages and decoding is required when receiving short messages, which is the difficulty of development.
2.1 short message PDU format analysis and practical at commands
There are two ways to send and receive SMS messages: text mode based on at command and PDU (protocol description unit) mode based on command. Most Siemens mobile phones only support PDU mode. In PDU mode, the text of the short message is encoded, converted into Unicode code and transmitted. We mainly discuss the sending and receiving modes of Siemens TCU.
Next, the data format of SMS PDU is introduced through the analysis of the sent short message format. Assuming that the content of the Chinese text message to be sent is "good evening 123", connect the "tc35t" to the serial port of the computer, turn on the super terminal of the computer, and send the short message according to the following specific operation process (underlined characters are the response information, {}
(note inside):
AT
OK, if the computer is successfully connected to the mobile phone, you can enter all kinds of GSM AT commands}
AT+CNMI=1,1,2
The OK unit receives the short message prompt} when the module receives the short message, it gives a response:
For example: + CMTI: "SM", 4
AT+CMGF=0
OK {set the working mode of the module: 0 is PDU mode and 1 is text mode}
At + CMGs 2 26{number of bytes of SMS sent}
>08916831082009050 0103 091
6831993125239 3208 OC
665a4eoa597 d003100320033 / / type Ctrl + Z and the prompt > appears after the last number, indicating that the system has received the command and the system will return to the operation structure.
OK {OK indicates success and error indicates failure}
+CMGS:32
The following information is analyzed:
08 indicates the address length of the short message center:
91 indicates the number type of SMS center:
68310820905 fo indicates the encoding method of sending short messages;
Od represents the length of the target address;
91 indicates the destination address type;
68313904152329 indicates the destination address. The mobile phone number of the receiving end message is 13904152329;
3208 indicates the method of sending center characters:
OC indicates the length of the short message;
665 A4 eoa59 d003100320033 indicates the time to send a kind of Chinese character
Unicode code
665a {late} 4eoa {on} 597 D {good} 0032 {2) 0033 {3}.
The following is the analysis of the information received by the module:
At + cmgr = < index > {read the content of the short message. Index indicates the location where the short message is stored}
At + cmgl = < stat > & LJ table short message: stat = 0, the column is degree 08, indicating the address length of the short message center:
91 indicates the number type of SMS center:
68310820905 fo indicates the encoding method of sending short messages;
Od represents the length of the target address;
91 indicates the destination address type;
68313904152329 indicates the destination address. The mobile phone number of the receiving end message is 13904152329;
3208 indicates the method of sending center characters:
OC indicates the length of the short message;
665 A4 eoa59 d003100320033 indicates the Unicode code for sending the Chinese characters
665a {late} 4eoa {on} 597 D {good} 0032 {2) 0033 {3}.
The following is the analysis of the information received by the module:
At + cmgr = < index > {read the content of the short message. Index indicates the location where the short message is stored}
At + cmgl = < stat > & LJ table SMS: stat = 0, listed as spent information; Stat = 4, column all messages}
+Cmgl: 1, 2, 24 {I refers to the number of messages, 2 refers to sending messages, and 24 refers to the total capacity of messages}
At + CMGD = < index > except for short messages, index indicates the storage location of short messages}
OK {deletion succeeded}
3. Data acquisition system software
Data acquisition system software mainly includes data acquisition, correction, SMS alarm and other functions. The pressure, flow, temperature and other physical quantities of the pumping well are converted into analog signals, the analog signals are converted into digital signals through a / D conversion, and then the digital signals are read out by the single chip microcomputer. The digital signal can obtain the operating state parameters of the well through calibration and compensation. This parameter is compared with the predetermined value stored in the center to judge whether it is normal. If it is abnormal, the system is required to send it to the modem connected with the computer of the oilfield monitoring center and the mobile phone of relevant management personnel of the unit through SMS.
3.1 main program
Send the data to the mobile phone or modem of the target number by SMS. First, encode the SIM card number and SMS content of the mobile phone or modem of the target number into PDU code (we send SMS in PDU format here), and calculate the PDU string length L. Then, the PDU code length and format are sent to the modem in parallel with the single chip microcomputer through the serial port, and the modem sends the short message channel to the target mobile phone or modem through the GSM network.
At + crags = l (enter) {l stands for PDU code length}
)Wait for the sign}
PDU {send PDU code}
OK (or error)
{modem will automatically send OK or
Error, if it is OK, it means that the SMS is sent successfully. If it is returned
If error is returned, it means the sending failed}
Main program:
ORG OOOOH
AJMP ZCX
ORG 0003H
AJMP ZD
zcx:MOV P1,#OFFH
MOV R2,#40H
MOV R3,#50H
DSJ:MOV A,P1
CJNE A,#60H,DSJ
SETB EA
SETB I'M
SETB EXO
MOV R2,A
MOV R3,A
ACALL YS
SJMP DSJ
END
3.2 serial port receiving interrupt subroutine
The system not only has alarm function, but also has short message function, so that relevant personnel can understand the current working condition of the system. When opening the SMS notification of modem in the data acquisition system, once the modem receives the SMS, it will send a SMS notification containing "+ CMTI": "SM" string through the serial port, indicating that the SMS has been received. At this time, send "at + cmgl" to modem through the serial port of shrapnel machine to read out all short messages. After receiving the instruction, modem will send all unread short messages to MCU in the format of PDU code through the serial port. PDU code contains GSM network information, time information of SMS sending, mobile phone number of sender, SMS content and other information. These information contained in the PDU code is not easy to identify, so it needs to be decoded to decode the SMS content and the sender's mobile phone number. Compare whether the short message content is consistent with the password preset in the single chip microcomputer. If it is inconsistent, it will be treated as an illegal query; If it is consistent, the single chip microcomputer sends "at + cmgl" to the modem through the serial port of the shrapnel machine to read out all short messages. After receiving the instruction, the modem will send all unread short messages to the single chip microcomputer in the format of PDU code through the serial port. PDU code contains GSM network information, time information of SMS sending, mobile phone number of sender, SMS content and other information.
These information contained in the PDU code is not easy to identify, so it needs to be decoded to decode the SMS content and the sender's mobile phone number. Compare whether the short message content is consistent with the password preset in the single chip microcomputer. If it is inconsistent, it will be treated as an illegal query; If it is consistent, the MCU provides the query function and sends the current relevant information of the system to the query mobile phone number in the form of SMS.
Interrupt receiving subroutine:
ZD:JZ JSNO:MOV R3,A
MOV A,R3
CJNE A,R3,NO
is:RETI
4. System software of oilfield monitoring center
The monitoring system software mainly consists of SMS receiving alarm, SMS query, database, report, graph and other functions. The monitoring system computer is connected with modem through serial port, and may send and receive short messages through serial port. If the modem receives the short message, it will send a notice to the computer. The computer can read the short message, decode it, and then store it in the database for staff processing. Since the SMS received by modem is saved in the SIM card, the SIM card can only store a limited number of dozens of SMS. Once the SIM card is full, it will cause modem congestion and can no longer accept SMS. Therefore, each SMS read out must be deleted in time. In order to manage, short message query function must be provided to query the working status of the current data acquisition system. In order to avoid damaging the data acquisition system, and the damaged data acquisition system can be repaired in time.
5. Concluding remarks
The application of oil well monitoring system based on SMS short message alarm effectively improves the safe production capacity of oil field, can meet the requirements of stable and high yield of large oil field, greatly saves management costs and human and material resources. It has strong practicability and economic value.