基于时空预留方案的十字路口交通自动调节智能交通管理系统附matlab代码

简介: 基于时空预留方案的十字路口交通自动调节智能交通管理系统附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法       神经网络预测       雷达通信      无线传感器        电力系统

信号处理              图像处理               路径规划       元胞自动机        无人机

⛄ 内容介绍

本文介绍了一种应用于十字路口交通自动调节的智能交通管理系统的传统算法。遗留算法的应用使智能交叉口能够容纳低比例的、没有装备或V2V和V2I通信有问题的车辆。所开发的智能交通管理技术是基于时空预留方案的,旨在最大限度地减少事故、交通拥堵以及由此产生的道路交通环境成本。三种智能交通管理算法应用于道路交叉口、环形交叉口和十字路口,其性能得到了分析。与传统的交通管理技术相比,使用所开发的智能交通管理技术的模拟结果表明,交通输出流量可以增加,交通流率可以提高,穿越交叉口的平均时间可以显著减少。当交通流量大时,这种减少更为明显。所进行的研究表明,在使用传统算法的智能交叉口中纳入低比例的未装备或有故障的V2V和V2I通信的车辆,对交通流的影响很小。

⛄ 部分代码

%--------------------------------------------------------------------------

%                           ISR-TrafSim v2.0


%

%--------------------------------------------------------------------------

% This Matlab file is part of the ISR-TrafSim: a Matlab

% library for traffic simulation and pose estimation in Urban environments,

% namely roundabouts and crossroads.

%

% http://www.isr.uc.pt/~conde/isr-trafsim/

%

%-CITATION---------------------------------------------------------------------------

% If you use this software please cite one of the following papers:

% 1) L.C.Bento, R.Parafita, S.Santos and U.Nunes, An Intelligent Traffic Management

% at Intersections legacy mode for vehicles not equipped with V2V and V2I Communications,

% 16th IEEE Int.Conf. Intelligent Transportation Systems, Netherlands, 2013.

% 2) L.C.Bento, R.Parafita and U.Nunes, Inter-vehicle sensor fusion for accurate vehicle

% localization supported by V2V and V2I communications, 15th IEEE Int.Conf. Intelligent

% Transportation Systems, USA, 2012.

% 3) L.C.Bento, R.Parafita and U.Nunes, Intelligent traffic management at intersections

% supported by V2V and V2I communications, 15th IEEE Int.Conf. Intelligent

% Transportation Systems, USA, 2012.

%

%-DESCRIPTION--------------------------------------------------------------

%

% Roundabout gestion module

%

%-DISCLAIMER---------------------------------------------------------------

% This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY;

% without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% You can use this source code without licensing fees only for NON-COMMERCIAL research

% and EDUCATIONAL purposes only.

% You cannot repost this file without prior written permission from the authors.

%

%-AUTHORS------------------------------------------------------------------

%   Urbano Nunes*

%   Luis Conde Bento**

%   Ricardo Parafita*

%   Sergio Santos*

%

%  *Institute of Systems and Robotics   - University of Coimbra

% **School of Technology and Management - Polytechnic Institute of Leiria

%--------------------------------------------------------------------------


function [] = round_gest_isr_trafsim()

global s c

% s.round_notify_list -> [id ; node ; state; time; posx; posy; inroad; outroad; currentVel; maxVel; carType, CurrentRoad, timeoflastnotify]


% Delete layers if are no longer necessary

delete_layer_isr_trafsim();


% Add car to s.round_notify_list if car is not in there (no commu)

add_car_notify_round_isr_trafsim();


% Delete car withot V2I from list s.rg_count_tab & s.list_round_already_reserve

if(s.time>s.time_round_without_commu && s.time_round_without_commu~=-1)

   %keyboard

   id=s.car_round_without_commu;

   s.time_round_without_commu=-1;

   s.car_round_without_commu=[];

   for i=1:size(s.rg_count_tab,2)

       for p=3:10

           if(isnan(s.rg_count_tab(p,i)))

               s.rg_count_tab(p,i)=0;

               s.rg_count_tab(2,i)=s.rg_count_tab(2,i)-1;

               break

           end

       end

   end

   for i=2:size(s.list_round_already_reserve,1)

       if(~isempty(find(s.list_round_already_reserve(i,:)==id)))

           s.list_round_already_reserve(i,:)=[];

           break

       end

   end

   if(ismember(id,c.listactive))

       pos=find(c.listactive==id);

       road=find(s.rg_count_tab(1,:)==c.car(pos).rar);

       for p=3:10

           if(s.rg_count_tab(p,road)==0)

               s.rg_count_tab(p,road)=id;

               s.rg_count_tab(2,road)=s.rg_count_tab(2,road)+1;

               break

           end

       end

   end

end


% Process Algoritm

