1 Introduction
At present, in the field of control, the application of virtual instrument systems is mostly limited to the point-to-point mode of acquisition-feedback-control. For multi-motor systems, especially battery motor systems driven by multiple motors, a large amount of information collection, distributed coordinated control, and real-time response speed are required. In the traditional way, the hardware composition is complex, the wiring is cumbersome, debugging and installation are inconvenient, and it is not easy to expand, and it does not take advantage of the virtual instrument. , Field bus technology and the concept of virtual instruments are well combined, and a set of distributed monitoring system with simple structure, high real-time and strong scalability has been designed, realizing the real-time control and monitoring of multiple motors in a complex control system Digitalization and graphicalization of adjustment and control effects.
2 Proposal of the overall plan
Figure 1 General block diagram of the system
The principle of designing the system is based on the principle of practicality, reliability and economy, to ensure that the system can not only meet the application needs, but also have flexibility, scalability and versatility. The system is optimized by the combination of virtual instrument technology, Modbus bus protocol and CAN bus. The schematic diagram of the system is shown in Figure 1. The system uses a PC to monitor multiple motors, multiple batteries and other auxiliary equipment. It is mainly composed of host computer, battery management system, motor control system, and other auxiliary control systems. The various controllers communicate through the CAN bus to realize the sending and receiving of control commands and the sharing of sensor measurement data, etc., thereby improving the control performance of the system.
The motor controller realizes the functions of collecting the motor's armature current, motor speed, judging the working conditions, receiving the set speed, etc .; the battery management controller realizes the functions of collecting battery temperature, voltage, current, receiving control commands and so on. The upper computer is written in the graphical programming language LabVIEW. The program displays real-time values ​​such as motor speed, vehicle speed, and battery charge state in the form of virtual instruments, and sends control commands to control the state of the motor battery by operating the upper computer. The CAN node is the core part of the system, through which the scattered parts are connected into a unified system. Each CAN node uses a unified hardware platform to achieve different working methods, and each node can independently select the connected equipment and working mode.
3 CAN node hardware design
For the vehicle electronic control unit, in order to simplify the design and improve reliability, the integrated microprocessor with CAN bus controller is used. The microprocessor with CAN bus controller does not occupy the port resources of the processor, which can greatly simplify the design of the interface circuit, reduce the complexity of the program, and improve the stability of the system. This system uses Philips high-performance microcontroller P87C591 . Figure 2 is a functional block diagram of the node hardware design. The node functional requirements and selected microprocessor resources are described as follows:
(1) Full-duplex enhanced UART, with programmable baud rate generator, to complete RS232 / RS485 communication according to the specified Modbus protocol; in hardware implementation, the RS485 bus terminal uses the transceiver MAX481; RS232 bus terminal The transceiver MAX232 is used. In order to realize the switching of serial port channels, a jumper slot is specially set in the system for manual selection. By setting different input signal values, the corresponding data channel is selected.
Figure 2 Node hardware functional block diagram
(2) The microprocessor P87C591 integrates and enhances the function of SJA1000 (independent CAN controller) on the chip, is fully compatible with the CAN2.0 protocol, and can complete the communication tasks such as CAN bus data transmission and reception; PCA82C250, in order to increase the reliability and anti-interference ability of the system, add corresponding photoelectric isolation circuit between P87C591 and PCA82C250. (3) The 10-bit ADC with 6 analog inputs can be set as an 8-bit fast ADC, which can basically meet the accuracy requirements of the system for acquisition and complete the measurement task of the state of the motor and battery; the acquisition of analog signals, The acquisition circuit adjusts (filters, amplifies, converts power) the electrical signals of the sensors at each test point, and then accesses the ADC interface of the microprocessor. To suppress common mode interference, the amplifier basically uses differential input.
(4) Two 8-bit resolution pulse width modulation outputs (PWM) provide control signals for the motor controller to complete the adjustment of the motor speed. Programmable I / O ports (quasi-bidirectional, push-pull, high-impedance, and open-drain) compatible with the 51 series, provide channels for digital signals, and are responsible for reading and setting of switching values.
(5) 16K bytes of internal program memory can meet the program space of this system. The I2C bus serial I / O port with master and slave functions in byte mode can be easily interfaced with peripheral storage chips to realize the data storage function.
In addition to the above main parts, the hardware part also has a power supply circuit, extended memory, and a watchdog circuit. The power supply circuit provides the required isolated power to improve the stability and safety of the node; E2PROM stores some parameters of the system through the I2C serial bus; the watchdog circuit is mainly to ensure the stability of the system operation. Reset the output in case of electricity and alert.
4 System software design
4.1 Design of upper computer software
Virtual instrument software is mainly divided into three levels: user application layer, virtual device driver program layer and hardware device driver layer. The user application layer is closely related to user needs. It mainly completes two tasks: 1. Provide users with a virtual interface of various test instruments, perform human-computer interaction, which is commonly referred to as interface design, and display and collect measured data through it. And status information to provide a platform for the user to interact with the system; second, complete tasks such as data classification, judgment, processing, serial communication, and data access operations.
Figure 3 Schematic diagram of the upper computer program
The device driver of the serial port is completed by VISA. VISA provided by LabVIEW is short for Virtual Instrument Software Architecture. VISA is an interface library for controlling VXI, GPIB, RS232 and other kinds of instruments on all LabVIEW working platforms. VISA is the standard adopted by the 35 largest instrumentation companies that form the VXI plug & play system alliance. By adopting the VISA standard, the driver software can be compatible with each other regardless of time and instrument I / O options.
4.2 Node programming
Figure 4 Node main program block diagram
Figure 4 is the main block diagram. It describes the basic flow of the general module design. According to the state of the read jumper and the state set in the read memory, the role of this module and the working mode of this module are determined. After selecting the working mode, re-initialize each, including I / O port configuration, CAN interrupt settings, acceptance filter settings, serial port working mode settings, timer mode settings, baud rate settings, and serial port I2C Related settings. After completing the initial settings, you can return to the working state and enter their respective main loops. The following describes the implementation of each working mode:
1) Implementation of bus conversion
The design of the universal serial port to CAN interface conversion working mode is mainly to realize the interconnection communication between CAN bus data and RS232 / 485 bus data and the upgrade of the system. Through the built-in CAN controller to control the working state of the bus, combined with the software design, the purpose of universal serial port and CAN interface communication is realized. Modbus stipulates two transmission modes ASCII or RTU, this system chooses to use RTU mode. When the Modbus protocol message and the CAN bus message are converted to each other, because the standard CAN protocol has an 11-bit ID, and the address of the Modbus protocol is one byte, the ID is divided into 3 and 8 bits for easy conversion. 3 bits are used to judge the type of the message, and the last 8 bits are the ID value of each module. For example, when the 11-bit Modbus protocol message is forwarded to the CAN port, the conversion format is specified as shown in Figure 5. When CAN bus forwards to serial port, it needs to go through three processes: collection, queuing and forwarding. The collection is because the return frame operated as the host computer sometimes returns the number of multiple nodes
Figure 5 Modbus11-bit message converted to CAN standard frame
According to data, CAN, as a serial bus, must also notify and receive data from each node that specifies the return value. The queue is because if there is a return request from the host computer, this data is sent first, other data is temporarily stored, and then sent after the return, otherwise it will be considered that the returned value is wrong. The queued data is sent to the upper computer in turn.
2) Realization of monitoring motor
This working mode completes the monitoring of the motor. It must first be initialized including (serial port closed, I2C setting, CAN initialization, setting the receiving filter), after reading the set parameters, it enters the main loop. This node is an intelligent node, which has the ability to independently control the operation of the motor. The host computer is only responsible for sending it the switching value of the control relay on and off and the digital value of the set motor speed. With a fixed working rate, this method can greatly reduce the burden on the bus and improve the real-time performance of the system. As the intelligent node itself, in addition to adjusting the motor according to the preset control algorithm, it is also responsible for collecting the operating state of the motor (current, voltage, temperature, speed), judging the abnormal state, and sending data in real time.
3) Realization of battery monitoring
The motor is driven by the electrical energy provided by the battery. The state of the battery not only reflects its own working state but also indirectly reflects the operating state of the motor. The current, voltage and temperature of the battery have their own thresholds. Under normal operating conditions, each node sends its own status to the upper computer according to the specified timing; when it is in an abnormal working state, the module determines the cause of the problem and takes corresponding Measures, and timely report to the host computer via CAN bus. If it is an irreparable communication error and communication cannot be continued, this node automatically completes the task of shutting down the battery and the motor. The set of drivers automatically quits the work and leaves the motor in a floating state to ensure that the normal running vehicle is not obstructed.
4) Realization of module setting
According to the setting of the jumper, when the program is started, it will determine when to enter the set working mode. When the user needs to set a node, the host computer runs the setting software, the host computer and the module are connected through the serial port, the node enters the set working mode (this mode is set for a single module one by one), the host computer sends the corresponding function code to read Take module parameters and send corresponding function codes to modify module parameters. The module parameters that can be set include the address of the module, the device connected to the module, the baud rate of the serial port to communicate with the device, etc. These parameters are stored in the memory of the I2C interface.
5) Implementation of other standard equipment
The Modbus protocol is an open protocol developed by MODICOM that is supported by many manufacturers. The standard Modbus uses an RS-232C compatible serial interface. The serial communication of this module follows the Modbus protocol, so there is more flexibility in expansion, as long as The upper computer corresponds to a certain program, and the industrial control equipment conforming to the Modbus protocol can be easily connected to the CAN bus through this module.
5 Conclusion
The design idea of ​​combining bus technology and virtual technology makes the system function division clearer, the device function realization more clear, the device external connection more concise, and the system expansion and integration easier. The generalization of the software platform, the standardization of the software protocol, and the unification of the hardware structure are realized, thereby ensuring the portability and scalability of the system, and providing a new idea for the design of the monitoring system. The actual operation of the system shows that the system design is correct, and the real-time, stability and flexibility of the system can meet the design requirements of the vehicle.
The author of this article is innovative: the virtual instrument technology, Modbus protocol and CAN bus form a unified system, and meet various functional requirements on a unified hardware platform.
Mini PC
Are you tired on big and messy wires on traditional computer tower? If yes, mini pc bring clean and space saving working environment back to you. Whatever daily tasks, like browsing web pages, documents checking or making, online teaching or learning, entertainments, etc. Or heavy duty handling, like photshops, video or music editing, gaming, apps developing, engineering drawing, designing jobs, etc. You can always find a right pc mini intel at this store.
Mini PC Office is an most and popular series designed for those who mainly run WPS, photoshops, PR, email, entertainments, etc. Sometimes, also call it as mini pc officeworks or home assistant mini pc.
Mini Gaming PC comes with higher level processors, like intel i3, i5, i7 10th, 11th or 12th; bigger memory and storage, like 16GB or 32GB ram, 512gb up to 1tb. Of course, rich slots support linking with two or more monitors or devices.
Except mini pc windows 11, there are also All In One PC , Student Laptop, Gaming Laptop , Android Tablet, Yoga Laptop , etc.
Mini PC Windows 11,High Performance Mini PC,Mini PC DDR4,PC Mini Intel
Henan Shuyi Electronics Co., Ltd. , https://www.shuyiminipc.com