CN112947151A - Efficient filtering method and device based on vehicle double CAN buses - Google Patents

Efficient filtering method and device based on vehicle double CAN buses Download PDF

Info

Publication number
CN112947151A
CN112947151A CN202110119947.4A CN202110119947A CN112947151A CN 112947151 A CN112947151 A CN 112947151A CN 202110119947 A CN202110119947 A CN 202110119947A CN 112947151 A CN112947151 A CN 112947151A
Authority
CN
China
Prior art keywords
message
network
messages
sending
feature
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.)
Granted
Application number
CN202110119947.4A
Other languages
Chinese (zh)
Other versions
CN112947151B (en
Inventor
张志�
朱宇涛
谭礼晋
王日冬
时鸽
李娜
余博
李超
杨丽萍
姚梁希
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pla 93114
Original Assignee
Pla 93114
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Pla 93114 filed Critical Pla 93114
Priority to CN202110119947.4A priority Critical patent/CN112947151B/en
Publication of CN112947151A publication Critical patent/CN112947151A/en
Application granted granted Critical
Publication of CN112947151B publication Critical patent/CN112947151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/25Pc structure of the system
    • G05B2219/25257Microcontroller
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Abstract

The invention relates to a high-efficiency filtering method and a device based on a vehicle dual CAN bus, wherein the method comprises the following steps: each message sending node sends a message to a message target node in the network through a master network and a slave network of the double CAN buses; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the CAN ID is respectively filled with the feature numbers corresponding to the master network and the slave network; the message target node receives messages through the master network and the slave network respectively, and after independent hardware filtering, the messages which are targeted by the message target node and sent by the master network and the slave network are all placed into a cache queue array; and filtering the messages in the cache queue array according to the CAN ID and the characteristic number in the messages, and filtering out the messages with repeated user data. The invention simplifies the data processing mode under the dual CAN redundant architecture model, avoids the problems of message repetition and loss, and achieves the purpose of high reliability of the redundant network system.

Description

Efficient filtering method and device based on vehicle double CAN buses
Technical Field
The invention relates to the technical field of bus communication, in particular to a high-efficiency filtering method and device based on a vehicle dual-CAN bus.
Background
In the CAN bus network architecture of some special vehicles, in order to realize the redundant communication functions of equipment control and state information transmission, improve the communication efficiency and ensure the communication safety and reliability, a dual-CAN redundancy design is mostly adopted. The current typical architecture has two forms of hot backup and full backup, and the hot backup usually determines the health state of a bus by judging the number of error frames of the bus and then determines which bus data is used, so that the packet loss condition when the bus is switched due to a fault exists. The full backup is that the two buses transmit the same message data in real time, namely the two buses work simultaneously, the message data volume received by each network node is twice that of the single bus mode, each message data is repeated once, the redundant data volume is large, the data filtering work load is heavy, and a small amount of message repetition or loss still exists at the moment of fault occurrence. Therefore, under the full backup network architecture, a method for efficiently filtering redundant messages and ensuring that each network node message is not repeated and lost in a typical bus fault state is urgently needed to be solved.
Disclosure of Invention
In view of the foregoing analysis, the present invention aims to provide a method and an apparatus for efficient filtering based on a dual CAN bus of a vehicle, which ensure redundancy of messages in a dual CAN network and ensure processing of instruction repetition or data repetition caused by repeated messages.
The technical scheme provided by the invention is as follows:
the invention discloses a high-efficiency filtering method based on a vehicle double CAN bus, which comprises the following steps:
a message sending step: each message sending node sends a message to a message target node in the network through a master network and a slave network of the double CAN buses; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the CAN ID is respectively filled with the feature numbers corresponding to the master network and the slave network;
a message receiving step: the message target node receives messages through the master network and the slave network respectively, and after independent hardware filtering, the messages which are targeted by the message target node and sent by the master network and the slave network are all placed into a cache queue array; and filtering the messages in the cache queue array according to the CAN ID and the characteristic number in the messages, and filtering out the messages with repeated user data.
Further, the feature numbers corresponding to the master network and the slave network are respectively filled, and the feature numbers comprise: before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; the first characteristic number m and the second characteristic number n are equal and are in the same monotone increasing or monotone decreasing circular change within the range of 0-K according to the sending sequence of the message;
and filling and sending the messages to a sending queue or a sending mailbox of the master network and the slave network at the same time, and keeping synchronous sending of the messages carrying the same user data.
Further, the message receiving step specifically includes:
after each message target node performs hardware filtering on a received message, the message sent by a master network and a slave network which take the message as a target is received, and then the message is put into the same cache queue;
selecting a message data redundancy processing time threshold T;
filtering the message data which are newly added in sequence in the buffer queue within the message data redundancy processing time threshold T;
comparing character strings in the cache queue in sequence, and judging whether CAN IDs in the messages are repeated; if so, searching two messages with the same feature number, keeping one of the messages as a filtering result, removing the feature number, and extracting user data; and if not, respectively removing the characteristic numbers of the messages with the non-repeated CAN IDs and extracting the user data.
Further, the feature numbers corresponding to the master network and the slave network are respectively filled, and the feature numbers comprise: before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; according to the sending sequence of the messages, the first feature number m and the second feature number n are changed in count along with the sent messages; the counting change intervals of the first feature number m and the second feature number n are equal and opposite in trend, and the sum of the first feature number m and the second feature number n carrying the same user data is a fixed value K; i.e., m + n ═ K;
and filling and sending the messages to a sending queue or a sending mailbox of the master network and the slave network at the same time, and keeping synchronous sending of the messages carrying the same user data.
Further, the message receiving step specifically includes:
after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
selecting a message data redundancy processing time threshold T;
message filtering is carried out on message data which are newly added in sequence in a cache queue within a message data redundancy processing time threshold T;
comparing the character strings in sequence to judge whether the CAN ID in the message is repeated;
for the message with repeated CAN ID, searching two messages with the characteristic numbers added as a fixed value K, keeping one of the messages as a filtering result, removing the characteristic numbers, and extracting user data; for the message of which the feature number is not found and is added with other feature numbers to be a fixed value K, determining that the network in the healthy state is the main network or the slave network at present and reporting the network in the fault state according to the fact that the change trend of the feature number in the message repeated by the adjacent CAN ID is in phase with the change trend of the feature number of the message received by the main network or the slave network; meanwhile, receiving the message through the network in a healthy state, removing the feature number, and extracting user data;
and respectively removing the characteristic numbers of the messages with non-repetitive CAN IDs and extracting user data.
Further, the feature numbers corresponding to the master network and the slave network are respectively filled, and the feature numbers comprise: before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; according to the sending sequence of the messages, the first feature number m and the second feature number n are changed in count along with the sent messages; the first feature number m is odd descending or odd ascending change, and the corresponding second feature number n carrying the same message of the user data is even ascending or even descending change with the sum of the first feature number m and a fixed value K; i.e., m + n ═ K; m is an odd number and n is an even number.
And filling and sending the messages to a sending queue or a sending mailbox of the master network and the slave network at the same time, and keeping synchronous sending of the messages carrying the same user data.
Further, the message receiving step specifically includes:
after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
selecting a message data redundancy processing time threshold T;
message filtering is carried out on message data which are newly added in sequence in a cache queue within a message data redundancy processing time threshold T;
judging whether the characteristic number is an odd number or an even number, if so, caching the message received by the main network into a queue array DATA 1; if the number is even, the message is the message received from the network and is cached in a queue array DATA 2;
sequentially judging whether CAN ID repetition exists in the queue array DATA1 and the queue array DATA2, if two messages with the characteristic numbers m + n ═ K exist, and if one message exists, keeping one message as a filtering result, removing the characteristic number, and extracting user DATA; and two messages are deleted from the queue array DATA1 and the queue array DATA 2;
for the residual DATA in the queue array DATA1, judging that the slave network DATA output of the node corresponding to the CAN ID fails at the moment corresponding to the feature number according to the CAN ID and the feature number, and reporting to the network in the fault state; removing the feature number from the message received by the main network, and extracting user data;
and for the residual DATA in the queue array DATA2, judging that the main network DATA transmission of the node corresponding to the CAN ID fails at the moment corresponding to the feature number according to the CAN ID and the feature number, reporting the network in a failure state, removing the feature number from the message received from the network, and extracting the user DATA.
Further, the value range of the preset time threshold T is Tmin < T < Tmax; tmin is the transmission time of the message with the lowest priority in the bus; tmax is the time of K times of continuous transmission of the message with the highest priority.
Further, when the number P of CAN controller filter groups in the hardware filter is smaller than the number Q of CAN IDs of nodes in the network to be communicated, the hardware filter setting method includes the steps of:
grouping the node CAN IDs with the number of Q, dividing the node CAN IDs into P groups with the number of P filter groups, and determining the number of CAN IDs allocated to each filter group { R1,…,Ri,…,RP},
Figure BDA0002921637210000051
For a first filter of the filter group, 1 CAN ID is selected from Q CAN IDs and allocated to the filter, the CAN IDs are used as a first reference, the CAN IDs of the remaining Q-1 nodes and the digital distance of the first reference CAN ID are sequenced, and the R with the longest digital distance with the first reference CAN ID is selected1-1 CAN ID as a node for the filter process;
for the second filter of the filter group, removing the secondSelecting 1 CAN ID from the CAN IDs already selected by a filter to be allocated to the filter, and taking the CAN ID as a second reference to the remaining Q-R1-1 node CAN IDs and second reference CAN IDs are sorted by their numerical distance, and the R with the longest numerical distance from the second reference CAN ID is selected2-1 CAN ID as a node for the filter process;
and sequentially distributing the nodes and determining the corresponding relation between the filter group and the nodes to be processed.
The invention also discloses a filtering device based on the efficient filtering method, which comprises a message sending module and a message receiving module;
the message sending module is used for sending messages to message target nodes in the network through a main network and a slave network of the double CAN buses in each message sending node; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the characteristic numbers corresponding to the master network and the slave network are filled in the CAN ID;
the message receiving module: and each message target node is used for receiving messages through the master network and the slave network respectively, independently performing hardware filtering, then putting the messages which are targeted by the message target nodes and comprise the messages sent by the master network and the slave network into a cache queue array, filtering the messages in the cache queue array according to the CAN ID and the feature number in the messages, and filtering out the messages with repeated user data.
The invention can realize at least one of the following beneficial effects:
the invention simplifies the data processing mode under the dual CAN redundant architecture model, completely avoids the problems of message repetition and loss by firstly carrying out unique processing on the message and then eliminating the redundant message, thereby achieving the purpose of high reliability of the redundant network system.
Drawings
The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, wherein like reference numerals are used to designate like parts throughout.
FIG. 1 is a flow chart of a high-efficiency filtering method according to the present embodiment;
fig. 2 is a connection diagram of the high-efficiency filtering apparatus according to this embodiment.
Detailed Description
The preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form a part hereof, and which together with the embodiments of the invention serve to explain the principles of the invention.
The embodiment discloses a high-efficiency filtering method based on a vehicle dual-CAN bus, as shown in FIG. 1, comprising the following steps:
step S1, message sending step: each message sending node sends a message to a message target node in the network through a master network and a slave network of the double CAN buses; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the CAN ID is respectively filled with the feature numbers corresponding to the master network and the slave network;
step S2, message receiving step: the message target node receives messages through the master network and the slave network respectively, and after independent hardware filtering, the messages which are targeted by the message target node and sent by the master network and the slave network are all placed into a cache queue array; and filtering the messages in the cache queue array according to the CAN ID and the characteristic number in the messages, and filtering out the messages with repeated user data.
A specific scheme of this embodiment:
1) before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; the first characteristic number m and the second characteristic number n are equal and are in the same monotone increasing or monotone decreasing circular change within the range of 0-K according to the sending sequence of the message; the increment or decrement interval can be preset;
more specifically, the designated area contains the information part or the data part of the message; k is 255, the characteristic number is in the range of 0-255, and the characteristic number is monotonically increased along with the transmission of the message at the interval of 1;
preferably, the padding feature number specifies the area as the first byte of the data portion.
2) Filling and sending the messages to a sending queue or a sending mailbox of a main network and a slave network at the same time, and keeping synchronous sending of the messages carrying the same user data;
3) after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
4) selecting a message data redundancy processing time threshold T;
5) filtering the message data which are newly added in sequence in the buffer queue within the message data redundancy processing time threshold T;
comparing character strings in the cache queue in sequence, and judging whether CAN IDs in the messages are repeated; if so, searching two messages with the same feature number, keeping one of the messages as a filtering result, removing the feature number, and extracting user data; and if not, respectively removing the characteristic numbers of the messages with the non-repeated CAN IDs and extracting the user data.
In a specific example of the present solution,
the CAN bus protocol of a user is CAN2.0B, the frame mode is expanded, and the CAN bus protocol has 29-bit CAN ID and 8 bytes of load transmission data; each bus node master control is STM32F429, is provided with two CAN controllers and is accessed to a CAN main network and a CAN slave network through two independent CAN channels.
And each CAN node performs hardware filtering setting on the two CAN controllers according to the equipment message required to be received, and the setting of the two channels is kept consistent.
When a node A on the network needs to send a message X1 to a node B, 1 is added to a first feature number m and a second feature number n which are kept equal, the current value is assumed to be 0X04, then the first byte of the data area of the message is put in, and then the message is sent to CAN channels of a master network and a slave network at the same time, wherein the CAN channels are X11 and X12 respectively.
The CAN main network channel and the CAN slave network channel of the node B respectively receive the messages X11 and X12 and the messages of other network nodes in the network, and after the messages are filtered by hardware, the node B puts the messages X11 and X12 and other messages into a cache queue array DATA [ NUM ].
With the timer, node B periodically processes the DATA in the cache queue array DATA [ NUM ] with T.
By comparing the feature number variable (namely the first byte of the DATA area) of each message in the DATA [ NUM ] in sequence with the character strings, if the messages X11 and X12 with the same feature number variable exist in the time T, the redundant message X12 is eliminated, and finally the uniqueness of the message X1 in the time T is kept.
The first byte of the data removing area, namely the data of the last 7 bytes, is the effective message data set by the user.
In the specific scheme, the data processing mode under the dual-CAN redundant architecture model is simplified, the messages are processed uniquely firstly, and then the redundant messages are eliminated, so that the problems of message repetition and message loss are completely avoided, and the aim of high reliability of a redundant network system is fulfilled.
Another specific scheme of this embodiment:
1) before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; according to the sending sequence of the messages, the first feature number m and the second feature number n are changed in count along with the sent messages; the counting change intervals of the first feature number m and the second feature number n are equal and opposite in trend, and the sum of the first feature number m and the second feature number n carrying the same user data is a fixed value K; i.e., m + n ═ K.
More specifically, the designated area contains the information part or the data part of the message; k is 255, the first feature number m is within the range of 0-255, and monotonically increases along with the transmission of the message at the interval of 1; the second feature number m is within the range of 0-255 and monotonically decreases along with the transmission of the message with the interval of 1; m + n is 255.
2) Filling and sending the messages to a sending queue or a sending mailbox of a main network and a slave network at the same time, and keeping synchronous sending of the messages carrying the same user data;
3) after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
4) selecting a message data redundancy processing time threshold T;
5) message filtering is carried out on message data which are newly added in sequence in a cache queue within a message data redundancy processing time threshold T;
firstly, comparing and judging whether CAN IDs in messages are repeated or not by sequential character strings;
for the message with repeated CAN ID, searching two messages with the characteristic numbers added as a fixed value K, keeping one of the messages as a filtering result, removing the characteristic numbers, and extracting user data; for the message of which the feature number is not found and is added with other feature numbers to be a fixed value K, determining that the network in the healthy state is the main network or the slave network at present and reporting the network in the fault state according to the fact that the change trend of the feature number in the message repeated by the adjacent CAN ID is in phase with the change trend of the feature number of the message received by the main network or the slave network; meanwhile, receiving the message through the network in a healthy state, removing the feature number, and extracting user data;
and respectively removing the characteristic numbers of the messages with non-repetitive CAN IDs and extracting user data.
In the specific scheme, the data processing mode under the dual-CAN redundant architecture model is simplified, the problems of message repetition and loss are completely avoided by carrying out unique processing on the messages and then removing the redundant messages, and the network in a fault state CAN be reported so as to achieve the aim of high reliability of a redundant network system.
Another specific scheme of this embodiment:
1) before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; according to the sending sequence of the messages, the first feature number m and the second feature number n are changed in count along with the sent messages; the first feature number m is odd descending or odd ascending change, and the corresponding second feature number n carrying the same message of the user data is even ascending or even descending change with the sum of the first feature number m and a fixed value K; i.e., m + n ═ K; m is an odd number and n is an even number.
2) Filling and sending the messages to a sending queue or a sending mailbox of a main network and a slave network at the same time, and keeping synchronous sending of the messages carrying the same user data;
3) after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
4) selecting a message data redundancy processing time threshold T;
5) message filtering is carried out on message data which are newly added in sequence in a cache queue within a message data redundancy processing time threshold T;
(1) judging whether the characteristic number is an odd number or an even number, if so, caching the message received by the main network into a queue array DATA 1; if the number is even, the message is the message received from the network and is cached in a queue array DATA 2;
(2) sequentially judging whether CAN ID repetition exists in the queue array DATA1 and the queue array DATA2, if two messages with the characteristic numbers m + n ═ K exist, and if one message exists, keeping one message as a filtering result, removing the characteristic number, and extracting user DATA; and two messages are deleted from the queue array DATA1 and the queue array DATA 2;
(3) for the residual DATA in the queue array DATA1, judging that the slave network DATA output of the node corresponding to the CAN ID fails at the moment corresponding to the feature number according to the CAN ID and the feature number, and reporting to the network in the fault state; removing the feature number from the message received by the main network, and extracting user data;
(4) and for the residual DATA in the queue array DATA2, judging that the main network DATA transmission of the node corresponding to the CAN ID fails at the moment corresponding to the feature number according to the CAN ID and the feature number, reporting the network in a failure state, removing the feature number from the message received from the network, and extracting the user DATA.
In the specific scheme, the data processing mode under the dual-CAN redundant architecture model is simplified, the problems of message repetition and loss are completely avoided by carrying out unique processing on the messages and then removing the redundant messages, and the network in a fault state CAN be reported so as to achieve the aim of high reliability of a redundant network system.
Further, in the above scheme, the value range of the preset time threshold T is Tmin < T < Tmax; tmin is the transmission time of the message with the lowest priority in the bus; tmax is the time of K times of continuous transmission of the message with the highest priority.
Preferably, the lowest priority message transmission time Tmin in the bus is obtained by monitoring through a CAN analyzer or CAN debugging software.
Specifically, the master network and slave network CAN controllers of the same network node have the same hardware filter setting.
More specifically, the hardware filter setting method when the number P of CAN controller filter groups in the hardware filter is smaller than the number Q of CAN IDs of nodes in the network to be communicated, includes the steps of:
grouping the node CAN IDs with the number of Q, dividing the node CAN IDs into P groups with the number of P filter groups, and determining the number of CAN IDs allocated to each filter group { R1,…,Ri,…,RP},
Figure BDA0002921637210000121
For the first filter of the filter group, 1 CAN ID is selected from Q CAN IDs and allocated to the filter, the CAN IDs of the remaining Q-1 nodes are taken as the reference, the numerical distances between the CAN IDs and the reference CAN ID are sequenced, and the R with the longest numerical distance with the CAN ID is selected1-1 CAN ID as a node for the filter process;
for the second filter of the filter group, 1 CAN ID is selected from the CAN IDs which have been selected for removing the first filter and is allocated to the filter, and the remaining Q-R is compared with the CAN ID1-1 node CAN IDs and reference CAN IDs are sorted according to their numerical distance, and the R with the longest numerical distance from the CAN ID is selected2-1 CAN ID as a node for the filter process;
and sequentially distributing the nodes and determining the corresponding relation between the filter group and the nodes to be processed.
Specifically, the digital distance is the number of different data obtained by comparing two CAN IDs according to bits.
The embodiment also discloses a high-efficiency filtering device based on the vehicle dual-CAN bus, which comprises a message sending module and a message receiving module, as shown in FIG. 2;
the message sending module is used for sending messages to message target nodes in the network through a main network and a slave network of the double CAN buses in each message sending node; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the characteristic numbers corresponding to the master network and the slave network are filled in the CAN ID;
the message receiving module: and each message target node is used for receiving messages through the master network and the slave network respectively, independently performing hardware filtering, then putting the messages which are targeted by the message target nodes and comprise the messages sent by the master network and the slave network into a cache queue array, filtering the messages in the cache queue array according to the CAN ID and the feature number in the messages, and filtering out the messages with repeated user data.
The specific technical details and advantageous effects in this embodiment are the same as those in the other embodiments described above, and thus are not repeated herein.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention.

