| controller_q_proportional(demands, orflows, orqueues, celldata, ts, idx)
|
function new_orflows = controller_q_proportional(demands, orflows, orqueues, celldata, ts, idx)
% CONTROLLER_Q_PROPORTIONAL - implementation of Proportional Queue Controller.
%
% Call: new_orflows = controller_q_proportional(demands, orflows, orqueues, celldata, ts, idx)
%
% Parameters:
% demands - vector of on-ramp demands;
% orflows - vector of on-ramp flows generated by ML controller,
% same size as 'demands';
% orqueues - vector of current on-ramp queue sizes, same size as 'demands';
% celldata - array of freeway cell data structures, whose length
% must be the same as size of 'demands';
% ts - sampling period;
% idx - index of the cell with given on-ramp.
%
% Returns: new_orflows - vector of proposed on-ramp flows.
%
% Last modified: 10/06/2006.
%
% Alex Kurzhanskiy <akurzhan@eecs.berkeley.edu>
%
K = size(demands, 1);
L = size(orflows, 1);
M = size(orqueues, 1);
N = size(celldata, 2);
if K ~= N
error('CONTROLLER_Q_PROPORTIONAL: number of on-ramp demands does not match number of cells.');
end
if L ~= N
error('CONTROLLER_Q_PROPORTIONAL: number of on-ramp flows does not match number of cells.');
end
if M ~= N
error('CONTROLLER_Q_PROPORTIONAL: number of on-ramp queues does not match number of cells.');
end
if (idx < 1) | (idx > N)
error('CONTROLLER_Q_PROPORTIONAL: invalid cell index.');
end
new_orflows = orflows;
d = demands(idx, 1); % demand
l = orqueues(idx, 1) - celldata(idx).ORqsize; % overflow
orf = (celldata(idx).ORqcontroller.Kp / ts) * l + d;
new_orflows(idx, 1) = max([0 orf]);
return;
|
|