基于时空预留方案的十字路口交通自动调节智能交通管理系统附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电子书和数学建模资料

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

matlab科研助手

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

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

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

打赏作者

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

抵扣说明:

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

余额充值