Abstract: This paper introduces the hardware and software design of the power detection system based on LonWorks fieldbus in detail. The object-oriented method is adopted in the software design, and its problem description and theme layer are given.
Keywords: LonWorks fieldbus OOA power detection
The power system is a special type of system with high safety and reliability requirements. The key to achieving this goal is to ensure reliable communication between field devices and achieve comprehensive automation of the distribution network. The power detection system based on LonWorks fieldbus is a subset of the comprehensive automation of distribution network, which completes the collection and monitoring of power grid data. The LonWonrks network connects the control system to the layer area network (LAN) and replaces the workstations in the LAN with network nodes. Each node can realize point-to-point information transmission and has extremely good interoperability, thus enabling the entire network to achieve A truly distributed control model without a center. Therefore, LonWorks bus technology can be used to decompose the entire complex distribution network integrated automatic system into relatively simple subsystems. The LonWorks network adopts all 7-layer protocols of the ISO/OSI model and object-oriented design methods. The network communication design is simplified to parameter settings through network variables. The communication rate is 78.125kbps or 1.25Mbps, and the direct communication distance can reach 2700m. The LonWorks network supports multiple communication media such as twisted pair, through-axis cable, optical fiber, wireless radio frequency, infrared, power line, etc., and is known as a universal control network. At present, more than 2,600 companies have intervened in LonWorks technology in different programs, and more than 1,000 companies have launched LonWorks products and further organized the LowMark Interoperability Association. It has been widely used in building automation, home automation, security systems, office equipment, industrial process control and other industries.
1 Hardware design of power detection system based on LonWorks fieldbus
The LonWorks network system is composed of intelligent nodes, and each intelligent node can have a variety of I/O functions. In this system, the network model based on the LonWorks bus is shown in Figure 1. In the figure, the neuron chip and communication protocol are the technical core of the LonWorks network. The LonWorks network uses the LonTalk protocol, which can be built into the Neuron chip or can be solidified in external memory. The neuron chip uses 3120. It has three 8-bit CPUs. The first one is used to complete the first and second layer functions of the LonTalk protocol and becomes the media access control processor to realize the control and processing of media access; the second one is used to complete the third layer To the function of the sixth layer, it becomes the network processor, which realizes network addressing, processing, background diagnosis, path selection, software timing and network management, and realizes network communication control, sending and receiving data packets, etc.; the third refers to processing The processor executes operating system services and user programs. The chip also has a storage information buffer to realize data transmission between CPUs and serves as a network buffer and application buffer. In the figure, the electric energy detector is responsible for detecting the electric energy parameters of the power grid, collecting the voltage, current, frequency and other variables on the power grid, and can save the data for a long time when the instrument is powered off (the time is determined by the user's requirements and the system storage space) . The specific requirements are: (1) Real-time detection of the frequency of the three-phase voltage and current of A, B, and C; (3) Detection of the active and reactive power of the three-phase A, B, and C; (4) Support of two communication modes: LonWorks Bus mode and RS232 serial mode; (5) Save voltage, current and other data at the hour; (6) Accumulate the total normal operating time and power outage time from the first time the instrument works; (9) Use digital tube display and keyboard input to realize interaction with the user. The user can view and set the operating parameters and historical records of the instrument on site. In the figure, the capacitor bank is used for reactive power compensation of the power grid, and other field devices are other intelligent nodes of power grid automation. Because the system mainly involves the software compilation of the monitoring computer, the interface design between the upper monitoring PC and the neuron chip 3120, and the design of the power detector. These aspects are introduced below.
1.1 Hardware design of power detector
The power detector is essentially an intelligent node of this system. It mainly completes the collection and processing of on-site power data and can transmit the data to the upper monitoring machine according to the requirements of the upper monitoring machine. At the same time, it can also set its working parameters according to the user's requirements. . In this system, according to specific design requirements, the power detector can be divided into voltage and current detection module, frequency detection module, data storage module, multiplex conversion module, transformer module, LonWorks communication module, RS232 communication module and keyboard and display The interface, its principle is shown in Figure 2. The voltage and current detection module is responsible for real-time detection of three-wire voltage and four-wire current; the frequency detection module is responsible for real-time detection of the frequency of three-phase voltage and current of A, B, and C; the RS232 communication module is responsible for the communication between the power detector and the external RS232 network and microcontroller; EEPROM is responsible for long-term storage of historical data such as voltage and current required by the user; the LonWorks communication module is responsible for communicating between the neuron chip and the LonWorks network and microcontroller. RS232 communication module, keyboard and display module, multiplex conversion module and other technologies are very mature and will not be detailed in this article. This article focuses on the LonWorks communication module and voltage and current detection module.
Ordinary digital voltage and ammeters can only measure DC voltage and current. If you want to measure AC voltage and current, you must add an AC/DC converter. It generally has two conversion methods: average value conversion and true effective value conversion. This system uses the true effective value method to detect voltage and current. At its core is the TRMS/DC converter, which is now monolithically integrated. The effective conversion chip in this system uses AD536 from AD Company, which is a low-power, precision TRMS/DC converter; the AD conversion chip uses TLC1543 produced by TI Company, which is a 10-bit ADC with a maximum sampling rate of 66kbps. The voltage and current sampling principle block diagram is shown in Figure 3. In the picture, MC14052 is a dual four-select one multi-channel analog switch. P1.5 and P1.6 of 89C52 are used to select the analog channel of MC14052. At any one time, only one phase voltage and current input channel is gated. Two AD536s perform true effective value conversion on AC voltage and AC current respectively, and the conversion results are sent to the serial A/D chip TLC1543 for analog-to-digital conversion. P1.0~P1.4 of 89C52 controls TLC1543 to complete the sampling process.
The function of the LonWorks communication module is to realize the communication between the neuron chip 3120 and the 89C52 microcontroller and the communication between the neuron chip 3120 and the LonWorks bus. Neuron chips support both serial and parallel operations. For serial operations, the most commonly used method is the I2C bus. In this bus mode, its IO8 and IO9 ports can be defined as I2C bus interfaces (at this time, IO8 is the serial clock line SCA and IO9 is the serial data line SDA). When writing software, you must first define IO8 and IO9 as I2C bus mode, and the definition format is: IO_8 i2c io_ob_ject_name.
Io_object_name is the name of the I/O object. Since IO8 and IO9 are used in pairs, only IO8 needs to be defined. In this system, the parallel method is selected. The neuron chip provides a specialized parallel port communication protocol. There are three parallel port communication modes, namely master, slave A, and slave B modes. Master mode is an intelligent parallel I/O object mode. In this mode, the neuron chip master pair initiates and establishes synchronization operations from the CPU. The slave CPU must be a neuron chip working in slave A mode or simulated slave A mode. The neuron chip working in slave A mode uses the handshake signal line HS, and the data of HS appears in the same clock cycle. Although this mode is mainly used for interfacing with master mode neuron chips, it is also suitable for external CPUs (non-neuron chips). Slave B mode is similar to slave A mode. The difference between them is that the handshake signals of the former appear in different clock cycles, while the latter appear in the same clock cycle. In this mode, the main CPU must be an external CPU. The interface between the external CPU and the neuron chip can use slave A or slave B. In this system, the communication method between 89C52 and neuron chip 3120 adopts parallel mode, and the working mode of 3120 is slave A. Because the handshake signal of the neuron chip 3120 is an open collector, an upper resistor needs to be connected. The hardware makeup port of 89C52 is shown in Figure 4. The Neuron Chip 3120 parallel I/O interface contains 8 I/O data lines and 3 control lines. In slave A mode, IO0~IO7 are data signal terminals, IO8 is CS# signal terminal, IO9 is R/W# signal terminal, IO10 is HS signal terminal, CS# signal is driven by 80C52, which effectively indicates that data transmission is in progress. The lower edge of the pulse writes data into the 80C52 or 3120. The R/W# signal controls the reading and writing of data when CS# is valid, and it is controlled by 80C52. The HS signal is driven by 3120, which notifies 80C52 and 3120 that it is in a busy state. When HS is high level, it means that 3120 is reading and writing data; when HS is low level, it means that 3120 data has been processed and the next communication can be carried out.
The neuron chip uses the token communication protocol to enable multiple devices to share the bus. Only one device can send data to the bus at any time. The virtual write token circulates between 80C52 and 3120. The CPU that obtains the virtual token has the right to send data to the bus. Otherwise data can only be read from the bus. The process is as follows: If 3120 has a virtual token, HS turns high after sending a byte to the bus. After 80C52 takes the data from the bus, HS automatically turns low (completed by the neuron chip firmware) ; If 89C52 has a write token, it will always query IO10 before it makes CS# and R/W# become low level and 3120 takes the data. If it is low, it means that 3120 has taken the data and can send the next word. Festival.
1.2 LonWorks and PC hardware interface design
In this system, the interface between the upper monitoring PC and the neuron chip is completed through the ISA expansion slot, and its schematic diagram is shown in Figure 5. In the figure, GAL16V8 decodes the address lines A0 and A1 of the ISA bus and the write signal line IOW#, with a total of two outputs. One channel is used to strobe the neuron chip, and the other channel is used to control the address latch 74245. When 74245 is strobed, D0 and HS form a direct connection. The PC-side program reads the content of the data line, shields the bits other than D0, and obtains the HS status of the handshake signal of the neuron chip. When 74245 is not strobed, the process proceeds normally. data transmission.
In the PC, only A0~A9 address bits are used to represent the I/O port address, that is, there are 1024 port addresses. The first 512 are used for system circuit boards, and the last 512 are used for expansion slots. When A9=0, it represents the I/O port address on the system board; when A9=1, it represents the port address on the expansion slot interface card. Therefore, when making an interface circuit card, the address must ensure A9=1. Among the 1024 port addresses, many have been occupied by various interface cards produced by IBM or other manufacturers to match the host, and some are reserved for future development. Therefore, the address range that general users can use is: 200~03FF. In this system, after GAV chip decoding, the port addresses of the neuron chip and address latch 74245 are 200H and 201H respectively.
2 Software design of power detection system based on LonWorks fieldbus
The software design of this system mainly includes two parts. The first part is the software design of the lower computer, which mainly completes on-site data collection, processing and storage; configures the working mode of 3120; 80C52 communicates with 3120, transmits data to 3120 and then to the upper monitoring machine, etc. Neuron C programming language is used in this system. Parallel port reading and writing are taken as an example to illustrate its characteristics. To read and write parallel port, first declare the parallel port object with the following statement:
IO_0 parallel slave/slave_b/master io_object_name
Io_in and io_out are used to read and write the parallel port respectively. In order to use the parallel port object, io_in and io_out need to define the parallel_io_interface structure, as shown below:
Struct parallel_io_interface {
Unsigned length;//length of data field
Unsigned data[maxlength];//data field }pio_name;
There are many functions and events inside Neuron C that can easily access neuron chip parallel I/O objects, such as io_in_ready, io_out_request, io_out_ready, etc.
The second part is the software design of the upper monitoring machine. The software design of this system adopts the object-oriented software design method. Since this system is part of the entire distribution automation system, it effectively improves the maintainability and scalability of the system. Object-oriented analysis is aimed at problem domains and systems. It is divided into five levels, namely object-class layer, attribute layer, service layer, structure layer and theme layer. This article will describe the problem domain and subject layer of this system.
The problem domain description is: (1) There is a user registration interface, and the user needs to enter the basic attributes of the on-site substation, including power distribution name, instrument number, detection capacity, line number, etc.; (2) The user can remotely query the on-site instrument information. Operating parameters include measuring range, number of input circuits, reactive power input threshold, input delay, upper and lower voltage limits, etc.; (3) Users can remotely query substation monthly data and hourly data; (4) Users can remotely set substation Operation parameters; (5) Allow users to interrupt communication at any time during communication; (6) Reports can be output according to user query conditions and provide printing functions; (7) Ability to maintain data, such as importing and exporting data; (8) Required to save The user's latest parameter settings can be loaded every time the program is run.
According to the description of the problem domain and the analysis of the object layer, attribute layer and service layer, its main layers are divided into user interface, file system, report output and communication. We attribute the registry and database to the file system because both involve the storage of files. Among them, CregisterTable encapsulates the API functions related to the registry and RegCreateKey, RegOpenKey, RegQueryValue, etc. Cdatabase uses dynamic generation technology to facilitate database configuration. . The description of the topic layer is shown in Figure 6. After object-oriented analysis and design of the system, you can enter into the specific implementation of the software. This system is developed with Visual C++6.0. Since there is a lot of information about VC++ programming, this article will not elaborate on the database configuration, interface configuration, and communication protocol between the host computer and the slave computer.
This system is an electric energy detection system developed by us for a company in Guangdong and has been delivered for use. As a subset of the entire power grid automation, this system uses LonWorks bus and object-oriented technology, so it is easy to expand and maintain. The above describes in detail the software and hardware design of the power monitoring system based on LonWorks. Although it has certain particularities, it still has certain reference significance for the design of other LonWorks bus systems.
Previous article:Design and development of color small long chart paperless recorder
Next article:Infrared telemetry system for battery performance under high-speed rotation
- Popular Resources
- Popular amplifiers
- 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
- Very detailed introductory article FPGA_SOPC_starter
- Start a new ultra-wideband experience and discuss solutions to support chip interoperability
- 【Contactless facial recognition access control system】+ 3-Arduino Bluetooth BLE library
- 24V to 16V circuit problem
- The problem of the propagation speed of electric pulses in wires
- About 15.4stack coordinator mode modification
- Newbie Help
- What is 802.11ay?
- Gizwits Gokit 3.0 Kit Review Summary
- CCS usage problems and solutions