Sample application 5 used in IEEE Transactions on Intelligent Transportation Systems is added.

This commit is contained in:
Cagatay Sonmez
2020-10-30 12:57:07 +03:00
parent 08341c3681
commit 6660de75b2
62 changed files with 6084 additions and 5 deletions

View File

@ -0,0 +1,60 @@
%--------------------------------------------------------------
%description
% returns a value according to the given argumentssss
%--------------------------------------------------------------
function [ret_val] = getConfiguration(argType)
if(argType == 1)
ret_val = 'D:\sim_results';
elseif(argType == 2)
ret_val = 60; %simulation time (in minutes)
elseif(argType == 3)
ret_val = 2; %Number of iterations
elseif(argType == 4)
ret_val = 2; %x tick interval for number of mobile devices
elseif(argType == 5)
ret_val = {'AI_BASED','MAB','GAME_THEORY','PREDICTIVE','RANDOM'};
elseif(argType == 6)
ret_val = {'ML-based','MAB-based','Game-based','SMA-based','random'};
elseif(argType == 7)
ret_val=[6 3 11 11]; %position of figure
%ret_val=[6 3 9 9]; %position of figure
elseif(argType == 8)
ret_val = [13 12 12]; %font fize for x/y label, lengend and x/y axis
elseif(argType == 9)
ret_val = 'Number of Vehicles'; %Common text for x axis
elseif(argType == 10)
ret_val = 100; %min number of mobile device
elseif(argType == 11)
ret_val = 100; %step size of mobile device count
elseif(argType == 12)
ret_val = 1800; %max number of mobile device
elseif(argType == 17)
ret_val = 0; %return 1 if you want to add 10^n text at x axis
elseif(argType == 18)
ret_val = 1; %return 1 if you want to save figure as pdf
elseif(argType == 19)
ret_val = 1; %return 1 if you want to plot errors
elseif(argType == 20)
ret_val=0; %return 1 if graph is plotted colerful
elseif(argType == 21)
ret_val=[0.55 0 0]; %color of first line
elseif(argType == 22)
ret_val=[0 0.15 0.6]; %color of second line
elseif(argType == 23)
ret_val=[0 0.23 0]; %color of third line
elseif(argType == 24)
ret_val=[0.6 0 0.6]; %color of fourth line
elseif(argType == 25)
ret_val=[0.08 0.08 0.08]; %color of fifth line
elseif(argType == 26)
ret_val=[0 0.8 0.8]; %color of sixth line
elseif(argType == 27)
ret_val=[0.8 0.4 0]; %color of seventh line
elseif(argType == 28)
ret_val=[0.8 0.8 0]; %color of eighth line
elseif(argType == 40)
ret_val={'-k*','-ko','-ks','-kv','-kp','-kd','-kx','-kh'}; %line style (marker) of the colerless line
elseif(argType == 50)
ret_val={'-k*','-ko','-ks','-kv','-kp','-kd','-kx','-kh'}; %line style (marker) of the colerfull line
end
end

View File