Claims (10)

1. A high-efficiency filtering method based on a vehicle dual CAN bus is characterized by comprising the following steps:
a message sending step: each message sending node sends a message to a message target node in the network through a master network and a slave network of the double CAN buses; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the CAN ID is respectively filled with the feature numbers corresponding to the master network and the slave network;
a message receiving step: the message target node receives messages through the master network and the slave network respectively, and after independent hardware filtering, the messages which are targeted by the message target node and sent by the master network and the slave network are all placed into a cache queue array; and filtering the messages in the cache queue array according to the CAN ID and the characteristic number in the messages, and filtering out the messages with repeated user data.
2. The efficient filtering method according to claim 1, wherein the feature numbers corresponding to the master network and the slave network are respectively filled with feature numbers, comprising: before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; the first characteristic number m and the second characteristic number n are equal and are in the same monotone increasing or monotone decreasing circular change within the range of 0-K according to the sending sequence of the message;
and filling and sending the messages to a sending queue or a sending mailbox of the master network and the slave network at the same time, and keeping synchronous sending of the messages carrying the same user data.
3. The efficient filtering method according to claim 2, wherein the message receiving step specifically comprises:
after each message target node performs hardware filtering on a received message, the message sent by a master network and a slave network which take the message as a target is received, and then the message is put into the same cache queue;
selecting a message data redundancy processing time threshold T;
filtering the message data which are newly added in sequence in the buffer queue within the message data redundancy processing time threshold T;
comparing character strings in the cache queue in sequence, and judging whether CAN IDs in the messages are repeated; if so, searching two messages with the same feature number, keeping one of the messages as a filtering result, removing the feature number, and extracting user data; and if not, respectively removing the characteristic numbers of the messages with the non-repeated CAN IDs and extracting the user data.
4. The efficient filtering method according to claim 1, wherein the feature numbers corresponding to the master network and the slave network are respectively filled with feature numbers, comprising: before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; according to the sending sequence of the messages, the first feature number m and the second feature number n are changed in count along with the sent messages; the counting change intervals of the first feature number m and the second feature number n are equal and opposite in trend, and the sum of the first feature number m and the second feature number n carrying the same user data is a fixed value K; i.e., m + n ═ K;
and filling and sending the messages to a sending queue or a sending mailbox of the master network and the slave network at the same time, and keeping synchronous sending of the messages carrying the same user data.
5. The efficient filtering method according to claim 4, wherein the message receiving step specifically comprises:
after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
selecting a message data redundancy processing time threshold T;
message filtering is carried out on message data which are newly added in sequence in a cache queue within a message data redundancy processing time threshold T;
comparing the character strings in sequence to judge whether the CAN ID in the message is repeated;
for the message with repeated CAN ID, searching two messages with the characteristic numbers added as a fixed value K, keeping one of the messages as a filtering result, removing the characteristic numbers, and extracting user data; for the message of which the feature number is not found and is added with other feature numbers to be a fixed value K, determining that the network in the healthy state is the main network or the slave network at present and reporting the network in the fault state according to the fact that the change trend of the feature number in the message repeated by the adjacent CAN ID is in phase with the change trend of the feature number of the message received by the main network or the slave network; meanwhile, receiving the message through the network in a healthy state, removing the feature number, and extracting user data;
and respectively removing the characteristic numbers of the messages with non-repetitive CAN IDs and extracting user data.
6. The efficient filtering method according to claim 1, wherein the feature numbers corresponding to the master network and the slave network are respectively filled with feature numbers, comprising: before each network node on the double CAN buses sends a message, filling a first feature number m in a designated area in a main network message, and filling a second feature number n in a designated area in a slave network message; according to the sending sequence of the messages, the first feature number m and the second feature number n are changed in count along with the sent messages; the first feature number m is odd descending or odd ascending change, and the corresponding second feature number n carrying the same message of the user data is even ascending or even descending change with the sum of the first feature number m and a fixed value K; i.e., m + n ═ K; m is an odd number and n is an even number.
And filling and sending the messages to a sending queue or a sending mailbox of the master network and the slave network at the same time, and keeping synchronous sending of the messages carrying the same user data.
7. The efficient filtering method according to claim 6, wherein the message receiving step specifically comprises:
after each network node performs hardware filtering on the received messages, the messages sent by a master network and a slave network which take the network nodes as targets are received, and then the messages are put into the same cache queue;
selecting a message data redundancy processing time threshold T;
message filtering is carried out on message data which are newly added in sequence in a cache queue within a message data redundancy processing time threshold T;
judging whether the characteristic number is an odd number or an even number, if so, caching the message received by the main network into a queue array DATA 1; if the number is even, the message is the message received from the network and is cached in a queue array DATA 2;
sequentially judging whether CAN ID repetition exists in the queue array DATA1 and the queue array DATA2, if two messages with the characteristic numbers m + n ═ K exist, and if one message exists, keeping one message as a filtering result, removing the characteristic number, and extracting user DATA; and two messages are deleted from the queue array DATA1 and the queue array DATA 2;
for the residual DATA in the queue array DATA1, judging that the slave network DATA output of the node corresponding to the CAN ID fails at the moment corresponding to the feature number according to the CAN ID and the feature number, and reporting to the network in the fault state; removing the feature number from the message received by the main network, and extracting user data;
and for the residual DATA in the queue array DATA2, judging that the main network DATA transmission of the node corresponding to the CAN ID fails at the moment corresponding to the feature number according to the CAN ID and the feature number, reporting the network in a failure state, removing the feature number from the message received from the network, and extracting the user DATA.
8. The efficient filtering method of claim 3, 5 or 7,
the value range of the preset time threshold value T is Tmin < T < Tmax; tmin is the transmission time of the message with the lowest priority in the bus; tmax is the time of K times of continuous transmission of the message with the highest priority.
9. The high efficiency filtering method according to any one of claims 1 to 7,
when the number P of CAN controller filter groups in a hardware filter is less than the number Q of CAN IDs of nodes in a network to be communicated, the hardware filter setting method comprises the following steps:
grouping the node CAN IDs with the number of Q, dividing the node CAN IDs into P groups with the number of P filter groups, and determining the number of CAN IDs allocated to each filter group { R1,…,Ri,…,RP},
Figure FDA0002921637200000041
For a first filter of the filter group, 1 CAN ID is selected from Q CAN IDs and allocated to the filter, the CAN IDs are used as a first reference, the CAN IDs of the remaining Q-1 nodes and the digital distance of the first reference CAN ID are sequenced, and the R with the longest digital distance with the first reference CAN ID is selected1-1 CAN ID as a node for the filter process;
for the second filter of the filter group, 1 CAN ID is selected from the CAN IDs which are already selected by the first filter and is distributed to the filter, and the CAN ID is taken as a second reference for the rest of Q-R1-1 node CAN IDs and second reference CAN IDs are sorted by their numerical distance, and the R with the longest numerical distance from the second reference CAN ID is selected2-1 CAN ID as a node for the filter process;
and sequentially distributing the nodes and determining the corresponding relation between the filter group and the nodes to be processed.
10. A filtering apparatus based on the efficient filtering method according to any one of claims 1 to 9, comprising a message sending module and a message receiving module;
the message sending module is used for sending messages to message target nodes in the network through a main network and a slave network of the double CAN buses in each message sending node; the user data carried in the messages sent by the master network and the slave network at the same time are the same, the CAN ID corresponding to the message sending node is contained, and the characteristic numbers corresponding to the master network and the slave network are filled in the CAN ID;
the message receiving module: and each message target node is used for receiving messages through the master network and the slave network respectively, independently performing hardware filtering, then putting the messages which are targeted by the message target nodes and comprise the messages sent by the master network and the slave network into a cache queue array, filtering the messages in the cache queue array according to the CAN ID and the feature number in the messages, and filtering out the messages with repeated user data.
CN202110119947.4A 2021-01-28 2021-01-28 Efficient filtering method and device based on double CAN buses of vehicle Active CN112947151B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110119947.4A CN112947151B (en) 2021-01-28 2021-01-28 Efficient filtering method and device based on double CAN buses of vehicle

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110119947.4A CN112947151B (en) 2021-01-28 2021-01-28 Efficient filtering method and device based on double CAN buses of vehicle

