function dmax = getMaxVDSLlength(topology,traffic);
%% ===========================================================================
% getMaxVDSLlength(topology,traffic) - Get the maximum VDSL modem length
%
% Parameter:    topology
% Parameter:    traffic The traffic pattern
% Returns:    	dmax	The maximum distance for a VDSL modem
%
% Example(s):
%   
% Algorithmic details
%
%
% Reference:
%    FSAN xDSL simulation tool manual
%% ===========================================================================

%% ===========================================================================
% Copyright (C) 1998 by Telia Research AB, Lulea, Sweden; All rights reserved. 
% Project       : FSAN duplex model
% Author(s)     : Tomas Nordstrom (Tomas.Nordstrom@FTW.at)
%               : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se)
%
% CVS:       $Id: getMaxVDSLlength.m,v 1.4 2000/03/13 14:04:17 tono Exp $
%% ===========================================================================
% Change History
%      1999-01-18 (DaB) Created to fix PBO ref_len bug
%      1999-01-19 (ToNo) Fixed a misscalculation of traffic_routes
%		 1999-02-04 (DaB) Fixed bug when no VDSL modem 
%      1999-03-09 (DaB) Rewritten 
%% ===========================================================================

totlen(1)=0;
nodes=size(topology,1);
for b=2:nodes,
   totlen(b)=totlen(b-1)+topology{b,1};
end;


traffic_routes=length(traffic(:,1));
dmax=0;
for a=1:traffic_routes,
   if strncmp(traffic{a,3},'VDSL',4),
      d=totlen(traffic{a,2})-totlen(traffic{a,1});
   else
      d=0;
   end;
   dmax=max(d,dmax);
end;