Discussion on the design of embedded stray current

  • Detail

Discussion on the design of embedded stray current monitoring device in the subway

1 principle of stray current generation in the subway

the traction power supply of the subway is generally DC power supply. When the DC large current flows along the track laid on the ground, in addition to flowing in the track, the DC current will leak from the track to the earth, flow on various metal objects in the earth, and then return to the power supply system. The leakage current in this part is called stray current, which is also called stray current in subway engineering, as shown in figure 0. Due to the corrosive effect of stray current on the buried underground metal, it may make the underground metal in some places suffer serious stray current electric corrosion while natural corrosion, resulting in accelerated electrochemical corrosion of subway

2 design of laboratory simulation device

due to the special environment of the subway, it is difficult to carry out experiments in the field in theory and in practice, so the research and experiments of this kind of topics are often carried out in the laboratory in most cases. Figure 1 is an experimental device designed by ourselves to simulate the generation of stray current of the subway and the corrosion of underground metals

3 design of data acquisition system

3.1 system overview

this system is composed of hardware and software. The hardware takes sst89c51 and 8-bit ADC chip ad0809 as the core, with keyboard control and LCD display functions. The system also has real-time time display and watchdog functions, and can communicate with external (microcomputer) through RS232 interface. The software of the system is based on the real-time embedded operating system ucos2, which will always jump out many particles and cause many dust. It adopts the multi task mechanism. Through task scheduling and task monitoring, the system has better real-time and security. UCOSII is a real-time embedded operating system with open source. It uses priority scheduling algorithm to complete the scheduling between tasks, and supports preemptive scheduling. UCOSII has a scalable architecture, μ C/os-ii is a portable, Rom implantable, tailorable, preemptive, real-time multitasking operating system kernel. It is widely used in microprocessors, microcontrollers and digital signal processors. Strictly speaking, uc/os-ii is just a real-time operating system kernel, which only includes the basic functions of task scheduling, task management, time management, memory management, communication and synchronization between tasks. No additional services such as input/output management, file system and network are provided. However, due to the good scalability and open source of uc/os-ii, these non essential functions can be realized by users according to their own needs μ The predecessor of c/os-ii is μ C/os, and μ The source code of c/os is published on the BS of the magazine. It has the functions of memory management, interrupt management and task control block (TCB) expansion. UCOSII also provides many system services, such as mailbox, message queue, semaphore and so on. It also has the advantages of good portability and simple structure

3.2 hardware design of the system

the hardware composition block diagram of the system is shown in Figure 2. Each resistance voltage signal is isolated and amplified, and then isolated by the linear optocoupler, and then transmitted to the input of the multi-channel acquisition a/d conversion chip 0809 for data acquisition. The digital quantity after a/d conversion is read by the single chip microcomputer, and after processing, the specific data can be displayed on the LCD. At the same time, it can also be read into the microcomputer by the communication interface for further processing and analysis. LCD has system prompt and real-time time display, which can be selected and controlled by keyboard

a/d conversion can adopt the low-cost and universal 8-bit successive approximation ADC ADC, namely mobile ADC, which is the abbreviation of application data center. In fact, it is the evolution of the combination of ASP mode and IDC business. It is a mobile information product business launched by China Mobile, which is mainly aimed at small and medium-sized enterprises and belongs to the industry application of mobile information. The business mainly includes mobile OA, mailbox Four industry application hosting solutions, including wireless station and mobile inventory. AD conversion is analog-to-digital conversion. As the name suggests, it is to convert analog signals into digital signals., It is suitable for data acquisition, and the conversion time can reach 100 US 32 Krom and RAM are extended outside the system for caching data and storing programs. The LCD adopts the d44780 of Hitachi series products, which can display 16 words × 2-line character module. The time chip adopts m48t86, which has the function of real-time time time and calendar display. As a thermoplastic, our products are one of the strongest plastics in a workshop and a series. The whole system adopts the full address decoding method, and the external equipment and memory are uniformly addressed

3.3 software design of the system

3.3.1 traditional program flow

the program of a typical single chip microcomputer data acquisition system usually includes input/output control, data processing and display, keyboard management and other modules. The program adopts the circulation mode, and the process is shown in Figure 3