Publications (2)

Publication Number Publication Date
CN112947151A true CN112947151A (en) 2021-06-11
CN112947151B CN112947151B (en) 2023-05-12

Family

ID=76238830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110119947.4A Active CN112947151B (en) 2021-01-28 2021-01-28 Efficient filtering method and device based on double CAN buses of vehicle

Country Status (1)

Country Link
CN (1) CN112947151B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111711551A (en) * 2020-05-29 2020-09-25 常州市凯程精密汽车部件有限公司 Parameter configuration method for CAN bus message filter

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944986A (en) * 2009-07-09 2011-01-12 南京南瑞继保电气有限公司 Double network hot standby method
CN103490966A (en) * 2013-10-10 2014-01-01 北京航天发射技术研究所 Dual-redundancy CAN bus data receiving and processing method
CN105743755A (en) * 2016-04-19 2016-07-06 上海君协光电科技发展有限公司 Dual-redundant CAN bus communication system
US20170054574A1 (en) * 2015-08-17 2017-02-23 Marvell World Trade Ltd. Virtual Controller Area Network
CN210225442U (en) * 2019-05-16 2020-03-31 江苏和正特种装备有限公司 double-CAN redundancy system based on full backup

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101944986A (en) * 2009-07-09 2011-01-12 南京南瑞继保电气有限公司 Double network hot standby method
CN103490966A (en) * 2013-10-10 2014-01-01 北京航天发射技术研究所 Dual-redundancy CAN bus data receiving and processing method
US20170054574A1 (en) * 2015-08-17 2017-02-23 Marvell World Trade Ltd. Virtual Controller Area Network
CN105743755A (en) * 2016-04-19 2016-07-06 上海君协光电科技发展有限公司 Dual-redundant CAN bus communication system
CN210225442U (en) * 2019-05-16 2020-03-31 江苏和正特种装备有限公司 double-CAN redundancy system based on full backup

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111711551A (en) * 2020-05-29 2020-09-25 常州市凯程精密汽车部件有限公司 Parameter configuration method for CAN bus message filter

