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

Terminal resistance matching method of CAN bus network Download PDF

Info

Publication number
CN112183008B
CN112183008B CN201910524595.3A CN201910524595A CN112183008B CN 112183008 B CN112183008 B CN 112183008B CN 201910524595 A CN201910524595 A CN 201910524595A CN 112183008 B CN112183008 B CN 112183008B
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.)
Active
Application number
CN201910524595.3A
Other languages
Chinese (zh)
Other versions
CN112183008A (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, it takes several weeks of debugging time. 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, also known as a controller area network, is a serial communication bus. The CAN bus has the advantages of advanced technology, high reliability, strong anti-electromagnetic interference capability, complete functions, reasonable cost and the like, and is recognized 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 successful communication, a suitable set of matching resistors must be reselected 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: 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 VrRising time TRAnd a falling 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 VrTaking the sampling point of the waveformThe voltage value of (d);
the seventh step: then based on the quantitative evaluation index of the bus signal, calculating the adaptive value of each particle according to a single objective function; updating the information of the optimal position and the optimal adaptive value of the particle according to the size of the adaptive value;
the 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, if the iteration is finished, finishing and obtaining the optimal terminal matching resistance; 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 positions are the optimal terminal matching resistance.
As a further description of the terminal resistance matching method according to 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 the number of nodes, 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 linearly decreases.
As a further description of the termination resistance matching method according to the present invention, preferably, 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.
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 standards specify such a CANH voltage, CANL voltage, and differential voltage as shown in table 1 below:
TABLE 1 International standards for Voltage levels
Figure GDA0003606761430000041
According to the table 1, a quantitative evaluation index of the bus voltage level is formulated; wherein the differential signal is the integrated result of CANH and CANL signal lines, the dominance and invisibility level of the differential signal is selected as the quantitative evaluation standard of the bus voltage level, and the dominance differential voltage VdEvaluation function f of1And a recessive differential voltage VrEvaluation function f of2As shown in formula (1) and formula (2), respectively;
Figure GDA0003606761430000051
Figure GDA0003606761430000052
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 an interval between two instants at which an instantaneous value of the pulse initially reaches a predetermined lower limit and a predetermined upper limit, and includes a fall time T of a falling edge from a dominant signal to a 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 GDA0003606761430000053
Figure GDA0003606761430000054
Wherein, TbitRepresents one bit time of 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 description 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 of5And overshoot of the rising edge σRQuantitative evaluation function f of6As shown in equation (5) and equation (6), respectively.
Figure GDA0003606761430000061
Figure GDA0003606761430000062
Wherein, VmaxIs the maximum value of the bus signal voltage; vminIs the minimum value of the bus signal voltage; vdIs the dominant differential voltage value; vrIs a recessive differential voltage value; the overshoot is a percentage smaller than 1, and the quantitative evaluation functions of the overshoot of the falling edge and the overshoot of the rising edge do 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=λ1f12f23f34f45f56f6 (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 (d), f4For a rise time TRQuantitative evaluation function of f5Overshoot for falling edge σDQuantitative evaluation function of f6Overshoot for rising edge σRThe quantitative evaluation function of (2); 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 GDA0003606761430000071
Figure GDA0003606761430000072
wherein the content of the first and second substances,
Figure GDA0003606761430000073
is the velocity of the particles at time t,
Figure GDA0003606761430000074
is a particle at time tPosition of (a), (b) c1And c2Is a learning factor, c1=c2=2,r1And r2Are random numbers distributed in intervals (0,1),
Figure GDA0003606761430000075
for the best position of the individual at time t,
Figure GDA0003606761430000076
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, expressed by formula
Figure GDA0003606761430000077
Determining; wherein, tmaxIs the maximum number of iterations, t is the current number of iterations, ωstartAs the inertial weight start value, ωendIs the 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, preferably, in the seventh step, the optimal position is a position of the particle corresponding to the maximum adaptive value, which is the optimal position.
The invention has the following beneficial effects: 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 reluctant 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 terminal resistance is optimal, and the interference rejection is poor. 3) And (4) a theoretical calculation mode is utilized. 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, it takes several weeks of debugging time. The method only needs to establish a circuit model of the network, 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.
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 bus signal quality after optimization;
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 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_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 eval"$dealwave"
set i[expr$i+1]
}
ml eval"$PSOfun2"
set j 1000
while{$j>0}{
ml eval"$PSOfun3"
set i 1
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 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_pl]
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: 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 transmits the simulated waveform data to the MATLAB software.
And a sixth step: MATLAB obtains dominant differential voltage V according to waveform datadRecessive differential voltage VrRising time TRA fall time TDFalling edge overshoot σDAnd the 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 optimization
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 at both ends of each ECU. And selecting the dimensionality of the particle swarm optimization 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 there are two perfectly symmetric resistors 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 standards specify such a CANH voltage, CANL voltage, and differential voltage as shown in table 1 below:
TABLE 1 International standards for Voltage levels
Figure GDA0003606761430000141
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 GDA0003606761430000151
Figure GDA0003606761430000152
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 GDA0003606761430000153
Figure GDA0003606761430000154
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 state voltage value, and includes the overshoot σ of the falling edge from the dominant signal to the recessive signalDAnd the amount of overshoot sigma 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 GDA0003606761430000161
Figure GDA0003606761430000162
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 functions of the overshoot of the falling edge and the overshoot of the rising edge do 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=λ1f12f23f34f45f56f6 (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 f3For a falling 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 lambda 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 GDA0003606761430000171
Figure GDA0003606761430000172
wherein the content of the first and second substances,
Figure GDA0003606761430000173
is the velocity of the particles at time t,
Figure GDA0003606761430000174
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 GDA0003606761430000175
for the best position of the individual at time t,
Figure GDA0003606761430000176
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, expressed by formula
Figure GDA0003606761430000177
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 optimal terminal matching resistance.
And after the optimization is completed, a group of resistance values corresponding to the global optimal particle positions are 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 can be seen from the optimization results of fig. 3-1, fig. 3-2 and fig. 3-3: 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 GDA0003606761430000181
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 signal after optimization is slightly inferior to the bus signal before optimization in terms of the three evaluation indexes, namely the recessive differential voltage, the rising time and the falling time, the quality of the bus signal 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 a 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 embodied in the following concrete steps in the 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 within the spirit and scope of the invention may occur to those skilled in the art. The scope of the invention is defined 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 present in the calculated waveformdHidden differential voltage VrThen, the voltage value at the sampling point of the waveform is taken;
the seventh step: then based on the quantitative evaluation index of the bus signal, calculating the adaptive value of each particle according to a single objective function; 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 information of the position of each particle updated 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, if the iteration is finished, finishing and obtaining the optimal terminal matching resistance; if not, repeating the fourth step to the ninth step until reaching the optimal terminal matching resistance.
2. The terminal resistor matching method according to claim 1, wherein the basic algorithm parameters are a learning factor of 2, a population size of 20, a population dimension set according to the number of nodes, upper and lower limits of each dimension of 20-1000, an iteration number of 1000, and an inertia weight which changes according to the inertia weight, the inertia weight at the beginning is 0.9, the inertia weight at the end is 0.4, and each generation linearly decreases.
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. The termination resistance matching method of claim 3, wherein 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 FDA0003606761420000031
According to the table 1, a quantitative evaluation index of the bus voltage level is formulated; 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 FDA0003606761420000032
Figure FDA0003606761420000033
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 method according to claim 3, wherein the signal rise time is an interval between two instants at which the instantaneous value of the pulse initially reaches a predetermined lower limit and a predetermined 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 FDA0003606761420000041
Figure FDA0003606761420000042
wherein, TbitRepresents one bit time of 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 amount of overshoot sigma of the rising edge from the recessive signal to the dominant signalR
Overshoot σ of the falling edgeDQuantitative evaluation function f of5And overshoot of the rising edge σRQuantitative evaluation function f of6As shown in equation (5) and equation (6), respectively.
Figure FDA0003606761420000043
Figure FDA0003606761420000044
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 functions of the overshoot of the falling edge and the overshoot of the rising edge do not need to be subjected to descaler and normalization.
7. The method for matching a termination resistance 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=λ1f12f23f34f45f56f6 (7)
wherein λ is1、λ2、λ3、λ4、λ5And λ6Weighting coefficients which are quantitative evaluation indexes of the six bus signal qualities respectively; f. of1Is dominant differential voltage VdEvaluation function of (f)2Is a recessive differential voltage VrEvaluation function of (f)3For a falling time TDQuantitative evaluation function of (d), f4Is the rise time TRQuantitative evaluation function of (d), f5Overshoot for falling edge σDQuantitative evaluation function of f6Overshoot by a rising edgeRThe quantitative evaluation function of (2); 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 FDA0003606761420000051
Figure FDA0003606761420000052
wherein the content of the first and second substances,
Figure FDA0003606761420000053
is the velocity of the particles at time t,
Figure FDA0003606761420000054
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 FDA0003606761420000055
is the best position of the individual at time t,
Figure FDA0003606761420000056
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 FDA0003606761420000061
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 update state is in a state where the position or velocity exceeds the upper and lower limits, a special process is required to make the position or velocity equal to the upper or lower limits.
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 method of 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 CN112183008A (en) 2021-01-05
CN112183008B true 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)

