Disclosure of Invention
Aiming at the problems of edge server buffer congestion caused by excessive task uploading and buffer task incomplete processing during cell switching, the invention provides a method for joint bandwidth allocation and data stream unloading based on an MEC single-vehicle single-cell under a single-vehicle single-cell scene.
The invention also provides a computer device and a storage medium;
the invention researches that in a single-vehicle single-cell scene, a vehicle sends a data stream unloading calculation request to an edge server at a certain position, the edge server is determined to allocate the optimal bandwidth for the vehicle according to the speed, the initial position and the size of the data stream of the vehicle, the limited calculation capacity of a vehicle-mounted unit, the calculation capacity of the edge server, the maximum storage capacity of a buffer area and other factors, the problem of buffer area congestion of the edge server and the problem that the data stream of the buffer area of the edge server is not processed completely when the vehicle cell is switched are solved, and the minimum time delay of the calculation of the total data stream of the vehicle in the cell or the maximum uploading data quantity are realized.
The invention solves the problem of edge server buffer area congestion and the problem that the data stream of the edge server buffer area is not processed completely when the vehicles are switched in the cell. The edge server provides an optimal bandwidth allocation method for the vehicles, the uploaded data volume is reasonably controlled, and the minimum time delay of total vehicle data flow calculation or the maximum uploaded data volume in the cell is realized.
The technical scheme of the invention is as follows:
a method for joint bandwidth allocation and data flow unloading based on an MEC single-vehicle single-cell is characterized in that: when the vehicle leaves the cell and the total data flow is completed in the cell, the lowest time delay t of the total data flow of the vehicle is calculateds(ii) a Because the processed data flow is too large, when the vehicle leaves the cell and the total data flow is not finished in the cell, the edge server solves the problem of buffer area congestion of the edge server and the problem that the data flow of the buffer area of the edge server is not finished when the vehicle is switched between the cells by a method for distributing optimal bandwidth, and the data uploading quantity of the vehicle is maximum.
According to the optimization of the invention, the vehicle i completes the total data stream in the cell, and the lowest total time delay t of the processed vehicle total data stream is calculated according to the method of distributing the optimal bandwidth of the vehicle i by the edge server jsThe method comprises the following steps:
A. according to equation (1), an initial bandwidth b is given0Under the condition of meeting the maximum capacity of the buffer area of the edge server j, the maximum bandwidth b provided by the edge server j for the vehicle i is calculated by adopting a PID algorithmij,bij=b1The bandwidth b of the vehicle i provided by the edge server j satisfies b ═ b0,b1](ii) a The data volume uploaded by the vehicle i can be reasonably controlled, and the problem of congestion of the buffer area of the edge server j is solved.
In the formula (1), N edge servers provide communication, storage and calculation resources for vehicles on a suburb or a highway, M vehicles run in a cell served by an edge server j, j is { 1.·, N }, a certain vehicle i runs at a constant speed in a straight line in the cell served by the edge server j, and i is { 1.·, M }, and a task unloading request is sent to the edge server at a certain position in the cell;
vehicle i is traveling at velocity v in the cell served by edge server j
ijStraight-line running at a constant speed at a certain initial position a
ijThe time required for the vehicle i to travel in the cell is t until the vehicle i leaves the cell after starting to transmit the data stream to the edge server j
4:
When the vehicle leaves the cell, the total data flow is completed in the cell, which means that: t is more than or equal to 0 and less than or equal to t of the vehicle
4Completing data flow unloading calculation in a time period;
Pijis the uplink transmission power, h, of vehicle i at edge server jijIs the small-scale fading path loss, N, of vehicle i at edge server j0Is the noise power spectral density of the edge server j receive segment; height of edge server j service is HjRice, horizontal distance to road surface DjRice, diameter of radiation range LCMeter, k is the number of revolutions of the CPU required by each bit, and epsilon refers to the maximum storage capacity of the buffer area;
t1is the moment when the first upload rate equals the computed rate of the edge server, t2Is the moment when the second upload rate equals the calculated rate of the edge server, t3Is the time when the data stream in the buffer of the edge server is processed, tsIs the total time delay for completing the vehicle data flow in the cell, xi is the integral parameter of the uploading rate integral with time, fjIs the number of revolutions per second, R, of the j CPU of the edge serverij(0) Vehicle i upload rate when t is 0;
B. according to the step AOut of the bandwidth b range, b ∈ [ b [ ]0,b1]B, under the condition of finishing calculating the data stream of the buffer zone when the vehicle i leaves the cell, bijCalculating the maximum bandwidth b provided by the edge server j for the vehicle i by adopting a PID algorithm to the formula (2)ij,bij=b2(ii) a The bandwidth b range of the vehicle i provided by the edge server j satisfies b E [ b ∈0,b2],b2∈[b0,b1](ii) a The data flow uploaded by the vehicle i can be reasonably controlled, and the problem that when the vehicle i leaves the cell, the data flow of the buffer area of the edge server is not processed completely is solved.
C. And B, calculating a bandwidth B range B epsilon [ B ] meeting the constraint condition according to the step A and the step B
0,b
2]Considering the factors of the size and initial position of the data stream, the uploading rate when t is 0
If vehicle i data stream S
iSatisfies S
iWhen S is less than or equal to S, the maximum bandwidth b is solved by a PID algorithm adjusting bandwidth method under the condition that no data stream is stored in a j buffer area of the edge server
ijSo that the total time delay t of the objective function
sMinimum, i.e. t
s=t
1Calculating the total time delay as shown in the formula (3); if vehicle i data stream S
iSatisfies S
iWhen the bandwidth is larger than S, the bandwidth is adjusted through a PID algorithm, and the maximum bandwidth b is solved under the condition that the data stream stored in the buffer area is not larger than the maximum capacity of the buffer area
ijIn the known bandwidth range, the bandwidth method is adjusted through a PID algorithm to solve the optimal bandwidth b
ijSo that the total time delay t of the objective function
sLowest and satisfies the total delay t
sAt t
2<t
3≤t
s≤t
4In the range, formula (3) is as follows:
in the formula (3), R (xi) is xi ranging from 0 to tsUpload rate at any time in time, SiIs the size of the data stream that vehicle i needs to compute, in bits. Expanding the uploading rate R (xi) to know, the edge server j provides the optimal bandwidth b of the vehicle iijThe above two problems can be solved and the total task S is calculatediThe lowest delay.
According to the invention, when the vehicle leaves the cell and the total data stream is not completed in the cell, the edge server solves the problem of edge server buffer area congestion and the problem that the data stream of the edge server buffer area is not completed when the vehicle is switched over, and the vehicle data uploading amount is maximum by the method for distributing the optimal bandwidth, and the method comprises the following steps:
D. according to equation (1), an initial bandwidth b is given0Under the condition of meeting the maximum capacity of the buffer area of the edge server j, the maximum bandwidth b provided by the edge server j for the vehicle i is calculated by adopting a PID algorithmij,bij=b1The bandwidth range of the vehicle i provided at the edge server j satisfies b ═ b0,b1](ii) a The data volume uploaded by the vehicle i can be reasonably controlled, and the problem of congestion of the buffer area of the edge server j is solved.
E. According to the bandwidth b range calculated in the step D, b belongs to [ b ∈ [)0,b1]B, under the condition of finishing calculating the data stream of the buffer zone when the vehicle i leaves the cell, bijCalculating the maximum bandwidth b provided by the edge server j for the vehicle i by adopting a PID algorithm to the formula (2)ij,bij=b2(ii) a The bandwidth b range of the vehicle i provided by the edge server j satisfies b E [ b ∈0,b2],b2∈[b0,b1](ii) a The data flow uploaded by the vehicle i can be reasonably controlled, and the problem that when the vehicle i leaves the cell, the data flow of the buffer area of the edge server is not processed completely is solved.
F. According to the bandwidth b range which is calculated in the step D and the step E and meets the constraint condition, b belongs to [ b ]0,b2]. Within the known bandwidth range, the optimal band is solved by a bandwidth adjusting methodWidth bij,bij=b2According to the time t when the vehicle i runs in the cell of the edge server j, t is t4Solving the maximum data quantity S of the objective functionijAs shown in formula (4):
in the formula (4), R (xi) is xi ranging from 0 to tsUpload rate S at any time within timeijIs the amount of data uploaded by vehicle i in cell of edge server j, and the unit is bit. Expanding the uploading rate R (xi) to know, the edge server j provides the optimal bandwidth b of the vehicle iijThe two problems can be solved, and the vehicle i uploads the maximum data volume S in the cell of the edge server jij。
According to the invention, the following steps are preferably executed before the step A and the step D, and the steps comprise:
a. calculating an initial bandwidth b
0: when in use
When t is equal to 0, the sum of the values,
solving the initial bandwidth b
0,b
0≤B
j;
a
0Refers to the radius of the communication range of the edge server j, i.e.
Wherein L is
CIs the edge server communication diameter; when in use
And when t is 0, R
ij(0) The uploading rate of the vehicle i at the nearest position of the edge server j when t is 0;
b. judging the initial position a
ijAnd
in a relation of
Then, calculate R
ij(0):
Namely at
Then, the sum S of the data stream uploaded and calculated at the time point and the data stream calculated by the vehicle-mounted terminal is as shown in formula (5):
c. the sum S of the data streams is compared with the total data stream S of the vehicle iiMaking a comparison, if SiLess than or equal to S, adopting PID algorithm to convert the initial bandwidth b0Substituting equation (6) calculates the difference e:
when the difference e is greater than or equal to the set threshold, increasing the initial bandwidth b
0The coefficient of increase is c; bandwidth b
ij=b
0+ce,b
ij≤B
jCalculating
To obtain a time point t
1,t
1The time point when the first uploading rate is equal to the computing rate of the edge server is obtained;
then the new bandwidth b is addedijSubstituting the formula (6), calculating a new difference e, iterating for multiple times until the difference e is smaller than a set threshold value, jumping out of the loop, and obtaining the bandwidth b meeting the minimum total time delay calculated by the total data of the vehicleij(ii) a Data stream no store bufferZone, not necessarily at t2Releasing the computing power after a point in time to process the buffer data stream, t2For the time point when the second upload rate is equal to the calculated rate of the edge server, the lowest total delay is ts=t1;
If S isiS, enter step A or step D.
According to a preferred embodiment of the invention, an initial bandwidth b is given in step A or step D
0And calculating the optimal bandwidth provided by the edge server j for the vehicle i by adopting a PID algorithm: when in use
When the step (d) is performed, step (d) is performed
If yes, entering the step e;
step d is as follows:
using PID algorithm, the calculation is performed at time t1And t2The memory capacity of the data stream uploading buffer is less than or equal to the maximum buffer memory capacity epsilon:
first, an initial bandwidth b is defined
0Substituting into formula
To obtain a time point t
1And t
2;
Then, the initial bandwidth b0Substituting equation (7) to calculate the target value ε and t1And t2Data flow difference value e of the buffer area between:
when the difference e is larger than or equal to the set value c, the bandwidth b is adjustedij=b0+ce,bij≤Bj;
Then the new bandwidth b is addedijSubstituting the formula (7) to recalculate the difference e, iterating for multiple times until the difference e is smaller than the set threshold value, jumping out of the loop, and calculating a satisfaction stripOptimum bandwidth of the element bij(ii) a By means of Matlab simulation, considering the influence of different initial positions and vehicle speeds on the bandwidth requirement, the problem of buffer congestion is solved by a bandwidth adjusting method to obtain a simulation diagram, as shown in FIG. 5.
Step e is as follows:
satisfy the requirement of
When the condition is met, firstly, the initial bandwidth b
0Substituting into formula
To obtain a time point t
1And t
2At the time point t of solution
1Is a negative number, take
t 10; then, the initial bandwidth b
0Substituting equation (8) to calculate the target value ε and t
1And t
2The data flow difference e of the buffer areas between;
when the difference e is larger than or equal to the set value c, the bandwidth b is adjustedij=b0+ce,bij≤Bj(ii) a Then the new bandwidth b is addedijSubstituting the formula (8) to recalculate the difference e, iterating for multiple times until the difference e is smaller than the set threshold value, jumping out of the loop, and calculating the optimal bandwidth b meeting the conditionij。
Preferably, in step B or E, the optimal bandwidth satisfying time t is calculated by using a PID algorithm to formula (2)
3At t
2≤t
3≤t
4Calculating the optimal bandwidth provided by the edge server j for the vehicle i within the range; when in use
When the step f is performed, go to step f
Entering step g;
step f is as follows:
and the bandwidth is adjusted by adopting a PID algorithm, so that the problem that the data stream of the buffer area is processed when the vehicle leaves the cell is solved:
under the condition of satisfying the above-mentioned solution bandwidth range, firstly, the initial bandwidth b is set0Substituting equation (9) to calculate the time t for finishing processing the buffer3:
Then, the target value t is determined
4And time t
3When the difference e is larger than or equal to a set value d, adjusting the bandwidth
Then the new bandwidth is added
Substituting equation (9) to calculate the new time t
3;
Recalculating the difference e, iterating for multiple times until the difference e is smaller than a set threshold value, jumping out of the loop, and calculating the time t
3Bandwidth of
To meet the required optimal bandwidth, when time t
3=t
4When the vehicle just leaves the cell, the buffer zone is processed, and the bandwidth at the moment
Maximum bandwidth to meet the requirements;
step g is as follows:
and the PID algorithm is adopted to adjust the bandwidth, so that the problem of processing the data stream of the buffer area when the vehicle leaves the cell is solved. Under the condition of satisfying the above-mentioned solution bandwidth range, firstly, the initial bandwidth b is set0Substituting equation (10) to calculate the time t for finishing processing the buffer3;
Then, the target value t is determined
4And time t
3When the difference e is larger than or equal to a set value d, adjusting the bandwidth
Then the new bandwidth is added
Substituting equation (10) to calculate the new time t
3;
Recalculating the difference e, iterating for multiple times until the difference e is smaller than a set threshold value, jumping out of the loop, and calculating the time t
3Bandwidth of
To meet the required optimal bandwidth, when time t
3=t
4When the vehicle just leaves the cell, the buffer zone is processed, and the bandwidth at the moment
To meet the required maximum bandwidth.
A computer arrangement comprising a memory storing a computer program and a processor implementing the steps of a MEC-single cell based joint bandwidth allocation and data flow offloading method when executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the MEC-single-cell based joint bandwidth allocation and data flow offloading method.
The invention has the beneficial effects that:
the invention researches a method for providing optimal bandwidth allocation for vehicles through the edge server under a single-vehicle single-cell scene, reasonably controls the data flow uploaded by the vehicles, and solves the problems of edge server buffer congestion and unprocessed data of the edge server buffer during vehicle cell switching. According to the dataThe size of the stream and the limited edge server computing power, as well as the vehicle's own computing power, take into account two scenarios. The first case is the case where the total data flow is completed in the cell, where the lowest time delay t of the total data flow of the vehicles can be calculateds. The second case is that the edge server solves the above two problems by allocating the optimal bandwidth and simultaneously maximizes the vehicle data upload amount because the processed data flow is too large and the vehicle does not complete the total data flow when leaving the cell. The invention provides a method for distributing optimal bandwidth by an edge server, which solves the problems of data stream loss and reduced system performance of the edge server caused by the congestion of a buffer area of the edge server. The problem that data streams in a buffer area are not processed completely when a vehicle is subjected to cell switching is solved, so that the cost of return communication is increased and tasks are lost in the return process.
Detailed Description
The invention is further defined in the following, but not limited to, the figures and examples in the description.
Example 1
A method for joint bandwidth allocation and data flow unloading based on an MEC single-vehicle single-cell is characterized in that: when the vehicle leaves the cell and the total data flow is completed in the cell, the lowest time delay t of the total data flow of the vehicle is calculateds(ii) a Because the processed data flow is too large, when the vehicle leaves the cell and the total data flow is not finished in the cell, the edge server solves the problem of buffer area congestion of the edge server and the problem that the data flow of the buffer area of the edge server is not finished when the vehicle is switched between the cells by a method for distributing optimal bandwidth, and the data uploading quantity of the vehicle is maximum.
Example 2
The method for joint bandwidth allocation and data flow offloading based on MEC single-vehicle single-cell in embodiment 1 is characterized in that:
the vehicle i completes the total data stream in the cell, and the lowest total time delay t for processing the total data stream of the vehicle is calculated according to the method for distributing the optimal bandwidth of the vehicle i by the edge server jsThe method comprises the following steps:
A. according to equation (1), an initial bandwidth b is given0Under the condition of meeting the maximum capacity of the buffer area of the edge server j, the maximum bandwidth b provided by the edge server j for the vehicle i is calculated by adopting a PID algorithmij,bij=b1The bandwidth b of the vehicle i provided by the edge server j satisfies b ═ b0,b1](ii) a The data volume uploaded by the vehicle i can be reasonably controlled, and the problem of congestion of the buffer area of the edge server j is solved.
In the formula (1), N edge servers provide communication, storage and calculation resources for vehicles on a suburb or a highway, M vehicles run in a cell served by an edge server j, j is { 1.·, N }, a certain vehicle i runs at a constant speed in a straight line in the cell served by the edge server j, and i is { 1.·, M }, and a task unloading request is sent to the edge server at a certain position in the cell;
vehicle i is traveling at velocity v in the cell served by edge server j
ijStraight-line running at a constant speed at a certain initial position a
ijThe time required for the vehicle i to travel in the cell is t until the vehicle i leaves the cell after starting to transmit the data stream to the edge server j
4:
When the vehicle leaves the cell, the total data flow is completed in the cell, which means that: t is more than or equal to 0 and less than or equal to t of the vehicle
4Completing data flow unloading calculation in a time period;
Pijis the uplink transmission power, h, of vehicle i at edge server jijIs the small-scale fading path loss, N, of vehicle i at edge server j0Is the noise power spectral density of the edge server j receive segment; height of edge server j service is HjRice, horizontal distance to road surface DjRice, diameter of radiation range LCMeter, as shown in fig. 1, k is the number of revolutions per bit of the CPU required, and epsilon refers to the maximum storage capacity of the buffer;
as in FIG. 3(a), t1Is the moment when the first upload rate equals the computed rate of the edge server, t2Is the moment when the second upload rate equals the calculated rate of the edge server, t3Is the time when the data stream in the buffer of the edge server is processed, tsIs the total time delay for completing the vehicle data flow in the cell, xi is the integral parameter of the uploading rate integral with time, fjIs the number of revolutions per second of the j CPU of the edge server,Rij(0) Vehicle i upload rate when t is 0;
B. according to the bandwidth b range calculated in the step A, b belongs to [ b ∈ [ ]0,b1]B, under the condition of finishing calculating the data stream of the buffer zone when the vehicle i leaves the cell, bijCalculating the maximum bandwidth b provided by the edge server j for the vehicle i by adopting a PID algorithm to the formula (2)ij,bij=b2(ii) a The bandwidth b range of the vehicle i provided by the edge server j satisfies b E [ b ∈0,b2],b2∈[b0,b1](ii) a The data flow uploaded by the vehicle i can be reasonably controlled, and the problem that when the vehicle i leaves the cell, the data flow of the buffer area of the edge server is not processed completely is solved.
C. And B, calculating a bandwidth B range B epsilon [ B ] meeting the constraint condition according to the step A and the step B
0,b
2]Considering the factors such as the size and initial position of the data stream, it can be seen from fig. 3(a) and equation (5) that the upload rate is 0 when t is equal to t
As shown in fig. 2, when the first byte arrives at the edge server, it is assumed that the edge server can calculate after receiving the first byte, and therefore, the upload start time is equal to the calculation start time. Because the calculated result is generally small, the return delay is approximately ignored, the queue delay of the buffer area is considered, and the data stream of the buffer area is processed when the vehicle leaves the cell, the total delay of the edge server for processing the data stream is equal to the uploading delay of the vehicle in the cell. If vehicle i data stream S
iSatisfies S
iWhen S is less than or equal to S, the maximum bandwidth b is solved by a PID algorithm adjusting bandwidth method under the condition that no data stream is stored in a j buffer area of the edge server
ijSo that the total time delay t of the objective function
sMinimum, i.e. t
s=t
1Calculating the total time delay as shown in the formula (3); if vehicle i data stream S
iSatisfies S
iWhen > S, through PID calculationAdjusting bandwidth, and solving the maximum bandwidth b when the data stream stored in the buffer is not greater than the maximum capacity of the buffer
ijIn the known bandwidth range, the bandwidth method is adjusted through a PID algorithm to solve the optimal bandwidth b
ijSo that the total time delay t of the objective function
sLowest and satisfies the total delay t
sAt t
2<t
3≤t
s≤t
4In the range, formula (3) is as follows:
in the formula (3), R (xi) is xi ranging from 0 to tsUpload rate at any time in time, SiIs the size of the data stream that vehicle i needs to compute, in bits. Expanding the uploading rate R (xi) to know, the edge server j provides the optimal bandwidth b of the vehicle iijThe above two problems can be solved and the total task S is calculatediThe lowest delay.
The reasoning process of equation (1) is as follows:
and the edge server j solves the problem of buffer congestion through a bandwidth allocation method, and when the uploading rate is greater than the calculation rate of the edge server, unprocessed data in unit time are stored in the buffer. There are three cases where the uploading rate change process affects the buffer storage data stream, as shown in fig. 3(a) to 3(c), where the edge server j calculates the rate as:
t in FIG. 3(a)
1And t
2The upload rate at that time is equal to the edge server computation rate, as in fig. 3(b) and 3(c)
That is, when t is 0, the uploading rate is greater than the calculation rate, so that the unprocessed data is stored in the buffer area when t is 0, that is, t is
t 10. The area of the shaded part in the calculated graph isThe memory capacity of the buffer area can be ensured as long as the memory capacity of the buffer area is not more than the maximum memory capacity epsilon of the buffer area. t is t
4Is that the vehicle i is from a certain initial position a in the edge server j cell
ijThe time required to start sending a data stream until leaving the cell, wherein,
k is the number of revolutions per bit required by the CPU.
For the uplink transmission rate R in the above formulaijAnd xi, the edge server j can avoid the problem of buffer congestion through bandwidth allocation, as shown in formula (1).
The reasoning process of equation (2) is as follows:
the edge server j provides bandwidth allocation to solve the problem that the task is not finished when the cell is switched. As shown in fig. 4(a) to 4(c), the edge server j causes t to be a bandwidth allocation method2And t3The area of the shaded portion in between is equal to t1And t2The shaded area therebetween, wherein, fig. 4(a) is the bandwidth allocation method having calculated t1~t2The data flow condition of the buffer area with the shaded area is shown schematically; t in FIGS. 4(b) and 4(c)1=0、t3The time is the time when the data in the buffer area is processed and is not processed, as long as t is satisfied3≤t4This condition solves the problem of unprocessed data streams in the buffer of the edge server j when the vehicle i leaves the cell. When t is3=t4And meanwhile, the edge server j allocates the maximum bandwidth for the vehicle i, so that the problems of increase of return communication cost and task loss when the vehicle i runs to the next cell are solved.
Simplifying to obtain:
for the uplink transmission rate R in the above formulaijAnd xi, the problem that the data stream of the buffer area of the edge server j is not processed completely when the vehicle i leaves the cell is solved by the edge server j through a bandwidth allocation method, as shown in a formula (2).
Example 3
The method for joint bandwidth allocation and data flow offloading based on MEC single-vehicle single-cell in embodiment 1 is characterized in that:
when a vehicle leaves a cell and the total data flow is not completed in the cell, the edge server solves the problem of edge server buffer area congestion and the problem that the data flow of the edge server buffer area is not processed when the vehicle is switched between the cells by a method for distributing optimal bandwidth, and the vehicle data uploading quantity is maximum, and the method comprises the following steps:
D. according to equation (1), an initial bandwidth b is given0Under the condition of meeting the maximum capacity of the buffer area of the edge server j, the maximum bandwidth b provided by the edge server j for the vehicle i is calculated by adopting a PID algorithmij,bij=b1The bandwidth range of the vehicle i provided at the edge server j satisfies b ═ b0,b1](ii) a The data volume uploaded by the vehicle i can be reasonably controlled, and the problem of congestion of the buffer area of the edge server j is solved.
E. According to the bandwidth b range calculated in the step D, b belongs to [ b ∈ [)0,b1]B, under the condition of finishing calculating the data stream of the buffer zone when the vehicle i leaves the cell, bijCalculating the maximum bandwidth b provided by the edge server j for the vehicle i by adopting a PID algorithm to the formula (2)ij,bij=b2(ii) a The bandwidth b range of the vehicle i provided by the edge server j satisfies b E [ b ∈0,b2],b2∈[b0,b1](ii) a The uploading data flow of the vehicle i can be reasonably controlled, and the problem of the vehicle i leaving is solvedWhen the cell is opened, the data flow of the buffer area of the edge server is not processed.
F. According to the bandwidth b range which is calculated in the step D and the step E and meets the constraint condition, b belongs to [ b ]0,b2]. Within the known bandwidth range, the optimal bandwidth b is solved by a bandwidth adjusting methodij,bij=b2According to the time t when the vehicle i runs in the cell of the edge server j, t is t4Solving the maximum data quantity S of the objective functionijAs shown in formula (4):
in the formula (4), R (xi) is xi ranging from 0 to tsUpload rate S at any time within timeijIs the amount of data uploaded by vehicle i in cell of edge server j, and the unit is bit. Expanding the uploading rate R (xi) to know, the edge server j provides the optimal bandwidth b of the vehicle iijThe two problems can be solved, and the vehicle i uploads the maximum data volume S in the cell of the edge server jij。
Example 4
The method for joint bandwidth allocation and data flow unloading based on the MEC single-vehicle single-cell in the embodiment 2 or 3 is characterized in that:
the following steps are executed before the step A and the step D, and the steps comprise:
a. calculating an initial bandwidth b
0: when in use
When t is equal to 0, the sum of the values,
solving the initial bandwidth b
0,b
0≤B
j;
a
0Refers to the radius of the communication range of the edge server j, i.e.
Wherein L is
CIs the edge server communication diameter; when in use
And when t is 0, R
ij(0) The uploading rate of the vehicle i at the nearest position of the edge server j when t is 0;
b. judging the initial position a
ijAnd
in a relation of
Then, calculate R
ij(0):
Namely at
Then, the sum S of the data stream uploaded and calculated at the time point and the data stream calculated by the vehicle-mounted terminal is as shown in formula (5):
c. the sum S of the data streams is compared with the total data stream S of the vehicle iiMaking a comparison, if SiLess than or equal to S, adopting PID algorithm to convert the initial bandwidth b0Substituting equation (6) calculates the difference e:
when the difference e is greater than or equal to the set threshold, increasing the initial bandwidth b
0The coefficient of increase is c; bandwidth b
ij=b
0+ce,b
ij≤B
jCalculating
To obtain a time point t
1,t
1The time point when the first uploading rate is equal to the computing rate of the edge server is obtained;
then the new bandwidth b is addedijSubstituting the formula (6), calculating a new difference e, iterating for multiple times until the difference e is smaller than a set threshold value, jumping out of the loop, and obtaining the bandwidth b meeting the minimum total time delay calculated by the total data of the vehicleij(ii) a The data stream has no storage buffer and does not need to be at t2Releasing the computing power after a point in time to process the buffer data stream, t2For the time point when the second upload rate is equal to the calculated rate of the edge server, the lowest total delay is ts=t1;
If S isiS, enter step A or step D.
Example 5
The method for joint bandwidth allocation and data flow unloading based on the MEC single-vehicle single-cell in the embodiment 2 or 3 is characterized in that:
in step A or step D, an initial bandwidth b is given
0And calculating the optimal bandwidth provided by the edge server j for the vehicle i by adopting a PID algorithm: when in use
When the step (d) is performed, step (d) is performed
If yes, entering the step e;
step d is as follows:
using PID algorithm, the calculation is performed at time t1And t2The memory capacity of the data stream uploading buffer is less than or equal to the maximum buffer memory capacity epsilon:
first, an initial bandwidth b is defined
0Substituting into formula
To obtain a time point t
1And t
2;
Then, the initial bandwidth b0Substituting equation (7) to calculate the target value ε and t1And t2Data flow difference value e of the buffer area between:
when the difference e is larger than or equal to the set value c, the bandwidth b is adjustedij=b0+ce,bij≤Bj;
Then the new bandwidth b is addedijSubstituting the formula (7) to recalculate the difference e, iterating for multiple times until the difference e is smaller than the set threshold value, jumping out of the loop, and calculating the optimal bandwidth b meeting the conditionij(ii) a By means of Matlab simulation, considering the influence of different initial positions and vehicle speeds on the bandwidth requirement, the problem of buffer congestion is solved by a bandwidth adjusting method to obtain a simulation diagram, as shown in FIG. 5.
Step e is as follows:
satisfy the requirement of
When the condition is met, firstly, the initial bandwidth b
0Substituting into formula
To obtain a time point t
1And t
2At the time point t of solution
1Is a negative number, take
t 10; then, the initial bandwidth b
0Substituting equation (8) to calculate the target value ε and t
1And t
2The data flow difference e of the buffer areas between;
when the difference e is larger than or equal to the set value c, the bandwidth b is adjustedij=b0+ce,bij≤Bj(ii) a Then the new bandwidth b is addedijSubstituting the formula (8) to recalculate the difference e, iterating for multiple times until the difference e is smaller than the set threshold value, jumping out of the loop, and calculating to meet the requirementOptimum bandwidth of condition bij. By means of Matlab simulation, considering the influence of different initial positions and vehicle speeds on the bandwidth requirement, the problem of buffer congestion is solved by a bandwidth adjusting method to obtain a simulation diagram, as shown in FIG. 5.
Example 6
The method for joint bandwidth allocation and data flow unloading based on the MEC single-vehicle single-cell in the embodiment 2 or 3 is characterized in that:
in the step B or E, the optimal bandwidth satisfying time t is calculated by adopting a PID algorithm to the formula (2)
3At t
2≤t
3≤t
4Calculating the optimal bandwidth provided by the edge server j for the vehicle i within the range; when in use
When the step f is performed, go to step f
Entering step g;
step f is as follows:
and the bandwidth is adjusted by adopting a PID algorithm, so that the problem that the data stream of the buffer area is processed when the vehicle leaves the cell is solved:
under the condition of satisfying the above-mentioned solution bandwidth range, firstly, the initial bandwidth b is set0Substituting equation (9) to calculate the time t for finishing processing the buffer3:
Then, the target value t is determined
4And time t
3When the difference e is larger than or equal to a set value d, adjusting the bandwidth
Then the new bandwidth is added
Substituting equation (9) to calculate the new time t
3;
Recalculating the difference e, iterating for multiple times until the difference e is smaller than a set threshold value, jumping out of the loop, and calculating the time t
3Bandwidth of
To meet the required optimal bandwidth, when time t
3=t
4When the vehicle just leaves the cell, the buffer zone is processed, and the bandwidth at the moment
Maximum bandwidth to meet the requirements; by Matlab simulation, a simulation diagram is obtained by solving the problem that buffer zone data is not processed when a vehicle leaves a cell by a bandwidth allocation method in consideration of the influence of different initial positions and vehicle speeds on bandwidth allocation, as shown in FIG. 6(a) and FIG. 6 (b). As can be seen from the simulation diagrams of fig. 6(a) and 6(b), the bandwidth allocation is independent of the speed size, and is only related to the initial position.
Step g is as follows:
and the PID algorithm is adopted to adjust the bandwidth, so that the problem of processing the data stream of the buffer area when the vehicle leaves the cell is solved. Under the condition of satisfying the above-mentioned solution bandwidth range, firstly, the initial bandwidth b is set0Substituting equation (10) to calculate the time t for finishing processing the buffer3;
Then, the target value t is determined
4And time t
3When the difference e is larger than or equal to a set value d, adjusting the bandwidth
Then the new bandwidth is added
Substituting equation (10) to calculate the new time t
3;
Recalculating the difference e, iterating for multiple times until the difference e is smaller than a set threshold value, jumping out of the loop, and calculating the time t
3Bandwidth of
To meet the required optimal bandwidth, when time t
3=t
4When the vehicle just leaves the cell, the buffer zone is processed, and the bandwidth at the moment
To meet the required maximum bandwidth. By Matlab simulation, a simulation diagram is obtained by solving the problem that buffer zone data is not processed when a vehicle leaves a cell by a bandwidth allocation method in consideration of the influence of different initial positions and vehicle speeds on bandwidth allocation, as shown in FIG. 6(a) and FIG. 6 (b).
Example 7
A computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method for joint bandwidth allocation and data stream offloading based on MEC single-vehicle single-cell according to any of embodiments 1-6 when executing the computer program.
Example 8
A computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the MEC single car cell based joint bandwidth allocation and data stream offloading methods of embodiments 1-6.