function uiResults(ex,result,modemno,plottype); %% =========================================================================== %uiResults - Show experiment results in a nice (and interactive) way % % Parameter: ex The experiment setup used for this result % Parameter: result The experiment result structure % Parameter: modemno The current selected modem % % Example(s): % result = evalExperiment; % uiResults(ex,result); % Show results (modem 1 selected) % or: % uiResults(ex,result,modemno); % Starts with modemno selected % % Reference: %% =========================================================================== %% =========================================================================== % Copyright (C) 1998,99 by Telia Research AB, Lulea, Sweden; All rights reserved. % Project : FSAN duplex model % Author(s) : Daniel Bengtsson (Daniel.J.Bengtsson@Telia.se) % : Tomas Nordstrom (Tomas.B.Nordstrom@Telia.se) % % CVS: $Id: uiResults.m,v 1.2 1999/03/31 13:16:36 tono Exp $ %% =========================================================================== % Change History % 1998-11-09 (DaB) Created % 1998-12-15 (ToNo) Added header and comments % 1998-12-15 (ToNo) Made it menu driven and gui oriented % 1998-12-21 (ToNo) Changed name on local experiment description to % ex. This does not work with callbacks just yet % 1998-12-22 (ToNo) Added more comments % 1999-01-04 (ToNo) Adjusted window size to manage small screens better. % 1999-01-05 (ToNo) Made modem number into a topology dependent selection % 1999-01-08 (ToNo) Made results local to each result figure using % a global variable res. :-( % 1999-01-11 (ToNo) Changed result appearance and allowed instant resizing % 1999-01-14 (ToNo) Working on the str2mat/mat2str & char bug % 1999-01-14 (ToNo) Added plot buttons % 1999-01-20 (ToNo) Added "zoom on" for plot buttons % 1999-02-25 (ToNo) Generlized list (tfplist) handling % 1999-02-26 (ToNo) Added ui for plot type selection % 1999-03-05 (ToNo) Added ui for named hamband %% =========================================================================== global res; % Check input if nargin<2, error('Not enough input arguments.'); end if nargin<3, modemno=1; end if nargin<4, plottype = 1; % 1='Linear', 2='Log' end %% =========================================================================== % Set up window set(0,'Units','pixels'); % Define sizes and positions of figures screensize=get(0,'ScreenSize'); swidth=screensize(3); sheight=screensize(4); bdwidth=7; fwidth=swidth/2-bdwidth*5; fwidth=max(fwidth,600); fwidth=min(fwidth,swidth); fheight=max(fwidth,650); fheight=min(fheight,sheight); f2start=bdwidth*4+fwidth; f2start=min(f2start,swidth-fwidth); bottom=sheight-fheight-100; % If we already is a result figure us it, otherwise create a new one if (get(0,'CurrentFigure')>=1), if strcmp(get(gcf,'Tag'),'ResFig'), resultfig=gcf; figpos=get(resultfig,'Position'); fwidth=figpos(3); fheight=figpos(4); f2start=figpos(1); bottom=figpos(2); else resultfig=figure; set(resultfig,'NumberTitle','off','Name','FSAN Duplex Simulation Result',... 'Position', [f2start bottom fwidth fheight],'Tag','ResFig', ... 'ResizeFcn','uiResults(res(gcbf).ex,res(gcbf).result,res(gcbf).current,res(gcbf).plottype);'); end; else resultfig=figure; set(resultfig,'NumberTitle','off','Name','FSAN Duplex Simulation Result',... 'Position', [f2start bottom fwidth fheight],'Tag','ResFig', ... 'ResizeFcn','uiResults(res(gcbf).ex,res(gcbf).result,res(gcbf).current,res(gcbf).plottype);'); end; clf; set(resultfig,'Pointer','arrow'); baseSize=get(0,'DefaultTextFontSize'); % Set up window for nice printing set(resultfig,'PaperPositionMode','auto'); uiheight=225; % User interaction area height plotheight=(fheight-uiheight)/2; % Make space for two diagrams plotbd=35; % Coordinates for some of the drawing areas (axes); RECT = [left, bottom, width, height] coordall=[1 1 fwidth fheight]; coordui=[1 fheight-uiheight fwidth uiheight]; coordfm=[plotbd plotheight+plotbd fwidth-plotbd*2 plotheight-plotbd*2]; coordfl=[plotbd plotbd fwidth-plotbd*2 plotheight-plotbd*2]; % Set up drawing areas rallax=axes('Units','pixels','pos',coordall); % The whole window axis('off'); ruiax=axes('Units','pixels','pos',coordui); % User interaction area axis('off'); plotheight=(fheight-uiheight)/2; ltax=axes('Units','pixels','pos',coordfm,'Tag','LTAX');% Area for LT side plot axis('off'); ntax=axes('Units','pixels','pos',coordfl,'Tag','NTAX');% Area for NT side plot axis('off'); %% =========================================================================== % Generate the content plottypes = str2mat('Linear', 'Log'); % Save the window context for use in callbacks res(resultfig).ex=ex; res(resultfig).result=result; res(resultfig).current=modemno; res(resultfig).plottype=plottype; res(resultfig).plotstrtype=deblank(plottypes(plottype,:)); current=modemno; % Selected modem n=length(result); % Get the resulting bitrates [bitrate_LT, bitrate_NT bitrate_LT_bg bitrate_NT_bg]=calcFSANresult(ex,result); ratios = bitrate_NT ./ bitrate_LT; Loss_LT= (bitrate_LT_bg-bitrate_LT) ./ bitrate_LT_bg.*100; Loss_NT=(bitrate_NT_bg-bitrate_NT) ./ bitrate_NT_bg.*100; % Show experiment parameters in user interaction area axes(ruiax); fill([0 0 1 1] ,[0 1 1 0],'w'); % Make user interaction area white axis('off'); axes(rallax); delta=20; lheight=fheight; lw=20; lheight=lheight-delta; tmpstr= sprintf('Scenario: %s',ex.tt.name); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+2,'FontWeight','bold'); lheight=lheight-delta; tmpstr= sprintf('Testing: %s',ex.param.vdslDuplex); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tmpstr= sprintf('Noise model: %s',ex.param.FSANNoiseModel); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tfplan=getList(ex.tfplist,ex.param.vdslDuplex); tmpstr= sprintf('PBO: %s with %g',tfplan.PBOmethod,tfplan.PBOparam); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tmpstr= sprintf('SNR max: %.1f',ex.param.SNRMax); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tmpstr= sprintf('Time division: %.1f/%.1f (up/down)',tfplan.timeDivision.up, tfplan.timeDivision.down); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; if ex.param.HAM, tmpstr= sprintf('Using hamband: %s',ex.param.HambandName); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); end; lheight=fheight-40; lw=200; text(lw+200, lheight, 'f axis type', 'Units','pixels', 'FontSize', baseSize+1); plotmui=uicontrol('style','popupmenu','string', plottypes, 'value',plottype,... 'units','pixels','pos',[lw+70+200, lheight-10 90 20], ... 'FontSize', baseSize+1, 'BackgroundColor', [1 1 0.9], ... 'callback', 'res(gcbf).plottype=get(gcbo, ''value'');uiResults(res(gcbf).ex,res(gcbf).result,res(gcbf).current,res(gcbf).plottype);' ... ); lheight=lheight-delta; if ex.param.fastrecalc, fcs='Fast calc'; else fcs=''; end; tmpstr= sprintf('f max=%.2f MHz (%s)',max(ex.param.f)/1e6, fcs); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); % Parameters to edit lheight=lheight-delta; tmpstr= sprintf('Shannon gap:'); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); uicontrol('style','edit',... 'string',num2str(ex.param.shannonGap),... 'units','pixels','HorizontalAlignment','left',... 'pos',[lw+100 lheight-10 40 20],'backgroundcolor', [1 1 0.9], ... 'callback', 'res(gcbf).ex.param.shannonGap=str2num(get(gcbo,''string''));uiResults(res(gcbf).ex,res(gcbf).result,res(gcbf).current,res(gcbf).plottype);' ... ); lheight=lheight-delta; text(lw, lheight, 'Efficiency loss:', 'Units','pixels', 'FontSize', baseSize+1); uicontrol('style','edit',... 'string',num2str(ex.param.efficiencyLoss),... 'units','pixels','HorizontalAlignment','left',... 'pos',[lw+100 lheight-10 40 20],'backgroundcolor', [1 1 0.9], ... 'callback', 'res(gcbf).ex.param.efficiencyLoss=str2num(get(gcbo,''string''));uiResults(res(gcbf).ex,res(gcbf).result,res(gcbf).current,res(gcbf).plottype);' ... ); % More parameters lheight=fheight-40; lw=400; lheight=lheight-delta; tmpstr= sprintf('Background noise: %.1f',ex.param.backgroundNoise); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tmpstr= sprintf('NEXT level: %.1f',ex.param.XTlevel.NEXT); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tmpstr= sprintf('FEXT level: %.1f',ex.param.XTlevel.FEXT); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); lheight=lheight-delta; tmpstr= sprintf('3cXT level: %.1f',ex.param.XTlevel.thirdCXT); text(lw, lheight, tmpstr, 'Units','pixels', 'FontSize', baseSize+1); % Buttons lheight=lheight-delta; uicontrol('string','Close', 'Position', [lw lheight-10 60 20],... 'callback','close(gcbf)'); %% =========================================================================== for i=1:n, clables(i)={sprintf('%s %s to %s', ... ex.tt.traffic{ex.tt.dm(i),3}, ... ex.tt.topology{ex.tt.traffic{ex.tt.dm(i),1},3}, ... ex.tt.topology{ex.tt.traffic{ex.tt.dm(i),2},3})}; end labels = str2mat(char(clables)); % Draw modem info row axes(ruiax); lpos=((55+10)/uiheight); line([0 1], [lpos lpos],'Color','k'); stepsize=max(100,fwidth/n); for mno=1:n, if mno==current, color='b'; angle='italic'; else color='k'; angle='normal'; end modeminfostr=clables(mno); text(10+(mno-1)*stepsize, 55, modeminfostr, ... 'Units','pixels', ... 'FontSize', baseSize+1,'FontWeight','bold','FontAngle',angle,... 'Color',color); tmpstr= sprintf('Down Rate: %.2f (%.2f )',bitrate_NT(mno),bitrate_NT_bg(mno)); text(10+(mno-1)*stepsize, 40, tmpstr, ... 'Units','pixels', 'FontSize', baseSize,'Color',color); tmpstr= sprintf('Up Rate: %.2f (%.2f )',bitrate_LT(mno),bitrate_LT_bg(mno)); text(10+(mno-1)*stepsize, 25, tmpstr, ... 'Units','pixels', 'FontSize', baseSize,'Color',color); tmpstr= sprintf('(Ratio: %.2f)',ratios(mno)); text(10+(mno-1)*stepsize, 10, tmpstr, ... 'Units','pixels', 'FontSize', baseSize-1,'Color',color); end % Modem selection axes(rallax); modempop=uicontrol('style','popupmenu','string', labels, 'value',current,... 'units','pixels','pos',[1, fheight-uiheight-20 200 20], ... 'BackgroundColor', [1 1 0.9], ... 'callback', 'res(gcbf).current=get(gcbo, ''value'');uiResults(res(gcbf).ex,res(gcbf).result,res(gcbf).current,res(gcbf).plottype);' ... ); plotstrtype=deblank(plottypes(plottype,:)); % Plot LT side axes(ltax); plotResult(ex,result,current,'LT',plotstrtype); % PlotIT Button for LT uicontrol('string','PlotIt', 'Position', [fwidth-70 fheight-uiheight-30 60 20],... 'callback', ... ... 'figure;plotResult(res(gcbf).ex,res(gcbf).result,res(gcbf).current,''LT'',res(gcbf).plotstrtype);zoom on;') % Plot NT side axes(ntax); plotResult(ex,result,current,'NT',plotstrtype); % PlotIT Button for NT uicontrol('string','PlotIt', 'Position', [fwidth-70 plotheight-30 60 20],... 'callback', ... 'figure;plotResult(res(gcbf).ex,res(gcbf).result,res(gcbf).current,''NT'',res(gcbf).plotstrtype);zoom on;') axes(rallax);