CN112183008A - Terminal resistance matching method of CAN bus network - Google Patents

Terminal resistance matching method of CAN bus network Download PDF

Info

Publication number
CN112183008A
CN112183008A CN201910524595.3A CN201910524595A CN112183008A CN 112183008 A CN112183008 A CN 112183008A CN 201910524595 A CN201910524595 A CN 201910524595A CN 112183008 A CN112183008 A CN 112183008A
Authority
CN
China
Prior art keywords
signal
value
bus
overshoot
particle
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
CN201910524595.3A
Other languages
Chinese (zh)
Other versions
CN112183008B (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.)
Beijing Institute of Technology BIT
SAIC Volkswagen Automotive Co Ltd
Original Assignee
Beijing Institute of Technology BIT
SAIC Volkswagen Automotive Co Ltd
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 Beijing Institute of Technology BIT, SAIC Volkswagen Automotive Co Ltd filed Critical Beijing Institute of Technology BIT
Priority to CN201910524595.3A priority Critical patent/CN112183008B/en
Publication of CN112183008A publication Critical patent/CN112183008A/en
Application granted granted Critical
Publication of CN112183008B publication Critical patent/CN112183008B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Dc Digital Transmission (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention provides a terminal resistance matching method of a CAN bus network, which applies a particle swarm algorithm to solve the problem of terminal resistance matching of a CAN bus, utilizes the combination of MATLAB software and Saber software to realize data sharing of the two software, combines the advantages of the two software, and formulates a quantitative evaluation index of a CAN bus signal. 1) Fast and efficient: when the network is complicated, the problem often cannot be solved by matching the terminal resistance by the existing method, and even if the problem is solved, the debugging time of several weeks is required. The method only needs to establish a circuit model of the network and then starts to calculate, the result can be obtained within about 1 day, and the calculated result is superior to the result obtained by the existing method; 2) the method is simple and easy to implement: the circuit model of the network does not need to be solved, and only the corresponding circuit model needs to be established in the Saber software, so that the requirement on optimization personnel is reduced, and the method is simple and easy to implement.

Description

