In order to shorten the development cycle of the new energy vehicle gateway controller and exploit the control ability of the gateway controller to develop the control algorithm for the global information of the vehicle, a model-based embedded development method is adopted, using Simulink and Stateflow of The MathWorks Company and MicroAutobox II and the implementation of the rapid prototyping hardware platform of dSPACE Company. Control Desk NG, a time management software, builds a gateway controller development platform and designs a gateway controller software based on this platform.Finally, the platform has passed the bench test and vehicle test. The experimental results show that the platform can not only adapt to the frequent changes of functional requirements, but also respond to the needs of experimental verification in the early stage of vehicle development. At the same time, it can provide a platform for subsequent algorithm verification and has good extensibility.
Nowadays, the society is generally facing the problems of energy exhaustion and environmental pollution.Traffic oil is expected to account for more than 62% of global oil consumption by 2020, so countries around the world have increased their investment in the transformation of transportation energy [1].With the characteristics of low emission and high efficiency of comprehensive energy utilization, new energy vehicles have gradually become the focus of global research [2]. Electric vehicles and hybrid electric vehicles have developed rapidly.Developing new energy automobile control technology is the inevitable direction of automobile industry development in the future [3].With the rapid development of electronic technology and communication technology, the field bus network technology is widely used in automobile electronic control system nowadays.The change of automotive communication mode solves the problems of complex lines and increasing wiring harness caused by the increasing number of automotive electronic control units.
It not only greatly improves the communication efficiency, saves costs, and meets the needs of automotive lightweight, but also serves as an important basis for automotive communication and control.Due to the continuous technological innovation, automotive network has the trend of multi-protocol coexistence, so gateway will be an important part of automotive electronics [5].The traditional development mode of automobile electronic control unit is that the automobile manufacturer puts forward functional requirements to the parts developer, then through the quotation of the developer and the signing of the development agreement, waits for the developer to provide the sample, the manufacturer tests, and then puts forward the change demand to the developer when the problem arises, so that the product can be reciprocated until the final completion of the product.This development method not only has a long development cycle and high cost, but also has relatively weak software quality control ability of automobile manufacturers.With the maturity of model-based software development technology and the enrichment of rapid prototyping products, more and more automobile manufacturers choose to build their own electronic control unit development platform in order to accelerate the product development cycle, improve the control ability of parts quality and enhance their market competitiveness.This paper chooses the MATLAB software of American MathWorks Company, the rapid prototyping system development kit of German dSPACE Company, Vehicle Spy3 of British Intrepid and MPC5784G of Netherlands NXP Company to build the gateway development platform, and designs a gateway controller verification platform with two CAN channels.Controller Area Network (CAN) is the current mainstream automobile network, which is widely used in the electrical network of foreign automobiles.It solves the real-time data exchange between different control units and test equipment in modern automobiles.Compared with other on-board bus, CAN bus has the characteristics of high real-time, high reliability, high flexibility, easy implementation and low cost.CAN bus can effectively support distributed control and real-time control, and work in multi-master mode. Any node on the network can actively send information to other nodes on the network at any time without dividing the master and slave. CAN nodes can realize point-to-point, point-to-multipoint and global broadcasting only by filtering the identifier of the message.
The communication medium of CAN bus can be twisted pair, coaxial cable or optical fiber, and the choice is flexible [7].The dSPACE real-time simulation system is a real-time development and testing platform of control system based on matlab/Simulink developed by German dSPACE company. It realizes seamless connection with Matlab/Simulink [8].Rapid Control Prototyping System (RPS) is a very effective and rapid method to develop, optimize and test control strategies without manual programming in real environment.RCP can be used to check and immediately improve design defects.With the implementation software and RTI of dSPACE, the model based on MATLAB/Simulink can be run automatically on the hardware of dSPACE.By using the integrated experimental and testing environment ControlDeskNG, the related variables in the graphical control monitor and adjustment program can be used during the running period.RCP hardware has much more processing power and memory space than the actual product-level electronic control unit (ECU), so hardly any hardware limitations need to be considered.The dSPACE RCP system can be used as an alternative (all-through) or extension (bypass) to ECU.DSPACE provides a variety of ready-made software and hardware components for controller development and design. It is more and more widely used in automotive ECU development [9?11].Therefore, this rapid prototyping product is chosen as the element of platform construction.The real-time control system is composed of various electronic control units in the automobile network.
The communication information between different controllers has a strong timeliness.In addition, a large amount of data exchange is needed between the electronic control units of automobiles, and the information carrying capacity of communication lines is limited. If the increasing number of electronic control units are mounted on the same line, it will easily lead to bus overload, which will lead to the decrease of real-time response speed of the system and the potential safety hazards [12]. ].Therefore, the automobile network needs to be analyzed according to the real-time and data quantity required by the electronic control unit. Different controllers are grouped and mounted on different lines, which can be Flexray, CAN, MOST, LIN, etc. [13].In this paper, the design of gateway controller takes the CAN network of a vehicle as an example. The network is divided into power CAN and body CAN.The electronic control unit on power CAN is mainly related to power control and safety of electric vehicle, including motor control system (MCS), battery management control system (BMS), vehicle controller (VCU), safety air bag control system (ABAG), transmission control system (TCU), electric power steering system (EPS), body dynamic stability system (ESC) and patrol. Speed Control System (STE).The main electronic control units on the body CAN are the combined instrument control system (IPC), the body control system (BCM), and the multimedia control system (MMC).The body power CAN has a high requirement for information timeliness, so it is set as a high-speed CAN, while the body power CAN can be set as a low-speed CAN.The communication network topology of the vehicle electronic system is shown in Figure 1.
After comprehensively analyzing the DBC files and functional requirements of the gateway, the gateway model is built by using the implementation software and real-time interface of dSPACE and combining matlab/Simulink and Stateflow.Based on hierarchical modeling, the gateway is divided into five modules: interrupt processing module, Stateflow information processing module, ECU timeout detection module, power CAN transceiver module and body CAN transceiver module.The interrupt processing module is mainly responsible for processing the receiving interruption and timer interruption of ECU CAN information; Stateflow information processing module is the core part of information processing and processing, and is the brain of gateway controller, thermostatic element which decides how information interacts on two CAN lines.At the same time, it is also the key part of the follow-up control algorithm development; ECU timeout detection module is to judge whether the controller on the network is connected to the line; power CAN transceiver module is responsible for receiving and sending information on the power CAN line; and the body CAN transceiver module is responsible for receiving and sending information on the body CAN line.The gateway model is shown in Figure 2.The information processing module of the gateway core is built by Stateflow.Stateflow is a graphical design and development tool integrated in Simulink, which is suitable for modeling and Simulation of event response system.The so-called event response system refers to those systems which are usually described by some natural language or logical expression.Traditional dynamic transformation systems usually use Simulink’s mathematical expressions, equations and other components of the input/output relationship to model, while event response systems need to use Stateflow to model.Stateflow and Simulink can be seamlessly connected to create a deterministic regulatory control system.By using the visualized model of Stateflow and the visual simulation ability, the complex dynamic logic relationship can be clearly and concisely reflected.
So the key part of gateway is modeled by Stateflow.According to the requirements of functional specifications, the power CAN is activated only when the electric vehicle is in the ignition state.At this time, the gateway receives power information from the power CAN network and forwards the relevant information received from the body network, otherwise the power CAN is in a dormant state.The body CAN is activated at ACC.Under the normal condition of each ECU, the gateway information transmission mode is triggered periodically.When there are ECU timeouts or predefined events, the gateway adopts a fast sending mechanism for related information.The so-called fast-forwarding mechanism is that the relevant information breaks the pre-defined cycle trigger mode of forwarding cycle when the timeout or specific events occur, and adopts short interval and multi-frequency information transmission mode.The periods and times of repeated information transmission are designed according to the importance of information and the bus load rate.The control logic of the information processing module is shown in Figure 3.This section uses ControlDesk to debug the program.ControlDesk is a comprehensive testing and testing software tool developed by dSPACE company for rapid prototyping and hardware in-the-loop testing. It provides comprehensive management of testing process. It can realize visual management of real-time hardware, variable, parameter, automation of testing process, etc.
[8].Firstly, the gateway model of electric vehicle is compiled and generated into SFD format file by using MATLAB.Then the generated files are downloaded to the rapid prototyping hardware platform MicroAutoBox II by ControlDesk and debugged online.In order to monitor and test the program, the gateway software test panel is built by ControlDesk.The test panel can be divided into four parts: the time-out display part to show which ECU receives the time-out information; the parameter setting part to adjust the parameters of the program online, which no longer needs frequent modification of the model, compilation and download. This module has obvious advantages and obvious effects for program debugging; the free variable test part, which is part of the program. It is a variable independent of the program and used to debug the program. The oscilloscope display part can be used to display the receiving and sending status of CAN information, and the display effect is intuitive and clear.The upper computer interface of gateway program test is shown in Figure 4.TargetLink automatic code generation tool is a suite developed by dSPACE company with rapid prototyping products. It can easily and quickly generate product-level C code from the control strategies designed by Simulink and Stateflow.
Compared with manual code, the code generated by TargetLink is faster, more reliable, easier to read, easier to understand and maintain, and can be adapted to a variety of microprocessors and compilers.Before using TargetLink to transform the code of MATLAB model, we must first transform Simulink model into TargetLink model, and then calibrate the variables of TargetLink model and set up simulation settings.There are three levels of simulation of TargetLink model before code conversion: the first stage is Simulink simulation, which aims to verify the correctness of the model, record reference data, and provide data basis for calibration and overflow; the second stage is software simulation in the loop, in essence, it simulates the code generated by TargetLink on PC to verify the correctness of the code and determine the data base for calibration and overflow. Quantitative analysis generates fixed-point code on the impact of the algorithm; the third stage is processor simulation in the loop, essentially in the target board simulation TargetLink generated code, the purpose is to determine the execution time, evaluate RAMROM stack utilization, and finally check the code [16?17].The MPC57xx of NXP adopts Power Architecture? Technology and is a 32-bit MCU with super high reliability for automotive and industrial applications.This series of chips can be compatible with both software and hardware of low-end and high-end products. Embedded flash memory based on high-density floating gate technology can easily meet the functional safety standards, such as ISO 26262 ASIL? D level security integrity requirements.A variety of on-chip redundancy and security options, such as delayed lock-in kernels, DMA controllers, memory protection units, fault acquisition and control units, also have the perfect support of Power Architecture? Tools and software ecological cooperation system.MPC5748G is chosen as the main chip of this platform. Its main frequency is up to 160 MHz. It supports single-precision floating-point operation, 8 KB instruction cache and 4 KB data cache. It supports variable length encoding (VLE) to improve code density. Its memory is up to 6 MB FLASH and 768 KB RAM. It has abundant peripheral resources and supports Ethernet, FlexRay, MOST, CAN and LIN.The TMPC574XG? MB evaluation board of NXP is used in the gateway module.The evaluation system supports full CPU access by users, including all CPU I/O signals and motherboard peripherals.The code generated by TargetLink is not a complete control program. It also needs to integrate, compile and debug the driver and interrupt program of ECU before it can be downloaded to MPC5748G evaluation board.Using NXP development environment S32 Design Studio IDE and Cyclione Universal of PE to complete the generation and debugging of ECU control program.The experimental verification is divided into three stages.The first stage is offline testing.
The software of SDF format generated by the model is tested and adjusted online by using the host computer program written by ControlDesk and Vehicle Spy to ensure that the requirements of functional specifications can be achieved, and the model is modified and perfected according to the experimental results.This stage of testing is mainly carried out by programmers, which belongs to the category of white-box testing.Figure 5 shows the gateway test diagram.The second stage is the bench test, which is generated by the test team professionals according to the functional specifications, and then tested step by step according to the test cases.The information received and transmitted by the control system on the bench is the information generated by the real ECU.Because testers are not familiar with the program, testing at this stage falls into the category of black-box testing.The third stage is the real vehicle test. The generated products are connected to the real vehicle for testing and verification. Through this test procedure, the products can be sent to the parts manufacturer for batch production.This paper combines matlab, dSPACE RCP, Target Link, ControlDesk, Vehicle Spy and MPC5748G into an efficient development platform of electric vehicle gateway, and develops a practical gateway program efficiently and quickly using the platform. Finally, the practicability of the program is verified through three stages of testing.
Developers can shift their focus to the development of control strategies, reduce the time required for manual code writing, and improve work efficiency.The design of control system is based on model.
Compared with code, the model is more intuitive, easy to understand, more convenient to design and expand. At the same time, the code generated by the model has higher readability and is suitable for team development.The internal development control program of automobile manufacturer has perfect test environment, seamless docking between developer and tester, efficient information communication, timely problem feedback, which greatly shortens the product development cycle. At the same time, this customized program can better meet their own needs, make the product have continuity and accelerate the development speed. At the same time, it greatly saves the development cost.Using the control ability of gateway to automobile general information can be used to develop control strategies to meet the verification requirements of automobile manufacturers for third-party parts.