CAN channel multi-message peak shifting sending automatic distribution method and system
By building a host computer and optimizing with greedy algorithms, it automatically allocates the sending time of multiple messages in CAN channel, and solves the problems of complex and limited performance of multi-message staggered transmission in the existing technology, achieving more efficient data transmission and system performance improvement.
Patent Information
- Application Number
- CN202510364752.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-06-27
AI Technical Summary
When handling multi-message staggered transmission on the CAN bus, the prior art has problems such as data transmission delay, limited system performance, complex manual adjustments and personal experience.
By building a host computer, importing DBC files, extracting message cycle time and number of tasks, calculating the minimum common multiple and total number of tasks, defining variables representing the offset time and sending of tasks, using classic population initialization and greedy algorithm optimization, generating populations and performing selection, crossing, and mutation operations until the termination condition is reached, and a multi-message staggered sending scheme for the CAN channel is obtained.
It realizes the equal distribution of message data transmission, reduces the system load rate and peak load rate, improves system performance and user experience, and simplifies the automatic allocation process of staggered peak transmission.
Smart Images

Figure CN120223637A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automotive electronics technology, and more specifically, to a method and system for automatically allocating multi-message staggered transmission on CAN channels. Background Art
[0002] CAN (Controller Area Network) communication refers to Controller Area Network communication, which is a serial communication protocol commonly used for real-time data transmission and is used for communication between electronic control units (ECUs) in the automotive and industrial control fields. Message information of the vehicle is defined on the CAN bus. However, when the amount of data transmitted on the CAN bus is large, or limited by the physical conditions of the CAN bus, resulting in a communication rate insufficient to handle the real-time transmission requirements of a large amount of data in the system, it will lead to congestion of communication information and cause delays in CAN bus information.
[0003] For the above problems, the existing solutions are as follows: reducing the number of CAN message transmissions or increasing the CAN message transmission period to reduce the amount of data transmitted per unit time; or adjusting the transmission time of each CAN message one by one to meet the CAN message transmission tasks or data limits at each moment. The first method will reduce the data transmission volume and real-time performance of the system, limit the performance of the system, and thus increase costs. The second method mainly obtains the communication information, message information, and message cycle time between various components of the vehicle by parsing the description file that defines the message information on the CAN bus, that is, the Database Container (DBC) file, and determines the transmission time of each message task by manually adjusting the time base of CAN message transmission.
[0004] For the second method, there are currently some tools available for parsing and processing DBC files, such as VectorCANoe, CANalyzer, etc., which require dedicated hardware devices and software support, are relatively complex to use, and require different software to complete different stages of processing. There are risks of data compatibility, data loss, and data consistency among these software tools, and the integration cost is high and the maintenance is difficult. In the solution, by continuously adjusting the value of the staggered transmission time and observing the results, the change of the results can be intuitively observed, and the optimal staggered transmission scheme can be continuously searched. However, for the manual adjustment method, it requires repeated experiments, consuming time and effort, and this method often relies on personal subjective judgment and experience, which may lead to subjective deviations and inaccurate results. In addition, it is difficult to find the global optimal solution when dealing with a large number of message tasks.
[0005] Of course, some researchers also use the greedy algorithm to obtain the transmission scheme for each message task. This method is relatively simple and does not require complex data structures and algorithms. It is easy to understand and implement. Each task configuration is the optimal solution in the current state and does not require global search. Therefore, it has high solution efficiency and strong applicability. In addition, some researchers use the Monte Carlo algorithm to estimate the solution of the problem through multiple experiments by simulating random staggered transmission times, which has high flexibility. However, based on the greedy algorithm, the optimal solution in the current state cannot be selected at each step, which may lead to the final result not being the global optimal solution, and there is a problem of local optimal solution. Moreover, the effect of the greedy algorithm depends on the design of the selection rule, and different selection rules may lead to different results. Based on the Monte Carlo algorithm, when there are many message tasks, the calculation cost is high, the convergence speed is slow, and the result is greatly affected by randomness, with a certain degree of uncertainty. Based on the above problems, the present invention designs an automatic allocation method for multi-message staggered transmission on the CAN channel. Summary of the Invention
[0006] The present invention provides an automatic allocation method and system for multi-message staggered transmission on the CAN channel to overcome at least one technical problem existing in the prior art.
[0007] On the one hand, the present invention provides an automatic allocation method for multi-message staggered transmission on the CAN channel, including:
[0008] Build a host computer and import the DBC file;
[0009] Run the host computer and extract the message cycle time and the number of message tasks of the periodic messages based on the DBC file;
[0010] According to the message cycle time and the number of message tasks of the periodic messages, obtain the set T={T1, T2,..., T K} of cycle time types and the set N={N1, N2,..., N K} of the number of tasks corresponding to each type, where K represents the number of cycle time types, and the unit of the cycle time type is ms;
[0011] Calculate the least common multiple T LCM of the cycle time types and the total number of tasks N Task ;
[0012] Define the variable x n , x n represents the offset time of the nth task, x n ∈ {0, 1, 2,..., t n - 1}, where t n represents the cycle time of the nth task;
[0013] Define the variable M tn , Mtn ∈ {0, 1}; When mod(t - x n , t n ) = 0, M tn = 1, indicating that a frame of the nth task is sent at time t; otherwise, M tn = 0; where mod(a, b) represents the remainder of a divided by b, and t ∈ {1, 2, …, T LCM};
[0014] According to the variable M tn , calculate the message task situation sent at each moment within the T LCM time period
[0015] Set the target model as mins = min max(S t );
[0016] Use the classical population initialization method for population coding to obtain the classical coding individual Code P = rand(0, 1, N Task ), where rand(0, 1, N Task ) means generating N Task random integers within the range from 0 to 1;
[0017] Use the greedy algorithm to optimize the solution of the target model, and the solution of the target model includes the final offset time of each task;
[0018] Encode the solution of the target model to obtain the greedy coding individual Among them, Code n represents the encoding of the final offset time of the nth task;
[0019] Generate a population using the classical coding individual and the greedy coding individual;
[0020] Calculate the fitness value of the population;
[0021] Perform selection, crossover, and mutation operations on the individuals in the population to update the population;
[0022] Judge whether the termination condition is reached. If not, return to the step of calculating the fitness value of the population; if so, calculate the fitness value of each individual in the current population;
[0023] Select the individual with the best fitness value in the current population as the selected individual;
[0024] Use the transmission scheme of the selected individual as the multi-message staggering transmission scheme for the CAN channel.
[0025] Optionally,
[0026] where GCD(T1, T2, …, T K ) represents the greatest common divisor of T1, T2, …, T K .
[0027] Optionally, the solution of the target model is optimized by using a greedy algorithm, specifically:
[0028] Initialize M tn ;
[0029] Set the offset time x1 of the first task to 0 ms;
[0030] Calculate M based on x1 t1 ;
[0031] For the second to the nth tasks, calculate the total amount of the first n - 1 tasks sent at each moment within the T LCM period
[0032] For each task q among the second to the nth tasks, take the t value corresponding to when S t ' is the smallest as the target value t goal , and make x q = t goal , q ∈ {2, 3, …, n}.
[0033] Optionally, the solution of the target model is encoded, specifically:
[0034] Use to encode the offset time x n of each task, where the dec2bin function represents converting decimal to binary, rand(a, b) represents randomly generating a value in the interval [a, b], the lower function represents rounding down, and L n represents the encoding length of the nth task, and L n = Roundup(log2 t n ) + 3, and the Roundup function represents rounding up.
[0035] Optionally, the fitness value of the population is calculated, specifically:
[0036] Suppose the population contains m classical - encoded individuals and m Grd greedy - encoded individuals;
[0037] Set the fitness - function formula of the individual as where f k represents the fitness value of the kth individual, and sk Denote the target model of the k-th individual;
[0038] Calculate the fitness value of the population according to the fitness values of each individual as
[0039] Optionally, perform a selection operation on the individuals in the optimized population using the random-proportion selection method, and the probability of each individual being selected is:
[0040]
[0041] where N P = m + m Grd , i = 1~N P , p = rand(0, 1), and rand(0, 1) represents a floating-point number uniformly randomly generated within 0 to 1.
[0042] Optionally, determine whether the termination condition is reached, specifically:
[0043] Obtain the current iteration number;
[0044] Judge whether the current iteration number is less than the iteration threshold. If so, it means the termination condition is not reached; if not, it means the termination condition is reached.
[0045] Optionally, determine whether the termination condition is reached, specifically:
[0046] Calculate the fitness value of the current population;
[0047] Judge whether the fitness value of the current population reaches the convergence value. If not, it means the termination condition is not reached; if so, it means the termination condition is reached.
[0048] On the other hand, the present invention also provides a CAN channel multi-message staggered transmission automatic allocation system, including:
[0049] A building module, used to build a host computer and import a DBC file;
[0050] An operation module, used to operate the host computer and extract the message cycle time and the number of message tasks of periodic messages based on the DBC file;
[0051] An acquisition module, used to obtain a set T = {T1, T2,..., T K} of cycle time types and a set N = {N1, N2,..., N K} of the number of tasks corresponding to each type according to the message cycle time and the number of message tasks of the periodic messages, where K represents the number of cycle time types, and the unit of the cycle time type is ms;
[0052] The first calculation module is used to calculate the least common multiple T of the cycle time types LCM and the total number of tasks N Task ;
[0053] The first variable definition module is used to define the variable x n , x n represents the offset time of the nth task, x n ∈ {0, 1, 2, …, t n -1}, where t n represents the cycle time of the nth task;
[0054] The second variable definition module is used to define the variable M tn , M tn ∈ {0, 1}; when mod(t - x n , t n ) = 0, M tn = 1, indicating that a frame of the nth task is sent at time t; otherwise, M tn = 0; where mod(a, b) represents the remainder of a divided by b, t ∈ {1, 2, …, T LCM};
[0055] The second calculation module is used to calculate the message task situation sent at each moment during the period T tn , according to the variable M LCM
[0056] The setting module is used to set the target model as min s = min max(S t );
[0057] The first encoding module is used to perform population encoding in the classical population initialization manner to obtain the classical encoded individual Code P = rand(0, 1, N Task ), where rand(0, 1, N Task ) represents generating N Task random integers within the range from 0 to 1;
[0058] The optimization module is used to optimize the solution of the target model by using the greedy algorithm, and the solution of the target model includes the final offset time of each task;
[0059] The second encoding module is used to encode the solution of the target model to obtain the greedy encoded individual where Code n represents the encoding of the final offset time of the nth task;
[0060] A generation module, configured to generate a population by using the classical coding individuals and the greedy coding individuals;
[0061] A third calculation module, configured to calculate the fitness value of the population;
[0062] An update module, configured to perform selection, crossover, and mutation operations on the individuals in the population and update the population;
[0063] A judgment module, configured to judge whether a termination condition is reached. If not, return to the step of calculating the fitness value of the population; if so, calculate the fitness value of each individual in the current population;
[0064] A selection module, configured to select the individual with the optimal fitness value in the current population as the selected individual;
[0065] A determination module, configured to use the transmission scheme of the selected individual as the multi-message staggering transmission scheme of the CAN channel.
[0066] Optionally, the optimization module is specifically configured to:
[0067] Initialize M tn ;
[0068] Set the offset time x1 of the first task to 0 ms;
[0069] Calculate M based on x1 t1 ;
[0070] For the second to the nth tasks, calculate the total amount of the first n - 1 tasks sent at each moment within the T LCM time period
[0071] For each task q among the second to the nth tasks, take the t value corresponding to when S t ' is the smallest as the target value t goal , and make x q = t goal , q ∈ {2, 3,..., n}.
[0072] The innovation points of the embodiments of the present invention include:
[0073] 1. In this embodiment, based on the DBC file, the transmission time of messages is automatically allocated, realizing the average distribution of message data transmission, reducing the overall load rate and peak load rate during data transmission of the system, improving the system performance, and improving the work efficiency of developers, which is one of the innovation points of the embodiments of the present invention.
[0074] 2. In this embodiment, by building a host computer, the usage process is simplified, which facilitates data visualization, improves the user experience and work efficiency, and also helps to enhance the overall performance of the system and user satisfaction. This is one of the innovative points of the embodiment of the present invention.
[0075] 3. In this embodiment, by automatically extracting valid data and performing data processing, the cycle time type and total number of tasks in the CAN message are determined, and the CAN transmission limit conditions are set according to the cycle time type and total number of tasks, thereby constructing the target model and constraint conditions for CAN message sending. This is one of the innovative points of the embodiment of the present invention.
[0076] 4. In this embodiment, for the target model, an optimized genetic algorithm is designed to construct the fitness function of the algorithm, and optimization is performed to finally obtain the time scheduling scheme for peak - shift sending of CAN messages, which simplifies the process of automatic allocation of peak - shift sending, and improves the solution quality and efficiency of the peak - shift allocation scheme. This is one of the innovative points of the embodiment of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following - described drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0078] Figure 1 It is a flowchart of a method for automatic allocation of peak - shift sending of multiple CAN messages provided by an embodiment of the present invention;
[0079] Figure 2 It is a schematic diagram of a host computer interface provided by an embodiment of the present invention;
[0080] Figure 3 It is a schematic diagram of the sending distribution of messages within the least common multiple time provided by an embodiment of the present invention;
[0081] Figure 4 It is a flowchart of the solution of the optimized target model provided by an embodiment of the present invention;
[0082] Figure 5 It is another flowchart of a method for automatic allocation of peak - shift sending of multiple CAN messages provided by the present invention;
[0083] Figure 6 It is yet another flowchart of a method for automatic allocation of peak - shift sending of multiple CAN messages provided by the present invention;
[0084] Figure 7A schematic structural diagram of the CAN channel multi-message staggered transmission automatic allocation system provided by the embodiment of the present invention. Detailed implementation manners
[0085] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0086] It should be noted that the terms "include" and "have" and any variations thereof in the embodiments of the present invention and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally further include steps or units not listed, or may optionally further include other steps or units inherent to these processes, methods, products or devices.
[0087] The embodiments of the present invention disclose a CAN channel multi-message staggered transmission automatic allocation method and system. The following will be described in detail respectively.
[0088] Figure 1 A flowchart of the CAN channel multi-message staggered transmission automatic allocation method provided by the embodiment of the present invention. Please refer to Figure 1 , the CAN channel multi-message staggered transmission automatic allocation method provided by the embodiment of the present invention includes:
[0089] Step 1: Build a host computer and import a DBC file;
[0090] Step 2: Run the host computer and extract the message cycle time and the number of message tasks of the periodic messages based on the DBC file;
[0091] Step 3: According to the message cycle time and the number of message tasks of the periodic messages, obtain the set T = {T1, T2,..., T K} of cycle time types and the set N = {N1, N2,..., N K} of the corresponding number of tasks for each type, where K represents the number of cycle time types, and the unit of the cycle time type is ms;
[0092] Step 4: Calculate the least common multiple T LCM of the cycle time types and the total number of tasks N Task ;
[0093] Step 5: Define a variable x n , x n represents the offset time of the nth task, xn ∈ {0, 1, 2, …, t n - 1}, where t n represents the period of the nth task;
[0094] Step 6: Define the variable M tn , M tn ∈ {0, 1}; when mod(t - x n , t n ) = 0, M tn = 1, indicating that a frame of the nth task is sent at time t; otherwise, M tn = 0; where mod(a, b) represents the remainder of a divided by b, t ∈ {1, 2, …, T LCM};
[0095] Step 7: According to the variable M tn , calculate the message task situation sent at each moment during the period T LCM
[0096] Step 8: Set the target model as min s = min max(S t );
[0097] Step 9: Use the classical population initialization method for population coding to obtain the classical coding individual Code P = rand(0, 1, N Task ), where rand(0, 1, N Task ) means generating N Task random integers within the range of 0 to 1;
[0098] Step 10: Use the greedy algorithm to optimize the solution of the target model. The solution of the target model includes the final offset time of each task;
[0099] Step 11: Encode the solution of the target model to obtain the greedy coding individual where Code n represents the encoding of the final offset time of the nth task;
[0100] Step 12: Use the classical coding individual and the greedy coding individual to generate a population;
[0101] Step 13: Calculate the fitness value of the population;
[0102] Step 14: Perform selection, crossover, and mutation operations on the individuals in the population to update the population;
[0103] Step 15: Determine whether the termination condition is reached. If not, return to the step of calculating the fitness value of the population; if so, calculate the fitness value of each individual in the current population.
[0104] Step 16: Select the individual with the optimal fitness value in the current population as the selected individual.
[0105] Step 17: Use the transmission scheme of the selected individual as the multi-message staggering transmission scheme for the CAN channel.
[0106] Specifically, please refer to Figure 1 , for the multi-message staggering transmission automatic allocation method for the CAN channel provided by the embodiment of the present invention, first build a host computer through step 1. To simplify the process and data visualization, the host computer interface of this embodiment is developed based on MATLAB 2019b.
[0107] Figure 2 Shown in Figure 2 is a schematic diagram of the host computer interface provided by the embodiment of the present invention. The host computer interface is divided into two columns. The left column is the data extraction and data processing area, including a DBC (Database Container, a file format for describing the CAN communication protocol) file import button. Through this button, a DBC file can be imported.
[0108] The left column also includes the function of displaying the message cycle time and the number of message tasks. After importing the DBC file, in step 2, by running the host computer, the file content can be read according to the description format of the DBC file, and the message cycle time can be extracted based on regular expressions and the number of message tasks can be counted. At the same time, the message cycle time and the number of message tasks are respectively displayed in the MsgTm and MsgNum lists in the left column of the interface. By clicking the "View button", the task IDs in the DBC file can also be displayed in the MsgID list.
[0109] After obtaining the message cycle time and the number of message tasks of the periodic messages, the target optimization model can be constructed. First, in step 3, different cycle time types can be obtained according to the message cycle time, and the set of cycle time types T = {T1, T2,..., T K} is defined, where K represents the number of cycle time types, and the unit of the cycle time type is ms. Then, according to the number of message tasks, the number of message tasks corresponding to each cycle time type can be statistically obtained, so that the set of task numbers corresponding to each type N = {N1, N2,..., N K} can be obtained.
[0110] Figure 3 Shown in Figure 3, To ensure that each message can be sent once, the present invention uses the least common multiple of the cycle time types as the time interval. Therefore, the least common multiple T of the cycle time types is calculated through step 4 LCM , ensuring that within T LCM time period, each frame of message is sent with an arbitrary offset. Among them, GCD(T1, T2, …, T K ) represents the greatest common divisor of T1, T2, …, T K . In this step, it is also necessary to calculate the total number of tasks according to the task quantity set N i = 1, 2 …… K.
[0111] When a message is sent, there will be different degrees of time offset for each frame of message. The present invention defines a variable x through step 5 n , and represents the offset time of the nth task through the variable x n , x n ∈ {0, 1, 2, …, t n - 1}, where t n represents the cycle time of the nth task.
[0112] Periodic tasks have the characteristic of periodic sending. The present invention defines a variable M through step 6 tn , and represents the sending situation of each task within T tn time through the variable M LCM , M tn ∈ {0, 1}. For example, M tn = 1 means that at time t, a frame of the nth task is sent. In the present invention, according to the offset time of the task, the constraint condition of M tn is set as when mod(t - x n , t n ) = 0, M tn = 1, indicating that a frame of the nth task is sent at time t; otherwise, M tn = 0; where mod(a, b) represents the remainder of a divided by b, and t ∈ {1, 2, …, T LCM}.
[0113] After obtaining the task sending situation M LCM at each moment within the T tn time period, in step 7, the message task situation sent at each moment within the T tn time period can be calculated according to the variable M LCM as t ∈ {1, 2, …, T LCM}. To ensure the communication quality, the present invention optimizes the offset time x n based on the genetic algorithm, so as to ensure that within T LCMDuring this period, the message tasks sent at each moment are not congested. According to the message task situation S sent at each moment t It can be seen that the message volumes sent at each moment are different. In the present invention, through step 8, the message task sending volume S t The maximum, that is, max(S t ), is used as the target model. When this target is the smallest, that is, when min s = min max(S t ), the obtained is the optimal solution.
[0114] After obtaining the target model, the optimal solution can be obtained by optimizing the target model. The present invention uses a genetic algorithm to optimize the target model. In the present invention, in order to improve the quality of the overall initial solution of the population, a combination of classical population initialization coding and calculating and coding the optimized solution based on the greedy algorithm is adopted. Therefore, first in step 9, the classical population initialization method is used for population coding to obtain the classical coding individual Code P = rand(0, 1, N Task ), where rand(0, 1, N Task ) means generating N Task random integers within the range from 0 to 1.
[0115] In step 10, the greedy algorithm is used to optimize the solution of the target model. Here, the solution of the target model includes the final offset time of each task, that is, it is necessary to use the greedy algorithm to solve the offset time of the task. Figure 4 This is a flowchart for optimizing the solution of the target model provided by the embodiment of the present invention. Please refer to Figure 4 . When using the greedy algorithm to solve the solution of the target model, first in step 101, using the known conditions, the task sending situation M tn at each moment is initialized, M tn ∈{0, 1}, and t ∈ {1, 2,..., T LCM}, n ∈ {1, 2,..., N Task}.
[0116] After the initialization is completed, in step 102, the offset time x1 of the first task is set to 0 ms. In step 103, according to the offset time x1 of the first task, M t1 can be calculated. After obtaining the updated M t1 , in step 104, for the second to the nth tasks, the task sending situations at each moment can be calculated respectively, so that the total amount of the first n - 1 tasks sent at each moment within the T LCM period can be calculated as In step 105, for each task q among the second to the nth tasks, the t value corresponding to the smallest S t ′ is taken as the target value tgoal Assign the obtained target value to the corresponding task offset time, that is, make x q = t goal , q ∈ {2, 3, …, n}, thus obtaining the solution of the target model as X = {0, …, x q}}.
[0117] After obtaining the solution of the target model, through step 11, the solution of the target model can be encoded to obtain a greedy encoded individual where Code n represents the encoding of the final offset time of the nth task. In this embodiment, the binary encoding method is used to encode the final offset time x n of each task, and the greedy encoded individual can be obtained as where the dec2bin function represents converting decimal to binary, rand(a, b) represents randomly generating a value in the interval [a, b], the lower function represents rounding down, and L n represents the encoding length of the nth task. Here, the constraint condition of L n is expressed as L n = Roundup(log2 t n ) + 3, L n ∈ Z, and the Roundup function represents rounding up.
[0118] The number of individuals in the population determines the search performance of the genetic algorithm. If the number of individuals is too small, obvious inbreeding will occur, resulting in pathological genes, wasting computing resources and reducing the search performance of the algorithm at the same time; if the number of individuals is too large, the optimization result will be difficult to converge, leading to a decline in the robustness of the algorithm. Usually, the value range of the number of individuals is set to [20, 100], and the value of the number of population individuals can be selected by considering the size of the solution space of the optimization problem. In the present invention, through step 12, m classical encoded individuals and m Grd greedy encoded individuals are selected to generate a population.
[0119] After obtaining the population, in step 13, calculate the fitness value of the population. When calculating the fitness value of the population, it is necessary to first calculate the fitness value of each individual. In this embodiment, the calculation formula of the fitness function of the individual is set as where f k represents the fitness value of the kth individual, and s k represents the target model of the kth individual. After obtaining the fitness value of each individual, the fitness value of the population can be calculated as
[0120] In step 14, selection, crossover, and mutation operations are performed on the individuals in the population to update the population. The selection operation usually uses the proportional selection operator, that is, the probability of an individual in the population being selected is proportional to its fitness value. However, this method is prone to making the result fall into a local optimal solution, which is disadvantageous for the search of the measurement pose. Therefore, in this embodiment, the random-proportional selection method is used to perform the selection operation on the individuals in the population, that is, while considering the fitness, individuals are randomly selected with a certain probability. The probability of each individual being selected is obtained as follows: where N P = m + m Grd , i = 1 to N P , p = rand(0, 1), and rand(0, 1) represents a floating-point number uniformly randomly generated within 0 to 1.
[0121] In the crossover operation, single-point crossover is used to complete the genotype pairing operation. The chromosomes between the two paired individuals perform gene crossover operations with a crossover probability, generally in the value range of [0.4, 0.8]. The larger its value, the more sufficient the search for the solution. After the parent generation completes the crossover operation, further mutation operations are performed on the genotypes of the offspring individuals. In this embodiment, the uniform random mutation method is used, that is, each locus of each genotype has a probability P Ψ of undergoing mutation, generally in the value range of [0.001, 0.1]. The larger its value, the richer the population diversity.
[0122] In the genetic algorithm, the optimal solution is obtained through multiple iterations. Therefore, after each population update, it is necessary to determine whether the iteration termination condition is reached through step 15. If the iteration termination condition is not reached, it means that the iteration to solve the optimal solution needs to continue. At this time, return to step 13, calculate the fitness value of the updated population, and make subsequent judgments based on the fitness value. If the iteration termination condition has been reached, the current population is used as the population after optimization, and the fitness values of each individual in the current population are calculated according to the individual fitness function formula.
[0123] After obtaining the optimized population, in step 16, the individual with the best fitness value in the current population is selected as the selected individual. The transmission scheme corresponding to the selected individual is the optimal solution of the target model. Therefore, through step 17, the transmission scheme of the selected individual is used as the multi-message staggering transmission scheme for the CAN channel.
[0124] It should be noted that the solution and display of the message staggering transmission mechanism are also included in the upper computer interface. Please refer to Figure 2, in the "Solution" interface in the right column of the host computer interface, it can be used to select the solution methods of the message peak-shifting sending mechanism, such as algorithm selection, parameter configuration, solution status iteration area, etc.; "Scheme" can be used to display the message peak-shifting sending scheme and data export. Through the "Save as" button, the corresponding sending scheme can be exported in Excel format for convenient data transmission and use.
[0125] The automatic allocation method for multi-message peak-shifting sending of CAN channels provided by the present invention simplifies the usage process by building a host computer, facilitating data visualization, improving user experience and work efficiency, and also helps to improve the overall performance of the system and user satisfaction. By automatically extracting valid data and performing data processing, the cycle time type and total number of tasks in the CAN message are determined, and CAN transmission limit conditions are set according to the cycle time type and total number of tasks, thereby constructing the target model and constraint conditions for CAN message sending. Also, for the target model, an optimized genetic algorithm is designed to construct the fitness function of the algorithm, and optimized solution is carried out. Finally, a time scheduling scheme for CAN message peak-shifting sending is obtained, which simplifies the process of peak-shifting sending automatic allocation and improves the solution quality and efficiency of the peak-shifting allocation scheme.
[0126] Optionally, Figure 5 Another flowchart of the automatic allocation method for multi-message peak-shifting sending of CAN channels provided for the implementation of the present invention is shown in Figure 1 and Figure 5 , in step 15, it is judged whether the termination condition is reached. Specifically: in step 151, the current iteration number is obtained; in step 152, it is judged whether the current iteration number is less than the iteration threshold. If so, it means that the termination condition is not reached; if not, it means that the termination condition is reached.
[0127] Specifically, please refer to Figure 5 , in this embodiment, according to the set iteration threshold, it is judged whether the termination condition is reached. Therefore, first, the current iteration number is obtained through step 151. The initial value of the iteration number is set to 0, and each time it iterates, this value is incremented by 1, so that the current iteration number can be obtained by accumulation. Then in step 152, the size relationship between the current iteration number and the iteration threshold is compared. If the current iteration number is less than the iteration threshold, it means that the termination condition is not reached; otherwise, it means that the termination condition is reached. It should be noted that the iteration threshold can be specifically set as needed, and the present invention does not make specific limitations on this.
[0128] Optionally, Figure 6 Another flowchart of the automatic allocation method for multi-message peak-shifting sending of CAN channels provided for the implementation of the present invention is shown in Figure 1 and Figure 6, in step 15, it is judged whether the termination condition is reached. Specifically: in step 153, the fitness value of the current population is calculated; in step 154, it is judged whether the fitness value of the current population reaches the convergence value. If not, it means that the termination condition is not reached; if so, it means that the termination condition is reached.
[0129] Specifically, in addition to judging whether the iteration termination condition is reached by the number of iterations, it can also be judged by judging the convergence value of the iteration target. Please refer to Figure 6 , in this embodiment, it is determined whether to terminate the iteration by judging whether the fitness value of the population reaches the convergence value. Since the individuals in the population will change after each update of the population, the fitness value of the population will inevitably change. Therefore, after each update of the population, first, the fitness value of the current population needs to be calculated through step 153. Then in step 154, it is judged whether the fitness value of the current population reaches the convergence value. If the convergence value is not reached, it means that the termination condition is not reached; otherwise, it means that the termination condition is reached. It should be noted that the convergence value can be specifically set as needed, and the present invention does not make specific limitations on this.
[0130] Based on the same inventive concept, the present invention also provides a CAN channel multi-message staggered transmission automatic allocation system Figure 7 is a schematic structural diagram of the CAN channel multi-message staggered transmission automatic allocation system provided by the embodiment of the present invention. Please refer to Figure 7 , the CAN channel multi-message staggered transmission automatic allocation system 100 provided by the present invention includes:
[0131] A building module, used to build a host computer and import a DBC file;
[0132] An operation module, used to operate the host computer and extract the message cycle time and message task quantity of periodic messages based on the DBC file;
[0133] An acquisition module, used to obtain a set T = {T1, T2,..., T K} of cycle time types and a set N = {N1, N2,..., N K} of the corresponding task quantities of each type, where K represents the number of cycle time types, and the unit of the cycle time type is ms;
[0134] A first calculation module, used to calculate the least common multiple T LCM of the cycle time types and the total task quantity N Task ;
[0135] A first variable definition module, used to define a variable x n , x n represents the offset time of the nth task, xn ∈ {0, 1, 2, …, t n - 1}, where t n represents the period of the nth task;
[0136] A second variable definition module for defining the variable M tn , M tn ∈ {0, 1}; when mod(t - x n , t n ) = 0, M tn = 1, indicating that a frame of the nth task is sent at time t; otherwise, M tn = 0; where mod(a, b) represents the remainder of a divided by b, and t ∈ {1, 2, …, T LCM};
[0137] A second calculation module for calculating the message task situation sent at each moment during the period T tn , according to the variable M LCM ;
[0138] A setting module for setting the target model as min s = min max(S t );
[0139] A first encoding module for performing population encoding in the classical population initialization manner to obtain the classical encoded individual Code P = rand(0, 1, N Task ), where rand(0, 1, N Task ) represents generating N Task random integers within the range from 0 to 1;
[0140] An optimization module for optimizing the solution of the target model using the greedy algorithm, where the solution of the target model includes the final offset time of each task;
[0141] A second encoding module for encoding the solution of the target model to obtain the greedy encoded individual where Code n represents the encoding of the final offset time of the nth task;
[0142] A generation module for generating a population using the classical encoded individual and the greedy encoded individual;
[0143] A third calculation module for calculating the fitness value of the population;
[0144] An update module for performing selection, crossover, and mutation operations on the individuals in the population to update the population;
[0145] A judgment module, configured to judge whether a termination condition is reached. If not, return to the step of calculating the fitness value of the population; if so, calculate the fitness value of each individual in the current population.
[0146] A selection module, configured to select the individual with the optimal fitness value in the current population as the selected individual.
[0147] A determination module, configured to use the transmission scheme of the selected individual as the multi-message staggering transmission scheme of the CAN channel.
[0148] Specifically, please refer to Figure 7 , for the multi-message staggering transmission automatic allocation system 100 of the CAN channel provided by the embodiment of the present invention, first, a host computer is built through a building module. To simplify the process and data visualization, the host computer interface of this embodiment is developed based on MATLAB 2019b.
[0149] Please refer to Figure 2 , the host computer interface is divided into two columns. The left column is the data extraction and data processing area, including a DBC (Database Container, a file format for describing the CAN communication protocol) file import button. Through this button, a DBC file can be imported.
[0150] The left column also includes the function of displaying the message cycle time and the number of message tasks. After importing the DBC file, by running the host computer through the running module, the file content can be read according to the description format of the DBC file, and the message cycle time can be extracted based on the regular expression and the number of message tasks can be counted. At the same time, the message cycle time and the number of message tasks are respectively displayed in the MsgTm and MsgNum lists in the left column of the interface. By clicking the "View button", the task ID in the DBC file can also be displayed in the MsgID list.
[0151] After obtaining the message cycle time and the number of message tasks of the periodic messages, the target optimization model can be constructed. The obtaining module can obtain different cycle time types according to the message cycle time, and define the set of cycle time types T = {T1, T2,..., T K}, where K represents the number of cycle time types, and the unit of the cycle time type is ms. Then, according to the number of message tasks, the number of message tasks corresponding to each cycle time type can be statistically obtained, so that the set of the number of tasks corresponding to each type N = {N1, N2,..., N K} can be obtained.
[0152] To ensure that each message can be sent once, the present invention uses the least common multiple of the cycle time types as the time interval. Therefore, the first calculation module calculates the least common multiple T LCM of the cycle time types to ensure that within T LCMDuring a time period, each frame of the message is sent with an arbitrary offset. Among them, GCD(T1, T2, …, T K ) represents the greatest common divisor of T1, T2, …, T K . At the same time, this module also needs to calculate the total number of tasks according to the task number set N i = 1, 2 …… K.
[0153] When the message is sent, there will be different degrees of time offset for each frame of the message. In the present invention, a variable x is defined by a first variable definition module n , and through the variable x n to represent the offset time of the nth task, x n ∈{0, 1, 2, …, t n -1}, where t n represents the cycle time of the nth task.
[0154] Periodic tasks have the characteristic of periodic sending. In the present invention, a variable M is defined by a second variable definition module tn , and through the variable M tn to represent the sending situation of each task within the time T LCM , M tn ∈{0, 1}. For example, M tn = 1 means that at time t, a frame of the nth task is sent. In the present invention, according to the offset time of the task, the constraint condition of M tn is set as when mod(t - x n , t n ) = 0, M tn = 1, indicating that a frame of the nth task is sent at time t; otherwise, M tn = 0; where mod(a, b) represents the remainder of a divided by b, and t ∈{1, 2, …, T LCM}.
[0155] After obtaining the task sending situation M LCM at each moment within the T tn period, the second calculation module can calculate the message task situation sent at each moment within the T tn period according to the variable M LCM as t ∈{1, 2, …, T LCM}. In order to ensure the communication quality, the present invention optimizes the offset time x n based on the genetic algorithm, so as to ensure that the message tasks sent at each moment within the T LCM period are not crowded. According to the message task situation S t sent at each moment, it can be seen that the amount of messages sent at each moment is different. In the present invention, through the setting module, the message task sending amount St The maximum, i.e., max(S t ), is used as the target model. When this target is minimized, i.e., when min s = min max(S t ), the optimal solution is obtained.
[0156] After obtaining the target model, the optimal solution can be obtained by optimizing the target model. The present invention uses a genetic algorithm to optimize the target model. In the present invention, in order to improve the quality of the overall initial solution of the population, a combination of classical population initialization coding and calculating and coding the optimized solution based on the greedy algorithm is adopted. Therefore, first, the first coding module performs population coding in the classical population initialization manner to obtain the classical coding individual Code P = rand(0, 1, N Task ), where rand(0, 1, N Task ) represents generating N Task random integers within the range from 0 to 1.
[0157] The optimization module uses the greedy algorithm to optimize the solution of the target model. Here, the solution of the target model includes the final offset time of each task, that is, it is necessary to use the greedy algorithm to solve the offset time of the task. When using the greedy algorithm to solve the solution of the target model, first, using the known conditions, the task sending situation M tn at each moment is initialized, M tn ∈ {0, 1}, and t ∈ {1, 2,..., T LCM}, n ∈ {1, 2,..., N Task}.
[0158] After the initialization is completed, the offset time x1 of the first task is set to 0 ms. According to the offset time x1 of the first task, M t1 can be calculated. After obtaining the updated M t1 , for the second to the nth tasks, the task sending situation at each moment can be calculated respectively, so that the total amount of the first n - 1 tasks sent at each moment within the T LCM period can be calculated as For each task q among the second to the nth tasks, the t value corresponding to the minimum S t ' is taken as the target value t goal , and the obtained target value is assigned to the corresponding task offset time, that is, make x q = t goal , q ∈ {2, 3,..., n}, so as to obtain the solution of the target model as X = {0,..., x q}.
[0159] After obtaining the solution of the target model, the second coding module encodes the solution of the target model to obtain the greedy coding individual Among them, Code n represents the encoding of the final offset time of the nth task. In this embodiment, the binary encoding method is used to encode the final offset time x n of each task, and the greedy encoding individual can be obtained as Among them, the dec2bin function represents converting decimal to binary, rand(a, b) represents randomly generating a number in the interval [a, b], the lower function represents rounding down, and L n represents the encoding length of the nth task. Here, the constraint condition of L n is expressed as L n = Roundup(log2 t n ) + 3, L n ∈Z, and the Roundup function represents rounding up.
[0160] The number of individuals in the population determines the search performance of the genetic algorithm. If the number of individuals is too small, obvious inbreeding will occur, resulting in pathological genes, wasting computing resources and reducing the search performance of the algorithm at the same time; if the number of individuals is too large, the optimization result will be difficult to converge, leading to a decline in the robustness of the algorithm. Usually, the value range of the number of individuals is set to [20, 100], and the value of the number of population individuals can be selected by considering the size of the solution space of the optimization problem. In the present invention, m classical encoding individuals and m Grd greedy encoding individuals are selected by the generation module to generate a population.
[0161] After obtaining the population, the third calculation module calculates the fitness value of the population. When calculating the fitness value of the population, it is necessary to first calculate the fitness value of each individual. In this embodiment, the calculation formula of the fitness function of the individual is set as Among them, f k represents the fitness value of the kth individual, and s k represents the target model of the kth individual. After obtaining the fitness values of each individual, the fitness value of the population can be calculated according to the fitness values of each individual as
[0162] The update module performs selection, crossover, and mutation operations on the individuals in the population to update the population. The selection operation usually uses the proportional selection operator, that is, the probability that an individual in the population is selected is proportional to its fitness value. However, this method is likely to make the result fall into a local optimal solution, which is disadvantageous for the search of the measurement pose. Therefore, in this embodiment, the random-proportional selection method is used to perform the selection operation on the individuals in the population, that is, while considering the fitness, a certain probability is used to randomly select individuals. The probability that each individual is selected is: Among them, N P = m + m Grd, where \(i = 1\) to \(N\) P , \(p = rand(0,1)\), and \(rand(0,1)\) represents generating a floating-point number uniformly at random within 0 to 1.
[0163] In the crossover operation, single-point crossover is used to complete the pairing operation of genotypes. Between the two paired individuals, the chromosomes perform gene crossover operations with a crossover probability, generally in the value range of \([0.4, 0.8]\). The larger its value, the more sufficient the search for solutions. After the parent generation completes the crossover operation, further mutation operations are performed on the genotypes of the offspring individuals. In this embodiment, the uniform random mutation method is adopted, that is, each locus of each genotype has a probability \(P\) Ψ of occurring mutations, generally in the value range of \([0.001, 0.1]\). The larger its value, the richer the population diversity.
[0164] In the genetic algorithm, the optimal solution is obtained through multiple iterations. Therefore, after each population update, it is necessary to use a judgment module to determine whether the iteration termination condition is reached. If the iteration termination condition is not reached, it means that it is necessary to continue iterating to solve the optimal solution. At this time, the fitness value of the updated population is returned, and subsequent judgments are made based on the fitness value. If the iteration termination condition has been reached, the current population is used as the optimized population, and the fitness values of each individual in the current population are calculated according to the individual fitness function formula.
[0165] After obtaining the optimized population, an individual with the optimal fitness value in the current population is selected through a selection module as the selected individual. The transmission scheme corresponding to this selected individual is the optimal solution of the target model. Therefore, through a determination module, the transmission scheme of the selected individual is used as the multi-message staggering transmission scheme for the CAN channel.
[0166] It should be noted that the upper computer interface also includes the solution and display of the message staggering transmission mechanism. Please refer to Figure 2 , the "Solution" interface in the right column of the upper computer interface can be used to select the solution method of the message staggering transmission mechanism, such as algorithm selection, parameter configuration, solution status iteration area, etc.; "Scheme" can be used to display the message staggering transmission scheme and data export. Through the "Save as" button, the corresponding transmission scheme can be exported in Excel format for convenient data transmission and use.
[0167] The automatic allocation system for staggered transmission of multiple CAN messages provided by the present invention simplifies the usage process by setting up a host computer, facilitating data visualization, improving user experience and work efficiency, and also contributing to enhancing the overall performance of the system and user satisfaction. By automatically extracting valid data and performing data processing, the cycle time type and total number of tasks in the CAN message are determined, and CAN transmission limit conditions are set according to the cycle time type and total number of tasks, thereby constructing the target model and constraint conditions for CAN message transmission. Also, for the target model, an optimized genetic algorithm is designed to construct the fitness function of the algorithm, perform optimized solution, and finally obtain the time scheduling scheme for staggered transmission of CAN messages, simplifying the process of automatic allocation of staggered transmission and improving the solution quality and efficiency of the staggered allocation scheme.
[0168] Those of ordinary skill in the art can understand that: The drawings are only schematic diagrams of an embodiment, and the modules or processes in the drawings are not necessarily essential for implementing the present invention.
[0169] Those of ordinary skill in the art can understand that: The modules in the device in the embodiment can be distributed in the device in the embodiment according to the description of the embodiment, or can be correspondingly changed and located in one or more devices different from this embodiment. The modules in the above embodiments can be combined into one module, or further split into multiple sub-modules.
[0170] Finally, it should be noted that: The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: They can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for automatically allocating multiple messages sent at different peak times on a CAN channel, characterized in that: include: Build the host computer and import the DBC file; Running the host computer to extract the message cycle time and message task quantity of the periodic message based on the DBC file; According to the message cycle time and message task quantity of the periodic message, a set of cycle time types T = {T1, T2, ..., T K } and the set of the number of tasks corresponding to each type N = {N1, N2, ..., N K }, where K represents the number of periodic time types, and the unit of periodic time type is ms; Calculate the lowest common multiple T of the cycle time type LCM and the total number of tasks N Task ; Define the variable x n , x n represents the offset time of the nth task, x n ∈{0,1,2,…,t n -1}, where t n Indicates the cycle time of the nth task; Define the variable M tn , M tn ∈{0,1}; when mod(tx n ,t n )=0, M tn =1, indicating that a frame of nth task is sent at time t; otherwise, M tn =0; where mod(a,b) represents the remainder of a divided by b, t∈{1,2,…,T LCM }; According to the variable M tn , calculated at T LCM The message tasks sent at each time during the time period Set the target model to min s = min max (S t ); Use the classic population initialization method to encode the population and obtain the classic coded individual Code P =rand(0,1,N Task ), where rand(0,1,N Task ) means in the range 0 to 1, generate N Task A random integer; A greedy algorithm is used to optimize a solution of the target model, wherein the solution of the target model includes a final offset time of each task; Encode the solution of the target model to obtain the greedy encoding individual Among them, Code n Indicates the encoding of the final offset time of the nth task; Generate a population using the classical coding individuals and the greedy coding individuals; Calculating the fitness value of the population; Performing selection, crossover, and mutation operations on individuals in the population to update the population; Determine whether the termination condition is met, if not, return to the step of calculating the fitness value of the population; if so, calculate the fitness value of each individual in the current population; Select the individual with the best fitness value in the current population as the selected individual; The sending scheme of the selected individual is used as the multi-message peak-shifting sending scheme of the CAN channel.
2. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 1, characterized in that: Among them, GCD(T1,T2,…,T K ) represents T1, T2, …, T K The greatest common divisor of .
3. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 2, characterized in that: A greedy algorithm is used to optimize the solution of the target model, specifically: Initialize M tn ; Set the offset time x1 of the first task to 0ms; Calculate M based on x1 t1 ; For the 2nd to nth tasks, calculate the LCM The total number of the first n-1 tasks sent at each time during the period For each task q from the 2nd to the nth task, take S t The corresponding t value when ′ is minimum is taken as the target value t goal , and make x q =t goal , q∈{2,3,…,n}.
4. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 1, characterized in that: The solution of the target model is encoded, specifically: use Offset time x for each task n Encoding, where the dec2bin function means converting decimal to binary, rand(a,b) means randomly generating an interval [a, b], and the lower function means rounding down. n represents the encoding length of the nth task, L n =Roundup(log2 t n )+3, the Roundup function means rounding up.
5. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 1, characterized in that: Calculate the fitness value of the population, specifically: Assume that the population contains m classically coded individuals and m Grd greedy coding individuals; The fitness function formula of the individual is set as Among them, f k represents the fitness value of the kth individual, s k represents the target model of the kth individual; According to the fitness value of each individual, the fitness value of the population is calculated as 6. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 1, characterized in that: The random-proportional selection method is used to perform selection operations on individuals in the optimized population, and the probability of each individual being selected is: Among them, N P =m+m Grd , i=1~N P , p = rand(0,1), rand(0,1) means uniformly randomly generating floating point numbers between 0 and 1.
7. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 1, characterized in that: Determine whether the termination conditions are met, specifically: Get the current iteration number; Determine whether the current number of iterations is less than the iteration threshold. If so, it means that the termination condition has not been met; if not, it means that the termination condition has been met.
8. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 1, characterized in that: Determine whether the termination conditions are met, specifically: Calculate the fitness value of the current population; Determine whether the fitness value of the current population has reached the convergence value. If not, it means that the termination condition has not been met; if so, it means that the termination condition has been met.
9. A CAN channel multi-message peak-shifting automatic distribution system, characterized in that: include: Build a module to build the host computer and import DBC files; An operation module, used for running the host computer, extracting the message cycle time and message task quantity of the periodic message based on the DBC file; The acquisition module is used to acquire a set of periodic time types T = {T1, T2, ..., T K } and the set of the number of tasks corresponding to each type N = {N1, N2, ..., N K }, where K represents the number of periodic time types, and the unit of periodic time type is ms; The first calculation module is used to calculate the least common multiple T of the cycle time type LCM and the total number of tasks N Task ; The first variable definition module is used to define the variable x n , x n represents the offset time of the nth task, x n ∈{0,1,2,…,t n -1}, where t n Indicates the cycle time of the nth task; The second variable definition module is used to define the variable M tn , M tn ∈{0,1}; when mod(tx n ,t n )=0, M tn =1, indicating that a frame of nth task is sent at time t; otherwise, M tn =0; where mod(a,b) represents the remainder of a divided by b, t∈{1,2,…,T LCM }; The second calculation module is used to calculate the tn , calculated at T LCM The message tasks sent at each time during the time period Setting module, used to set the target model to min s = min max (S t ); The first encoding module is used to encode the population using the classic population initialization method to obtain the classic encoding individual Code P =rand(0,1,N Task ), where rand(0,1,N Task ) means in the range 0 to 1, generate N Task A random integer; An optimization module, used for optimizing a solution of the target model by using a greedy algorithm, wherein the solution of the target model includes a final offset time of each task; The second encoding module is used to encode the solution of the target model to obtain the greedy encoding individual Among them, Code n Indicates the encoding of the final offset time of the nth task; A generation module, used for generating a population by using the classical coding individuals and the greedy coding individuals; A third calculation module, used to calculate the fitness value of the population; An updating module, used for performing selection, crossover and mutation operations on individuals in the population to update the population; A judgment module is used to judge whether the termination condition is met, and if not, return to the step of calculating the fitness value of the population; if so, calculate the fitness value of each individual in the current population; The selection module is used to select the individual with the best fitness value in the current population as the selected individual; The determination module is used to use the sending scheme of the selected individual as the multi-message peak-shifting sending scheme of the CAN channel.
10. The method for automatically allocating multiple messages sent at different peak times through a CAN channel according to claim 9, characterized in that: The optimization module is specifically used for: Initialize M tn ; Set the offset time x1 of the first task to 0ms; Calculate M based on x1 t1 ; For the 2nd to nth tasks, calculate the LCM The total number of the first n-1 tasks sent at each time during the period For each task q from the 2nd to the nth task, take S t The corresponding t value when ′ is minimum is taken as the target value t goal , and make x q =t goal , q∈{2,3,…,n}.