Families Citing this family (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 (4)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10013513B2 (en) * 2014-10-31 2018-07-03 International Business Machines Corporation Accelerating particle-swarm algorithms

Patent Citations (4)

* 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
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
赵建辉 等.粒子群优化点匹配算法.《微计算机信息》.2010, *
陈龙威 等.一种CAN总线终端电阻匹配系统的设计.《电器与能效管理技术》.2015, *

Also Published As

Publication number Publication date
CN112183008A (en) 2021-01-05

Similar Documents

Publication Publication Date Title
CN103426042B (en) The group technology of social networks and system
CN105574191B (en) Online community network multi-source point information source tracing system and method
CN109921939B (en) Method and system for selecting key nodes in communication network
CN107169557A (en) A kind of method being improved to cuckoo optimized algorithm
CN112183008B (en) Terminal resistance matching method of CAN bus network
CN113422695B (en) Optimization method for improving robustness of topological structure of Internet of things
CN115113686A (en) Timing adjustment method and device, storage medium and electronic equipment
Yuan et al. Interplay between structure and dynamics in adaptive complex networks: Emergence and amplification of modularity by adaptive dynamics
CN106685745B (en) A kind of constructing network topology method and device
CN113054651B (en) Network topology optimization method, device and system
CN115829055A (en) Federal learning model training method and device, computer equipment and storage medium
CN109816544B (en) Information propagation model realization method and device based on contact probability
CN102857389A (en) Frequency domain distortion prediction channel modeling method of 1553B bus
CN109510681B (en) Reference node selection method with minimum time synchronization series of communication network
CN111597139B (en) Communication method, system, equipment and medium of GPU
CN108829923A (en) Delay calibration determination method for parameter, device, electronic equipment and storage medium
CN114401192B (en) Multi-SDN controller cooperative training method
CN107895078A (en) Macro model construction method of the strong electromagnetic pulse to long electric power transmission line coupling response
CN107315918B (en) Method for improving steady estimation by using noise
Xiao et al. Constructing real-life benchmarks for community detection by rewiring edges
CN105389441A (en) Acquisition method and apparatus for reflected voltage in specified location of 1553B network
CN113794994B (en) Information gathering method and device based on multicast domain name system and application thereof
NAN et al. A Particle Swarm Optimization for Terminal Resistor Matching
CN111027268B (en) Circuit for simulating common mode choke coil
Antonakaki et al. Evolving twitter: an experimental analysis of graph properties of the social graph

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