m车载自组织网络(Vehicular Ad-hoc Network,VANET)通信系统的matlab仿真

目录

1.算法仿真效果

2.MATLAB核心程序

3.算法涉及理论知识概要

4.完整MATLAB


1.算法仿真效果

matlab2022a仿真结果如下:

 

 

 

 

2.MATLAB核心程序

...........................................................................
%分析Kjam和流量的关系;
q1   = zeros(1,length(Kjam));
q2   = zeros(1,length(Kjam));
q3   = zeros(1,length(Kjam));
for i = 1:length(Kjam)
    n     = 1;
    V0    = c*Kjam(i)^((n+1)/2)/(n+1)/(n+1);
    q1(i) = V0*k*(1-(k/Kjam(i))^((n+1)/2));
    n     =-0.5;
    V0    = c*Kjam(i)^((n+1)/2)/(n+1)/(n+1);
    q2(i) = V0*k*(1-(k/Kjam(i))^((n+1)/2));
    n     =-1;
    q3(i) = c*k*log(Kjam(i)/k);
end
figure;
plot(Kjam,q1,'b-s',...
    'LineWidth',1,...
    'MarkerSize',6,...
    'MarkerEdgeColor','k',...
    'MarkerFaceColor',[0.0,0.9,0.0]);
hold on;
plot(Kjam,q2,'r-o',...
    'LineWidth',1,...
    'MarkerSize',6,...
    'MarkerEdgeColor','k',...
    'MarkerFaceColor',[0.9,0.0,0.0]);
hold on;
plot(Kjam,q3,'k-^',...
    'LineWidth',1,...
    'MarkerSize',6,...
    'MarkerEdgeColor','k',...
    'MarkerFaceColor',[0.0,0.0,0.9]);
hold off;
grid on
xlabel('Kjam');
ylabel('Q');
legend('Greenshield','Drew','Greenberg');



%%
%步骤二
T    = [0:1:7500];%全部为绿灯的情况
V1   = zeros(1,length(T));
V2   = zeros(1,length(T));
Vsafe= zeros(1,length(T));
Videa= zeros(1,length(T));
dsafe= zeros(1,length(T));%车辆之间的安全距离
Dxd  = zeros(1,length(T));

V01  = 50000/3600;%前一辆车子的初始速度
V02  = 50000/3600;%前一辆车子的初始速度
a1   = 0;%前一个车子加速度
a2   = 0.01;%后一个车子加速度
Vmax = 80000/3600;%公里最大限速
d1   = 0;
d2   = 0;
............................................................................
figure;
subplot(211);
plot(T,V1,'g','linewidth',4);
hold on
plot(T,V2,'r--');
hold on
xlabel('Times(s)');
ylabel('V');
legend('real V of car1','real V of car2');


subplot(212);
plot(T,Dxd,'g','linewidth',2);
xlabel('Times(s)');
ylabel('the distance between 2 cars');
 
%出现红灯,减速
T    = [0:0.01:60];%全部为绿灯的情况
V1   = zeros(1,length(T));
V2   = zeros(1,length(T));
Vsafe= zeros(1,length(T));
Videa= zeros(1,length(T));
dsafe= zeros(1,length(T));%车辆之间的安全距离
Dxd  = zeros(1,length(T));

V01  = 50000/3600;%前一辆车子的初始速度
V02  = 50000/3600;%前一辆车子的初始速度
a1   = -0.5;%前一个车子加速度
a2   = -0.47;%后一个车子加速度
Vmax = 80000/3600;%公里最大限速
d1   = 0;
d2   = 0;
..............................................................................
figure;
subplot(211);
plot(T,V1,'b','linewidth',2);
hold on
plot(T,V2,'r--');
hold on
xlabel('Times(s)');
ylabel('V');
legend('real V of car1','real V of car2');
subplot(212);
plot(T,Dxd,'b','linewidth',2);
xlabel('Times(s)');
ylabel('the distance between 2 cars');
12_017_m

3.算法涉及理论知识概要

         这里根据那个fluid dynamic model stochastic model模型,这里使用一种如下的车辆移动模型,能够反映出车辆移动的随机性和连续性。

        首先,考虑到第三步骤的实际的问题的仿真,因此,我们在这里,就必须考虑符合实际VANET的车辆移动模型。

        第一:要反映出真实的城市道路情况,比如车道,十字路口,速度限制。

        第二:正确反映车的运动规律。

        针对第一种情况,我们需要考虑节点运动模型,对于第二种情况,我们需要考虑车辆的随机运动情况(类似于论文的stochastic model模型)

      对于任意时刻t,某两个车辆的速度分别为:和,为了保证整个行驶过程是安全的,车与车之间必须保持一个安全的距离,设这个安全距离为。那么相对于前一个车辆来讲,后一个车辆的安全速度为:

那么第二个车的理想的速度为: 

       其中Vsafe为理论最佳安全速度,Vmax为路段规定的最大限制速度,最后一项是下一时刻的车辆速度。其中:

       这个表达式的含义为在行驶过程中,驾驶员受到干扰,可能操作得到的速度会和最佳的速度值有偏离,但也有可能没有收到干扰,因此事随机从中选择一个作为输出值。

最终,下一时刻的车辆位置为:

        从宏观角度考虑,那么就是整个车道网络中,车流的移动情况,这里我们使用如下的数学原理:

         宏观移动模型,将道路拓扑视为任意方向的街道并任意连接而组成的网络图。两个拐角之间的街道定义为块。将一个块上的一组车辆视为一个单元,该单元的车辆共享一组参数:速度 v,车流密度 k 和车流体积 q = kv

        将车流视为典型的流体后,车辆的速度和车辆密度的关系为:

kjamv=0的时候的车辆密度。当k=0的时候,有 

 

        针对不同的road segment

        对于每个roadsegment,我们使用随机模型,将直线路线上的车流进行分流,即满足一定概率的车流左右转弯,而同时,由于一定概率的车流会从垂直的线路行驶入直线线路上。这个过程我们使用随机过程分析,假设每个车流得到每个路口的时候,会以0.5的概率继续向前行驶,以0.25的概率左右转弯。然后车辆对这三个方向的判断,满足泊松分布。

4.完整MATLAB

V

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Originally reactive protocols were not design for the characteristic of highly mobility during route discovery. Due to dynamically modification to the VANET this changes very often due to breakdown which causing excessive broadcasting and flooding the entire network in order for new routes to be discovered. In additional, the initial of routing need some time and this latency can easily change everything. Due to these reasons, the typical reactive protocols, in their current format, do not totally appropriate for time critical applications such as cooperative collision avoidance (CCA). The Cooperative Collision Avoidance is an important class of safety applications in VANETs, which aims at offering earlier warning to drivers using vehicle-to-vehicle (V2V) communication [13]. Ad Hoc On Demand Distance Vector (AODV) is an reactive routing protocolwhich capable of both unicast and multicast. In AODV, like all reactive protocols,topology information is only transmitted by nodes on-demand. When source hassomething to send then initially it propagates RREQ message which is forwarded byintermediate node until destination is reached. A route reply message is unicastedback to the source if the receiver is either the node using the requested address, or ithas a valid route to the requested address. This repository provides a MATLAB simulaiton of VANET enviornment and rsults comparison in terms of throughput, packet drop ratio etc. More information can be reached at https://www.youtube.com/watch?v=2QeSYOgJo9s&t=32s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

我爱C编程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值