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

get_max_df(celldata)
function [dm, fm] = get_max_df(celldata)
% GET_MAX_DF - find maximum possible values for density and flow on the whole
%              freeway section by searching the freeway cell data.
%
% Call:   [dm, fm] = get_max_df(celldata)
%
% Parameter:   celldata - array of freeway cell structures.
%
% Returns:
%          dm - maximal jam density in the given freeway section;
%          fm - maximal Qm (maximal flow) in the given freeway section.
%
% Last modified:   07/30/2006.

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

N  = size(celldata, 2);  % number of cells

rj = [];
qm = [];

for i = 1:N
  rj = [rj celldata(i).FDrhojam];
  qm = [qm celldata(i).FDfmax];
end

dm = max(rj);
fm = max(qm);

return;

Contact us at files@mathworks.com