Terminal resistance matching method of CAN bus network
Technical Field
The invention relates to a method for solving the matching problem of CAN bus terminal resistors in any application field. In particular to a terminal resistance matching method of a CAN bus network.
Background
The CAN bus is also called a controller area network, and is a serial communication bus. The CAN bus has the advantages of advanced technology, high reliability, strong anti-electromagnetic interference capability, perfect functions, reasonable cost and the like, and is known as one of the most promising buses. Each CAN bus network must be matched to a termination resistance. In the signal transmission process, the signal quality of each node of the CAN bus is seriously influenced by the signal reflection phenomenon and the existence of the parasitic capacitance of the conducting wire. The termination resistance has two functions: firstly, the impedance of the bus can be continuous, and the influence of the signal reflection phenomenon on the signal quality is reduced; and secondly, a discharge loop can be provided for the parasitic capacitor, and the influence of the parasitic capacitor on the bus signal is reduced. Due to the difference in the number of nodes, communication rate, bus cable length, transceiver type and network topology of each CAN network, the optimal termination resistance of different CAN bus networks varies with the application scenario. Therefore, to ensure the success of the communication, a suitable set of matching resistors must be selected again for each industrial application. The following three methods have been generally adopted in the industrial field. 1. Empirical values are used. This is the most simple and feasible way and the signal quality of the bus is the worst. The communication can be carried out reluctantly in many occasions, but the interference resistance is poor. 2. When the empirical value is not used successfully, a method is generally adopted in which the terminal resistance value is continuously changed and a plurality of attempts are made until the communication is successful. This approach is time consuming and labor intensive, and even if the communication is successful, it cannot be guaranteed that the selected termination resistance is optimal, and the interference rejection is poor. 3. And (4) utilizing a theoretical calculation mode. The method has higher requirement on professional knowledge of designers, and needs to establish an equivalent circuit model of the CAN network and solve the model. The method is time-consuming and labor-consuming, and the calculation result is greatly influenced by the accuracy of the model. Therefore, a convenient and fast method for matching the resistance of the CAN bus terminal is very needed.
Disclosure of Invention
In view of the above problems, the present invention provides a matching method for a CAN bus termination resistor based on a particle swarm algorithm, which adopts the particle swarm algorithm, greatly shortens the working time for matching the CAN bus termination resistor, effectively improves the signal quality of the CAN bus by calculating the termination resistor, and CAN quickly and accurately solve the CAN bus termination matching resistor.
The invention provides a terminal resistance matching method of a CAN bus network, which is characterized by comprising the following steps:
the first step is as follows: according to a circuit diagram of an actual CAN network, establishing a simulation circuit model corresponding to the CAN network in Saber software;
the second step is that: establishing basic algorithm parameters in MATLAB software, calling the basic algorithm parameters of the MATLAB software in Saber software, and initializing the basic algorithm parameters of the simulation circuit model;
the third step: randomly initializing the initial position and the initial speed of each particle in MATLAB software according to the scale and the dimension of the particle; wherein the initial position of each particle corresponds to a set of resistance values;
the fourth step: according to the initial position, the information of the initial position of each particle is transmitted by MATLAB software and written into Saber software, so that the Saber software obtains the resistance value of each node;
the fifth step: modifying the terminal resistance value of each node in the CAN/CAN FD network topology in the Saber software according to the resistance value of each node obtained by the Saber software; then, performing transient direct current simulation again to obtain corresponding CANH and CANL signal line waveform data; the Saber software transmits the simulated waveform data to MATLAB software;
and a sixth step: MATLAB obtains dominant differential voltage V according to waveform datadRecessive differential voltage VrRise time TRA fall time TDFalling edge overshoot σDAnd rising edge overshoot σRThe information of (a); wherein a dominant differential voltage V is calculated in the waveformdHidden differential voltage VrThen, the voltage value at the sampling point of the waveform is taken;
the seventh step: calculating an adaptive value of each particle according to a single objective function based on the quantitative evaluation index of the bus signal; updating the information of the optimal position and the optimal adaptive value of the particle according to the size of the adaptive value;
eighth step: updating the speed and position of each particle according to the speed function and the position function according to the updated information in the seventh step;
the ninth step: transmitting and writing the information to Saber software by MATLAB software according to the updated information of the position of each particle in the eighth step, so that the Saber software obtains the updated resistance value of each node;
the tenth step: judging whether the iteration is finished or not, if the iteration is finished, finishing and obtaining the matched resistor with the optimal terminal; if not, repeating the fourth step to the ninth step until reaching the matched resistance with the corresponding best terminal. And after the optimization is completed, a group of resistance values corresponding to the global optimal particle position is the optimal terminal matching resistance.
As a further description of the terminal resistance matching method of the present invention, preferably, the basic algorithm parameters are that a learning factor is 2, a population size is 20, a population dimension is set according to a node number, an upper limit and a lower limit of each dimension are 20 to 1000, an iteration number is 1000, and an inertial weight that changes is adopted for the inertial weight, the inertial weight at the beginning is 0.9, the inertial weight at the end is 0.4, and each generation is linearly decreased.
As a further description of the termination resistance matching method according to the present invention, in the seventh step, it is preferable that the quantitative evaluation index of the bus signal for determining the bus signal includes a bus voltage level, a signal rise time, and an overshoot.
As a further description of the termination resistance matching method according to the present invention, it is preferable that the bus voltage level is divided into a CANH voltage, a CANL voltage, and a differential voltage; the international standard specifies such CANH, CANL and differential voltages as shown in table 1 below:
TABLE 1 International Standard for Voltage levels
Figure BDA0002097586270000041
According to the table 1, making a quantitative evaluation index of the bus voltage level; wherein, the differential signal is the integrated result of CANH and CANL signal lines, the level of the dominance and the invisibility of the differential signal is selected as the quantitative evaluation standard of the bus voltage level, and the dominant differential voltage V isdEvaluation function f of1And a recessive differential voltage VrEvaluation function f of2As shown in formula (1) and formula (2), respectively;
Figure BDA0002097586270000051
Figure BDA0002097586270000052
according to the formula, the evaluation functions of the dominant differential voltage and the recessive differential voltage are dimensionless values, and the demagnification and normalization of the evaluation functions are realized between 0 and 1.
As a further explanation of the termination resistance matching method according to the present invention, it is preferable that the signal rise time is between two instants at which the instantaneous value of the pulse initially reaches the prescribed lower limit and the prescribed upper limitInterval, including the falling time T of the falling edge from the dominant signal to the recessive signalDAnd a rising time T of a rising edge from a recessive signal to a dominant signalRThe rise time is the time elapsed for the calculation to rise from 10% to 90%;
said fall time TDQuantitative evaluation function f of3And said rise time TRQuantitative evaluation function f of4As shown in equation (3) and equation (4), respectively.
Figure BDA0002097586270000053
Figure BDA0002097586270000054
Wherein, TbitRepresents one bit time of the CAN communication; from the above equation, it can be seen that the quantitative evaluation functions of the rise time and the fall time realize the de-dimensionalization and normalization.
As a further explanation of the terminal resistance matching method according to the present invention, preferably, the overshoot is a percentage of the signal voltage level exceeding its stable voltage value, and includes an overshoot σ of a falling edge from a dominant signal to a recessive signalDAnd the overshoot σ of the rising edge from the recessive signal to the dominant signalR
Overshoot σ of the falling edgeDQuantitative evaluation function f of5Overshoot of the sum rising edge σRQuantitative evaluation function f of6As shown in equation (5) and equation (6), respectively.
Figure BDA0002097586270000061
Figure BDA0002097586270000062
Wherein, VmaxIs a busA maximum value of the signal voltage; vminIs the minimum value of the bus signal voltage; vdIs a dominant differential voltage value; vrIs a recessive differential voltage value; the overshoot is a percentage smaller than 1, and the quantitative evaluation function of the overshoot of the falling edge and the overshoot of the rising edge does not need to be subjected to descaler and normalization.
As a further description of the terminal resistance matching method according to the present invention, preferably, in the seventh step, the single objective function is formula (7), and an optimization algorithm is performed according to formula (7) of the single objective function to calculate an adaptive value of each particle;
the single objective function is shown in equation (7):
f=λ1gf12gf23gf34gf45gf56gf6 (7)
wherein λ is1、λ2、λ3、λ4、λ5And λ6Weighting coefficients which are quantitative evaluation indexes of the six bus signal qualities respectively; f. of1Is a dominant differential voltage VdEvaluation function of f2Is a recessive differential voltage VrEvaluation function of f3To a fall time TDQuantitative evaluation function of f4For a rise time TRQuantitative evaluation function of f5Overshoot for falling edge σDQuantitative evaluation function of f6Overshoot by a rising edgeRThe quantitative evaluation function of (1); f is the final objective function; wherein the weight λ of each evaluation function is determined according to engineering experience1、λ2、λ3、λ4、λ5And λ60.45, 0.15, 0.05, 0.15 and 0.15, respectively.
As a further explanation of the termination resistance matching method according to the present invention, preferably, in the eighth step, the speed function is formula (8), and the position function is formula (9):
Figure BDA0002097586270000071
Figure BDA0002097586270000072
wherein the content of the first and second substances,
Figure BDA0002097586270000073
is the velocity of the particles at time t,
Figure BDA0002097586270000074
is the position of the particle at time t, c1And c2Is a learning factor, c1=c2=2,r1And r2Are random numbers distributed in the interval (0, 1),
Figure BDA0002097586270000075
for the best position of the individual at time t,
Figure BDA0002097586270000076
the position is the global optimal position at the time t, wherein if the speed or the position exceeds the upper limit and the lower limit, the speed or the position is equal to the upper limit or the lower limit;
omega is inertial weight and is represented by formula
Figure BDA0002097586270000077
Determining; wherein, tmaxIs the maximum number of iterations, f is the current number of iterations, ωstartAs the inertial weight start value, ωendIs an inertia weight end value; when the particle updates the state, the position or velocity may exceed the upper and lower limits, and at this time, a special process is required to make the position or velocity equal to the upper or lower limit.
As a further description of the termination resistance matching method according to the present invention, preferably, in the seventh step, the optimum adaptive value is a maximum value among adaptive values of each particle.
As a further description of the termination resistance matching method according to the present invention, in the seventh step, it is preferable that the optimal position is a position of the particle corresponding to the maximum adaptive value.
The invention has the following beneficial effects: the following three methods are generally adopted in the industrial field: 1) empirical values are used. This is the most simple and feasible way and the signal quality of the bus is the worst. The communication can be carried out reluctantly in many occasions, but the interference resistance is poor. 2) When the empirical value is not used successfully, a method is generally adopted in which the terminal resistance value is continuously changed and a plurality of attempts are made until the communication is successful. This approach is time consuming and labor intensive, and even if the communication is successful, it cannot be guaranteed that the selected termination resistance is optimal, and the interference rejection is poor. 3) And (4) utilizing a theoretical calculation mode. The method has higher requirement on professional knowledge of designers, and needs to establish an equivalent circuit model of the CAN network and solve the model.
The method CAN avoid establishing and solving the mathematical model of the CAN network, and does not need to spend a large amount of time to determine the terminal resistance by using an enumeration method. In practical engineering application, the terminal resistance value of the CAN bus network CAN be quickly and accurately determined. Specifically, the beneficial effects of the invention are as follows: 1) fast and efficient: when the network is complicated, the problem often cannot be solved by matching the terminal resistance by the existing method, and even if the problem is solved, the debugging time of several weeks is required. The method only needs to establish a circuit model of the network, then starts to calculate, and can obtain a result within about 1 day, and the calculated result is superior to the result obtained by the existing method; 2) the method is simple and easy to implement: the circuit model of the network does not need to be solved, and only the corresponding circuit model needs to be established in the Saber software, so that the requirement on optimization personnel is reduced, and the method is simple and easy to implement.
Drawings
FIG. 1 is a flow chart of a terminal resistance matching method of a CAN bus network of the present invention;
FIG. 2 is a schematic diagram of the topology optimization of the present invention;
FIG. 3-1 is a waveform illustrating the result of bus signal quality before optimization;
FIG. 3-2 is a waveform illustrating the result of the optimized bus signal quality;
fig. 3-3 is a waveform diagram illustrating comparison results of bus signal quality before and after optimization of fig. 3-1 and fig. 3-2.
Detailed Description
To further understand the structure, characteristics and other objects of the present invention, the following detailed description is given with reference to the accompanying preferred embodiments, which are only used to illustrate the technical solutions of the present invention and are not to limit the present invention.
The invention provides a terminal resistance matching method of a CAN bus network, and figure 1 is a flow chart of the terminal resistance matching method of the CAN bus network. As shown in fig. 1, the termination resistance matching method is implemented as follows.
1. Establishing the combination of Saber and MATLAB of circuit simulation software
The design idea of the invention is as follows: a circuit model of the CAN network is established in Saber, so that bus signal data obtained by different terminal resistors CAN be simulated and transmitted to MATLAB. And the MATLAB calculates different terminal matching resistances and corresponding evaluation function values according to the evaluation functions of the indexes. And repeatedly iterating through an optimization algorithm to obtain the optimal terminal matching resistance of the CAN bus. Therefore, a combination of Saber and MATLAB must be established to enable data sharing between the two pieces of software. The invention realizes the data sharing of Saber and MATLAB by using the following AIM language program:
set PSOfun1″PSOfun1″
set PSOfun2″PSOfun2″
set PSOfun3″PSOfun3″
set PSOfun4″PSOfun4″
set dealwave″dealwave″
set dealvma″dealvma″
ml eval″$PSOfun1″
set i 1000
while{$i<21}{
ml eval″$dealvma″
set R1[MtiTrans:mti2var ml X1]
set R2[MtiTrans:mti2var ml X2]
set R3[MtiTrans:mti2var ml X3]
set R4[MtiTrans:mti2var ml X4]
set R5[MtiTrans:mti2var ml X5]
sch property res_611_value-name rnom[vma:info$R1-data]
sch property res_831_value-name rnom[vma:info$R2-data]
sch property res_970_value-name rnom[vma:info$R3-data]
sch property res_1091_value-name mom[vma:info$R4-data]
sch property res_1203_value-name rnom[vma:info$R5-data]
vma:delete$R1$R2$R3$R4$R5
SimSession runCommand{dc;tr(tend 50u,tstep 0.1u}-blocking no-queue yes
set pf[pf:open-directory C:/Users/Administrator/Desktop/five-filename five_1.tr.ai_pl]
set wf1[pf:read$pf canh]
set wf2[pf:read$pf canl]
MtiTrans:wf2mti ml$wf1
MtiTrans:wf2mti ml$wf2
wf delete$wf1$wf2
pf:close$pf
ml eva1″$dealwave″
set i[expr$i+1]
}
ml eva1″$PSOfun2″
set j 1000
while{$j>0}{
ml eval″$PSOfun3″
set i 1
while{$i<21}{
ml eva1″$dealvma″
set R1[MtiTrans:mti2var ml X1]
set R2[MtiTrans:mti2var ml X2]
set R3[MtiTrans:mti2var ml X3]
set R4[MtiTrans:mti2var ml X4]
set R5[MtiTrans:mti2var ml X5]
sch property res_611_value-name mom[vma:info$R1-data]
sch property res_831_value-name mom[vma:info$R2-data]
sch property res_970_value-name mom[vma:info$R3-data]
sch property res_1091_value-name rnom[vma:info$R4-data]
sch property res_1203_value-name rnom[vma:info$R5-data]
vma:delete$R1$R2$R3$R4$R5
SimSession runCommand{dc;tr(tend 50u,tstep 0.1u}-blocking no-queue yes
set pf[pf:open-directory C:/Users/Administrator/Desktop/five-filename five_1.tr.ai_p1]
set wf1[pf:read$pf canh]
set wf2[pf:read$pf canl]
MtiTrans:wf2mti ml$wf1
MtiTrans:wf2mti ml$wf2
the functions that the above programs can realize are as follows: the bus signal data in Saber is sent to MATLAB and the terminal matching resistance calculated by MATLAB is sent to Saber. Referring to fig. 1, the specific steps are as follows.
The first step is as follows: and according to the circuit diagram of the actual CAN network, establishing a simulation circuit model corresponding to the CAN network in Saber software.
The second step is that: establishing basic algorithm parameters in MATLAB software, calling the basic algorithm parameters of the MATLAB software in Saber software, and initializing the basic algorithm parameters of the simulation circuit model. The basic algorithm parameters are that a learning factor is 2, the size of a population is 20, the dimension of the population is set according to the number of nodes, the upper limit and the lower limit of each dimension are 20-1000, the number of iterations is 1000, and the inertial weight is changed, the inertial weight at the beginning is 0.9, the inertial weight at the end is 0.4, and each generation is linearly decreased.
The third step: randomly initializing the initial position and the initial speed of each particle in MATLAB software according to the scale and the dimension of the particle; wherein the initial position of each particle corresponds to a set of resistance values.
The fourth step: information of the initial position of each particle is transmitted by MATLAB software and written to Saber software according to the initial position, so that the Saber software obtains the resistance value of each node.
The fifth step: modifying the terminal resistance value of each node in the CAN/CAN FD network topology in the Saber software according to the resistance value of each node obtained by the Saber software; then, performing transient direct current simulation again to obtain corresponding CANH and CANL signal line waveform data; the Saber software then passes the simulated waveform data to the MATLAB software.
And a sixth step: MATLAB obtains dominant differential voltage V according to waveform datadRecessive differential voltage VrRise time TRA fall time TDFalling edge overshoot σDAnd rising edge overshoot σRThe information of (a); wherein a dominant differential voltage V is calculated in the waveformdHidden differential voltage VrThen, the voltage value at the sampling point of the waveform is taken.
2. Implementation of particle swarm algorithm
The traditional terminal resistor matching method is only to match terminal resistors at two ends of a specific EUC or at certain specific positions of a bus, and two ends of other ECUs are directly connected with a high-resistance resistor in a kiloohm level in parallel or directly suspended. The method adopted by the invention can match a reasonable resistor for both ends of each ECU. And selecting the dimensionality of the particle swarm algorithm according to the number of terminal resistors needing to be optimized in the actual network topology. Each requiring an "independently" optimized resistance as one dimension of the particle swarm algorithm. By "independent" resistor, it is meant that its resistance is selected independently of the resistance of the other resistors. If two perfectly symmetric resistances are present in the network, then they both count just one "independent resistance". Because, when one resistance value is determined, the other resistance value is also determined.
In combination with the actual situation, the selection range of each resistor can be limited, that is, an upper limit and a lower limit are added to each dimension of the particle swarm optimization. Thus, the optimization time can be saved, and the correctness of the result can be improved. Referring to fig. 1, the specific steps are as follows.
The seventh step: calculating an adaptive value of each particle according to a single objective function based on the quantitative evaluation index of the bus signal; and updating the information of the optimal position and the optimal adaptive value of the particle according to the size of the adaptive value.
In the seventh step, the quantitative evaluation indexes of the bus signals comprise the quantitative evaluation indexes of the bus signals of the bus voltage level, the signal rising time and the overshoot.
First, the bus voltage level is divided into a CANH voltage, a CANL voltage, and a differential voltage; the international standard specifies such CANH, CANL and differential voltages as shown in table 1 below:
TABLE 1 International Standard for Voltage levels
Figure BDA0002097586270000141
According to the table 1, making a quantitative evaluation index of the bus voltage level; wherein, the differential signal is the integrated result of CANH and CANL signal lines, the level of the dominance and the invisibility of the differential signal is selected as the quantitative evaluation standard of the bus voltage level, and the dominant differential voltage V isdEvaluation function f of1And a recessive differential voltage VrEvaluation function f of2As shown in formula (1) and formula (2), respectively;
Figure BDA0002097586270000151
Figure BDA0002097586270000152
according to the formula, the evaluation functions of the dominant differential voltage and the recessive differential voltage are dimensionless values, and the demagnification and normalization of the evaluation functions are realized between 0 and 1.
The signal rise time is the interval between two moments when the instantaneous value of the pulse reaches the lower limit and the upper limit, and includes the fall time T of the falling edge from the dominant signal to the recessive signalDAnd a rising time T of a rising edge from a recessive signal to a dominant signalRThe rise time is the time elapsed for the calculation to rise from 10% to 90%;
said fall time TDQuantitative evaluation function f of3And said rise time TRQuantitative evaluation function f of4As shown in equation (3) and equation (4), respectively.
Figure BDA0002097586270000153
Figure BDA0002097586270000154
Wherein, TbitRepresents one bit time of the CAN communication; from the above equation, it can be seen that the quantitative evaluation functions of the rise time and the fall time realize the de-dimensionalization and normalization.
Furthermore, the overshoot is the percentage of the signal voltage level that exceeds its steady voltage value, including the overshoot σ of the falling edge from dominant to recessive signalDAnd the overshoot σ of the rising edge from the recessive signal to the dominant signalR
Overshoot σ of the falling edgeDQuantitative evaluation function f of5Overshoot of the sum rising edge σRQuantitative evaluation function f of6As shown in equation (5) and equation (6), respectively.
Figure BDA0002097586270000161
Figure BDA0002097586270000162
Wherein, VmaxIs the maximum value of the bus signal voltage; vminIs the minimum value of the bus signal voltage; vdIs a dominant differential voltage value; vrIs a recessive differential voltage value; the overshoot is a percentage smaller than 1, and the quantitative evaluation function of the overshoot of the falling edge and the overshoot of the rising edge does not need to be subjected to descaler and normalization.
In the seventh step, the single objective function is a formula (7), and an optimization algorithm is performed according to the formula (7) of the single objective function to calculate an adaptive value of each particle;
the single objective function is shown in equation (7):
f=λ1gf12gf23gf34gf45gf56gf6 (7)
wherein λ is1、λ2、λ3、λ4、λ5And λ6Weighting coefficients which are quantitative evaluation indexes of the six bus signal qualities respectively; f. of1Is a dominant differential voltage VdEvaluation function of f2Is a recessive differential voltage VrEvaluation function of f3To a fall time TDQuantitative evaluation function of f4For a rise time TRQuantitative evaluation function of f5Overshoot for falling edge σDQuantitative evaluation function of f6Overshoot by a rising edgeRThe quantitative evaluation function of (1); f is the final objective function; wherein the weight λ of each evaluation function is determined according to engineering experience1、λ2、λ3、λ4、λ5And λ60.45, 0.15, 0.05, 0.15 and 0.15, respectively.
Eighth step: and updating the speed and position of each particle according to the speed function and the position function according to the updated information in the seventh step. In the eighth step, the speed function is formula (8), and the position function is formula (9):
Figure BDA0002097586270000171
Figure BDA0002097586270000172
wherein the content of the first and second substances,
Figure BDA0002097586270000173
is the velocity of the particles at time t,
Figure BDA0002097586270000174
is the position of the particle at time t, c1And c2Is a learning factor, c1=c2=2,r1And r2Are random numbers distributed in the interval (0, 1),
Figure BDA0002097586270000175
for the best position of the individual at time t,
Figure BDA0002097586270000176
the position is the global optimal position at the time t, wherein if the speed or the position exceeds the upper limit and the lower limit, the speed or the position is equal to the upper limit or the lower limit;
omega is inertial weight and is represented by formula
Figure BDA0002097586270000177
Determining; wherein, tmaxIs the maximum number of iterations, t is the current number of iterations, ωstartAs the inertial weight start value, ωendIs an inertia weight end value; when the particle updates the state, the position or velocity may exceed the upper and lower limits, and at this time, a special process is required to make the position or velocity equal to the upper or lower limit.
The ninth step: and according to the information of the position of each particle updated in the eighth step, transmitting and writing the information to the Saber software by the MATLAB software, so that the Saber software obtains the updated resistance value of each node.
The tenth step: judging whether the iteration is finished or not, if the iteration is finished, finishing and obtaining the matched resistor with the optimal terminal; if not, repeating the fourth step to the ninth step until reaching the matched resistance with the corresponding best terminal.
And after the optimization is completed, a group of resistance values corresponding to the global optimal particle position is the optimal terminal matching resistance.
Please refer to fig. 2, fig. 3-1, fig. 3-2 and fig. 3-3. FIG. 2 is a schematic diagram of the topology optimization of the present invention; FIG. 3-1 is a waveform illustrating the result of bus signal quality before optimization; FIG. 3-2 is a waveform illustrating the result of the optimized bus signal quality; fig. 3-3 is a waveform diagram illustrating comparison results of bus signal quality before and after optimization of fig. 3-1 and fig. 3-2. The present invention optimizes the topology shown in fig. 2, and it can be seen from the optimization results of fig. 3-1, fig. 3-2 and fig. 3-3 that: the optimized waveform is better than the waveform before optimization. The specific optimization results for each index are shown in table 1:
TABLE 1
Figure BDA0002097586270000181
As can be seen from fig. 2 and 3-1, fig. 3-2 and 3-3 and table 1, the bus signal quality after optimization is better overall than the bus signal quality before optimization. For three evaluation indexes of dominant differential voltage, rising edge overshoot and falling edge overshoot, the optimized bus signal is obviously superior to the bus signal before optimization. Although the bus signals after optimization are slightly inferior to the bus signals before optimization for the three evaluation indexes of the recessive differential voltage, the rising time and the falling time, the quality of the bus signals is not obviously affected. Thus, overall, the optimized bus signal is significantly better than the bus signal before optimization.
The method has the advantages that the establishment and the solution of the mathematical model of the CAN network CAN be avoided, and the terminal resistance CAN be determined by using an enumeration method without spending a large amount of time. In practical engineering application, the method CAN quickly and accurately calculate the terminal matching resistance of the CAN bus network, and CAN effectively optimize bus signals. The method of the invention is specifically shown in the following steps in practical engineering application: 1) fast and efficient: when the network is complicated, the problem often cannot be solved by matching the terminal resistance by the existing method, and even if the problem is solved, the debugging time of several weeks is required. The method only needs to establish a circuit model of the network and then starts to calculate, the result can be obtained within about 1 day, and the calculated result is superior to the result obtained by the existing method; 2) the method is simple and easy to implement: the circuit model of the network does not need to be solved, and only the corresponding circuit model needs to be established in the Saber software, so that the requirement on optimization personnel is reduced, and the method is simple and easy to implement.
It should be noted that the above summary and the detailed description are intended to demonstrate the practical application of the technical solutions provided by the present invention, and should not be construed as limiting the scope of the present invention. Various modifications, equivalent substitutions, or improvements may be made by those skilled in the art within the spirit and principles of the invention. The scope of the invention is to be determined by the appended claims.

Claims (10)

1. A terminal resistance matching method of a CAN bus network is characterized by comprising the following steps:
the first step is as follows: according to a circuit diagram of an actual CAN network, establishing a simulation circuit model corresponding to the CAN network in Saber software;
the second step is that: establishing basic algorithm parameters in MATLAB software, calling the basic algorithm parameters of the MATLAB software in Saber software, and initializing the basic algorithm parameters of the simulation circuit model;
the third step: randomly initializing the initial position and the initial speed of each particle in MATLAB software according to the scale and the dimension of the particle; wherein the initial position of each particle corresponds to a set of resistance values;
the fourth step: according to the initial position, the information of the initial position of each particle is transmitted by MATLAB software and written into Saber software, so that the Saber software obtains the resistance value of each node;
the fifth step: modifying the terminal resistance value of each node in the CAN/CAN FD network topology in the Saber software according to the resistance value of each node obtained by the Saber software; then, performing transient direct current simulation again to obtain corresponding CANH and CANL signal line waveform data; the Saber software transmits the simulated waveform data to MATLAB software;
and a sixth step: MATLAB obtains dominant differential voltage V according to waveform datadRecessive differential voltage VrRise time TRA fall time TDFalling edge overshoot σDAnd rising edge overshoot σRThe information of (a); wherein a dominant differential voltage V is calculated in the waveformdHidden differential voltage VrThen, the voltage value at the sampling point of the waveform is taken;
the seventh step: calculating an adaptive value of each particle according to a single objective function based on the quantitative evaluation index of the bus signal; updating the information of the optimal position and the optimal adaptive value of the particle according to the size of the adaptive value;
eighth step: updating the speed and position of each particle according to the speed function and the position function according to the updated information in the seventh step;
the ninth step: transmitting and writing the information to Saber software by MATLAB software according to the updated information of the position of each particle in the eighth step, so that the Saber software obtains the updated resistance value of each node;
the tenth step: judging whether the iteration is finished or not, if the iteration is finished, finishing and obtaining the matched resistor with the optimal terminal; if not, repeating the fourth step to the ninth step until reaching the matched resistance with the corresponding best terminal.
2. The terminal resistance matching method according to claim 1, wherein the basic algorithm parameters are that a learning factor is 2, a population size is 20, a population dimension is set according to the number of nodes, the upper and lower limits of each dimension are 20-1000, the number of iterations is 1000, and the inertial weight is changed, the inertial weight at the beginning is 0.9, the inertial weight at the end is 0.4, and each generation is linearly decreased.
3. The termination resistance matching method according to claim 1, wherein in the seventh step, the quantitative evaluation index of the bus signal for determining the bus signal includes a bus voltage level, a signal rise time, and an overshoot.
4. A termination resistance matching method according to claim 3, characterised in that the bus voltage level is divided into CANH voltage, CANL voltage and differential voltage; the international standard specifies such CANH, CANL and differential voltages as shown in table 1 below:
TABLE 1 International Standard for Voltage levels
Figure FDA0002097586260000031
According to the table 1, making a quantitative evaluation index of the bus voltage level; wherein, the differential signal is the integrated result of CANH and CANL signal lines, the level of the dominance and the invisibility of the differential signal is selected as the quantitative evaluation standard of the bus voltage level, and the dominant differential voltage V isdEvaluation function f of1And a recessive differential voltage VrEvaluation function f of2As shown in formula (1) and formula (2), respectively;
Figure FDA0002097586260000032
Figure FDA0002097586260000033
according to the formula, the evaluation functions of the dominant differential voltage and the recessive differential voltage are dimensionless values, and the demagnification and normalization of the evaluation functions are realized between 0 and 1.
5. The termination resistance matching method according to claim 3, wherein the signal rise time is an interval between two instants at which an instantaneous value of the pulse initially reaches a prescribed lower limit and a prescribed upper limit, and includes a fall time T of a falling edge from the dominant signal to the recessive signalDAnd a rising time T of a rising edge from a recessive signal to a dominant signalRThe rise time is the time elapsed for the calculation to rise from 10% to 90%;
said fall time TDQuantitative evaluation function f of3And said rise time TRQuantitative evaluation function f of4As shown in equation (3) and equation (4), respectively.
Figure FDA0002097586260000041
Figure FDA0002097586260000042
Wherein, TbitRepresents one bit time of the CAN communication; from the above equation, it can be seen that the quantitative evaluation functions of the rise time and the fall time realize the de-dimensionalization and normalization.
6. The termination resistance matching method according to claim 3, wherein the overshoot is a percentage of the signal voltage level exceeding its steady voltage value, and comprises an overshoot σ of the falling edge from a dominant signal to a recessive signalDAnd the overshoot σ of the rising edge from the recessive signal to the dominant signalR
Overshoot σ of the falling edgeDQuantitative evaluation function f of5Overshoot of the sum rising edge σRQuantitative evaluation function f of6As shown in equation (5) and equation (6), respectively.
Figure FDA0002097586260000043
Figure FDA0002097586260000044
Wherein, VmaxIs the maximum value of the bus signal voltage; vminIs the minimum value of the bus signal voltage; vdIs a dominant differential voltage value; vrIs a recessive differential voltage value; the overshoot is a percentage smaller than 1, and the quantitative evaluation function of the overshoot of the falling edge and the overshoot of the rising edge does not need to be subjected to descaler and normalization.
7. The termination resistance matching method according to claim 1, wherein in the seventh step, the single objective function is formula (7), and an optimization algorithm is performed according to formula (7) of the single objective function to calculate an adaptive value of each particle;
the single objective function is shown in equation (7):
f=λ1gf12gf23gf34gf45gf56gf6 (7)
wherein λ is1、λ2、λ3、λ4、λ5And λ6Weighting coefficients which are quantitative evaluation indexes of the six bus signal qualities respectively; f. of1Is a dominant differential voltage VdEvaluation function of f2Is a recessive differential voltage VrEvaluation function of f3To a fall time TDQuantitative evaluation function of f4For a rise time TRQuantitative evaluation function of f5Overshoot for falling edge σDQuantitative evaluation function of f6Overshoot by a rising edgeRThe quantitative evaluation function of (1); f is the final objective function; wherein the weight λ of each evaluation function is determined according to engineering experience1、λ2、λ3、λ4、λ5And λ60.45, 0.15, 0.05, 0.15 and 0.15, respectively.
8. The termination resistance matching method according to claim 1, wherein in the eighth step, the velocity function is formula (8), and the position function is formula (9):
Figure FDA0002097586260000051
Figure FDA0002097586260000052
wherein the content of the first and second substances,
Figure FDA0002097586260000053
is the velocity of the particles at time t,
Figure FDA0002097586260000054
is the position of the particle at time t, c1And c2Is a learning factor, c1=c2=2,r1And r2Are random numbers distributed in the interval (0, 1),
Figure FDA0002097586260000055
for the best position of the individual at time t,
Figure FDA0002097586260000056
the position is the global optimal position at the time t, wherein if the speed or the position exceeds the upper limit and the lower limit, the speed or the position is equal to the upper limit or the lower limit;
omega is inertial weight and is represented by formula
Figure FDA0002097586260000061
Determining; wherein, tmaxIs the maximum number of iterations, t is the current number of iterations, ωstartAs the inertial weight start value, ωendIs an inertia weight end value; when the particle updates the state, the position or velocity may exceed the upper and lower limits, and at this time, a special process is required to make the position or velocity equal to the upper or lower limit.
9. The termination resistance matching method according to claim 1, wherein in the seventh step, the optimum adaptive value is a maximum value among adaptive values of each particle.
10. The termination resistance matching method according to claim 1, wherein in the seventh step, the optimal position is a position of the particle corresponding to the maximum adaptive value, which is the optimal position.
CN201910524595.3A 2019-06-18 2019-06-18 Terminal resistance matching method of CAN bus network Active CN112183008B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910524595.3A CN112183008B (en) 2019-06-18 2019-06-18 Terminal resistance matching method of CAN bus network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910524595.3A CN112183008B (en) 2019-06-18 2019-06-18 Terminal resistance matching method of CAN bus network

Publications (2)

Publication Number Publication Date
CN112183008A true CN112183008A (en) 2021-01-05
CN112183008B CN112183008B (en) 2022-07-22

Family

ID=73914401

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910524595.3A Active CN112183008B (en) 2019-06-18 2019-06-18 Terminal resistance matching method of CAN bus network

Country Status (1)

Country Link
CN (1) CN112183008B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114217563A (en) * 2022-01-14 2022-03-22 华清科盛(北京)信息技术有限公司 Terminal resistance adjusting method and device of industrial CAN bus based on sorting system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8018874B1 (en) * 2009-05-06 2011-09-13 Hrl Laboratories, Llc Network optimization system implementing distributed particle swarm optimization
US20160125103A1 (en) * 2014-10-31 2016-05-05 International Business Machines Corporation Accelerating particle-swarm algorithms
CN106444956A (en) * 2016-10-31 2017-02-22 北京信息科技大学 Particle swarm optimization based control method and device of photovoltaic maximum power point tracking
WO2017124809A1 (en) * 2016-01-21 2017-07-27 上海斐讯数据通信技术有限公司 Particle swarm optimization method and system based on gpu operation of mobile terminal
CN107959608A (en) * 2017-12-06 2018-04-24 珠海格力电器股份有限公司 CAN bus terminal resistance matching process and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8018874B1 (en) * 2009-05-06 2011-09-13 Hrl Laboratories, Llc Network optimization system implementing distributed particle swarm optimization
US20160125103A1 (en) * 2014-10-31 2016-05-05 International Business Machines Corporation Accelerating particle-swarm algorithms
WO2017124809A1 (en) * 2016-01-21 2017-07-27 上海斐讯数据通信技术有限公司 Particle swarm optimization method and system based on gpu operation of mobile terminal
CN106444956A (en) * 2016-10-31 2017-02-22 北京信息科技大学 Particle swarm optimization based control method and device of photovoltaic maximum power point tracking
CN107959608A (en) * 2017-12-06 2018-04-24 珠海格力电器股份有限公司 CAN bus terminal resistance matching process and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
赵建辉 等: "粒子群优化点匹配算法", 《微计算机信息》, 31 December 2010 (2010-12-31), pages 202 - 204 *
陈龙威 等: "一种CAN总线终端电阻匹配系统的设计", 《电器与能效管理技术》, 31 December 2015 (2015-12-31), pages 37 - 41 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114217563A (en) * 2022-01-14 2022-03-22 华清科盛(北京)信息技术有限公司 Terminal resistance adjusting method and device of industrial CAN bus based on sorting system

Also Published As

Publication number Publication date
CN112183008B (en) 2022-07-22

Similar Documents

Publication Publication Date Title
CN105574191B (en) Online community network multi-source point information source tracing system and method
CN112183008B (en) Terminal resistance matching method of CAN bus network
CN115113686A (en) Timing adjustment method and device, storage medium and electronic equipment
CN113422695B (en) Optimization method for improving robustness of topological structure of Internet of things
CN106685745B (en) A kind of constructing network topology method and device
CN108833548A (en) SD-WAN network system and for network flow accelerate optimization method
CN108259195A (en) The determining method and system of the coverage of anomalous event
CN113054651B (en) Network topology optimization method, device and system
CN107330221A (en) The worst eye pattern implementation method based on PDN Yu passage cooperation model
EP2991234A1 (en) Method, apparatus, and system for configuring high-speed serial bus parameter
CN115829055A (en) Federal learning model training method and device, computer equipment and storage medium
CN109510681B (en) Reference node selection method with minimum time synchronization series of communication network
CN110334104A (en) A kind of list update method, device, electronic equipment and storage medium
CN111597139B (en) Communication method, system, equipment and medium of GPU
WO2013183317A1 (en) High-frequency wiring structure, high-frequency mounting substrate, method for producing high-frequency wiring structure, and method for shaping waveform of high-frequency signal
CN106953820A (en) Signal blind checking method based on the plural continuous neural networks of double Sigmoid
CN114610664A (en) Parameter value determining method and chip
CN105634677B (en) Ethernet transmission circuit
CN114401192B (en) Multi-SDN controller cooperative training method
CN111277429B (en) SerDes parameter screening method, device, system and readable storage medium
Xiao et al. Constructing real-life benchmarks for community detection by rewiring edges
CN106455324A (en) Method and system for generating topological structures
CN105389441A (en) Acquisition method and apparatus for reflected voltage in specified location of 1553B network
CN111628947B (en) Techniques for improving high-speed communications in computing systems
CN112597729B (en) DDR SDRAM channel optimization method and device and memory chip

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