Exist_Car_withot_V2I=~isempty(s.list_round_without_commu);  % Doesn't exist car without communication on the list

Exist_Notification=size(s.round_notify_list,2)>1;        % Exist notifications


if(s.pause==1)

   s.pause=0;  % to pause only once

   keyboard

end


if(Exist_Notification && ~Exist_Car_withot_V2I)

   

   aux=2;                                          % aux starts in 2 because first notification is NaN

   while( aux <= size(s.round_notify_list,2) )     % For each new notification

       cond1=s.round_notify_list(3,aux)==-1;

       cond2=s.time>s.round_notify_list(4,aux)+2;

       cond3=(dist_isr_trafsim(50,50,s.round_notify_list(5,aux),s.round_notify_list(6,aux)))<s.control_radius_round;

       if(cond1 && cond2 && cond3)

           id=s.round_notify_list(1,aux);                  % Car Id

           n=find(c.listactive==id);                       % Car place on c.listactive

           CarCommu=~isnan(s.round_notify_list(9,aux));    % If car have communications

           if(CarCommu)

               % Generate trajectory

               traj=gen_traj_isr_trafsim(s.round_notify_list(7,aux),s.round_notify_list(8,aux));

               

               % View road after roundabout

               rafter=check_road_after_roundabout_isr_trafsim(traj);

               

               % Try generate a velocity profile

               vel_prof=reserve_space_isr_trafsim(round2(s.time,0.001),s.round_notify_list(5,aux),s.round_notify_list(6,aux),s.round_notify_list(9,aux),s.round_notify_list(10,aux),s.round_notify_list(11,aux),traj,rafter,n,'round',s.round_method);

               

               % Order to send velocity profile

               if(~isnan(vel_prof))

                   send_velocity_profile_isr_trafsim(n,aux,id,vel_prof,rafter,'round');

                   if(vel_prof(1,end)>s.round_last_time_used)  % Store last time used by round gest mode

                       s.round_last_time_used=vel_prof(1,end);

                       %last_used_round=vel_prof(1,end)

                   end

                   %viewM(s.ocmap2,s.layer,0,s.occup_res2)

                   break

               end

               

           else

               exist_exit_full=0;

               if(s.round_notify_list(12,aux)==13 || s.round_notify_list(12,aux)==14)

                   for i=3:size(s.rg_count_tab,2)

                       if(s.rg_count_tab(2,i)>s.rg_car_limit)

                           exist_exit_full=1;

                       end

                   end

               else

                   for i=1:size(s.rg_count_tab,2)

                       if(s.rg_count_tab(2,i)>s.rg_car_limit)

                           exist_exit_full=1;

                       end

                   end

               end

               previous_withouV2I_exit=s.time_round_without_commu==-1;

               % To dont send cars when one of exits is already full

               if(~exist_exit_full && previous_withouV2I_exit)

                   

                   

                   % Reserve space

                   [M,L]=reserve_all_paths_isr_trafsim(s.round_notify_list(12,aux),n,'wait','round');

                   

                   % Add generated matrix in correct space

                   if(s.time>s.round_last_time_used)

                       last=s.time;

                   else

                       last=s.round_last_time_used;

                   end

                   

                   for i=1:size(M,3)

                       current_layer=round2(last+L(i),0.01);  % Layer to write

                       

                       % Add layer if is necessary

                       exist_current_layer=find(s.layer==current_layer);

                       if(isempty(exist_current_layer))

                           create_layer(round2(current_layer,0.01));

                       end

                       

                       % Write layer in correct position and verify if everything is ok

                       layer_pos=find(s.layer==current_layer);

                       if(nnz(s.ocmap2(:,:,layer_pos)&M(:,:,i))>0)

                           keyboard

                       end

                       s.ocmap2(:,:,layer_pos)=s.ocmap2(:,:,layer_pos)+M(:,:,i);

                   end

                   

                   s.list_round_without_commu(end+1,:)=[id last+L(1) last+L(end) s.round_notify_list(12,aux)];

                   s.round_last_time_used=last+L(end);

                   %round=s.list_round_without_commu

                   

                   % Agend time to empty list already reserved

                   s.time_round_without_commu=s.list_round_without_commu(3);

                   s.car_round_without_commu=s.list_round_without_commu(1);

                   %s.list_round_already_reserve(end+1,:)=NaN;

                   for i=1:size(s.rg_count_tab,2)

                       for p=3:10

                           if(s.rg_count_tab(p,i)==0)

                               s.rg_count_tab(p,i)=NaN;

                               break

                           end

                       end

                   end

                   s.rg_count_tab(2,:)=s.rg_count_tab(2,:)+1;

                   

                   % To view the map (help on debug)

                   %                         viewM(s.ocmap2,s.layer,0,s.occup_res2,n,'round')

                   

                   % Delete notification

                   s.round_notify_list(:,aux)=[];

                   

                   % Driver ignores traffic rules

                   c.car(n).dri_ignore_trf_round=1;

                   %disp(['Ignore Round: ' num2str(id)]);

                   break

               end

           end

       end

       aux=aux+1;

   end

