%
% 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
%
subplot(111);
subplot(211);
axis([0 500 0 120]);
plot(OfrTotAll,100*AccNetDat./OfrNetDat);
title(['Series ',series,': Acceptance Rate = Accptd/Offrd (1000 net data bytes/packet)']);
ylabel('Acceptance Rate, Pct');
xlabel('Offered Load, kbyte/s');
grid;
%
% Completion Rate
%
subplot(212);
plot(OfrTotAll,100*CmpNetDat./AccNetDat);
title(['Series ',series,': Completion Rate = Cmpltd/Accptd (1000 net data bytes/packet)']);
ylabel('Completion Rate, Pct');
xlabel('Offered Load, kbyte/s');
grid;
pause;
axis;
subplot(111);
%
% Transfer delay
%
subplot(211);
plot(OfrTotAll,TrfDelay);
title(['Series ',series,': Transfer Delay (1000 net data bytes/packet)']);
ylabel('Transfer Delay, ms');
xlabel('Offered Load, kbyte/s');
grid;
%
% Queuing delay
%
subplot(212);
plot(OfrTotAll,QueDelay);
title(['Series ',series,': Queuing Delay (1000 net data bytes/packet)']);
ylabel('Queuing Delay, ms');
xlabel('Offered Load, kbyte/s');
grid;
pause
subplot(111);
%
% Plot Total Data Throughput 
%
subplot(211);
axis([0 500 0 250]);
plot(OfrTotAll,CmpTotAll);
title(['Series ', series, ': Total Throughput (1000 net data bytes/packet)']);
ylabel('Total Cmpltd Data, kbyte/s');
xlabel('Offered Load, kbyte/s');
grid;
%
% Plot Net Data Throughput 
%
subplot(212);
plot(OfrTotAll,CmpNetDat);
title(['Series ',series,': Net Throughput (1000 net data bytes/packet)']);
ylabel('Net Cmpltd Data, kbyte/s');
xlabel('Offered Load, kbyte/s');
grid;
pause
%
% Clean up
%
axis;
subplot(111);

