%2013 10 29 MDP SW 大改修
clear;
%ser = input('Please input series number:  ');
%fname = ['../cal/', ser, '.txt'];



%MDPtestSYS@ISAS
%fname = '../../view_mdp/dat/131029_13.lm';
%Func-D2
%fname = '../../mmo140128/dat/MSA.lm' %Normal
%fname = '../../mmo140129/dat/MSA.lm' %DPU2 fail
%fname = '../../mmo140130/dat/MSA.lm' %DPU1 fail
%Func-D 7/3 2014
%fname = '../../mmo140703/dat/MSA.lm'
%Func-D 7/10-11 2014 MDP1/2 redundancy
%fname = '../../mmo140710/dat/MSA.lm'
%fname = '../../mmo140711/dat/MSA.lm'
%Operation sim. 7/15-16 2014
%fname = '../../mmo140715/dat/MSA.lm';
%Func-S 9/13 2014
%fname = '../../mmo140913/dat/MSA.lm'
%Func-S 9/26 2014
%fname = '../../mmo140926/dat/MSA.lm'
%Func-D2 10/14 2014
%fname = '../../mmo141014/dat/MSA.lm'
%Func-S 10/31 2014
%fname = '../../mmo141031/dat/MSA.lm'
%Func-N 11/02 2014
%fname = '../../mmo141102/dat/MSA.lm'
%Func-N 11/09 2014
%fname = '../../mmo141109/dat/MSA.lm'
%Func-N 11/11 2014
%fname = '../../mmo141111/dat/MSA.lm'
%Func-N 11/13 2014
%fname = '../../mmo141113/dat/MSA.lm'
%TimeLine 11/15 2014
%fname = '../../mmo141115/dat/MSA.lm'
%TimeLine 11/18 2014
%fname = '../../mmo141118/dat/MSA.lm'
%Func-N 11/23 2014
%fname = '../../mmo141123/dat/MSA.lm'
%Func-D 12/11 2014
%fname = '../../mmo141211/dat/MSA.lm'
%Func-D 1/22 2015
%fname = '../../mmo150122/dat/MSA.lm'
%Func-S 4/27 2015
%fname = '../../mmo150427/dat/MSA.lm'
%SW uploading 11/28 2015
%fname = '../../mmo151128/dat/MSA.lm'
%Func-D 12/01 2015
fname = '../../mmo151201/dat/MSA.lm'

dat= dlmread(fname, '');
n = size(dat);
i = 1;
k = 1;
size1 = 0;
size2 = 0;
for i = 1:n(1)
    %MDPの時刻
    if dat(i, 2) == -1;
        ti = dat(i,1);
        if dat(i, 3) ‾= -1;
            size1 = dat(i, 3);
            size2 = dat(i, 4);
        end
    else
        dat1(k, 1) = ti;
        dat1(k, 2) = dat(i,1);
        dat1(k, 3) = dat(i,2);
        dat1(k, 4) = dat(i,3);
        dat1(k, 5) = dat(i,4);
        dat1(k, 6) = dat(i,5);
        dat1(k, 7) = size1;
        k = k + 1;
    end
end

fn = 3;
figure(fn);
%subplot(2,1,1);
plot(dat1(:,2), dat1(:,1)*16, 'rs','MarkerSize',2);
grid on;
%title('g-factor');
ylabel('MDPtime');
xlabel('MSAtime');
hold on
%plot([0 1e6], [0 1e6], '--');
sec = 0.
for i = 1:k-1
    if dat1(i, 3) == 0
        plot(dat1(i,2), dat1(i,1)*16, 'bs','MarkerSize',2);
    elseif dat1(i, 3) == 16
        plot(dat1(i,2), dat1(i,1)*16+10000, 'gs','MarkerSize',2);
    end
end
hold off

figure(fn+1);
%subplot(2,1,2);
plot(dat1(:,2), dat1(:,4), 'rs','MarkerSize',2);
grid on;
%title('g-factor');
ylabel('Data No.');
xlabel('MSAtime');
hold on

sec = 0.
for i = 1:k-1
    if dat1(i, 3) == 0
        plot(dat1(i,2), dat1(i,4), 'bs','MarkerSize',2);
    elseif dat1(i, 3) == 16
        plot(dat1(i,2), dat1(i,4), 'gs','MarkerSize',2);
    end
end
hold off

figure(fn+2);
%subplot(2,1,2);
plot(dat1(:,2), dat1(:,7), 'rs','MarkerSize',3);
grid on;
%title('g-factor');
ylabel('Data Size');
xlabel('MSAtime');
hold on

sec = 0.
for i = 1:k-1
    if dat1(i, 3) == 0
        plot(dat1(i,2), dat1(i,7), 'bs','MarkerSize',2);
    elseif dat1(i, 3) == 16
        plot(dat1(i,2), dat1(i,7), 'gs','MarkerSize',2);
    end
    plot(dat1(i,2), dat1(i,6), 'b.','MarkerSize',2);
end
hold off
