Disclosure of Invention
The invention provides a method for introducing a light sleep mode, a deep sleep mode and a fault detection state into an AUTOSAR-based network management system, aiming at optimizing automobile energy consumption and improving the flexibility of network management.
The technical scheme adopted by the invention is as follows:
The network node state comprises a network mode and a sleep mode, wherein the network node receives and transmits network management messages in the network mode, and when the number of errors of the network management messages transmitted or received exceeds a threshold value or the network management messages with sleep marks are received, the node enters a fault detection state;
the node stops communication work in the sleep mode, if the duration of no communication work exceeds a certain time, the node enters the sleep mode, if the predicted stay time of the node entering the sleep mode is smaller than a preset time, the node enters the light sleep mode, and if the predicted stay time of the node entering the sleep mode is larger than the preset time or the duration of the node entering the light sleep mode exceeds a certain time, the node enters the deep sleep mode.
According to the scheme, after the ECU is powered on, the network node is initialized to enter a light sleep mode;
the node detects an active wake-up request or receives an effective network management message when in a light sleep mode, or receives a specific wake-up request when in a deep sleep mode, and the node enters a repeated message state, wherein the specific wake-up request specifically comprises a power-on signal or a specific hardware reset signal;
When the duration of the repeated message state exceeds the time of the repeated message timer, the node enters a normal operation state if an active network request exists, and enters a sleep preparation state if the active network request does not exist.
According to the scheme, when the node reaches a threshold value in a normal operation state or in the timing time of the repeated message state or the receiving error exceeds the threshold value, or the node receives a network management message with a sleep mark, the node enters a fault detection state;
When the node is in a fault detection state and receives a network management message without a sleep mark, the node enters a sleep preparation state;
If the active network request is not detected and the network management timeout timer is overtime, the node enters a pre-sleep mode;
When the node is in the pre-sleep mode, the active or passive wake-up request is not received any more and the timer is overtime, if the expected stay time is smaller than a certain preset value, the node enters the light sleep mode, and if the expected stay time is larger than a certain preset value, the node enters the deep sleep mode.
According to the scheme, when the node is in the light sleep mode, if an active wake-up request is detected, the node enters a quick sending state in a repeated message state;
when the node is in the light sleep mode, if the node receives an effective network management message, the node enters a normal sending state in the repeated message state, and the node sends the network management message in a normal period;
When the node enters a quick sending state, a counter is started, when the counter is zero, the node enters a normal sending state, and after waiting for a certain time, the node sends a network management message in a normal period.
According to the scheme, if the node receives the network management message of the repeated message request position 1 in the normal operation state or in the sleep state preparation state, the node enters the repeated message state.
According to the scheme, when the node is in the normal operation state, if all network requests are released, the node does not need to actively request the network any more, and immediately enters the state of being ready for sleeping, and simultaneously immediately stops sending the network management message.
According to the scheme, when the node can correctly send the network management message in the fault detection state and can receive the network management message without the sleep mark, the node enters the repeated message state.
According to the scheme, when the node is in the pre-sleep mode, if an active wake-up request is detected, the node enters a rapid sending state of a repeated message state;
When the node is in the pre-sleep mode, if the passive wake-up request is detected, the node enters a normal sending state of the repeated message state.
According to the scheme, the fault detection state introduces a dynamically updated network management table in the network management interface module, wherein the network management table comprises three key fields of a node ID, a time interval and a fault counter, the node ID is used for uniquely identifying each node, the time interval is used for recording the longest interval of messages which each node should send, the fault counter is used for accumulating the times that the nodes do not send messages on time, and when the value of the fault counter exceeds a preset value, the node is judged to be in a fault state.
A computer readable storage medium storing a computer program which, when invoked by a motor controller, implements the AUTOSAR-based improved network management method described above.
The invention has the beneficial effects that:
1. The invention adds a fault detection stage in the original network communication node state, effectively solves the problem that when the node is in a network mode, if the node fails, no network management message is sent, but other nodes confirm that the node is ready for sleeping, and improves the accuracy of network management.
2. The invention introduces light sleep and deep sleep modes, reduces the energy consumption level of the vehicle when not in use, improves the overall energy efficiency, provides more selection space for the AUTOSAR network management system, enables the system to flexibly adjust according to different scenes and requirements, reduces the faults and unstable phenomena caused by frequent awakening and dormancy of the ECU, and improves the flexibility of network management.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
The ignition switch of the vehicle has OFF, ACC, ON, START states, and the ECU in the CAN network is divided into two types, namely I type and II type according to the working state of the ECU after the ignition switch is turned OFF.
A class I ECU which starts communication only when the ignition switch is switched from OFF to ON/ACC, and stops or delays communication for a period of time immediately after the ignition switch is switched from non-OFF to 0 FF;
and the class II ECU CAN still maintain CAN communication when the ignition switch is OFF.
The class I ECU adopts an indirect network management mode, and the class II ECU adopts an AUTOSAR network management mode.
Example 1
The embodiment provides an AUTOSAR-based improved network management method, as shown in figure 1, wherein the network node state comprises a network mode and a sleep mode, a node receives and transmits a network management message in the network mode, and when the error frequency of transmitting or receiving the network management message exceeds a threshold value or the network management message with a sleep mark is received, the node enters a fault detection state;
the node stops communication work in the sleep mode, if the duration of no communication work exceeds a certain time, the node enters the sleep mode, if the predicted stay time of the node entering the sleep mode is smaller than a preset time, the node enters the light sleep mode, and if the predicted stay time of the node entering the sleep mode is larger than the preset time or the duration of the node entering the light sleep mode exceeds a certain time, the node enters the deep sleep mode.
In this embodiment, in order to solve the problem that when a node in a network is in an active state, if a network management message cannot be normally sent due to a sudden failure, other nodes may misuse to prepare the node for entering a sleep state, and a failure detection state is added. To solve this problem, the present embodiment employs introducing a dynamically updated network management table into the network management interface module.
The network management table comprises three key fields, namely a node ID, a time interval and a fault counter, wherein the node ID is used for uniquely identifying each node, the time interval is used for recording the interval of the message which each node should send, and the fault counter is used for accumulating the times that the node does not send the message on time.
When the system is started, all nodes enter a REPEAT state by default, and send network management messages according to a certain sequence. Whenever the network management interface module receives management messages from other nodes, it will record the sender's ID in the network management table (no duplication of records if an ID already exists). Meanwhile, after each successful message reception, the "time interval" and "failure counter" of the corresponding node are reset to 0. If the number of times that a certain node sends or receives a message in a set time interval reaches a certain value, the system considers that the node may have a fault. At this time, if further detection is necessary, the system transmits a network management message in the REPEAT state to the node as a probe. Normally, the node receiving the message will respond to the same REPEAT state management message in the next transmission period, and if the node fails to respond, the corresponding failure counter will be incremented by 1. The above detection process is continued until the value of the fault counter reaches a preset threshold. Once this threshold is reached, the system determines that the node is in a failure state and reports the failure to the application layer.
In this embodiment, a light sleep mode and a deep sleep mode are also introduced. The light sleep mode and the deep sleep mode can carry out reasonable state transition according to the actual running condition and the energy consumption requirement of the automobile. The logic intelligently selects the sleep mode of the ECU based on a variety of factors such as network load, ECU mission priority, vehicle driving status, etc., and configures a timer to set a light sleep timer for transitioning from network mode to light sleep mode, and to set a deep sleep timer for transitioning from light sleep mode to deep sleep mode, and to make state transitions as necessary. In the light sleep mode, the power consumption is lower and the low-limit functions remain active, in which mode the ECU is still able to respond to certain specific types of wake-up signals, such as specific types of network management messages or hardware interrupts. In the deep sleep mode, the operation is stopped, and all unnecessary hardware functions are shut down to save electric energy to the maximum extent. In this mode, the ECU responds to only a few wake-up signals, such as a power-up signal or a specific hardware reset signal.
Example two
In this embodiment, NM is an abbreviation for network management (Network Management).
As yet another embodiment of the present invention, the present embodiment specifically classifies an operation mode of one network node into the following operation modes:
(1) Network Mode (Network Mode)
Nodes in network mode, network communication is in an on or operational mode (including a preparation phase at the start of operation and at the end of operation). The network mode is subdivided into the following four phases:
① REPEAT MESSAGE STATE (repeat message status-RMS)
When a node enters a Network Mode from other modes, the default enters REPEAT MESSAGE STATE, which is a preparation phase before the Network formally begins to work, and is used for waiting for all relevant nodes in the Network to prepare the Network and starting communication. Wherein REPEAT MESSAGE STATE further comprises the following two states:
1) Normal TRANSMIT STATE (Normal transmitting State-NTS)
And when the remote wake-up occurs, entering an NTS state and carrying out passive communication.
2) IMMEDIATE TRANSMIT STATE (Rapid Transmit State-ITS)
And when local wake-up occurs, the ITS state is entered, and active communication is performed.
② Normal Operation State (Normal operating State-NOS)
The node enters Normal Operation State from REPEAT MESSAGE STATE, which is the normal working state of node communication.
③ READY SLEEP STATE (preparation for sleep state-RSS)
After the node is finished, the node enters READY SLEEP STATE from Normal Operation State to prepare to enter sleep. This stage is used to wait for all nodes in the network to complete and then go to sleep uniformly.
④ Fault Detection State (Fault detection state-FDS)
And monitoring the network state and the running state of each node in real time, and rapidly detecting and responding to the faults. When the number of transmission errors or reception errors of the node in the network mode exceeds a threshold value, the node will enter an FDS state and repeatedly transmit FDS messages at intervals in the state. If the message sent by the node is unsuccessful or the network management message cannot be received within the appointed time, the node is not able to normally use bus communication, and the node reports the error to the application layer.
(2) Sleep Mode (Sleep Mode)
The sleep mode is a mode that the node stops working, so that energy consumption can be saved, the final purpose of whole network management is achieved, and the network management work is to manage how each node orderly enters the sleep mode and resumes working state. The node should enter sleep mode by default after power-up or reset. Wherein the sleep mode comprises the following three modes:
① PREPARE SLEEP STATE (Pre-sleep mode-PSS)
The node enters the pre-sleep mode from the ready-to-sleep state of the network mode, which is similar to the role of RSS, but it is already no longer in the network mode and is a further ready stage before formally entering the sleep stage.
② LIGHT SLEEP STATE (light sleep mode-LSS)
In the event that the vehicle has no active signal for a short period of time, a light sleep stage is entered, keeping low-level functions active (e.g., a module that receives a wake-up signal, a time keeping module, etc.). The general application scene is to stop briefly or wait for a short time to start again. The triggering conditions comprise the closing of a vehicle door, flameout of an engine and inactivity of a CAN bus exceeding a set time.
③ DEEP SLEEP STATE (deep sleep mode-DSS)
And when the vehicle has no activity signal for a long time, the vehicle enters a deep sleep stage and stops working. The general applicable scene is long-time parking, no obvious activity signal and longer expected time. The triggering conditions comprise that the CAN bus is inactive for more than a set time, a driver is far away from the vehicle, and the vehicle electric quantity is low.
As shown in fig. 2, each state transition of the network node in this embodiment includes:
1. Powering up the ECU, the ECU will initialize to enter the light sleep mode.
2. When the light sleep exceeds a certain time, the deep sleep mode is entered.
3. The system is powered down.
4. If the node detects an active wake-up request in the light sleep mode, the node must send a network management message to actively wake up the network, and in the process of actively waking up the network, the node must first enter the NM fast transmission state. When a node needs to wake up the network due to an active wake-up request, it must quickly send consecutive NM messages.
5. When the node is in the light sleep mode, if receiving the effective network management message, the node leaves the light sleep mode and enters the NM normal sending state in the repeated message state, after entering the NM normal sending state, the node must send the network management message in a normal period before the timeout of the repeated message timer, and when the node receives the network management message, the first frame message sent by the node to the bus can be the network management message or the application message.
6. When the counter is zero, the node in the NM fast transmitting state enters the NM normal transmitting state and starts to wait for a period of time and then transmits a network management message in a normal period.
7. The active requesting network node in the repeat message state must enter the normal operating state if the repeat message timer REPEAT MESSAGE TIMER expires, but the active network request of the node remains. The node continues to send network management messages and application messages in the normal period.
8. When the node is in the normal operation phase, if the network management message with the repeat message Request bit REPEAT MESSAGE set to 1 is received, the repeat message phase is forced to be re-entered.
9. The node in the duplicate message state, if no active network request is detected, will enter the ready to sleep state once REPEAT MESSAGE TIMER times out.
10. When the node is in the ready-to-sleep state, if a network management message with the repeat message Request bit REPEAT MESSAGE set to 1 is received, the repeat message state is also forced to be re-entered.
11. If the node in the sleep-ready state does not detect an active network request, the node will enter the pre-sleep mode once the network management Timeout Timer NM Timeout Timer expires.
12. And if the node in the pre-sleep mode detects an active wake-up request, the node enters an NM (network management) quick transmission state of a repeated message state.
13. And if the node in the pre-sleep mode receives a passive wake-up request, the node enters an NM normal sending state of the repeated message state.
14. The node in the ready-to-sleep state must immediately enter the normal operating state if an active network request is detected, and must begin sending network management messages and application messages at the normal cycle.
15. A node in a normal operating state, if it releases all network requests and no longer needs to actively request the network, must immediately switch the network management state to a ready-to-sleep state, while the node must immediately stop sending network management messages.
16. The node transmission error reaches or the reception error exceeds a threshold value, and the node enters a fault detection state.
17. The node is in a fault detection state before, and receives a network management message without sleep, and the node enters a state of being ready to sleep.
18. The node receives the network management message with the sleep mark, and the node enters a fault detection state.
19. And in the timing time of the repeated message state, the node sending error reaches or the receiving error exceeds a threshold value, and the node enters a fault detection state.
20. The node can correctly send the network management message and receive the network management message without the sleep mark, and the node enters a repeated message state.
21. If the node in the pre-sleep mode no longer receives an active or passive wake-up request, once the timer expires, the node will enter the light sleep mode with a short expected residence time (less than a certain preset value).
22. If the node in the pre-sleep mode no longer receives an active or passive wake-up request, once the timer expires, the node will enter the deep sleep mode with a longer expected stay time (greater than a certain preset value).
23. And if the node in the deep sleep mode receives a specific wake-up request, the node enters a repeated message state.
In this embodiment, in order to solve the problem that when a node in a network is in an active state, if a network management message cannot be normally sent due to a sudden failure, other nodes may misuse to prepare the node for entering a sleep state, and a failure detection state is added. To solve this problem, this embodiment adopts two strategies:
1. optimizing and creating a sleep mechanism for the vehicle as described above.
2. A dynamically updated network management table is introduced into the network management interface module.
The network management table comprises three key fields, namely a node ID, a time interval and a fault counter, wherein the node ID is used for uniquely identifying each node, the time interval is used for recording the interval of each node which is required to send the message, and the fault counter is used for accumulating the times that the node does not send the message on time.
When the system is started, all nodes enter a REPEAT state by default, and send network management messages according to a certain sequence. Whenever the network management interface module receives management messages from other nodes, it will record the sender's ID in the network management table (no duplication of records if an ID already exists). Meanwhile, after each successful message reception, the "time interval" and "failure counter" of the corresponding node are reset to 0. If the number of times that a certain node sends or receives a message in a set time interval reaches a certain value, the system considers that the node may have a fault. At this time, if further detection is necessary, the system transmits a network management message in the REPEAT state to the node as a probe. Normally, the node that receives this message will respond to the same REPEAT state management message in its next transmission cycle. If the node fails to respond, the corresponding failure counter will increment by 1. The above detection process is continued until the value of the fault counter reaches a preset threshold. Once this threshold is reached, the system determines that the node is in a failure state and reports the failure to the application layer.
In this embodiment, a light sleep mode and a deep sleep mode are also introduced. The light sleep mode and the deep sleep mode can carry out reasonable state transition according to the actual running condition and the energy consumption requirement of the automobile. The logic intelligently selects the sleep mode of the ECU based on a variety of factors such as network load, ECU task priority, vehicle driving status, etc., and configures a timer to set a light sleep timer for transitioning from a ready-to-sleep mode to a light sleep mode, and to set a deep sleep timer for transitioning from a light sleep mode to a deep sleep mode and making state transitions as necessary. In the light sleep mode, the power consumption is lower and the low-limit functions remain active, in which mode the ECU is still able to respond to certain specific types of wake-up signals, such as specific types of network management messages or hardware interrupts. In the deep sleep mode, the operation is stopped, and all unnecessary hardware functions are shut down to save electric energy to the maximum extent. In this mode, the ECU responds to only a few wake-up signals, such as a power-up signal or a specific hardware reset signal.
The transitions between modes are shown in the following table:
Current state of |
Triggering event |
Transition to State |
Network mode |
No network activity and timeout |
Preparing sleep states |
Preparing sleep states |
No network activity and timeout, expected residence time is short |
Light sleep mode |
Preparing sleep states |
No network activity and timeout, expected residence time is longer |
Deep sleep mode |
Light sleep mode |
Specific wake-up signal |
Network mode |
Light sleep mode |
Inactivity and further timeout |
Deep sleep mode |
Deep sleep mode |
Specific wake-up signal |
Network mode |
Example III
Fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present invention, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack-mounted server, a blade server, a tower server, or a rack-mounted server (including an independent server or a server cluster formed by multiple servers), which may execute a program. The computer device 20 of the present embodiment includes at least, but is not limited to, a memory 21, a processor 22, which may be communicatively connected to each other via a system bus, as shown in fig. 3. It should be noted that fig. 3 only shows a computer device 20 having components 21-22, but it should be understood that not all of the illustrated components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the memory 21 (i.e., readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), and the like, and the memory 21 may also be an external storage device of the computer device 20, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD), etc. Of course, the memory 21 may also include both internal storage units of the computer device 20 and external storage devices. In this embodiment, the memory 21 is typically used to store an operating system and various types of application software installed on the computer device 20. Further, the memory 21 may be used to temporarily store various types of data that have been output or are to be output.
Processor 22 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 22 is generally used to control the overall operation of the computer device 20. In this embodiment, the processor 22 is configured to execute the program code stored in the memory 21 or process data to implement an improved network management method based on the AUTOSAR in the present invention.
The embodiment adds the fault detection state in the original network communication node state, effectively solves the problem that when the node is in the network mode, if the network management message is not sent due to the occurrence of the fault, other nodes confirm that the node is ready for sleeping, improves the accuracy of network management, introduces the light sleep mode and the deep sleep mode, reduces the energy consumption level of a vehicle when the vehicle is not used, improves the overall energy efficiency, simultaneously provides more selection space for an AUTOSAR network management system, enables the system to flexibly adjust according to different scenes and requirements, reduces the fault and unstable phenomenon caused by frequent awakening and dormancy of an ECU, and improves the flexibility of network management.
It will be understood that modifications and variations will be apparent to those skilled in the art from the foregoing description, and it is intended that all such modifications and variations be included within the scope of the following claims.