Weightless training and testing methods for deep reinforcement learning-based energy management strategies
Through the weight-free training method and the regular engine start-stop strategy, the problem of misleading the reward function and time-consuming weight adjustment of the reinforcement learning algorithm in the energy management strategy is solved, and the training speed and control efficiency of the energy management strategy of hybrid electric vehicles are improved.
Patent Information
- Application Number
- CN202311515188.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2043-11-13
AI Technical Summary
Existing reinforcement learning algorithms have problems with misleading reward functions and time-consuming weight adjustments in energy management strategies, resulting in low training efficiency and lack of effective shared experience.
Design an unweighted training method for deep reinforcement learning energy management strategy. By eliminating the optimization terms of instantaneous fuel consumption and SOC deviation, a regular engine start-stop strategy is introduced, and the best operating curve of the engine and fuel consumption rate are used to guide the agent. Explore the optimal strategy and combine Python and Simulink environments for joint simulation training and hardware-in-the-loop testing.
It improves the training speed and control efficiency of the energy management strategy, reduces the dependence on weight adjustment, and achieves more efficient fuel economy and maintenance of SOC status.
Smart Images

Figure CN118092150B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersection of new energy vehicles and artificial intelligence algorithms, and relates to a weightless training and testing method for a deep reinforcement learning energy management strategy. Background Art
[0002] Pure electric vehicles have attracted the attention of consumers due to their charging prices, environmentally friendly power and suitability for urban driving. Fuel cell vehicles use hydrogen to generate electricity in the fuel cell stack and then drive the electric motor. Hybrid vehicles are at a more advanced technical stage and can meet the requirements of long-distance travel, convenient refueling / charging, energy efficiency and emission reduction. Energy management strategy is one of the core technologies that determine the fuel economy of hybrid vehicles. It is necessary to ensure the optimal energy distribution among multiple energy sources while meeting power requirements and system constraints. In recent years, reinforcement learning has achieved many amazing achievements in fields such as games and autonomous driving, and the research enthusiasm has increased year by year. At the same time, in order to solve the defects of "discrete error" and "dimensionality curse" in traditional reinforcement learning, scholars have begun to pay more attention to deep reinforcement learning algorithms, such as deep value networks, deep deterministic policy gradients, soft actor-critics, etc. However, there are two problems in the actual research process on energy management strategies:
[0003] (1) The SOC deviation term in the reward function may mislead the reinforcement learning agent. Many studies have adopted a reward function that includes instantaneous fuel consumption and state of charge deviation, which may be influenced by the previous algorithm based on the minimum equivalent fuel consumption strategy. In the context of reinforcement learning, the reward value plays a key role in guiding the agent to explore better control strategies. However, this type of defined reward may mislead the training process. For example, when there is already a large gap between the real-time SOC and the target value, any action taken may generate a large reward. Similarly, when the SOC is equal to 40% and 80%, although the deviation from the target value is the same, the optimal action that should be selected will be inconsistent. Due to the empirical influence of traditional energy management strategies, this definition of the reward function may not be applicable to reinforcement learning energy management strategies.
[0004] (2) The traditional training process will consume a lot of energy and time to adjust the weight parameters. Usually, during the normal training process, it is crucial to ensure that the algorithm can converge under the optimization goal. Subsequently, the hybrid system model is checked based on the results. Relying on continuous training and adjustment of weights, the goal is to achieve optimal fuel economy and maintain SOC status. Therefore, weight adjustment is a time-consuming process that relies heavily on personal experience and the computing power of the equipment used. In addition, there is basically no valuable shared experience in terms of weight adjustment skills, especially the weight coefficients in the reward function. Summary of the invention
[0005] In view of this, the purpose of the present invention is to provide a weightless training and testing method for a deep reinforcement learning-based energy management strategy, so that it is suitable for hybrid electric vehicles and can improve the training speed and control efficiency of the energy management strategy.
[0006] In order to achieve the above object, the present invention provides the following technical solutions:
[0007] A weightless training and testing method for a deep reinforcement learning energy management strategy specifically comprises the following steps:
[0008] S1: Modeling of training and test scenarios for simulation environments, combining maps (such as Google Maps, Google Earth) with real data from geographic information systems, using 3D simulation modeling software (such as Matlab, RoadRunner, and UnrealEngine, etc.), modifying the training scenario based on Curved Road in the MathWorks official map, and building a test scenario from a real road, and designing a real-time speed planning method for short-term driving range;
[0009] S2: For various parallel hybrid powertrain configurations equipped with a single motor, a joint simulation training framework based on Python environment and Simulink environment is established, and an interactive data transfer framework is formed through Matlab.engine engine and Matlab function;
[0010] S3: Aiming at the design defects in the previous training methods, a new unweighted training method is designed. After eliminating the optimization items about instantaneous fuel consumption and SOC deviation in the original reward function, a regular engine start-stop strategy is introduced to maintain the SOC change, and the engine's optimal operating curve and fuel consumption rate are used to guide the deep reinforcement learning agent to explore the optimal energy management strategy;
[0011] S4: After the offline simulation training and testing phase, hardware-in-the-loop testing is carried out. The optimal energy management strategy obtained through training is saved as a pth file of the PyTorch tool in the Python environment. The matrix is reconstructed in the form of a Constant constant module in the Simulink environment. The total amount of data is determined by the number of neurons in the two adjacent layers. Through the Huahai RapidU3 automotive-grade controller and the Speedgoat mobile real-time target machine, the hardware-in-the-loop testing, calibration and monitoring of the energy management strategy of the deep reinforcement learning hybrid system are completed by CAN communication.
[0012] Furthermore, in step S1, modeling of training and testing scenarios for the simulation environment specifically includes the following steps:
[0013] S11: Determine the best path from the start point to the end point through a map (such as Google Maps); then, obtain the elevation data of the target path by searching for the target path in a digital globe (such as Google Earth), export the path in KML format, and use a geographic information system to obtain latitude and longitude data; and obtain the terrain features of the area corresponding to the target path. Subsequently, the latitude and longitude information is converted into distance data using the Distance function in the Mapping Toolbox toolset released by MathWorks, and the data is used to recreate the trajectory of the entire path in meters in a Cartesian coordinate system. Next, the path trajectory is converted into an XODR format and imported into the RoadRunner software to draw elements such as the road surface, lane lines, and road boundaries for the target path. After the model is saved as an FBX file and imported into the Unreal Engine modeling software, the terrain modeling tool is used to draw the corresponding terrain features of the surrounding area of the target path. In addition, iconic geographical feature elements are also established. After completing the above process, a 3D test scene model is established, which replicates the real-world target path at a 1:1 ratio.
[0014] S12: The training path is mainly based on the Curved Road scene in the MathWorks official map. Since the original road model is completely closed and absolutely flat, the real-world elevation changes are introduced to simulate the undulating terrain in the real world, and the actual slope is merged with the Z-axis data; in addition, the introduction of the slope leads to a significant height difference between the starting point and the end point in the vertical direction. Therefore, when the vehicle is about to reach the end point, the training of the current round is stopped immediately, and the specific modeling process is the same as the test scenario.
[0015] S13: After completing the 3D modeling of the driving scenario, a method for real-time and local speed planning needs to be designed. When cruise control, lane keeping, speed optimization, and slope utilization are considered, short-term driving speed planning can provide the necessary data interface for subsequent path planning and obstacle avoidance functions when the autonomous driving algorithm is introduced. If there are obstacles ahead, the scope of local speed planning will be further reduced. In addition, considering the actual conditions, such as the field of view of the front camera, the speed planning area will be limited to the future 60 waypoints after the current position. This means that the speed planning for the next 60 meters is based on the real-time maximum longitudinal driving force, maximum longitudinal braking force, road curvature, road slope, and air resistance coefficient. These environmental variables are implicit in the actual target speed trajectory, and the planned short-term speed trajectory fully complies with the mechanical characteristics. At the same time, based on the current speed at each waypoint position within the 60-meter range, it is ensured that the vehicle can stop safely and comfortably in the next 60 meters.
[0016] Further, step S2 specifically includes the following steps:
[0017] S21: Use the PyTorch deep learning toolkit in the Python environment to establish a deep reinforcement learning agent, and build a deep value network algorithm for discrete control and a deep deterministic policy gradient algorithm for continuous control. Except for the output layer, these two have the same fully connected neural network architecture, i.e. 7 / 256 / 128 / 64. The former has a total of 16 neurons in the output layer and does not use activation functions, while the latter has only 1 neuron in the output layer and uses the Sigmoid function to control the output range.
[0018] S22: In the Simulink environment, we combined the Powertrain Blockset tool to build a variety of parallel hybrid powertrain models equipped with a single motor. Due to the different motor layouts, the motor speed and torque states are also quite different during actual operation, so the roles they play in energy management strategies are also different. We use the same reinforcement learning configuration to explore strategies for hybrid powertrains of different configurations.
[0019] S23: Build an interactive joint simulation training architecture. After starting the hybrid power system model of Simulink in the Python environment, keep the two environments running in the appropriate frequency range. In each single-step loop of Python, use the control action from the reinforcement learning agent to rewrite the constant module in the Simulink model, and collect the necessary state information of the hybrid power system at the current moment and transmit it back to Python. It should be noted that the rewriting frequency of the control command to the constant module should be controlled at the millisecond level, otherwise excessive delay will cause system delays.
[0020] Further, in step S3, a weightless training method is designed, which specifically includes the following steps:
[0021] S31: Design a set of rule-based engine start-stop strategies, which not only realizes the integration of learning-based and rule-based control strategies, but also achieves the goal of combining advantages and complementing defects. The design of the rule-based engine start-stop strategy is as follows, mainly involving two key state parameters: required power and battery SOC:
[0022] 1) When the required torque is equal to 0 kW: the engine and motor stop working and the vehicle is at rest;
[0023] 2) When the required torque is less than 0 kW: the engine stops and the vehicle is in regenerative braking mode;
[0024] 3) When the required torque is greater than 0kW, there are two cases:
[0025] ① When the required torque is greater than the maximum torque of the motor, the engine starts and the vehicle is in hybrid drive mode;
[0026] ② When the required torque is less than or equal to the maximum torque of the motor, it is further divided according to the real-time state of the battery SOC, specifically:
[0027] a. The SOC is greater than the upper threshold of 65%, the engine is stopped, and the vehicle is in pure electric mode;
[0028] b. The SOC is less than the lower threshold of 45%, the engine is started, and the vehicle is in driving charging mode;
[0029] c. When SOC is within the threshold range, the rectangular wave concept is combined to keep the engine in the current working state;
[0030] For the deep reinforcement learning algorithm with Markov decision process as the environment, in the normal program running process, only the current and previous engine operating states can be mastered. Once the vehicle is parked for a long time or maintained in regenerative braking mode, the rule-based engine start-stop strategy cannot determine whether the engine should resume operation or remain stopped at the next moment. Therefore, drawing on the idea of rectangular waves, the engine start is regarded as a rising edge, and the engine stop is regarded as a falling edge. At the same time, the driving charging mode with the engine in operation is set to state 1, the pure electric drive mode with the engine in a stationary state is set to state 0, and the remaining states are set to transient states. By recording and comparing the difference in the number of rising edges and falling edges, the engine working state multiple time steps ago in the Markov decision process can be judged.
[0031] S32: The design goal of the hybrid system energy management strategy requires maintaining the state of charge while improving fuel economy. However, the reinforcement learning agent will generate corresponding actions at every allowed moment during operation, and it is difficult to learn when to stop the engine. Therefore, by combining with the rule-based engine start-stop strategy, the hybrid system can dynamically switch driving modes according to the real-time required torque and SOC conditions, ensuring that the engine is started for charging or supplementing torque only when the required torque is high or the SOC is low, thereby minimizing the unnecessary running time of the engine. In addition, if the reward function only includes instantaneous fuel consumption, the trained strategy tends to keep the engine's operating point at the bottom of the fuel consumption graph. Therefore, to solve this problem, an unweighted reward function is designed. By considering the engine's optimal operating curve and fuel consumption rate, the optimal operating curve is used as expert experience to guide the reinforcement learning agent to select the best action according to the engine characteristics. However, by expressing the different actions that may appear on both sides of the optimal value in the form of deviations, after adding the fuel consumption rate term, the reinforcement learning agent is able to select the action corresponding to higher efficiency. Therefore, the two optimization terms have equal importance, eliminating the need to introduce weight coefficients. At the same time, in order to optimize the training process, the two optimization items are represented in normalized form, as follows:
[0032]
[0033] Among them, R NEW-EMS represents the unweighted reward function, BSFC represents the fuel consumption rate, BSFC max is the maximum specific fuel consumption, BSFC min is the minimum fuel consumption rate, abs represents the absolute value, T eng is the engine torque, τ is a very small constant that prevents the denominator from becoming zero, T maxeng is the current maximum torque of the engine, T mineng is the current minimum torque of the engine, T OOT It is the torque of the engine's optimal operating curve.
[0034] The beneficial effects of the present invention are that the present invention can be applied to hybrid electric vehicles and deep reinforcement learning-based energy management strategies, thereby improving the training speed and accuracy of energy management measurements.
[0035] Other advantages, objectives and features of the present invention will be described in the following description to some extent, and to some extent, will be obvious to those skilled in the art based on the following examination and study, or can be taught from the practice of the present invention. The objectives and other advantages of the present invention can be realized and obtained through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below in conjunction with the accompanying drawings, wherein:
[0037] Figure 1 It is an overall flow chart of the weightless training and testing method of the deep reinforcement learning energy management strategy of the present invention;
[0038] Figure 2 It is a simulation training and test scenario model of an embodiment of the present invention;
[0039] Figure 3 is a joint simulation data interaction diagram of an embodiment of the present invention;
[0040] Figure 4 It is the P1-P4 hybrid power system configuration of an embodiment of the present invention;
[0041] Figure 5 is a regular engine start-stop strategy according to an embodiment of the present invention;
[0042] Figure 6 It is a schematic diagram of a hardware-in-the-loop experimental device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments only illustrate the basic concept of the present invention in a schematic manner, and the following embodiments and features in the embodiments can be combined with each other without conflict.
[0044] Among them, the drawings are only used for illustrative explanations, and they only represent schematic diagrams rather than actual pictures, and should not be understood as limitations on the present invention. In order to better illustrate the embodiments of the present invention, some parts of the drawings may be omitted, enlarged or reduced, and do not represent the size of actual products. For those skilled in the art, it is understandable that some well-known structures and their descriptions in the drawings may be omitted.
[0045] The same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right", "front", "rear", etc. indicate the orientation or position relationship, they are based on the orientation or position relationship shown in the drawings, which is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operate in a specific orientation. Therefore, the terms describing the position relationship in the drawings are only used for illustrative purposes and cannot be understood as limiting the present invention. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0046] See also Figure 1 to Figure 6 , the present invention provides a weightless training and testing scheme for a deep reinforcement learning-based energy management strategy, such as Figure 1 As shown, it mainly includes the following steps:
[0047] S1: For the training and testing scenarios of the simulation environment, combined with real data from Google Maps, Google Earth and GIS, using Matlab, RoadRunner and Unreal Engine, we modified the training scenario based on Curved Road in the official MathWorks map, and built a test scenario from a real road (from Campus A of Chongqing University to Huxi Campus in Chongqing), and proposed a real-time speed planning method for short-term driving range. The specific steps include:
[0048] S11: A test road from the real world. The best route from the starting point (Zone A of Chongqing University) to the end point (Huxi Campus of Chongqing University) is determined through Google Maps. The total distance is about 23.3 kilometers and the estimated driving time is 36 minutes. Then, the target path is searched in Google Earth to obtain the elevation data of the target path, the path is exported in KML format, and the latitude and longitude data are obtained using the geographic information system. Corresponding to this is Figure 2 The terrain characteristics of the target path in (a) correspond to mountainous terrain and slope change trends. The latitude and longitude information is then converted to distance data using the Distance function in the Mapping Toolbox toolset released by MathWorks, and the data is used to recreate the trajectory of the entire path in meters in a Cartesian coordinate system. Next, the path trajectory is converted to XODR format and imported into the RoadRunner software to plot the target path. Figure 2(b) The road surface, lane lines, and road boundaries are shown in Figure 2. After the model is saved as an FBX file and imported into the Unreal Engine modeling software, the terrain modeling tool is used to draw the corresponding terrain features in the surrounding area of the target path. In addition, iconic geographical features such as the Jialing River, the University Town Tunnel, and the campus shape are also established. After completing the above process, the Figure 2 The 3D test scene model shown in (c) replicates the real-world target path at a 1:1 scale.
[0049] S12: The training path is mainly based on the Curved Road scene in the official MathWorks map, with a total length of about 7 kilometers, and has many curved and even high-curvature road areas. Since the original road model is completely closed and absolutely flat, the real-world elevation changes are introduced to simulate the undulating terrain in the real world, and the actual slope is merged with the Z-axis data. In addition, the introduction of the slope leads to a significant height difference between the start and end points in the vertical direction. Therefore, when the vehicle is about to reach the end point, the training of the current round is stopped immediately. The specific modeling process is the same as the test scenario. The training scenario model is as follows Figure 2 (d) as shown.
[0050] S13: After completing the 3D modeling of the driving scenario, a method for real-time and local speed planning needs to be proposed. When cruise control, speed optimization, and slope utilization are considered, short-term speed planning can provide the necessary data interface for subsequent path planning and obstacle avoidance functions when the autonomous driving algorithm is introduced. If there are obstacles ahead, the scope of local speed planning will be further reduced. Taking into account actual conditions, such as the field of view of the front camera, the speed planning area will be limited to the future 60 waypoints after the current position. This means that the speed planning for the next 60 meters is based on parameters such as the real-time maximum longitudinal driving force, maximum longitudinal braking force, road curvature, road slope, and air resistance coefficient. These environmental variables are implicit in the actual target speed trajectory, and the planned short-term speed trajectory fully complies with the mechanical characteristics. At the same time, based on the current speed at each waypoint position within the 60-meter range, it is ensured that the vehicle can stop safely and comfortably in the next 60 meters.
[0051] S2: For deep reinforcement learning-based energy management strategies, establish Figure 3 The joint simulation training architecture based on Python environment and Simulink environment shown in the figure forms an interactive data transmission architecture through Matlab.engine engine and Matlab function. Specifically, it includes the following steps:
[0052] S21: Use the PyTorch deep learning toolkit in the Python environment to establish a deep reinforcement learning agent, and build a deep value network algorithm for discrete control and a deep deterministic policy gradient algorithm for continuous control. Except for the output layer, these two have the same fully connected neural network architecture, i.e. 7 / 256 / 128 / 64. The former has a total of 16 neurons in the output layer and does not use activation functions, while the latter has only 1 neuron in the output layer and uses the Sigmoid function to control the output range.
[0053] S22: In the Simulink environment, four parallel hybrid powertrain models with single motors were established in combination with the Powertrain Blockset tool, namely Figure 4 The P1-P4 configurations are shown. Due to the different motor layouts, the motor speed and torque states are quite different during actual operation, so the roles they play in energy management strategies are also different. The same reinforcement learning configuration is used to explore strategies for hybrid power systems of different configurations.
[0054] S23: The specific interactive joint simulation training architecture can be elaborated as follows: after starting the hybrid power system model of Simulink in the Python environment, keep the two environments running in the appropriate frequency range at all times, and use the control actions from the reinforcement learning agent to rewrite the constant modules in the Simulink model in each single-step loop of Python, and collect the necessary state information of the hybrid power system at the current moment and transmit it back to Python. It should be noted that the rewriting frequency of the control command to the constant module should be controlled at the millisecond level, otherwise excessive delay will cause system delays.
[0055] S3: In view of the design defects in the previous training methods, a new unweighted training scheme is proposed. After eliminating the optimization items about instantaneous fuel consumption and SOC deviation in the original reward function, a set of self-designed regular engine start-stop strategies is introduced to maintain the SOC variation range, and the engine's optimal operating curve and fuel consumption rate are used to guide the deep reinforcement learning agent to explore the optimal energy management strategy. The specific steps include:
[0056] S31: Design a set of Figure 5 The rule-based engine start-stop strategy shown in the figure not only realizes the integration of learning-based and rule-based control strategies, but also achieves the goal of combining advantages and complementing defects. The design of the rule-based engine start-stop strategy is as follows, mainly involving two key state parameters: required power and battery SOC:
[0057] 1) When the required torque is equal to 0 kW: the engine and motor stop working and the vehicle is at rest;
[0058] 2) When the required torque is less than 0 kW: the engine stops and the vehicle is in regenerative braking mode;
[0059] 3) When the required torque is greater than 0kW, there are two cases:
[0060] ① When the required torque is greater than the maximum torque of the motor, the engine starts and the vehicle is in hybrid drive mode;
[0061] ② When the required torque is less than or equal to the maximum torque of the motor, it is further divided according to the real-time state of the battery SOC, specifically:
[0062] a. The SOC is greater than the upper threshold of 65%, the engine is stopped, and the vehicle is in pure electric mode;
[0063] b. The SOC is less than the lower threshold of 45%, the engine is started, and the vehicle is in driving charging mode;
[0064] c. When SOC is within the threshold range, the rectangular wave concept is combined to keep the engine in the current working state.
[0065] For the deep reinforcement learning algorithm with Markov decision process as the environment, in the normal program running process, only the current and previous engine operating states can be mastered. Once the vehicle is parked for a long time or maintained in regenerative braking mode, the rule-based engine start-stop strategy cannot determine whether the engine should resume operation or remain stopped at the next moment. Therefore, drawing on the idea of rectangular waves, the engine start is regarded as a rising edge, and the engine stop is regarded as a falling edge. At the same time, the driving charging mode with the engine in operation is set to state 1, the pure electric drive mode with the engine in a stationary state is set to state 0, and the remaining states are set to transient states. By recording and comparing the difference in the number of rising edges and falling edges, the engine working state multiple time steps ago in the Markov decision process can be determined.
[0066] S32: The design goal of the hybrid powertrain energy management strategy requires maintaining the state of charge while improving fuel economy. However, the reinforcement learning agent will generate corresponding actions at every allowed moment during operation, and it has difficulty in learning when to stop the engine. Therefore, by combining with the rule-based engine start-stop strategy, the hybrid powertrain can dynamically switch the driving mode according to the real-time required torque and SOC conditions, ensuring that the engine is started for charging or replenishing torque only when the required torque is high or the SOC is low, thereby minimizing the unnecessary running time of the engine. In addition, if the reward function only includes instantaneous fuel consumption, the trained strategy tends to keep the engine's operating point at the bottom of the fuel consumption graph. Therefore, to solve this problem, an unweighted reward function is proposed. By considering the engine's optimal operating curve and fuel consumption rate, the optimal operating curve is used as expert experience to guide the reinforcement learning agent to select the best action according to the engine characteristics. However, by expressing the different actions that may appear on both sides of the optimal value in the form of deviation, after adding the fuel consumption rate term, the reinforcement learning agent can choose the action corresponding to higher efficiency. Therefore, the two optimization terms have equal importance, eliminating the need to introduce weight coefficients. At the same time, in order to optimize the training process, both terms are represented in normalized form.
[0067]
[0068] Among them, BSFC represents the fuel consumption rate, BSFC max is the maximum specific fuel consumption, BSFC min is the minimum fuel consumption rate, abs represents the absolute value, T eng is the engine torque, τ is a very small constant that prevents the denominator from becoming zero, T maxeng is the current maximum torque of the engine, T mineng is the current minimum torque of the engine, T OOT It is the torque of the engine's optimal operating curve.
[0069] S4: For the hardware-in-the-loop test after offline training, the trained policy network is saved as a pth file of the PyTorch tool in the Python environment, and the matrix is reconstructed in the Simulink environment in the form of a Constant module. The total amount of data is determined by the number of neurons in two adjacent layers. Through the Huahai Rapid U3 automotive-grade controller and the Speedgoat mobile real-time target machine, the hardware-in-the-loop test, calibration and monitoring of the energy management strategy of the deep reinforcement learning hybrid system are completed using CAN communication.
[0070] Specifically, the specific connection relationship of the hardware-in-the-loop experiment is as follows Figure 6As shown. The Huahai Rapid U3 automotive-grade controller for the MPC5744P main processor and the Speedgoat mobile real-time target machine with the IO611 board are connected via CAN1 and CAN2. The hybrid system model is compiled into C code using the Speedgoat tool chain and downloaded to the mobile real-time machine. After the energy management strategy is compiled into an S19 format file, it is flashed to the controller through the CAN3 line through the Meca software alone, and the hardware-in-the-loop experiment is adjusted and monitored through CAN3 and Meca. With the Speedgoat mobile real-time target machine as the core device, status information is sent through CAN1 and Rapid U3 and control instructions are received through CAN2.
[0071] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the purpose and scope of the technical solution, which should be included in the scope of the claims of the present invention.
Claims
1. A weightless training and testing method for a deep reinforcement learning energy management strategy, characterized in that: The method specifically comprises the following steps: S1: Establish a simulated road scene for offline iterative training, combine the real data from the map and geographic information system, use 3D simulation modeling software, modify the training scene based on the Curved Road in the MathWorks official map, and build a test scene from the real road, and design a real-time speed planning method for the short-term driving range; S2: For various parallel hybrid powertrain configurations equipped with a single motor, a joint simulation training framework based on Python environment and Simulink environment is established, and an interactive data transfer framework is formed through Matlab.engine engine and Matlab function; S3: Design a non-weighted training method. After eliminating the optimization items about instantaneous fuel consumption and SOC deviation in the original reward function, introduce a regular engine start-stop strategy to maintain the SOC change, and use the engine's optimal operating curve and fuel consumption rate to guide the deep reinforcement learning agent to explore the optimal energy management strategy. In order to optimize the training process, both optimization terms are represented in normalized form as follows: Among them, R NEW-EMS represents the unweighted reward function, BSFC represents the fuel consumption rate, BSFC max is the maximum specific fuel consumption, BSFC min is the minimum fuel consumption rate, abs represents the absolute value, T eng is the engine torque, τ is a very small constant that prevents the denominator from becoming zero, T maxeng is the current maximum torque of the engine, T mineng is the current minimum torque of the engine, T OOT is the torque of the engine's optimal operating curve; S4: After the offline simulation training and testing phase, hardware-in-the-loop testing is carried out. The optimal energy management strategy obtained through training is saved as a pth file of the PyTorch tool in the Python environment. The matrix is reconstructed in the form of a Constant constant module in the Simulink environment. The total amount of data is determined by the number of neurons in the two adjacent layers. Through the Huahai Rapid U3 automotive-grade controller and the Speedgoat mobile real-time target machine, the hardware-in-the-loop testing, calibration and monitoring of the energy management strategy of the deep reinforcement learning hybrid system are completed by CAN communication.
2. The weightless training and testing method according to claim 1, characterized in that: Step S1 specifically includes the following steps: S11: Determine the best path from the start point to the end point through the map; then, obtain the elevation data of the target path by searching the target path in the digital earth, export the path in KML format and use the geographic information system to obtain the latitude and longitude data; and obtain the terrain features of the area corresponding to the target path; then, use the Distance function in the Mapping Toolbox toolset released by MathWorks to convert the latitude and longitude information into distance data, and use the data to recreate the trajectory of the entire path in meters in the Cartesian coordinate system; next, the path trajectory is converted into XODR format and imported into the RoadRunner software, and the road surface, lane lines and road boundaries are drawn for the target path; after the model is saved as an FBX file and imported into the Unreal Engine modeling software, the terrain modeling tool is used to draw the corresponding terrain features of the surrounding area of the target path; in addition, iconic geographical feature elements are also established; after completing the above process, a 3D test scene model is established to replicate the real-world target path at a 1:1 ratio; S12: The training path is based on the Curved Road scene in the MathWorks official map. It introduces real-world elevation changes, simulates real-world undulating terrain, and merges the actual slope with the Z-axis data. In addition, when the vehicle is about to reach the end point, the current round of training is stopped immediately. The specific modeling process is the same as the test scenario. S13: After completing the three-dimensional modeling of the driving scene, design a method that can be used for real-time and local speed planning; when comprehensively considering cruise control, lane keeping, speed optimization and slope utilization, short-term driving speed planning can provide the necessary data interface for subsequent path planning and obstacle avoidance functions when the autonomous driving algorithm is introduced; if there are obstacles ahead, the scope of local speed planning will be further narrowed; in addition, considering the actual conditions, speed planning is performed within the next 60 meters based on the real-time maximum longitudinal driving force, maximum longitudinal braking force, road curvature, road slope and air resistance coefficient; at the same time, based on the current speed of each waypoint position within the 60-meter range, ensure that the vehicle can stop safely and comfortably in the next 60 meters.
3. The weightless training and testing method according to claim 1, characterized in that: Step S2 specifically includes the following steps: S21: Use the PyTorch deep learning toolkit in the Python environment to establish a deep reinforcement learning agent, and build a deep value network algorithm for discrete control and a deep deterministic policy gradient algorithm for continuous control. The two have the same fully connected neural network architecture except for the output layer. The former has a total of 16 neurons in the output layer and does not use activation functions, while the latter has only 1 neuron in the output layer and uses the Sigmoid function to control the output range; S22: In the Simulink environment, multiple parallel hybrid powertrain models with single motors are built in combination with the Powertrain Blockset tool, that is, the same reinforcement learning configuration is used to explore strategies for hybrid powertrains of different configurations; S23: Build an interactive joint simulation training architecture. After starting the hybrid power system model of Simulink in the Python environment, keep the two environments running within the appropriate frequency range at all times. In each single-step loop of Python, use the control actions from the reinforcement learning agent to refresh the constant modules in the Simulink model. At the same time, collect the necessary status information of the hybrid power system at the current moment and transmit it back to Python. It should be noted that the refresh frequency of the control command for the constant module should be controlled at the millisecond level, otherwise excessive delay will cause system delays.
4. The weightless training and testing method according to claim 1, characterized in that: In step S3, a weightless training method is designed, which specifically includes the following steps: S31: Design a set of regular engine start-stop strategies, involving two key state parameters: required power and battery SOC: 1) When the required torque is equal to 0 kW: the engine and motor stop working and the vehicle is at rest; 2) When the required torque is less than 0 kW: the engine stops and the vehicle is in regenerative braking mode; 3) When the required torque is greater than 0kW, there are two cases: ① When the required torque is greater than the maximum torque of the motor, the engine starts and the vehicle is in hybrid drive mode; ② When the required torque is less than or equal to the maximum torque of the motor, it is further divided according to the real-time state of the battery SOC, specifically: a. The SOC is greater than the upper threshold of 65%, the engine is stopped, and the vehicle is in pure electric mode; b. The SOC is less than the lower threshold of 45%, the engine is started, and the vehicle is in driving charging mode; c. When SOC is within the threshold range, the rectangular wave concept is combined to keep the engine in the current working state; For the deep reinforcement learning algorithm with Markov decision process as the environment, the idea of rectangular wave is borrowed, and the engine start is regarded as the rising edge, while the engine stop is regarded as the falling edge; at the same time, the driving charging mode with the engine in operation is set as state 1, the pure electric driving mode with the engine in a stationary state is set as state 0, and the remaining states are set as transient states; by recording and comparing the difference in the number of rising edges and falling edges, the working state of the engine multiple time steps ago in the Markov decision process can be determined; S32: The design goal of the hybrid powertrain energy management strategy requires maintaining the charge state while improving fuel economy. By combining with the rule-based engine start-stop strategy, the hybrid powertrain dynamically switches driving modes according to the real-time required torque and SOC conditions, ensuring that the engine is started for charging or supplementing torque only when the required torque is high or the SOC is low, thereby minimizing unnecessary engine running time; in addition, an unweighted reward function is designed to consider the engine's optimal operating curve and fuel consumption rate, and use the optimal operating curve as expert experience to guide the reinforcement learning agent to select the best action based on the engine characteristics; however, the different actions that may appear on both sides of the optimal value are represented in the form of deviations. After adding the fuel consumption rate term, the reinforcement learning agent can select the action corresponding to higher efficiency.
