%% ===========================================================================
% Copyright (C) 1999 by Telia Research AB, Lulea, Sweden; All rights reserved. 
% 
% Description   : File containing user definitions for an fsan experiment
%
% File          : userDefinitionsExample1.m
% Project       : FSAN simulator
% Author(s)     : Tomas Nordstrom (Tomas.Nordstrom@FTW.at)
%               : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se)
%
% CVS:       $Id: userDefinitionsExample1.m,v 1.3 2000/04/11 08:10:04 dab Exp $
%% ===========================================================================

%% ===========================================================================
% Change History
%      1998-02-26 (ToNo) Created
%      1999-08-14 (DaB)  Changed efficiencyLoss struct
%      1999-08-19 (DaB)  Updated for new tfplan struct
%      2000-04-05 (UvAn) Added frequency axis for the call to calcPSD
%      2000-04-05 (UvAn) New return value from etsi_tfplanHAM
%      2000-04-11 (DaB)  added sync
%% ===========================================================================
global ex;
global gui;

%% ===========================================================================
% Below follows any user modifications to the experiment setups
[ex.tfplist, ex.param.HAMBandName] = ...
	etsi_tfplanHAM(ex.tfplist);   % Get default ETSI HAM band

gui.scenario	= 'My own Scenario';		% Scenario to run
gui.vdslDuplex	= 'VDSL-XXX';                   % Duplex method for VDSL
gui.ttlist      = [];

% Set up the experiment structures

% Define what VDSL plan to use
xDSL=getList(ex.param.xDSLlist,'VDSL');
xDSL.used=gui.vdslDuplex;
ex.param.xDSLlist=setList(ex.param.xDSLlist,'VDSL',xDSL);

% Add our own VDSL definition
tmp_tfplan=getList(ex.tfplist,ex.param.HAMBandName); % initiate tmp_tfplan
tmp_tfplan.name=gui.vdslDuplex;
tmp_tfplan.PSD.downstream ='calcPSD([.3e6 -160 .3e6 -60 3.5e6 -60 3.5e6 -160],''Linear'',ex.param.frequency.f)'; 
tmp_tfplan.PSD.upstream   ='calcPSD([3.5e6 -160 3.5e6 -60 10e6 -60 10e6 -160],''Linear'',ex.param.frequency.f)'; 
tmp_tfplan.timeDivision.up=1;		% Time used in up resp. down link
tmp_tfplan.timeDivision.down=1;	
tmp_tfplan.timeDivision.sync=1;	
tmp_tfplan.PSD.PBO.method='None';	% Power back-off method 
tmp_tfplan.PSD.PBO.param.freq=2e6;	% PBO parameter length(m)
tmp_tfplan.PSD.PBO.param.len=0;		% PBO parameter frequency(Hz)
tmp_tfplan.PSD.PBO.param.maxlen=500;	% PBO parameter maxlength(m)
tmp_tfplan.lcname='VDSL-theo';		
tmp_tfplan.PSD.active.upstream=[0.3e6 10e6];
tmp_tfplan.PSD.active.downstream=[0.3e6 10e6];
tmp_tfplan.PSD.HAM.active=1;
ex.tfplist=insertList(ex.tfplist,tmp_tfplan);

% Change technology specifics
lc=getList(ex.lclist,tmp_tfplan.lcname);
lc.param.efficiencyLoss=0.15;           % Change a linecode parameter
ex.lclist=setList(ex.lclist,lc.name,lc);
lcPrintTheo(lc);

% Use our own scenario
tt.name=gui.scenario;
tt.topology=[
    {0  '' 'CO' ''}; 
    {500  'DTAG_40' 'N1' '500m'}; 	% Distance, Cable, Node name, Line name
    {500  'DTAG_40' 'N2' '500m'}; 
    {500  'DTAG_40' 'N3' '500m'}; 
    {1500 'DTAG_40' 'C'  '1500m'}; 
    {500  'DTAG_40' 'N4' '500m'}; 
    ];
tt.traffic=[
    {1 2 'VDSL' 3};			% From node, to node, tfplan, no gui.modems
    {1 2 'ADSL' 4}; 
    {1 3 'VDSL' 4}; 
    {1 4 'ISDN-2B1Q' 3};
    {1 4 'ADSL' 1}; 
    {1 5 'HDSL-1' 3};
    {5 6 'VDSL' 3};
    {5 6 'ADSL' 4}; 
    ];
gui.ttlist=insertList(gui.ttlist,tt);	% Insert into list (used for GUI)
ex.tt=tt;				% Define the experiment tt structure

% Test VDSL
ex.param.modemlist=['VDSL'];