%
% 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) ? ');
series = input('Series ? ');
eval(['load ' name])
% 
% Restructure the arrays
%
ID = MSRESULT(:,1);
NoRows = sum(ID == 1);
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);
%
% Acceptance Rate
%
axis([0 500 0 120]);
plot(OfrTotAll,100*AccNetDat./OfrNetDat);
title([series,': Acceptance Rate = Accepted/Offered']);
ylabel('Acceptance Rate, Pct');
xlabel('Offered Load, kbyte/s');
text(0.12,0.29,'-.-.-. = R/C+C+A','sc');
text(0.12,0.24,'...... = R/C+C','sc');
text(0.12,0.20,'------ = C+A','sc');
text(0.12,0.16,'solid = C','sc');
grid;
pause;
%
% Completion Rate
%
plot(OfrTotAll,100*CmpNetDat./AccNetDat);
title([series,': Completion Rate = Completed/Accepted']);
ylabel('Completion Rate, Pct');
xlabel('Offered Load, kbyte/s');
text(0.12,0.29,'-.-.-. = R/C+C+A','sc');
text(0.12,0.24,'...... = R/C+C','sc');
text(0.12,0.20,'------ = C+A','sc');
text(0.12,0.16,'solid = C','sc');
grid;
pause;
axis;
%
% Transfer delay
%
plot(OfrTotAll,TrfDelay);
title([series,': Transfer Delay']);
ylabel('Transfer Delay, ms');
xlabel('Offered Load, kbyte/s');
text(0.12,0.87,'-.-.-. = R/C+C+A','sc');
text(0.12,0.83,'...... = R/C+C','sc');
text(0.12,0.79,'------ = C+A','sc');
text(0.12,0.75,'solid = C','sc');
grid;
pause;
%
% Queuing delay
%
plot(OfrTotAll,QueDelay);
title([series,': Queuing Delay']);
ylabel('Queuing Delay, ms');
xlabel('Offered Load, kbyte/s');
text(0.12,0.87,'-.-.-. = R/C+C+A','sc');
text(0.12,0.83,'...... = R/C+C','sc');
text(0.12,0.79,'------ = C+A','sc');
text(0.12,0.75,'solid = C','sc');
grid;
pause
%
% Plot Total Data Throughput 
%
axis([0 500 0 250]);
plot(OfrTotAll,CmpTotAll);
title([series, ': Total Throughput']);
ylabel('Total Cmpltd Data, kbyte/s');
xlabel('Offered Load, kbyte/s');
text(0.12,0.87,'-.-.-. = R/C+C+A','sc');
text(0.12,0.83,'...... = R/C+C','sc');
text(0.12,0.79,'------ = C+A','sc');
text(0.12,0.75,'solid = C','sc');
grid;
pause
%
% Plot Net Data Throughput 
%
plot(OfrTotAll,CmpNetDat);
title([series,': Net Throughput']);
ylabel('Net Cmpltd Data, kbyte/s');
xlabel('Offered Load, kbyte/s');
text(0.12,0.87,'-.-.-. = R/C+C+A','sc');
text(0.12,0.83,'...... = R/C+C','sc');
text(0.12,0.79,'------ = C+A','sc');
text(0.12,0.75,'solid = C','sc');
grid;
pause
%
% Clean up
%
axis;


