CN117527516A - CAN fault injection method, device, equipment and storage medium - Google Patents
CAN fault injection method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN117527516A CN117527516A CN202311294542.XA CN202311294542A CN117527516A CN 117527516 A CN117527516 A CN 117527516A CN 202311294542 A CN202311294542 A CN 202311294542A CN 117527516 A CN117527516 A CN 117527516A
- Authority
- CN
- China
- Prior art keywords
- fault
- controller
- tested
- message
- fault injection
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000002347 injection Methods 0.000 title claims abstract description 96
- 239000007924 injection Substances 0.000 title claims abstract description 96
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000012360 testing method Methods 0.000 claims abstract description 80
- 238000004088 simulation Methods 0.000 claims description 10
- 238000012986 modification Methods 0.000 claims description 5
- 230000004048 modification Effects 0.000 claims description 5
- 238000004891 communication Methods 0.000 description 18
- 230000005540 biological transmission Effects 0.000 description 7
- 238000010586 diagram Methods 0.000 description 5
- 238000012795 verification Methods 0.000 description 5
- 101150063504 CAN2 gene Proteins 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 239000000243 solution Substances 0.000 description 4
- 101150008604 CAN1 gene Proteins 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 2
- 239000011159 matrix material Substances 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000873 masking effect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0631—Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0677—Localisation of faults
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40208—Bus networks characterized by the use of a particular bus standard
- H04L2012/40215—Controller Area Network CAN
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40267—Bus for use in transportation systems
- H04L2012/40273—Bus for use in transportation systems the transportation system being a vehicle
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The invention discloses a CAN fault injection method, a device, equipment and a storage medium, relating to the field of fault test, wherein the method comprises the following steps: determining a fault type and a controller to be tested based on fault test requirement information, generating a fault message based on the fault type, and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested; according to the invention, the fault message is sent to the controller to be tested through the CAN channel connected with the controller to be tested, so that the controller to be tested is subjected to fault injection, the fault injection efficiency is effectively improved, and the fault test requirement of the vehicle controller is accurately met.
Description
Technical Field
The present invention relates to the field of fault testing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for injecting a CAN fault.
Background
CAN (Controller Area Network) is a communication protocol that is widely used in automobiles and other vehicles and that allows for efficient data exchange and communication between different Electronic Control Units (ECUs) in the vehicle. As electronic systems carried in modern automobiles become more complex and interconnected, so too are the requirements for reliability and safety of the vehicle communication network. To ensure stable operation of the vehicle and safety of passengers, comprehensive testing and verification of the vehicle electronic system is required. Because the complexity of the CAN wire harness is higher and higher, the fault test of the controller unit on the vehicle cannot be effectively performed at present, so that the hidden trouble problem of the vehicle control unit cannot be accurately found.
The foregoing is provided merely for the purpose of facilitating understanding of the technical solutions of the present invention and is not intended to represent an admission that the foregoing is prior art.
Disclosure of Invention
The invention mainly aims to provide a CAN fault injection method, a device, equipment and a storage medium, and aims to solve the technical problem that the hidden trouble problem of a vehicle control unit cannot be accurately found because the prior art cannot effectively perform fault test on the vehicle control unit.
In order to achieve the above object, the present invention provides a CAN fault injection method, which includes the steps of:
determining a fault type and a controller to be tested based on the fault test requirement information;
generating a fault message based on the fault type;
and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested.
Optionally, the generating the fault message based on the fault type includes:
generating an initial message based on the fault type;
determining a CAN channel connected with the controller to be tested;
determining a target message identifier based on the fault type and the CAN channel;
editing the identification of the initial message based on the target message identification to obtain a fault message.
Optionally, the generating an initial message based on the fault type includes:
determining a message format based on the to-be-detected controller;
determining a message data field according to the fault test requirement information;
determining a fault simulation scenario based on the fault type;
determining a frame period according to the fault simulation scene;
and generating an initial message based on the message format, the message data field and the frame period.
Optionally, before the fault message is sent to the to-be-tested controller through the CAN channel connected with the to-be-tested controller to perform fault injection on the to-be-tested controller, the method further includes:
determining a fault event of the controller to be tested based on the fault type;
determining a signal to be shielded and a shielding message identifier corresponding to the signal to be shielded based on the fault event;
and acquiring CAN information to be shielded of the controller to be tested based on the signal to be shielded and the shielding message identifier, and shielding the CAN information to be shielded.
Optionally, before determining the fault type and the controller to be tested based on the fault test requirement information, the method further includes:
obtaining a fault test file;
extracting fault test parameters from the fault test file;
defining structural body variables for the fault test parameters to obtain a test structural body;
and acquiring fault test requirement information based on the test structure body.
Optionally, before the fault message is sent to the controller to be tested through the CAN channel connected with the controller to be tested to perform fault injection on the controller to be tested, the method further includes
Acquiring CAN topology information;
acquiring the topological relation between the controller to be tested and each CAN node based on CAN topological information;
configuring a CAN environment based on the topological relation;
and pre-testing the controller to be tested based on the configured CAN environment.
Optionally, before the fault message is sent to the to-be-tested controller through the CAN channel connected with the to-be-tested controller to perform fault injection on the to-be-tested controller, the method further includes:
modifying CAN information to be sent;
and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested after modification, and judging whether the controller to be tested checks the message integrity.
In addition, in order to achieve the above object, the present invention also proposes a CAN fault injection device, including:
the fault acquisition module is used for determining the fault type and the controller to be tested based on the fault test requirement information;
the message generation module is used for generating a fault message based on the fault type;
and the fault injection module is used for sending the fault message to the controller to be tested through the CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested.
In addition, to achieve the above object, the present invention also proposes a CAN fault injection apparatus comprising: the controller includes a memory, a processor, and a CAN fault injection program stored on the memory and executable on the processor, the CAN fault injection program configured to implement the steps of the CAN fault injection method as described above.
In addition, in order to achieve the above object, the present invention also proposes a storage medium having a CAN fault injection program stored thereon, which when executed by a processor, implements the steps of the CAN fault injection method as described above.
According to the invention, the fault type and the controller to be tested are determined based on the fault test requirement information, a fault message is generated based on the fault type, and the fault message is sent to the controller to be tested through a CAN channel connected with the controller to be tested, so that fault injection is carried out on the controller to be tested; according to the invention, the fault message is sent to the controller to be tested through the CAN channel connected with the controller to be tested, so that the controller to be tested is subjected to fault injection, the fault injection efficiency is effectively improved, and the fault test requirement of the vehicle controller is accurately met.
Drawings
FIG. 1 is a schematic structural diagram of a CAN fault injection device of a hardware operating environment according to an embodiment of the invention;
FIG. 2 is a schematic flow chart of a first embodiment of the CAN fault injection method of the invention;
FIG. 3 is a flow chart of a second embodiment of the CAN fault injection method of the invention;
fig. 4 is a block diagram of a first embodiment of the CAN fault injection apparatus of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
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.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a CAN fault injection device in a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the CAN fault injection apparatus may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a Wireless interface (e.g., a Wireless-Fidelity (Wi-Fi) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the configuration shown in fig. 1 is not limiting of a CAN fault injection apparatus and may include more or fewer components than shown, or certain components in combination, or a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a CAN fault injection program may be included in the memory 1005 as one type of storage medium.
In the CAN fault injection apparatus shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001 and the memory 1005 in the CAN fault injection device of the present invention may be disposed in the CAN fault injection device, where the CAN fault injection device invokes a CAN fault injection program stored in the memory 1005 through the processor 1001, and executes the CAN fault injection method provided by the embodiment of the present invention.
The embodiment of the invention provides a CAN fault injection method, referring to figure 2, figure 2 is a flow chart diagram of a first embodiment of the CAN fault injection method.
In this embodiment, the CAN fault injection method includes the following steps:
step S10: and determining the fault type and the controller to be tested based on the fault test requirement information.
It should be understood that the main body of execution of the method of this embodiment may be a CAN fault injection device having functions of data processing, network communication and program running, such as a computer, or other devices or apparatuses capable of implementing the same or similar functions, and the above CAN fault injection device (hereinafter referred to as a fault injection device) is described herein as an example.
It should be noted that the fault test requirement information may include information about a controller that needs to perform a fault test, a controller node name, information about a fault test item, test environment requirement information, and the like. The fault type may be a test item type that requires a fault test. The controller to be tested may be a vehicle-mounted controller that needs to perform a failure test, such as an engine controller, a vehicle brake controller, a vehicle body controller, and the like.
It can be understood that the fault injection device may obtain the information and parameters such as the identifier of the controller to be tested, the node name, the signal length, the signal name, and the like by obtaining the fault test file, and obtain the fault test requirement information based on the information and parameters.
Further, in order to accurately acquire the information related to the fault requirement, the step S10 may include:
step S101: obtaining a fault test file;
step S102: extracting fault test parameters from the fault test file;
step S103: defining structural body variables for the fault test parameters to obtain a test structural body;
step S104: and acquiring fault test requirement information based on the test structure body.
It should be noted that the fault test file may be a pre-packaged CSV file. The fault test parameters may be parameters in the DBC matrix: ID. Parameters such as node name, signal name, length, start bit, offset, precision, etc.
It can be understood that the fault injection device defines a structural body, wherein members in the structural body comprise contents in CSV files such as ID, node name and the like; defining a structure variable, reading a CSV file, separating by using a separation function, and writing a segmentation result into the defined structure variable.
In a specific implementation, the fault injection apparatus may prepare each parameter in the DBC matrix in advance: ID. Parameters such as node name, signal name, length, start bit, offset, precision, position of the check sum, algorithm and the like are arranged into a CSV file, and when fault injection is needed, fault demand information is obtained by reading the CSV file.
Step S20: and generating a fault message based on the fault type.
It should be noted that, the fault message may be a CAN message for simulating a fault message, and the fault message may be an error flag bit, a bit error, a frame error, a transmission error, and the like. For example, a faulty message may introduce bit errors by changing the values of certain bits, which may cause the recipient to parse out the wrong data or fail to parse correctly.
It will be appreciated that the fault injection device determines message parameters based on the fault type (e.g., the message parameters may include a message ID, data fields, control bits, etc.), determines message values, configures a message format, and constructs a fault message based on the message parameters, the message values, and the message format.
Further, in order to accurately generate the fault message, the step S20 may include:
step S201: generating an initial message based on the fault type;
step S202: determining a CAN channel connected with the controller to be tested;
step S203: determining a target message identifier based on the fault type and the CAN channel;
step S204: editing the identification of the initial message based on the target message identification to obtain a fault message.
It should be noted that, the target message identifier may be a message ID to be modified and edited, and the fault injection device determines information required for fault injection by designing a signal list and a signal value, and selects a message ID corresponding to the fault type.
It will be appreciated that in some cases address conflicts or network conflicts on the CAN bus may occur. By modifying the message ID, the conflict conditions can be simulated, and the stability and the anti-interference capability of the controller to be tested under the environment can be evaluated. In complex vehicle systems, there are multiple controllers operating simultaneously and communicating. By modifying the message ID, messages sent by other controllers can be simulated, and the response and cooperation capability of the controller to be tested to the messages can be tested.
Further, in order to accurately construct the initial message simulating the fault, the step S201 may include:
determining a message format based on the to-be-detected controller;
determining a message data field according to the fault test requirement information;
determining a fault simulation scenario based on the fault type;
determining a frame period according to the fault simulation scene;
and generating an initial message based on the message format, the message data field and the frame period.
It should be noted that, the fault injection device determines the message data field of the fault message according to the fault type to be simulated. For example, if the fault type is a bit error, the value of a particular bit may be modified in the message data field. And determining the frame period of the fault message according to the behavior and influence of the fault. A frame period refers to a time interval or frequency of message transmission. Different types of faults may have different effects on the frame period. For example, certain faults may cause the sending rate of messages to become faster or slower.
It should be understood that the fault injection device may obtain a message parameter and a message value corresponding to the fault type based on the fault type, generate an initial message based on the message parameter and the message value, and the fault simulation parameter may include a message ID, a data field, a control bit, an error flag bit, a timestamp, and the like.
It can be understood that the fault injection device determines specific values of the parameters in the message according to the fault type. For example, for bit errors, the value of a particular bit may be modified; for transmission errors, the situations of message loss or repetition and the like can be simulated.
It should be understood that the fault injection device determines a CAN channel connected to the to-be-detected controller, obtains CAN requirements based on the CAN channel, and configures a frame format of the fault message according to the CAN requirements, including a standard frame or an extended frame, and corresponding control bits and data lengths.
Step S30: and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested.
The fault injection device injects the constructed fault message onto the CAN bus of the vehicle to ensure that the injected fault message is transmitted in the CAN network according to the expectation.
It CAN be understood that the fault injection device performs communication configuration according to the CAN configuration information by determining a CAN communication interface through which the to-be-detected controller performs communication connection, for example, selecting a corresponding CAN communication rate, setting a filter to filter a specific message, and the like, and sends the fault message to the to-be-detected controller through a CAN channel connected with the to-be-detected controller so as to perform fault injection on the to-be-detected controller.
In a specific implementation, the fault injection device simulates the fault of the external device or other controller through fault injection: by modifying the message ID, it is possible to simulate an external device or other controller sending an erroneous or faulty message. This allows the controller under test to be tested for robustness and correctness in handling fault information from other sources.
Simulating network conflicts or address conflicts: in some cases, address conflicts or network conflicts on the CAN bus may occur. By modifying the message ID, the conflict conditions can be simulated, and the stability and the anti-interference capability of the controller to be tested under the environment can be evaluated.
Testing interactions between multiple controllers: in complex vehicle systems, there are multiple controllers operating simultaneously and communicating. By modifying the message ID, messages sent by other controllers can be simulated, and the response and cooperation capability of the controller to be tested to the messages can be tested.
Further, in order to pre-test whether the CAN network has a communication problem, before the step S30, the method may include:
acquiring CAN topology information;
acquiring the topological relation between the controller to be tested and each CAN node based on CAN topological information;
configuring a CAN environment based on the topological relation;
and pre-testing the controller to be tested based on the configured CAN environment.
It should be noted that the fault injection apparatus confirms that all nodes and apparatuses have been correctly connected to the CAN bus by confirming the network connection. Checking whether the physical connection and power supply of each node are normal or not, and verifying whether the connection between the nodes accords with the topology plan or not;
and detecting the CAN communication link, and monitoring the communication link on the CAN bus to ensure that messages between nodes CAN be normally transmitted. Checking the sending and receiving conditions of the message, and verifying the integrity and accuracy of the data;
and verifying the message ID and the data format, monitoring the message sent by each node, and verifying whether the message ID and the data format are consistent with expectations. Ensuring that the message sent by each node meets the specification and system design requirements of the CAN protocol;
and testing the synchronization performance, namely testing the synchronization performance among the nodes by sending a synchronization message. And observing whether each node can receive the synchronous message within a preset time or not, and evaluating the clock synchronization and coordination performance of the system.
Further, in order to verify whether the data is complete in the transmission process, before the step S30, the method may include:
modifying CAN information to be sent;
and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested after modification, and judging whether the controller to be tested checks the message integrity.
It should be noted that, the present embodiment may detect whether the data is bit-erroneous, lost or damaged during the transmission process through the checksum verification. When the sender calculates and appends a checksum to the data, the receiver may use the same verification algorithm to verify the integrity of the data. If the checksums do not match, it is indicated that the data may have been corrupted and appropriate corrective action needs to be taken. The checksum verification may ensure consistency of the data between transmission and reception. If the checksums match, it may be confirmed that the data has not been changed or corrupted during transmission. This is critical to ensure data synchronization and correctness between controllers.
It can be understood that the fault injection device determines whether the controller to be tested has checksum (checksum) verification by traversing all signals of the controller to be tested, thereby determining whether the controller to be tested verifies the message integrity.
According to the embodiment, the fault type and the controller to be tested are determined based on the fault test requirement information, a fault message is generated based on the fault type, and the fault message is sent to the controller to be tested through a CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested; because the fault message is generated and sent to the controller to be tested through the CAN channel connected with the controller to be tested, the fault injection is carried out on the controller to be tested, so that the fault injection efficiency is effectively improved, and the fault test requirement on the vehicle controller is accurately met.
Referring to fig. 3, fig. 3 is a flowchart of a second embodiment of a CAN fault injection method according to the present invention.
Based on the first embodiment, in this embodiment, before step S30, the method includes:
step S31: determining a fault event of the controller to be tested based on the fault type;
step S32: determining a signal to be shielded and a shielding message identifier corresponding to the signal to be shielded based on the fault event;
step S33: and acquiring CAN information to be shielded of the controller to be tested based on the signal to be shielded and the shielding message identifier, and shielding the CAN information to be shielded.
It should be noted that the fault event may be a fault simulation event to be tested corresponding to the fault type. The signal to be shielded may be a message or a message to be shielded. The shielding message identifier may be a message to be shielded or an ID corresponding to the message.
It CAN be understood that, in this embodiment, by determining each signal channel of the communication connection of the to-be-tested controller, determining whether each signal channel is a channel that needs to be tested for faults, determining, based on a determination result, a to-be-tested channel and a to-be-shielded channel in the signal channels, and shielding a message of the to-be-shielded channel, thereby implementing shielding of the to-be-shielded CAN message.
For example, a fault injected controller is on CAN2, which needs to receive all signals on CAN1, while also needing to forward the fault injected controller signal on CAN2 to CAN1. Input mask ID: after 0x216, a signal of 0x216 is not received on CAN2, so as to implement communication loss fault injection for the fault injected controller.
The fault injected controller is at CAN2, which needs to receive all signals on CAN1. The ID may be queried based on the node name, if the ID is known to be negligible. Input ID: and after 0x238, all signals corresponding to the ID are obtained, the identification modification value is changed and confirmed according to the requirement, and finally, after the confirmation signal is clicked and output, the channel ID of the signal received by the fault injection controller can be seen to be modified at trace.
According to the embodiment, a fault event of the controller to be tested is determined based on a fault type, a signal to be shielded is determined based on the fault event, a shielding message identifier corresponding to the signal to be shielded, a CAN message to be shielded of the controller to be tested is obtained based on the signal to be shielded and the shielding message identifier, and the CAN message to be shielded is shielded; because the CAN message to be shielded is shielded, the error operation risk and the test interference are reduced, and the fault test accuracy is effectively improved by limiting the target range of fault injection.
In addition, the embodiment of the invention also provides a storage medium, wherein the storage medium is stored with a CAN fault injection program, and the CAN fault injection program realizes the steps of the CAN fault injection method when being executed by a processor.
Because the storage medium adopts all the technical solutions of all the embodiments, at least all the beneficial effects brought by the technical solutions of the embodiments are not described in detail herein.
Referring to fig. 4, fig. 4 is a block diagram showing the structure of a first embodiment of the CAN fault injection apparatus of the present invention.
As shown in fig. 4, the CAN fault injection apparatus provided in the embodiment of the present invention includes:
a fault acquisition module 10, configured to determine a fault type and a controller to be tested based on the fault test requirement information;
a message generating module 20, configured to generate a fault message based on the fault type;
the fault injection module 30 is configured to send the fault message to the to-be-tested controller through a CAN channel connected to the to-be-tested controller, so as to perform fault injection on the to-be-tested controller.
Further, the message generating module 20 is further configured to generate an initial message based on the fault type; determining a CAN channel connected with the controller to be tested; determining a target message identifier based on the fault type and the CAN channel; editing the identification of the initial message based on the target message identification to obtain a fault message.
Further, the message generating module 20 is further configured to determine a message format based on the to-be-tested controller; determining a message data field according to the fault test requirement information; determining a fault simulation scenario based on the fault type; determining a frame period according to the fault simulation scene; and generating an initial message based on the message format, the message data field and the frame period.
Further, the CAN fault injection apparatus further includes:
a message masking module 40 for determining a fault event of the controller under test based on the fault type; determining a signal to be shielded and a shielding message identifier corresponding to the signal to be shielded based on the fault event; and acquiring CAN information to be shielded of the controller to be tested based on the signal to be shielded and the shielding message identifier, and shielding the CAN information to be shielded.
Further, the fault obtaining module 10 is further configured to obtain a fault test file; extracting fault test parameters from the fault test file; defining structural body variables for the fault test parameters to obtain a test structural body; and acquiring fault test requirement information based on the test structure body.
Further, the fault injection module 30 is further configured to obtain CAN topology information; acquiring the topological relation between the controller to be tested and each CAN node based on CAN topological information; configuring a CAN environment based on the topological relation; and pre-testing the controller to be tested based on the configured CAN environment.
Further, the fault injection module 30 is further configured to modify a CAN message to be sent; and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested after modification, and judging whether the controller to be tested checks the message integrity.
According to the embodiment, the fault type and the controller to be tested are determined based on the fault test requirement information, a fault message is generated based on the fault type, and the fault message is sent to the controller to be tested through a CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested; because the fault message is generated and sent to the controller to be tested through the CAN channel connected with the controller to be tested, the fault injection is carried out on the controller to be tested, so that the fault injection efficiency is effectively improved, and the fault test requirement on the vehicle controller is accurately met.
It should be understood that the foregoing is illustrative only and is not limiting, and that in specific applications, those skilled in the art may set the invention as desired, and the invention is not limited thereto.
It should be noted that the above-described working procedure is merely illustrative, and does not limit the scope of the present invention, and in practical application, a person skilled in the art may select part or all of them according to actual needs to achieve the purpose of the embodiment, which is not limited herein.
In addition, technical details not described in detail in the present embodiment may refer to the CAN fault injection method provided in any embodiment of the present invention, which is not described herein.
Furthermore, it should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. Read Only Memory)/RAM, magnetic disk, optical disk) and including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.
Claims (10)
1. The CAN fault injection method is characterized by comprising the following steps of:
determining a fault type and a controller to be tested based on the fault test requirement information;
generating a fault message based on the fault type;
and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested.
2. The CAN fault injection method of claim 1, wherein the generating a fault message based on the fault type comprises:
generating an initial message based on the fault type;
determining a CAN channel connected with the controller to be tested;
determining a target message identifier based on the fault type and the CAN channel;
editing the identification of the initial message based on the target message identification to obtain a fault message.
3. The CAN fault injection method of claim 2, wherein the generating an initial message based on the fault type comprises:
determining a message format based on the to-be-detected controller;
determining a message data field according to the fault test requirement information;
determining a fault simulation scenario based on the fault type;
determining a frame period according to the fault simulation scene;
and generating an initial message based on the message format, the message data field and the frame period.
4. The CAN fault injection method of claim 1, wherein the CAN channel connected through the to-be-tested controller sends the fault message to the to-be-tested controller, before performing fault injection on the to-be-tested controller, further comprising:
determining a fault event of the controller to be tested based on the fault type;
determining a signal to be shielded and a shielding message identifier corresponding to the signal to be shielded based on the fault event;
and acquiring CAN information to be shielded of the controller to be tested based on the signal to be shielded and the shielding message identifier, and shielding the CAN information to be shielded.
5. The CAN fault injection method of claim 1, wherein before determining the fault type and the controller under test based on the fault test requirement information, further comprising:
obtaining a fault test file;
extracting fault test parameters from the fault test file;
defining structural body variables for the fault test parameters to obtain a test structural body;
and acquiring fault test requirement information based on the test structure body.
6. The CAN fault injection method of claim 1, wherein the CAN channel connected through the controller under test sends the fault message to the controller under test before fault injection is performed on the controller under test, further comprising
Acquiring CAN topology information;
acquiring the topological relation between the controller to be tested and each CAN node based on CAN topological information;
configuring a CAN environment based on the topological relation;
and pre-testing the controller to be tested based on the configured CAN environment.
7. The CAN fault injection method of claim 1, wherein the CAN channel connected through the to-be-tested controller sends the fault message to the to-be-tested controller, before performing fault injection on the to-be-tested controller, further comprising:
modifying CAN information to be sent;
and sending the fault message to the controller to be tested through a CAN channel connected with the controller to be tested after modification, and judging whether the controller to be tested checks the message integrity.
8. A CAN fault injection apparatus, the CAN fault injection apparatus comprising:
the fault acquisition module is used for determining the fault type and the controller to be tested based on the fault test requirement information;
the message generation module is used for generating a fault message based on the fault type;
and the fault injection module is used for sending the fault message to the controller to be tested through the CAN channel connected with the controller to be tested so as to perform fault injection on the controller to be tested.
9. A CAN fault injection apparatus, the CAN fault injection apparatus comprising: a memory, a processor and a CAN fault injection program stored on the memory and executable on the processor, the CAN fault injection program configured to implement the CAN fault injection method of any one of claims 1 to 7.
10. A storage medium, wherein a CAN fault injection program is stored on the storage medium, and when executed by a processor, the CAN fault injection program implements the CAN fault injection method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311294542.XA CN117527516A (en) | 2023-10-08 | 2023-10-08 | CAN fault injection method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311294542.XA CN117527516A (en) | 2023-10-08 | 2023-10-08 | CAN fault injection method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117527516A true CN117527516A (en) | 2024-02-06 |
Family
ID=89755712
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311294542.XA Pending CN117527516A (en) | 2023-10-08 | 2023-10-08 | CAN fault injection method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117527516A (en) |
-
2023
- 2023-10-08 CN CN202311294542.XA patent/CN117527516A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109634258B (en) | Bus message checking method, device and system for hardware-in-loop test | |
CN107943008B (en) | Automated diagnosis test method based on VT system | |
CN110445635B (en) | Control message sending method and device and bus simulation test system | |
CN113572726B (en) | Multimode network control-data plane consistency verification method and device | |
CN111966084A (en) | TBOX detection device and method | |
Dhadyalla et al. | Combinatorial testing for an automotive hybrid electric vehicle control system: a case study | |
CN116107893A (en) | Heterogeneous platform embedded software test verification system and method | |
CN107797540B (en) | Transmission fault testing method and device and terminal | |
CN114816980A (en) | Automatic testing device and method for embedded communication system | |
CN117527516A (en) | CAN fault injection method, device, equipment and storage medium | |
Himmler et al. | Hardware-in-the-Loop Testing in the Context of ISO 26262 | |
CN111142502A (en) | Processing method, device and equipment for ECU detection and storage medium | |
CN113660139B (en) | V2X protocol consistency detection method based on multiple message layer communication | |
CN115348200A (en) | CAN communication function test method and test system | |
CN115685959A (en) | Diagnostic write configuration test method, device, equipment and storage medium | |
CN111786842B (en) | Data processing method and hardware-in-the-loop test system | |
CN111782499A (en) | Test case generation method and system | |
CN115473832B (en) | Internet of vehicles end cloud communication testing method, device, server, client and system | |
CN116866239A (en) | Service interface testing method, device and equipment | |
Muller et al. | A generic framework for failure modes and effects analysis of automotive networks | |
CN116668334A (en) | Test system | |
CN116846775A (en) | Fault tolerance test method and device, electronic equipment and storage medium | |
Anusha et al. | Development of automatic test script generation (ATSG) tool for active safety software validation | |
CN117193042A (en) | Method, device, medium and equipment for comprehensively simulating rocket flight test | |
CN118567974A (en) | Piling-based software integration test method, piling-based software integration test system and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |