function [tt] = TTsetup(tdlist,deflen,cable) %TTsetup - Sets up a tt traffic and topology structure from a % list of modems % % Parameter: tdlist A list (cell array) with elements like: % {'VDSL', 12, 750} % where the first field is a modem/system name % where the second field is the number of modems % where the third field is the distance from the CO % deflen Default length to use when negative % distance is indicated (0 is the current default) % cable Cable to use (default is 'TP100') % Returns: tt The resulting tt struct % % Example(s): % nt = {{'VDSL', 12, 750},{'HDSL', 13, 300},... % {'ADSL', 30, 1000},{'ISDN', 75, 750}}; % ex.tt = TTsetup(nt); % %% =========================================================================== %% =========================================================================== % Copyright (C): % 2003-2009 by Forschungszentrum Telekommunikation Wien, Austria; % All rights reserved. % Project : FTW's xDSLsimu % Author(s) : Tomas Nordstrom (Tomas.Nordstrom@FTW.at) % % CVS: $Id: TTsetup.m,v 1.2 2005/01/04 10:25:12 tono Exp $ %% =========================================================================== % Change History % 2003-11-11 (ToNo) Created %% =========================================================================== if nargin<2, deflen=0; end if nargin<3, cable='TP100'; end % Collect all various distances distlist = []; for tix = 1:length(tdlist), distlist(end+1) = tdlist{tix}{3}; if distlist(end) < 0 distlist(end) = deflen; end; end; % Sort the (unique) distances and find their delta [dists, dix, rdix] = unique(distlist); delta = [dists(1) diff(dists)]; [aix,bix]=sort(rdix); % Construct the topology tt.topology={{0, '', 'CO', ''}}; for tix = 1:length(dists) tt.topology{end+1}=... {delta(tix), cable,sprintf('N%d (%.0f m)',tix,dists(tix)),sprintf('%.0f m',delta(tix))}; end; % Construct the traffic tt.traffic={}; for tempix = 1:length(bix) tix = bix(tempix); tt.traffic{end+1}={1, aix(tempix)+1, tdlist{tix}{1}, tdlist{tix}{2}}; end; % Give it a name tt.name = sprintf('SpM scenario with %d modem types',length(bix));