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


%MDPtestSYS@ISAS
%fname = '../../view_mdp/dat/131029_14.lm'; %MEA & MIA
%fname = '../../view_mdp/dat/131227.lm'; %MEA & MIA
%fname = '../../view_mdp/dat/140116_15.lm'; %MIA

%SW改修し書き換え後の第一回目
%Function-S 1/28 2014
%fname = '../../mmo140128/dat/MEA1.lm';

%Function-D 7/3 2014
%fname = '../../mmo140703/dat/MEA1.lm';
%fname = '../../mmo140703/dat/MEA2.lm';
%fname = '../../mmo140703/dat/MIA.lm';

%Function-D 7/10-11 2014 DPU1/2 redundancy 
%fname = '../../mmo140710/dat/MEA1.lm';
%fname = '../../mmo140710/dat/MEA2.lm';
%fname = '../../mmo140710/dat/MIA.lm';
%fname = '../../mmo140711/dat/MEA1.lm';

%Operation sim. 7/15-16 2014
%fname = '../../mmo140715/dat/MEA1.lm';
%fname = '../../mmo140715/dat/MEA2.lm';
%fname = '../../mmo140715/dat/MIA.lm';
%Function-S 9/13 2014
%fname = '../../mmo140913/dat/MEA1.lm';
%fname = '../../mmo140913/dat/MEA2.lm';
%Function-S 9/13 2014
%fname = '../../mmo140926/dat/MEA1.lm';
%fname = '../../mmo140926/dat/MEA2.lm';
%Function-D2 10/14 2014
%fname = '../../mmo141014/dat/MEA1.lm';
%fname = '../../mmo141014/dat/MEA2.lm';
%Function-S 10/31 2014
%fname = '../../mmo141031/dat/MEA1.lm';
%fname = '../../mmo141031/dat/MEA2.lm';
%fname = '../../mmo141031/dat/MIA.lm';
%Function-N 11/02 2014
%fname = '../../mmo141102/dat/MEA1.lm';
%fname = '../../mmo141102/dat/MEA2.lm';
%fname = '../../mmo141102/dat/MIA.lm';
%Function-N 11/09 2014
%fname = '../../mmo141109/dat/MEA1.lm';
%fname = '../../mmo141109/dat/MEA2.lm';
%fname = '../../mmo141109/dat/MIA.lm';
%Function-N 11/11 2014
%fname = '../../mmo141111/dat/MEA1.lm';
%fname = '../../mmo141111/dat/MEA2.lm';
%fname = '../../mmo141111/dat/MIA.lm';
%Function-N 11/13 2014
%fname = '../../mmo141113/dat/MEA1.lm';
%fname = '../../mmo141113/dat/MEA2.lm';
%fname = '../../mmo141113/dat/MIA.lm';
%Timeline 11/15 2014
%fname = '../../mmo141115/dat/MEA1.lm';
%fname = '../../mmo141115/dat/MEA2.lm';
%fname = '../../mmo141115/dat/MIA.lm';
%Timeline 11/18 2014
%fname = '../../mmo141115/dat/MEA1.lm';
%fname = '../../mmo141115/dat/MEA2.lm';
%fname = '../../mmo141115/dat/MIA.lm';
%Function-N 11/23 2014
%fname = '../../mmo141123/dat/MEA1.lm';
%fname = '../../mmo141123/dat/MEA2.lm';
%fname = '../../mmo141123/dat/MIA.lm';
%Function-D 12/11 2014
%fname = '../../mmo141211/dat/MEA1.lm';
%fname = '../../mmo141211/dat/MEA2.lm';
%fname = '../../mmo141211/dat/MIA.lm';
%Function-D 1/22 2015
%fname = '../../mmo150122/dat/MIA.lm';
%Function-S 4/27 2015
%fname = '../../mmo150427/dat/MIA.lm';
%Function-D 12/01 2015
%fname = '../../mmo141211/dat/MEA1.lm';
%fname = '../../mmo141211/dat/MEA2.lm';
fname = '../../mmo141211/dat/MIA.lm';
dat= dlmread(fname, '');
n = size(dat);
i = 1;
k = 1;
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) = size2; %dat(i,5);
        dat1(k, 7) = size1;
        k = k + 1;
    end
end

fn = 6;
figure(fn);
%subplot(2,1,1);
plot(dat1(:,2), dat1(:,1)*16, 'rs','MarkerSize',4);
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) == 3
        plot(dat1(i,2), dat1(i,1)*16 + 100000, 'bs','MarkerSize',4);
    elseif dat1(i, 3) == 1
        plot(dat1(i,2), dat1(i,1)*16, 'g*','MarkerSize',4);
    end
end
hold off

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

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

figure(fn+2);
plot(dat1(:,1), dat1(:,7), 'rs','MarkerSize',4);
xlabel('Data Size');
xlabel('MSAtime');
hold on
for i = 1:k-1
    if dat1(i, 3) == 3
        plot(dat1(i,1), dat1(i,7), 'bs','MarkerSize',4);
    elseif dat1(i, 3) == 1
        plot(dat1(i,1), dat1(i,7), 'gs','MarkerSize',4);
    end
end
hold off

