Code covered by the BSD License  

Highlights from
CTMSIM - an interactive freeway traffic macrosimulator

image thumbnail
from CTMSIM - an interactive freeway traffic macrosimulator by Alex Kurzhanskiy
Freeway traffic simulation based on Asymmetric Cell Transmission Model

adjust_fr_split_ratios(betas, celldata)
function new_betas = adjust_fr_split_ratios(betas, celldata)
% ADJUST_FR_SPLIT_RATIOS - multiplies spit ratio by off-ramp flow coefficient.
%
% Call:   new_betas = adjust_fr_split_ratios(betas, celldata)
%
% Parameters:
%             betas    - vector of off-ramp split ratios;
%             celldata - array of freeway cell structures, whose length must be
%                        the same as size of 'betas'.
%
% Returns:   new_betas - adjusted split ratio vector.
%
% Last modified:   09/29/2006.

%
% Alex Kurzhanskiy   <akurzhan@eecs.berkeley.edu>
%

M = size(betas, 1);
N = size(celldata, 2);

if M ~= N
  error('ADJUST_FR_SPLIT_RATIOS: number of split ratios does not match number of cells.');
end

new_betas = [];

for i = 1:N
  if isempty(celldata(i).FRname)
    b = 0;
  else
    b = (celldata(i).FRknob * betas(i, 1));
    if b > 1
      b = 1;
    end
    if b < 0
      b = 0;
    end
  end

  new_betas = [new_betas; b];
end

return;

Contact us at files@mathworks.com