it can be seen that the traditional program is based on the single task mechanism, and each module forms a whole and runs as a task. In practical application, the security of this program is poor. As long as a system design module makes a mistake, the work of the whole system will be disrupted, and only the watchdog can be used to reset. For complex systems, the watchdog will frequently reset in actual operation. And because the frequency of data acquisition and keyboard program execution may vary a lot, so the timing requirements of the system will be very high, and the traditional program flow is difficult to meet the real-time performance

3.3.2 uCOSII based system program flow

uCOSII based program flow is shown in Figure 4. In the program, each module corresponds to a task, which is parallel to each other, but each module corresponds to a different priority, which is scheduled by the operating system. The system can monitor the work of other modules through the monitoring module, so as to reduce the reset times of the watchdog. Moreover, through the task scheduling of uCOSII kernel, the real-time performance of the system will be improved a lot

3. 4 division and composition of tasks

the parallel tasks in the system are: display task, keyboard management task, output task, data acquisition task and data processing task from high to low priority. The system adopts static priority, so the control of the system will be relatively simple

each task in the system includes three parts: application program, task stack and task control block (TCB). The task control block is a data structure. UCOSII uses it to save the state of the task when the CPU usage right of the task is deprived. When the task regains CPU usage, the task control block can ensure that the task is executed from the point of interruption. The operating system can manage the task by querying the content of the task control block. There are five states of tasks in the system: sleep state, ready state, running state, interrupted service and waiting state. The transition between States is shown in Figure 5

in the sleep state, the task resides in the program space and has not been handed over to uc/os2ii for management. Once the task is established, it enters the ready state. The task with the highest priority in the ready state is changed to the running state. If the operation of the system causes the priority of a task in the ready state to be higher than the priority of the task in the running state, the system will make the running task lose control of the CPU through scheduling, turn to the waiting state or ready state, and then run the task in the ready state. In this way, the task switching is realized

each task in the waiting state corresponds to a waiting time. The time management function can turn the task in the waiting state whose waiting time has passed into the ready state, which is actually the interrupt service program of clock interrupt

3.5 task communication and scheduling

the communication between tasks in this system is completed by message queue. Message queue is a communication mechanism in uc/os2ii, which enables one task or interrupt service subroutine to send variables defined in pointer mode to another task. For convenience and ease of use, message queue is used for communication between data acquisition tasks, data processing tasks, keyboard management tasks, output tasks, and display tasks. The system manages message queues through queue control blocks, and each message queue corresponds to a queue control block. The access of messages is based on the priority principle. The task with the highest priority in the waiting task list in the queue control block first fetches messages from the message queue. The system adopts a preemptive kernel, and the scheduling function always ensures that the task with the highest priority in the ready state turns into the running state. When the ready task preempts the CPU, the system executes an interrupt service program. When the message in the task is sent and the interrupt returns, the system calls the scheduling function to change the task from the waiting state to the ready state, so that the highest priority of the task in the ready state will change, thereby affecting the task switching between the running state and the ready state

4 working process of the system

the system uses two ways to display the size of the acquisition current, cyclic display and specified display. Under normal working conditions, the cyclic display mode is used to display the size of 8-channel acquisition current. After each circuit of voltage is collected, a message is sent to the data processing task, and after each circuit of data processing task is processed, a message is sent to the display task, Because the priority of keyboard scanning task is the highest than that of data acquisition task, whenever the user selects the keyboard, he will rob the current acquisition task, deal with the voltage that the user needs to select, and display it accordingly. When the collected current exceeds a certain standard, the system will alarm to inform the monitoring personnel. In addition, the system also has a serial 232 interface for communication with the microcomputer to store the historical situation of stray current

5 Conclusion

after debugging, the software and hardware of the system work normally. Experiments show that this system has greatly improved the security and real-time performance compared with the traditional data acquisition system. The data acquisition system includes: visual report definition, audit relationship definition, report approval and release, data filling, data preprocessing, data review, comprehensive query statistics and other functional modules. Expand the coverage of data collection and improve the comprehensiveness, timeliness and accuracy of audit work through the networking and digitization of information collection; Finally, realize the modernization of relevant business work management, standardization of procedures, scientific decision-making and networking of services. It can fully meet the needs of complex systems. With the development of network and multimedia technology, the application of embedded system has a broader space

Copyright © 2011 JIN SHI