%
% Graph results from MSRESULT.xxx produced by 
% the RF MAC Simulator
%
% Carlos Puig
% Revised 7/12/93
%
clear
subplot(111);
name = input('Filename (MSRESULT.xxx) ? ');
XLabel = input('X Axis label ? ');
eval(['load ' name])
% 
% Restructure the arrays
%
ID = MSRESULT(:,1);
NoRows = 11;
NoCols = length(ID)/NoRows;
Shape = zeros(NoRows,NoCols);
%
BatchNo   = Shape;
SimNo     = Shape;
RepNo     = Shape;
ChanCap   = Shape;
OfrTotAll = Shape;
OfrNetDat = Shape;
AccTotAll = Shape;
AccNetDat = Shape;
TrxTotAll = Shape;
TrxTotDat = Shape;
TrxNetDat = Shape;
RcvTotAll = Shape;
RcvTotDat = Shape;
RcvNetDat = Shape;
CmpTotAll = Shape;
CmpNetDat = Shape;
QueDelay  = Shape;
RtyDelay  = Shape;
AccDelay  = Shape;
DatDelay  = Shape;
AckDelay  = Shape;
TrfDelay  = Shape;
%
BatchNo(:)   = MSRESULT(:,1);
SimNo(:)     = MSRESULT(:,2);
RepNo(:)     = MSRESULT(:,3);
ChanCap(:)   = MSRESULT(:,4);
OfrTotAll(:) = MSRESULT(:,5);
OfrNetDat(:) = MSRESULT(:,6);
AccTotAll(:) = MSRESULT(:,7);
AccNetDat(:) = MSRESULT(:,8);
TrxTotAll(:) = MSRESULT(:,9);
TrxTotDat(:) = MSRESULT(:,10);
TrxNetDat(:) = MSRESULT(:,11);
RcvTotAll(:) = MSRESULT(:,12);
RcvTotDat(:) = MSRESULT(:,13);
RcvNetDat(:) = MSRESULT(:,14);
CmpTotAll(:) = MSRESULT(:,15);
CmpNetDat(:) = MSRESULT(:,16);
QueDelay(:)  = MSRESULT(:,17);
RtyDelay(:)  = MSRESULT(:,18);
AccDelay(:)  = MSRESULT(:,19);
DatDelay(:)  = MSRESULT(:,20);
AckDelay(:)  = MSRESULT(:,21);
TrfDelay(:)  = MSRESULT(:,22);
clear MSRESULT;
clear shape;
OfrTotAll = min(500,OfrTotAll);
%
% Select the series
%
for NumSer = 1:3,
if (NumSer == 1),
     series = 'Normal';
elseif (NumSer == 2)
     series = 'Hidden Nodes';
else
     series = 'Heavy Interference';
end 
Select    = (2*NumSer-1):(2*NumSer);
XMin	     = 0;
XMax      = 1000;
XVar      = XMin:100:XMax;
XVar(1)   = 50;
AccNDat = AccNetDat(:,Select);
CmpNDat = CmpNetDat(:,Select);
CmpTAll = CmpTotAll(:,Select);
TrfDel  = TrfDelay(:,Select);
%
% Completion Rate
%
axis([XMin XMax 0 120]);
plot(XVar,100*CmpNDat./AccNDat);
title([series,': Completion Rate = Completed/Accepted']);
ylabel('Completion Rate, Pct');
xlabel(XLabel);
text(0.12,0.21,'------ = 4-Way','sc');
text(0.12,0.16,'solid = C+A','sc');
grid;
pause;
axis;
%
% Transfer delay
%
plot(XVar,TrfDel);
title([series,': Transfer Delay']);
ylabel('Transfer Delay, ms');
xlabel(XLabel);
text(0.12,0.87,'solid = C+A','sc');
text(0.12,0.83,'------ = 4-Way','sc');
grid;
pause;
%
% Plot Net Data Throughput 
%
axis([XMin XMax 0 250]);
plot(XVar,CmpNDat);
title([series,': Net Throughput']);
ylabel('Net Cmpltd Data, kbyte/s');
xlabel(XLabel);
text(0.12,0.87,'solid = C+A','sc');
text(0.12,0.83,'------ = 4-Way','sc');
grid;
pause
%
% Clean up
%
axis;
end