@ -0,0 +1,113 @@
function [] = plotApDelay()
folderPath = getConfiguration(1);
numOfSimulations = getConfiguration(3);
stepOfxAxis = getConfiguration(4);
startOfMobileDeviceLoop = getConfiguration(10);
stepOfMobileDeviceLoop = getConfiguration(11);
endOfMobileDeviceLoop = getConfiguration(12);
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
placeTypes = {'AP 1 (60 km/h)','Ap 4 (40 km/h)','AP 11 (20 km/h)'};
results = zeros(size(placeTypes,2),numOfMobileDevices);
for s=1:numOfSimulations
indexCounter = 1;
for i=startOfMobileDeviceLoop:stepOfMobileDeviceLoop:endOfMobileDeviceLoop
try
filePath1 = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_ITS_SCENARIO_AI_BASED_',int2str(i),'DEVICES_AP_UPLOAD_DELAY.log');
filePath2 = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_ITS_SCENARIO_AI_BASED_',int2str(i),'DEVICES_AP_DOWNLOAD_DELAY.log');
readData1 = dlmread(filePath1,';',60,0);
readData2 = dlmread(filePath2,';',60,0);
for j=1:size(placeTypes,2)
results(j,indexCounter) = results(j,indexCounter) + mean(readData1(:,j+1)) + mean(readData2(:,j+1));
end
catch err
error(err)
end
indexCounter = indexCounter + 1;
end
end
results = results/numOfSimulations;
types = zeros(1,numOfMobileDevices);
for i=1:numOfMobileDevices
types(i)=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
end
hFig = figure;
pos=getConfiguration(7);
fontSizeArray = getConfiguration(8);
set(hFig, 'Units','centimeters');
set(hFig, 'Position',pos);
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',fontSizeArray(3));
if(getConfiguration(20) == 1)
for i=stepOfxAxis:stepOfxAxis:numOfMobileDevices
xIndex=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
markers = {':k*',':ko',':ks',':kv'};
for j=1:size(placeTypes,2)
plot(xIndex, results(j,i),char(markers(j)),'MarkerFaceColor',getConfiguration(20+j),'color',getConfiguration(20+j));
hold on;
end
end
for j=1:size(placeTypes,2)
plot(types, results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
hold on;
end
set(gca,'color','none');
else
markers = {'-k*','-ko','-ks','-kv'};
for j=1:size(placeTypes,2)
plot(types, results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.4);
hold on;
end
%set(gcf, 'Position',getConfiguration(28));
end
lgnd = legend(placeTypes,'Location','NorthWest');
if(getConfiguration(20) == 1)
set(lgnd,'color','none');
end
if(getConfiguration(20) == 1)
set(lgnd,'color','none');
end
if(getConfiguration(17) == 0)
manualXAxisCoefficent = 1;
end
hold off;
axis square
xlabel(getConfiguration(9));
set(gca,'XTick', startOfMobileDeviceLoop + stepOfMobileDeviceLoop:(stepOfxAxis*stepOfMobileDeviceLoop):endOfMobileDeviceLoop);
set(gca,'XTickLabel', startOfMobileDeviceLoop + stepOfMobileDeviceLoop/manualXAxisCoefficent:(stepOfxAxis*stepOfMobileDeviceLoop)/manualXAxisCoefficent:endOfMobileDeviceLoop/manualXAxisCoefficent);
ylabel('Average Network Delay (sec)');
set(gca,'XLim',[startOfMobileDeviceLoop-5 endOfMobileDeviceLoop+5]);
if(getConfiguration(17) == 1)
xlim = get(gca,'XLim');
ylim = get(gca,'YLim');
text(1.02 * xlim(2), 0.165 * ylim(2), 'x 10^2');
end
set(get(gca,'Xlabel'),'FontSize',fontSizeArray(1));
set(get(gca,'Ylabel'),'FontSize',fontSizeArray(1));
set(lgnd,'FontSize',fontSizeArray(2));
if(getConfiguration(18) == 1)
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperPositionMode', 'manual');
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
filename = strcat(folderPath,'\apDelay');
saveas(gcf, filename, 'pdf');
end
end

View File

@ -0,0 +1,8 @@
function [] = plotAvgFailedTask()
plotGenericLine(1, 2, 'Average Failed Tasks (%)', 'ALL_APPS', 'NorthWest', 1);
plotGenericLine(1, 2, 'Failed Tasks for Danger Assessment App (%)', 'DANGER_ASSESSMENT', 'NorthWest', 1);
plotGenericLine(1, 2, 'Failed Tasks for Navigation App (%)', 'TRAFFIC_MANAGEMENT', 'NorthWest', 1);
plotGenericLine(1, 2, 'Failed Tasks for Infotainment App (%)', 'INFOTAINMENT', 'NorthWest', 1);
end

View File

@ -0,0 +1,11 @@
function [] = plotAvgNetworkDelay()
plotGenericLine(1, 7, 'Average Network Delay (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(5, 1, 'Average WLAN Delay (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(5, 2, 'Average MAN Delay (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(5, 3, 'Average WAN Delay (sec)', 'ALL_APPS', 'NorthWest', 0, 1, 1);
plotGenericLine(5, 4, 'Average GSM Delay (sec)', 'ALL_APPS', 'NorthWest', 0, 1, 1, 0, [4, 1700]);
end

View File

@ -0,0 +1,9 @@
function [] = plotAvgProcessingTime()
plotGenericLine(1, 6, 'Average Processing Time (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(2, 6, 'Processing Time on RSU (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(3, 6, 'Processing Time on Cloud (sec)', 'ALL_APPS', 'NorthWest', 0);
end

View File

@ -0,0 +1,8 @@
function [] = plotAvgQoE()
plotGenericLine(1, 13, 'Average QoE (%)', 'ALL_APPS', 'SouthWest', 0);
plotGenericLine(1, 13, 'QoE for Danger Assessment App (%)', 'DANGER_ASSESSMENT', 'SouthWest', 0);
plotGenericLine(1, 13, 'QoE for Navigation App (%)', 'TRAFFIC_MANAGEMENT', 'SouthWest', 0);
plotGenericLine(1, 13, 'QoE for Infotainment App (%)', 'INFOTAINMENT', 'SouthWest', 0);
end

View File

@ -0,0 +1,9 @@
function [] = plotAvgServiceTime()
plotGenericLine(1, 5, 'Average Service Time (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(2, 5, 'Service Time on RSU (sec)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(3, 5, 'Service Time on Cloud (sec)', 'ALL_APPS', 'NorthWest', 0);
end

View File

@ -0,0 +1,7 @@
function [] = plotAvgVmUtilization()
plotGenericLine(2, 8, 'Average VM Utilization of RSU (%)', 'ALL_APPS', 'NorthWest', 0);
plotGenericLine(3, 8, 'Average VM Utilization of Cloud (%)', 'ALL_APPS', 'NorthWest', 0);
end

View File

@ -0,0 +1,91 @@
function [] = plotDelayReasonAsBar(isEdge)
folderPath = getConfiguration(1);
numOfSimulations = getConfiguration(3);
stepOfxAxis = 3;%getConfiguration(4);
startOfMobileDeviceLoop = getConfiguration(10);
stepOfMobileDeviceLoop = getConfiguration(11);
endOfMobileDeviceLoop = getConfiguration(12);
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
all_results = zeros(numOfSimulations, numOfMobileDevices, 2);
if ~exist('isEdge','var')
isEdge = 1;
end
for s=1:numOfSimulations
for j=1:numOfMobileDevices
try
mobileDeviceNumber = startOfMobileDeviceLoop + stepOfMobileDeviceLoop * (j-1);
filePath = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_ITS_SCENARIO_AI_BASED_',int2str(mobileDeviceNumber),'DEVICES_ALL_APPS_GENERIC.log');
readData = dlmread(filePath,';',1,0);
value1 = 0;
value2 = 0;
if(isEdge == 1)
value1 = readData(2,5);
value2 = readData(2,6);
else
value1 = readData(3,5);
value2 = readData(3,6);
end
all_results(s,j,1) = value2;
all_results(s,j,2) = value1 - value2;
catch err
error(err)
end
end
end
if(numOfSimulations == 1)
results = all_results;
else
results = mean(all_results); %still 3d matrix but 1xMxN format
end
results = squeeze(results); %remove singleton dimensions
hFig=figure;
pos=getConfiguration(7);
set(hFig, 'Units','centimeters');
set(hFig, 'Position',pos);
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',11);
set(0,'DefaultTextFontSize',12);
b = bar(results,'stacked');
%set(b(1),'LineStyle','--');
if(isEdge == 1)
lgnd = legend(b,{'processing time','WLAN delay'},'Location','NorthWest');
ylabel({'Service Time on Edge (sec)'});
filename = 'edge_delay_reason';
else
lgnd = legend(b,{'processing time','WAN delay'},'Location','NorthWest');
ylabel({'Service Time on Cloud(sec)'});
filename = 'cloud_delay_reason';
end
set(b,{'FaceColor'},{[.45 .45 .45];[.90 .90 .90]});
axis square
xlabel(getConfiguration(9));
set(gca,'XTick', stepOfxAxis:stepOfxAxis:numOfMobileDevices);
set(gca,'XTickLabel', (startOfMobileDeviceLoop*stepOfxAxis):(stepOfxAxis*stepOfMobileDeviceLoop):endOfMobileDeviceLoop);
set(gca,'XLim',[0 numOfMobileDevices+1])
set(get(gca,'Xlabel'),'FontSize',12)
set(get(gca,'Ylabel'),'FontSize',12)
set(lgnd,'FontSize',12)
if(getConfiguration(18) == 1)
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperPositionMode', 'manual');
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
filename = strcat(folderPath,'\',filename);
saveas(gcf, filename, 'pdf');
end
end

View File

@ -0,0 +1,198 @@
function [] = plotGenericLine(rowOfset, columnOfset, yLabel, appType, legendPos, calculatePercentage, divisor, ignoreZeroValues, hideLowerValues, hideXAxis)
folderPath = getConfiguration(1);
numOfSimulations = getConfiguration(3);
stepOfxAxis = getConfiguration(4);
scenarioType = getConfiguration(5);
startOfMobileDeviceLoop = getConfiguration(10);
stepOfMobileDeviceLoop = getConfiguration(11);
endOfMobileDeviceLoop = getConfiguration(12);
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
all_results = zeros(numOfSimulations, size(scenarioType,2), numOfMobileDevices);
min_results = zeros(size(scenarioType,2), numOfMobileDevices);
max_results = zeros(size(scenarioType,2), numOfMobileDevices);
if ~exist('appType','var')
appType = 'ALL_APPS';
end
if ~exist('divisor','var')
divisor = 1;
end
if ~exist('ignoreZeroValues','var')
ignoreZeroValues = 0;
end
if ~exist('hideLowerValues','var')
hideLowerValues = 0;
end
if exist('hideXAxis','var')
hideXAxisStartValue = hideXAxis(2);
hideXAxisIndex = hideXAxis(1);
end
for s=1:numOfSimulations
for i=1:size(scenarioType,2)
for j=1:numOfMobileDevices
try
mobileDeviceNumber = startOfMobileDeviceLoop + stepOfMobileDeviceLoop * (j-1);
filePath = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_ITS_SCENARIO_',char(scenarioType(i)),'_',int2str(mobileDeviceNumber),'DEVICES_',appType,'_GENERIC.log');
readData = dlmread(filePath,';',rowOfset,0);
value = readData(1,columnOfset);
if(calculatePercentage==1)
readData = dlmread(filePath,';',1,0);
totalTask = readData(1,1)+readData(1,2);
value = (100 * value) / totalTask;
end
all_results(s,i,j) = value;
catch err
error(err)
end
end
end
end
if(numOfSimulations == 1)
results = all_results;
else
if(ignoreZeroValues == 1)
results = sum(all_results,1) ./ sum(all_results~=0,1);
%TODO cahnge NaN to 0
else
results = mean(all_results); %still 3d matrix but 1xMxN format
end
end
results = squeeze(results); %remove singleton dimensions
for i=1:size(scenarioType,2)
for j=1:numOfMobileDevices
if(results(i,j) < hideLowerValues)
results(i,j) = NaN;
else
results(i,j) = results(i,j) / divisor;
end
end
end
if exist('hideXAxis','var')
for j=1:numOfMobileDevices
if(j*stepOfMobileDeviceLoop+startOfMobileDeviceLoop > hideXAxisStartValue)
results(hideXAxisIndex,j) = NaN;
end
end
end
for i=1:size(scenarioType,2)
for j=1:numOfMobileDevices
x=results(i,j); % Create Data
SEM = std(x)/sqrt(length(x)); % Standard Error
ts = tinv([0.05 0.95],length(x)-1); % T-Score
CI = mean(x) + ts*SEM; % Confidence Intervals
if(CI(1) < 0)
CI(1) = 0;
end
if(CI(2) < 0)
CI(2) = 0;
end
min_results(i,j) = results(i,j) - CI(1);
max_results(i,j) = CI(2) - results(i,j);
end
end
types = zeros(1,numOfMobileDevices);
for i=1:numOfMobileDevices
types(i)=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
end
hFig = figure;
pos=getConfiguration(7);
fontSizeArray = getConfiguration(8);
set(hFig, 'Units','centimeters');
set(hFig, 'Position',pos);
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',fontSizeArray(3));
if(getConfiguration(20) == 1)
for i=1:1:numOfMobileDevices
xIndex=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
markers = getConfiguration(50);
for j=1:size(scenarioType,2)
plot(xIndex, results(j,i),char(markers(j)),'MarkerFaceColor',getConfiguration(20+j),'color',getConfiguration(20+j));
hold on;
end
end
for j=1:size(scenarioType,2)
if(getConfiguration(19) == 1)
errorbar(types, results(j,:), min_results(j,:),max_results(j,:),'-k','color',getConfiguration(20+j),'LineWidth',1);
else
plot(types, results(j,:),'-k','color',getConfiguration(20+j),'LineWidth',1);
end
hold on;
end
set(gca,'color','none');
else
markers = getConfiguration(40);
for j=1:size(scenarioType,2)
if(getConfiguration(19) == 1)
errorbar(types, results(j,:),min_results(j,:),max_results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1);
else
plot(types, results(j,:),char(markers(j)),'MarkerFaceColor','w');
end
hold on;
end
end
legends = getConfiguration(6);
lgnd = legend(legends,'Location',legendPos);
%lgnd.Position=[0.21,0.8,0.2,0.01];
if(getConfiguration(20) == 1)
set(lgnd,'color','none');
end
xCoefficent = 100;
if(getConfiguration(17) == 0)
xCoefficent = 1;
end
hold off;
axis square
xlabel(getConfiguration(9));
step = stepOfxAxis*stepOfMobileDeviceLoop;
set(gca,'XTick', step:step:endOfMobileDeviceLoop);
set(gca,'XTickLabel', step/xCoefficent:step/xCoefficent:endOfMobileDeviceLoop/xCoefficent);
ylabel(yLabel);
set(gca,'XLim',[startOfMobileDeviceLoop-5 endOfMobileDeviceLoop+5]);
if(getConfiguration(17) == 1)
xlim = get(gca,'XLim');
ylim = get(gca,'YLim');
text(1.02 * xlim(2), 0.165 * ylim(2), 'x 10^2');
end
set(get(gca,'Xlabel'),'FontSize',fontSizeArray(1));
set(get(gca,'Ylabel'),'FontSize',fontSizeArray(1));
set(lgnd,'FontSize',fontSizeArray(2));
if(getConfiguration(18) == 1)
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperPositionMode', 'manual');
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
filename = strcat(folderPath,'\',int2str(rowOfset),'_',int2str(columnOfset),'_',appType);
saveas(gcf, filename, 'pdf');
end
end

View File

@ -0,0 +1,78 @@
function [] = plotGenericPie(vmType, appType, threshold)
folderPath = "D:\git-repos\PhD\EdgeCloudSim\sim_results";
scenarioType = getConfiguration(5);
startOfMobileDeviceLoop = 2000;
stepOfMobileDeviceLoop = 2000;
endOfMobileDeviceLoop = 2000;
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
if ~exist('appType','var')
appType = 1;
end
if ~exist('vmType','var')
vmType = 'edge';
end
total = zeros(1,size(scenarioType,2));
found = zeros(1,size(scenarioType,2));
for s=1:size(scenarioType,2)
for j=1:numOfMobileDevices
try
mobileDeviceNumber = startOfMobileDeviceLoop + stepOfMobileDeviceLoop * (j-1);
filePath = strcat(folderPath,'\ite11\SIMRESULT_ITS_SCENARIO_',char(scenarioType(s)),'_',int2str(mobileDeviceNumber),'DEVICES_SUCCESS.log');
readData = dlmread(filePath,';',1,0);
for k=1:size(readData,1)
if(readData(k,7) == appType && ((strcmp(vmType,'edge') == 1 && readData(k,3) == 3) || (strcmp(vmType,'cloud') == 1 && readData(k,3) ~= 3) || strcmp(vmType,'all')==1))
if(readData(k,12) - readData(k,11) > threshold)
found(s) = found(s) + 1;
end
total(s) = total(s) + 1;
end
end
catch err
error(err)
end
end
end
hFig = figure;
pos=getConfiguration(7);
fontSizeArray = getConfiguration(8);
set(hFig, 'Units','centimeters');
set(hFig, 'Position',pos);
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',fontSizeArray(3));
if(getConfiguration(20) == 1)
%result = found ./ total .* 100;
p = pie(found);
hold on;
end
txt = reshape(getConfiguration(6),[size(scenarioType,2) 1]);
pText = findobj(p,'Type','text');
percentValues = get(pText,'String');
combinedtxt = strcat(txt,' (',percentValues,')');
for i=1:size(scenarioType,2)
pText(i).String = combinedtxt(i);
end
set(pText,'fontsize',fontSizeArray(1))
hold off;
axis square
if(getConfiguration(18) == 1)
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperPositionMode', 'manual');
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
filename = strcat(folderPath,'\',int2str(rowOfset),'_',int2str(columnOfset),'_',appType);
saveas(gcf, filename, 'pdf');
end
end

View File

@ -0,0 +1,96 @@
function [] = plotGenericScatter(yLabel, xLabel, legendPos, vmType, appType, drawLine)
folderPath = "D:\git-repos\PhD\EdgeCloudSim\sim_results";
scenarioType = getConfiguration(5);
simulationTime = getConfiguration(2);
startOfMobileDeviceLoop = 2000;
stepOfMobileDeviceLoop = 2000;
endOfMobileDeviceLoop = 2000;
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
if ~exist('appType','var')
appType = 1;
end
if ~exist('vmType','var')
vmType = 'edge';
end
result_x = NaN(size(scenarioType,2), 5000);
result_y = NaN(size(result_x,1), size(result_x,2));
%result_sz = NaN(size(result_x,1), size(result_x,2));
for s=1:size(scenarioType,2)
index = 1;
firstDeviceId = -1;
for j=1:numOfMobileDevices
try
mobileDeviceNumber = startOfMobileDeviceLoop + stepOfMobileDeviceLoop * (j-1);
filePath = strcat(folderPath,'\ite11\SIMRESULT_ITS_SCENARIO_',char(scenarioType(s)),'_',int2str(mobileDeviceNumber),'DEVICES_SUCCESS.log');
readData = dlmread(filePath,';',1,0);
for k=1:size(readData,1)
if(readData(k,7) == appType && ((strcmp(vmType,'edge') == 1 && readData(k,3) == 3) || (strcmp(vmType,'cloud') == 1 && readData(k,3) ~= 3) || strcmp(vmType,'all')==1))
if(firstDeviceId == -1)
firstDeviceId = readData(k,2);
end
if(readData(k,2) == firstDeviceId) % && readData(k,11) - readData(k,10) < 2
result_y(s, index) = readData(k,12) - readData(k,11);
result_x(s, index) = readData(k,12) / 60;
%result_sz(s, index) = j*10;
index = index + 1;
end
end
end
catch err
error(err)
end
end
end
hFig = figure;
pos=getConfiguration(7);
fontSizeArray = getConfiguration(8);
set(hFig, 'Units','centimeters');
set(hFig, 'Position',pos);
set(0,'DefaultAxesFontName','Times New Roman');
set(0,'DefaultTextFontName','Times New Roman');
set(0,'DefaultAxesFontSize',fontSizeArray(3));
if(getConfiguration(20) == 1)
for i=1:size(scenarioType,2)
scatter(result_x(i,:), result_y(i,:));
hold on;
end
if exist('drawLine','var')
y = [drawLine, drawLine];
x = [0, simulationTime];
plot(x,y);
end
end
legends = getConfiguration(6);
lgnd = legend(legends,'Location',legendPos);
%lgnd.Position=[0.21,0.8,0.2,0.01];
if(getConfiguration(20) == 1)
set(lgnd,'color','none');
end
hold off;
axis square
xlabel(xLabel);
ylabel(yLabel);
set(get(gca,'Xlabel'),'FontSize',fontSizeArray(1));
set(get(gca,'Ylabel'),'FontSize',fontSizeArray(1));
set(lgnd,'FontSize',fontSizeArray(2));
if(getConfiguration(18) == 1)
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperPositionMode', 'manual');
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
filename = strcat(folderPath,'\',int2str(rowOfset),'_',int2str(columnOfset),'_',appType);
saveas(gcf, filename, 'pdf');
end
end

View File

@ -0,0 +1,66 @@
function [] = plotLocation()
folderPath = getConfiguration(1);
numOfSimulations = getConfiguration(3);
stepOfxAxis = getConfiguration(4);
startOfMobileDeviceLoop = 500;
stepOfMobileDeviceLoop = 500;
endOfMobileDeviceLoop = 1500;
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
PlaceCount = 40;
results = zeros(numOfMobileDevices, PlaceCount);
for s=1:numOfSimulations
indexCounter = 1;
for i=startOfMobileDeviceLoop:stepOfMobileDeviceLoop:endOfMobileDeviceLoop
try
filePath = strcat(folderPath,'\ite',int2str(s),'\SIMRESULT_ITS_SCENARIO_AI_BASED_',int2str(i),'DEVICES_LOCATION.log');
readData = dlmread(filePath,';',1,0);
for j=1:PlaceCount
results(indexCounter,j) = results(indexCounter,j) + mean(readData(:,j+1));
end
catch err
error(err)
end
indexCounter = indexCounter + 1;
end
end
results = results/numOfSimulations;
xValues = {};
yValues = {};
indexCounter = 1;
for i=startOfMobileDeviceLoop:stepOfMobileDeviceLoop:endOfMobileDeviceLoop
xValues(indexCounter) = {int2str(i)};
indexCounter = indexCounter + 1;
end
for i=1:PlaceCount
yValues(i) = {int2str(i)}
end
hFig=figure;
%pos=getConfiguration(7);
pos=[10 3 24 6];
set(hFig, 'Units','centimeters');
set(hFig, 'Position',pos);
C = [0,172,0;2,171,0;5,171,0;7,171,0;10,171,0;12,171,0;15,171,0;17,171,0;20,171,0;22,171,0;25,170,0;27,170,0;30,170,0;32,170,0;35,170,0;37,170,0;40,170,0;42,170,0;45,170,0;47,169,0;50,169,0;52,169,0;55,169,0;57,169,0;60,169,0;62,169,0;65,169,0;67,169,0;70,168,0;72,168,0;75,168,0;77,168,0;80,168,0;82,168,0;85,168,0;87,168,0;90,168,0;92,168,0;95,167,0;97,167,0;100,167,0;102,167,0;105,167,0;107,167,0;110,167,0;112,167,0;115,167,0;117,166,0;120,166,0;122,166,0;125,166,0;127,166,0;130,166,0;132,166,0;135,166,0;137,166,0;140,165,0;142,165,0;145,165,0;147,165,0;150,165,0;152,165,0;155,165,0;157,165,0;159,164,0;160,164,0;161,163,0;162,162,0;163,162,0;163,161,0;164,160,0;165,159,0;166,159,0;167,158,0;168,157,0;168,157,0;169,156,0;170,155,0;171,154,0;172,154,0;172,153,0;173,152,0;174,152,0;175,151,0;176,150,0;176,149,0;177,149,0;178,148,0;179,147,0;180,147,0;181,146,0;181,145,0;182,144,0;183,144,0;184,143,0;185,142,0;185,142,0;186,141,0;187,140,0;188,139,0;189,139,0;189,138,0;190,137,0;191,137,0;192,136,0;193,135,0;193,134,0;194,134,0;195,133,0;196,132,0;197,132,0;198,131,0;198,130,0;199,129,0;200,129,0;201,128,0;202,127,0;202,127,0;203,126,0;204,125,0;205,124,0;206,124,0;206,123,0;207,122,0;208,122,0;209,121,0;210,120,0;211,119,0;211,119,0;211,118,0;211,117,0;210,116,0;210,115,0;210,114,0;210,113,0;210,112,0;210,111,0;209,110,0;209,109,0;209,108,0;209,107,0;209,106,0;208,105,0;208,104,0;208,103,0;208,102,0;208,102,0;208,101,0;207,100,0;207,99,0;207,98,0;207,97,0;207,96,0;207,95,0;206,94,0;206,93,0;206,92,0;206,91,0;206,90,0;206,89,0;205,88,0;205,87,0;205,86,0;205,85,0;205,84,0;205,84,0;204,83,0;204,82,0;204,81,0;204,80,0;204,79,0;204,78,0;203,77,0;203,76,0;203,75,0;203,74,0;203,73,0;203,72,0;202,71,0;202,70,0;202,69,0;202,68,0;202,67,0;202,67,0;201,66,0;201,65,0;201,64,0;201,63,0;201,62,0;201,61,0;200,60,0;200,59,0;199,58,0;198,57,0;197,56,0;196,55,0;195,54,0;194,53,0;193,53,0;192,52,0;191,51,0;190,50,0;189,49,0;188,48,0;187,47,0;186,46,0;185,45,0;184,44,0;183,43,0;182,42,0;181,41,0;180,41,0;179,40,0;177,39,0;176,38,0;175,37,0;174,36,0;173,35,0;172,34,0;171,33,0;170,32,0;169,31,0;168,30,0;167,29,0;166,29,0;165,28,0;164,27,0;163,26,0;162,25,0;161,24,0;160,23,0;159,22,0;158,21,0;157,20,0;156,19,0;155,18,0;153,18,0;152,17,0;151,16,0;150,15,0;149,14,0;148,13,0;147,12,0;146,11,0;145,10,0;144,9,0;143,8,0;142,7,0;141,6,0;140,6,0;139,5,0;138,4,0;137,3,0;136,2,0;135,1,0;134,0,0];
h = heatmap(yValues, xValues, results, 'Colormap', colormap(C/255),'FontName','Times New Roman','FontSize',11);
h.Title = 'Mean number of vehicles per places';
h.XLabel = 'Place IDs';
h.YLabel = '#Vehicle in simulation';
if(getConfiguration(18) == 1)
set(hFig, 'PaperUnits', 'centimeters');
set(hFig, 'PaperPositionMode', 'manual');
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
filename = strcat(folderPath,'\position');
saveas(gcf, filename, 'pdf');
end
end

View File

@ -0,0 +1,15 @@
function [] = plotTaskFailureReason()
plotGenericLine(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'NorthWest', 1);
plotGenericLine(1, 11, 'Failed Task due to Mobility (%)', 'ALL_APPS', 'NorthWest', 1);
plotGenericLine(5, 5, 'Failed Tasks due to WLAN (%)', 'ALL_APPS', 'NorthWest', 1);
plotGenericLine(5, 6, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'NorthWest', 1);
plotGenericLine(5, 7, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'NorthWest', 1);
plotGenericLine(5, 8, 'Failed Tasks due to GSM failure (%)', 'ALL_APPS', 'NorthEast', 1);
end

View File

@ -0,0 +1,7 @@
function [] = plotTimeComplexity()
plotGenericLine(6, 1, 'Simulation Time (minute)', 'ALL_APPS', 'NorthWest', 0, 60);
plotGenericLine(6, 2, 'Orchestration Algorithm Overhead (micro second)', 'ALL_APPS', 'NorthEast', 0, 1000);
end