function [result,errorStr] = checkEx(); %% =========================================================================== %checkEx - Check experiment description in the global structure ex % % Returns: result 1=OK 0=Error % Returns: errorStr error string % % Example(s): % ok=checkEx; % if ~ok, % error('Ex struct not correct'); % end; % % Reference: % FSAN xDSL simulation tool manual %% =========================================================================== %% =========================================================================== % Copyright (C) 1999 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: checkEx.m,v 1.14 2000/03/30 13:09:02 tono Exp $ %% =========================================================================== % Change History % 1999-01-14 (ToNo) Created % 1999-01-18 (ToNo) Fixed "No Disturbed modem" check % 1999-01-18 (ToNo) Added many new checks and now it returns the % error string % 1999-02-25 (ToNo) Generlized list (tfplist) handling % 1999-02-26 (ToNo) Added checks for vdslDuplex and removed for noiseMargin. % 1999-08-12 (DaB) Updated for new efficiencyLoss struct % 1999-08-19 (DaB) Updated for new tfplan struct %% =========================================================================== global ex; result=1; errorStr=''; %% =========================================================================== % Check param notypes=length(ex.param.modemlist(:,1)); if notypes<1 result=0; errorStr=[errorStr sprintf('Error: No Disturbed modem!\n')]; end; %% =========================================================================== % Check all disturbed modems for distmodem = 1:notypes, xDSL=getList(ex.param.xDSLlist,(ex.param.modemlist(distmodem,:))); if isempty(xDSL), result=0; errorStr=[errorStr ... sprintf('Error: disturbed modem "%s" not in xDSLlist\n', ... ex.param.modemlist(distmodem,:))]; break; end; %% =========================================================================== % Check tf plan/list tfplan=getList(ex.tfplist,xDSL.used); PSD_up=eval(tfplan.PSD.upstream); PSD_down=eval(tfplan.PSD.downstream); if (tfplan.timeDivision.down+tfplan.timeDivision.up > 2) | ... (tfplan.timeDivision.down < 0) | ... (tfplan.timeDivision.up < 0), result=0; errorStr=[errorStr ... sprintf('Error: timeDivision should not be %.2f, %.2f (down, up)\n', ... tfplan.timeDivision.down,tfplan.timeDivision.up)]; end; %% =========================================================================== % Check lc structure lc = getList(ex.lclist,tfplan.lcname); if (lc.param.efficiencyLoss<0 | lc.param.efficiencyLoss>1), result=0; errorStr=[errorStr sprintf('Error: efficiencyLoss should not be %.2f\n',lc.param.efficiencyLoss)]; end; if lc.param.SNRMax<0 | lc.param.SNRMax>160, result=0; errorStr=[errorStr sprintf('Error: SNRMax should not be %.2f\n',lc.param.SNRMax)]; end; if ex.param.backgroundNoise>-60, result=0; errorStr=[errorStr ... sprintf('Error: backgroundNoise should not be %.2f\n', ex.param.backgroundNoise)]; end; %if lc.param.Gamma<0 | lc.param.Gamma>50, % result=0; % errorStr=[errorStr sprintf('Error: shannonGap should not be %.2f\n',lc.param.Gamma)]; %end; %% =========================================================================== % Check tt % TBD % TBD %% =========================================================================== % Check PBO PBOmethod=tfplan.PSD.PBO.method; PBOparam=tfplan.PSD.PBO.param; switch PBOmethod % $$$ case 'RefLen', % Reference length method % $$$ if PBOparam.len>10000, % $$$ errorStr=[errorStr sprintf('Error: Too long >10km RefLen')]; % $$$ result=0; % $$$ end; % $$$ case 'RefFEXT', % Reference FEXT method % $$$ if PBOparam.len>10000, % $$$ errorStr=[errorStr sprintf('Error: Too long >10km RefLen')]; % $$$ result=0; % $$$ end; % $$$ case 'RefFreq' % Reference frequency method % $$$ if PBOparam.len>PBOparam.maxlen, % $$$ errorStr=[errorStr sprintf('Warning: PBO.param.len longer than PBO.param.maxlen')]; % $$$ result=1; % $$$ end; % $$$ if PBOparam.freq>30e6, % $$$ errorStr=[errorStr sprintf('Error: RefFreq too high >30MHz')]; % $$$ result=0; % $$$ end; % $$$ if PBOparam.freq<0.5e6, % $$$ errorStr=[errorStr sprintf('Warning: RefFreq (PBOparam) lower than 0.5 MHz')]; % $$$ result=1; % $$$ end; otherwise end; %switch end;