0 Introduction
At present, the main task of oil production plants is to produce oil by pumping units. The distribution points of pumping units are wide and wide. They work in harsh environments and are easily damaged and destroyed by external forces. Frequent inspections are required, and the work intensity of personnel is high. At present, due to the lack of remote means, the production status of oil wells is in a post-processing state. When oil wells are abnormal or stolen, they cannot be handled in time, resulting in a large number of unknown losses. The remote terminal (RTU) based on the CD-MA communication channel makes full use of the existing computer network. Through on-site monitoring and data collection and transmission, it can meet the needs of remote monitoring of oil wells. The remote terminal can perform real-time and fully automatic online reading of parameters such as load, displacement, tubing back pressure, temperature, stroke frequency, working current, voltage, etc. during the operation of the oil well; when an abnormal situation occurs on site, the monitoring center can automatically issue relevant alarm information, and the dispatching room can send relevant personnel to handle the scene according to the alarm information. The collection of relevant data has been transformed from the traditional manual operation mode to the computer automatic operation mode, without manual intervention, thus saving manpower and improving work efficiency.
1 Monitoring system architecture and remote terminal functions
The monitoring system (as shown in Figure 1) is mainly composed of a monitoring center and a remote terminal. The remote terminal is responsible for collecting and sending data from the pumping unit. The monitoring center centrally monitors the data from each remote terminal. The remote terminal accesses the Internet through the CDMA channel to establish a connection with the monitoring center server. The monitoring center is the command center of the system. It can send various commands and information to the remote terminal on site, further process the received data, and send necessary information to various departments through the network. The
remote terminal monitors the three-phase voltage value, three-phase current value, pumping unit load, wellhead oil pipe back pressure, wellhead oil pipe temperature, etc.
2 Overall structural design of remote terminal
As shown in Figure 2, it is a block diagram of the RTU system architecture. According to the application requirements, the system is designed as a single-chip microcomputer plus an embedded processor. The MSP430F149 single-chip microcomputer is
an ultra-low power 16-bit RISC mixed signal processor (Mixed Signal Processor) launched by
Texas Instruments
(TI). The processor has rich hardware resources, high processing speed and low power consumption. It has 8-way 12b ADC and dual UART, making it very suitable as the data acquisition processor of the terminal. $3C44. BOX is a 32-bit embedded processor with ARM7 as the core launched by Samsung. It has rich resources and low power consumption and low cost, which can meet the application needs of the terminal.
The MSP430 single-chip microcomputer mainly completes the real-time data collection in this system. The data to be collected are: three-phase voltage and current data of the oil pump collected by the power sensor, the load of the oil pump arm, the temperature sensor analog signal, and the pressure and infrared sensor signals. The single-chip microcomputer sends the collected data to S3C44BOX through UART in the required data format.
In this system, S3C44BOX performs certain data processing and completes wireless network connection and data transmission and reception by controlling the CDMA module. After starting up, S3c44BOX controls the CDMA module to first establish a data link with the monitoring center. After receiving the link information, the monitoring center can obtain the operation information of the oil well and receive the data information collected by the single-chip microcomputer at any time. When S3C44BOX receives the information of the single-chip microcomputer, it sends the data to the monitoring center through the CDMA network, or transmits the information sent by the monitoring center to the single-chip microcomputer. There are many tasks implemented on S3C44BOX and involve the PPP (Point to Point) protocol stack. In order to meet the real-time performance of the system, this terminal uses the vlxWorks embedded real-time operating system. The tasks to be completed by S3C44BOX are:
(1) Receive data frames from MSP430; send control instructions to MSP430.
(2) Process the data sent by MSP430 and use the load sensor data to calculate the rotation period of the oil production arm and extract the pumping unit indicator diagram.
(3) Connect to the CDMA network. S3C44BOX sends AT commands to the CDMA module to control it to dial up PPP and establish an Internet connection.
(4) After the PPP connection is established, the remote terminal and the monitoring center exchange data.
(5) Monitor the power supply of the system. If a power failure occurs in the remote terminal, before the system is completely shut down (maintained by a large capacitor so that the system will not shut down immediately), the system will send a power failure alarm to the main station.
(6) Processing of the system watchdog. Including software watchdog and hardware watchdog to ensure the reliability of the system. [page]
(7) Network support. With support for the local area network, it becomes convenient and fast to download the VxWorks application image to the FLASH memory during debugging, which facilitates the upgrade of the system software.
The remote terminal uses AnyDATA's DTGS-800 as the wireless communication module. The main features of this module are: using Qualcomm's 6050 chip; the frequency band is 800 MHz, supporting the CDMA2000 1XRTT standard; built-in TCP/IP protocol stack, etc. DTGS-800 is connected to S3C44BOX through U_ART, and S3C44BOX controls the CDMA module by sending AT commands.
3 Software Design of Remote Terminal
The software of the remote terminal is divided into MSP430 single-chip microcomputer program design and S3C44BOX program design.
3.1 MSP430 single-chip microcomputer program design
The MSP430 single-chip microcomputer is responsible for multiple data collection and data packaging and sending. The MSP430 single-chip microcomputer has dual UARTs. uART0 is used to transmit data to the upper computer ARM and receive instructions given by ARM; UARTl is connected to the power sensor through the RS 485 protocol. The digital output terminals TELSIG1 and TELSIG2 of the two infrared sensors are connected to the P5.0 and P5.1 general I/O ports of the MSP430 respectively. The analog signals output by the temperature sensor, pressure sensor and load sensor are connected to the A0, A1 and A4 ports of the single-chip microcomputer respectively after passing through their respective signal conditioning circuits. The analog-to-digital conversion of temperature, pressure and load signals is completed through
the 12 b ADC built into the
MSP430F149
single-chip microcomputer. The analog-to-digital conversion is sampled in the form of timed interrupts, and the sampling frequency of the original data is 50 kHz.
The design idea of the software adopts a fast process loop, calling each process based on the process flag as the judgment condition and executing related control. As shown in Figure 3, the count value of a loop counter is used to set the flags of all processes. In the timer interrupt service program with a period of 10 ms, the counter value is increased by 1. Each time TimeFlag() is executed, the counter value is compared with the count value corresponding to the scheduled execution time of each process to obtain the flag status of the process, so that each process can be executed in an orderly manner.
3.2 S3C44BOX Programming
The programming of S3C4480x involves the VxWorks operating system: modification of BSP (Board Support Package), tailoring of the operating system, and design of the application program.
BSP is a layer between the embedded system hardware and the operating system. It is part of the operating system and its main purpose is to support the operating system so that it can run better on the hardware. Most of the BSP programming process is to modify a certain BSP template. According to the hardware structure and software application requirements of this system, the modification of BSP needs to achieve the following goals:
(1) Implement operating system support for TFFS (True FLASH File System) file system. TFFS is a file system compatible with Vx-works. It provides a unified block device interface for a wide variety of FLASH storage devices. With TFFS, the reading and writing of FLASH storage devices by applications are just like their operations on disk devices with MS-DOS file system. After the file system is established, the remote terminal operation log, system configuration parameters, system calibration parameters, CDMA user name/password, etc. can be saved in the form of files.
(2) Implement support for the RTL8019 Ethernet control chip; implement access to the remote terminal's file system via FTP, so that the system application can be upgraded online and log files can be downloaded; implement Telnet, and the configuration parameters of the remote terminal can be modified through Telnet to maintain the remote terminal.
Figure 4 shows the main program flow of the VxWorks application. When Vx-Works completes startup, it enters the application. The main program of the application completes various initializations and the creation of each task, as well as the creation of a task-level watchdog.
System initialization includes initializing system parameters, adding CDMA device drivers to the device driver list using the iosDrvInstall() function, adding CDMA devices to the I/O system device list using iosDevAdd(), and hardware watchdog initialization. System parameter initialization includes log file checking, system configuration parameter loading, CDMA user name/password verification, etc. If there is no corresponding parameter file on the file system, create a file according to the default parameters. The hardware watchdog chip uses X5045. Initialize and set the reset time of the watchdog and start it. The reset time of the X5045 watchdog chip can only reach 1.4 s at most, and the VxWorks system startup time exceeds 1.4 s. In order to prevent the reset signal generated by X5045 from interrupting the startup of VxWorks, X5045 must be disabled before VxWorks starts, which requires modifying the BSP. Add code to disable X5045 reset at the beginning of the romStart() function in the bootIn-it.c file. [page]
SysclkC20nnect() maps the function ticklO ms() to the system clock interrupt of Vx-Works. The system timer interrupt cycle is set to 10 ms. In the tickloms() function, it is determined whether the software watchdog of each task has timed out. If it has timed out, the program enters an infinite loop and prints information about which task has an error, triggering a hardware watchdog reset.
CDMAconnectTask() establishes a PPP connection by sending AT commands to the CDMA module.
timeTask() completes the setting and reading of the CPU real-time clock module.
The CDMATask() process establishes a socket connection with the master station.
The commTask() process implements the data packet exchange between the remote terminal and the monitoring center, packages the data frames to be sent to the master station, reads the CDMA device data into the buffer, and parses the master station command. The
commTask430() process completes the data exchange between ARM and MSP430.
The dataTask() process processes the data uploaded from the MSP430, including calculating the rotation period of the oil drilling machine arm and extracting the oil drilling machine's indicator diagram through load data.
warnTask() implements real-time system alarms. The types of alarms include: load out of bounds, pressure out of bounds, temperature out of bounds, three-phase voltage out of bounds, three-phase current out of bounds, and infrared triggering. If the number of out-of-bounds exceeds the value set by the parameter during the detection, it is considered that an alarm is generated.
pwrWarnTask() performs alarm processing for power failure and incoming calls.
3.3 Network connection establishment of CDMA module
The terminal establishes a PPP connection to access the Internet through the CDMA module. PPP provides a standard method for transmitting multi-protocol data packets on point-to-point connections. PPP was originally designed to provide an encapsulation protocol for IP traffic transmission between two peer nodes. In the TCP-IP protocol suite, it is a data link layer protocol (the second layer in the OSI model) used for synchronous modulation connections, replacing the original non-standard second layer protocol, namely SLIP. PPP carries the link control protocol (LCP) and the network control protocol (NCP). In order to use the PPP protocol stack provided by VxWorks, the PPP component needs to be added to VxWorks, as shown in Figure 5.
VxWorks provides a structure of type PPP_OPTIONS to describe PPP parameters. You can configure PPP parameters by filling in the PPP_OPTIONS structure and passing the structure address to the pppInit() function. After successful initialization, PPP connects itself to the TCP/IP stack of Vxworks at the link layer. After the PPP dial-up connection is successfully established, all VxWorks IP network devices are available. At this time: the PPP connection is transparent to the user.
S3C44BOX uses AT commands to control the DTGS-800 CDMA module. AT commands are a set of commands invented by Hayes to control modems. They have become a de facto standard and are adopted by all modem manufacturers. Each command begins with the letter "AT". There are certain differences in AT commands for different models of modems. S3C44BOX sends AT commands to establish a communication link. The AT commands required for dialing are:
① Initiate a call ATD
② Control the echo ATEx
control character to be echoed, if x=0, it will not be echoed; if x=1, it will be echoed.
The steps to establish a PPP connection are shown in Figure 6. The CDMA_Init() function fills in the PPP_OPTIONS structure and initializes the serial port used by the CDMA module. The dialed number is "#777" and the username and password are both "CARD". Use the pppInit() function provided by VxWorks to complete the initialization of PPP. The return value of pppInit() cannot indicate the status of the PPP connection, it can only return whether the connection is successfully initialized. To confirm the success of the connection establishment, use pppInfoGet(). When the status of IPCP (Internet Protocol Control Protocol) is "OPENED", it means that the PPP connection is successfully established.
4 Conclusion
The design and implementation of a data acquisition remote terminal based on VxWorks is introduced from the aspects of hardware and software. The core architecture of this remote terminal is not only suitable for remote data transmission and monitoring of oil wells, but also can be well applied in other fields, such as power monitoring, remote meter reading, industrial control, meteorological data acquisition, water ripple monitoring, water conservancy monitoring, earthquake detection, traffic information release, etc. It has strong engineering application value, especially suitable for the development of applications and application systems in the field of M2M (Machine to Machine). When it is necessary to make specific applications, it only needs to select the corresponding sensors according to the specific situation and make certain modifications to the hardware and software, so it has a wide range of application prospects.
Previous article:Design of phase difference meter based on FPGA average value principle
Next article:Research on the speed measurement method of high-speed industrial sewing machine
Recommended ReadingLatest update time:2024-11-17 00:03
- Popular Resources
- Popular amplifiers
- Design of permanent magnet synchronous motor control system based on VxWorks_Zhang Guilin
- Design of Embedded Multi-protocol Communication Controller Based on VxWorks
- Multi-task real-time scheduling design of low-orbit broadband communication payload management software based on VXWorks
- Design and implementation of CPCI multi-channel card driver based on VxWorks
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- ADI Award-winning Live Broadcast: Voltage Reference Product Technology and Application Selection July 25th 10:00-11:30 am Don't miss it~
- Why do you think that domestic chip manufacturers do not provide good support?
- 【ufun learning】Learning Part 3: "Basic Routine 2 - PWM Control"
- Last day! Prize-winning quiz to unlock the technology of Microchip's new MCUs!
- Today at 10:00 am TI Award Live Broadcast: Application of TI mmWave Sensors in Smart Home
- I have a question here while testing a full-bridge LLC+SR synchronous rectification circuit?
- When tps40210 is used for 12V input and 24V output, the RC pin cannot oscillate
- Key Design Tips for Automotive RF Front-End
- Sichuan local mobile phones and TVs received earthquake warnings in advance: Learn how to turn them on in one article
- ARM register analysis and exception handling methods