Also Published As

Publication number Publication date
CN112947151B (en) 2023-05-12

Similar Documents

Publication Publication Date Title
CN106850188A (en) A kind of data transmission system based on multichannel isomery one-way transmission path
CN105450489A (en) HEBus efficient fieldbus system for preferably realizing shortest message in output and communication method
CN112468372B (en) Method and device for detecting equipment state in power line communication network
CN108494649B (en) Bus system based on combination of polling and uniform time slot and data transmission method
JPH0216628B2 (en)
KR101858543B1 (en) Packet loss detection method, apparatus, and system
CN111835579B (en) Method and system for testing effectiveness of network traffic scheduling simulation
KR20160096526A (en) Method for diagnosing network and apparatus for the same
CN113242273A (en) Train network, communication method, train, electronic device, and storage medium
CN112019440B (en) CAN bus multicast method based on identifier multiplexing
CN112947151A (en) Efficient filtering method and device based on vehicle double CAN buses
CN106773862A (en) A kind of rectifier combining system and its control method
CN107277886A (en) A kind of internet of things equipment ad hoc network method based on WIFI
CN115022084A (en) Network isolation gatekeeper data exchange method and application thereof
CN109217963B (en) Time alignment method for real-time phasor data of wide area measurement system of power distribution network
CN112346329A (en) RS422 dual-bus system redundancy management method
US8320262B2 (en) Bus system and method and device for transmitting communications on a bus system
CN108259130A (en) The Modbus Transmission systems and method of a kind of baud rate even-odd check position adaptive
CN114301563B (en) Inter-cluster redundancy synchronization circuit, bus system and inter-cluster synchronization method
CN113438056B (en) Fountain code-based Internet of vehicles data transmission method and device and storage medium
CN109379207A (en) A kind of service multiplexing method, business Deplexing method and relevant device
KR20170043009A (en) Communication method based on multi path in network
CN107920021B (en) Link optimization method based on cellular link aggregation
CN109495162B (en) Protection switching method, receiving end and storage medium
CN111556104A (en) Seamless switching mode applied to data after multipath collection

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
GR01 Patent grant
GR01 Patent grant