
1 简介元胞自动机(Cellular Automata,简称CA)模型作为交通流理论的一种重要数学模型,具有时空离散、规则简单、计算效率高、易于实现等特点,一直都是交通流研究的一个热点,具有广阔应用前景。本文在现有元胞自动机交通流模型的基础上,建立双车道元胞自动机交通流模型。2 部分代码%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % A Two-Lane Cellular Automaton Traffic Flow Model with the Keep-Right Rule %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% clc; clear all; close all; B3; % The number of the lanes plazalength100; % The length of the simulation highways hNaN; % The handle of the image [plaza,v]create_plaza(B,plazalength); hshow_plaza(plaza,h,0.1); iterations1000; % Number of iterations probc0.1; % Density of the cars probv[0.1 1]; % Density of two kinds of cars probslow0.3; % The probability of random slow Dsafe1; % The safe gap distance for the car to change the lane VTypes[1,2]; % Maximum speed of two different cars [plaza,v,vmax]new_cars(plaza,v,probc,probv,VTypes);% Generate cars on the lane size(find(plaza1)) PLAZArot90(plaza,2); hshow_plaza(PLAZA,h,0.1); for t1:iterations; size(find(plaza1)) PLAZArot90(plaza,2); hshow_plaza(PLAZA,h,0.1);%%地图显示 [v,gap,LUP,LDOWN]para_count(plaza,v,vmax); [plaza,v,vmax]switch_lane(plaza,v,vmax,gap,LUP,LDOWN); [plaza,v,vmax]random_slow(plaza,v,vmax,probslow); [plaza,v,vmax]move_forward(plaza,v,vmax); end3 真结果4 参考文献[1]李松, 张杰, 贺国光. 基于元胞自动机模型的交通流混沌仿真研究[J]. 计算机工程与应用, 2007, 43(32):4.部分理论引用网络文献若有侵权联系博主删除。