elseif(Exist_Car_withot_V2I)

   

   if(s.time>s.list_round_without_commu(2)) % s.time>s.list_round_without_commu(2) to

       % Give permission to car to advance

       n=find(c.listactive==s.list_round_without_commu(1));

       c.car(n).nostop(end+1)=(s.list_round_without_commu(4));

       

       

       % Add car to list already reserved

       if(isempty(find(s.list_round_already_reserve==s.list_round_without_commu(1))))

           [ll cc]=find(s.list_round_already_reserve(1,:)==s.list_round_without_commu(4));

           s.list_round_already_reserve(end+1,cc)=s.list_round_without_commu(1);

       end

       

       % Delete car from list

       [ll cc]=find(s.list_round_without_commu==s.list_round_without_commu(1));

       s.list_round_without_commu(ll,:)=[];

   end

end

end

⛄ 运行结果

⛄ 参考文献

1) L.C.Bento, R.Parafita, S.Santos and U.Nunes, An Intelligent Traffic Management at Intersections legacy mode for vehicles not equipped with V2V and V2I Communications, 16th IEEE Int.Conf. Intelligent Transportation Systems, Netherlands, 2013.

2) L.C.Bento, R.Parafita and U.Nunes, Inter-vehicle sensor fusion for accurate vehicle% localization supported by V2V and V2I communications, 15th IEEE Int.Conf. Intelligent Transportation Systems, USA, 2012.

3) L.C.Bento, R.Parafita and U.Nunes, Intelligent traffic management at intersections supported by V2V and V2I communications, 15th IEEE Int.Conf. Intelligent Transportation Systems, USA, 2012.

⛳️ 代码获取关注我

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
20天前
|
存储 人工智能 机器人
【Matlab】Matlab电话拨号音合成与识别(代码+论文)【独一无二】
【Matlab】Matlab电话拨号音合成与识别(代码+论文)【独一无二】
|
2月前
|
机器学习/深度学习 算法 计算机视觉
霍夫变换车道线识别-车牌字符识别代码(matlab仿真与图像处理系列第5期)
霍夫变换车道线识别-车牌字符识别代码(matlab仿真与图像处理系列第5期)
30 2
|
2月前
|
算法
MATLAB | 插值算法 | 一维interpl插值法 | 附数据和出图代码 | 直接上手
MATLAB | 插值算法 | 一维interpl插值法 | 附数据和出图代码 | 直接上手
40 0
|
2月前
|
算法
MATLAB | 插值算法 | 二维interp2插值法 | 附数据和出图代码 | 直接上手
MATLAB | 插值算法 | 二维interp2插值法 | 附数据和出图代码 | 直接上手
83 0
|
3月前
|
传感器 人工智能 自动驾驶
未来之路:自动驾驶技术驶向智能交通系统
随着科技的不断进步,自动驾驶技术正在以惊人的速度改变我们的出行方式。本文将探讨自动驾驶技术在构建智能交通系统中的重要性,并介绍其对道路安全、交通效率和环境保护所带来的积极影响。同时,我们还将讨论当前面临的挑战以及未来发展的展望。
28 0
|
3月前
|
传感器 人工智能 自动驾驶
未来之路:自动驾驶技术与智能交通系统的革命
在全球汽车产业不断创新发展的背景下,自动驾驶技术正逐渐崭露头角。本文将探讨自动驾驶技术与智能交通系统的相关概念及其对未来交通运输的巨大影响。通过深入分析自动驾驶技术的原理、挑战和应用领域,我们将了解到它将如何改变我们的出行方式、提升交通效率以及带来更安全可靠的道路体验。
71 0
|
3月前
|
传感器 人工智能 自动驾驶
驱动未来:自动驾驶技术与智能交通系统的奇妙融合
在科技飞速发展的时代背景下,自动驾驶技术和智能交通系统正成为改变我们出行方式的重要推动力。本文将探讨自动驾驶技术的原理、应用以及其与智能交通系统的紧密关系,展示它们带给我们的便利性、安全性和环境友好性。
|
3月前
|
传感器 人工智能 自动驾驶
迈向未来的自动驾驶技术与智能交通系统
随着科技的不断进步,自动驾驶技术和智能交通系统正逐渐改变着我们的出行方式。本文将探讨这些技术的发展现状、优势和挑战,并展望未来可能的发展方向。通过引入人工智能、传感器和通信技术等创新手段,自动驾驶技术和智能交通系统有望为我们带来更高效、安全和环保的出行体验。