birbnetes basics added
This commit is contained in:
parent
f6d892d731
commit
052d4b16ce
1
scripts/birbnetes/.gitignore
vendored
Normal file
1
scripts/birbnetes/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
output
|
4
scripts/birbnetes/compile.sh
Normal file
4
scripts/birbnetes/compile.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
rm -rf ../../bin
|
||||||
|
mkdir ../../bin
|
||||||
|
javac -classpath "../../lib/cloudsim-4.0.jar:../../lib/commons-math3-3.6.1.jar:../../lib/colt.jar" -sourcepath ../../src ../../src/edu/boun/edgecloudsim/applications/birbnetes/MainApp.java -d ../../bin
|
18
scripts/birbnetes/config/applications.xml
Normal file
18
scripts/birbnetes/config/applications.xml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<applications>
|
||||||
|
<application name="BIRBNETES">
|
||||||
|
<usage_percentage>100</usage_percentage>
|
||||||
|
<prob_cloud_selection>1</prob_cloud_selection>
|
||||||
|
<poisson_interarrival>7</poisson_interarrival>
|
||||||
|
<delay_sensitivity>0</delay_sensitivity>
|
||||||
|
<active_period>2</active_period>
|
||||||
|
<idle_period>20</idle_period>
|
||||||
|
<data_upload>88</data_upload>
|
||||||
|
<data_download>2</data_download>
|
||||||
|
<task_length>750</task_length>
|
||||||
|
<required_core>1</required_core>
|
||||||
|
<vm_utilization_on_edge>4</vm_utilization_on_edge>
|
||||||
|
<vm_utilization_on_cloud>20</vm_utilization_on_cloud>
|
||||||
|
<vm_utilization_on_mobile>5</vm_utilization_on_mobile>
|
||||||
|
</application>
|
||||||
|
</applications>
|
42
scripts/birbnetes/config/default_config.properties
Normal file
42
scripts/birbnetes/config/default_config.properties
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#default config file
|
||||||
|
simulation_time=30
|
||||||
|
warm_up_period=3
|
||||||
|
vm_load_check_interval=0.1
|
||||||
|
location_check_interval=0.1
|
||||||
|
file_log_enabled=true
|
||||||
|
deep_file_log_enabled=false
|
||||||
|
|
||||||
|
min_number_of_mobile_devices=100
|
||||||
|
max_number_of_mobile_devices=1000
|
||||||
|
mobile_device_counter_size=100
|
||||||
|
|
||||||
|
wan_propagation_delay=0.1
|
||||||
|
lan_internal_delay=0.005
|
||||||
|
wlan_bandwidth=200
|
||||||
|
wan_bandwidth=15
|
||||||
|
gsm_bandwidth=0
|
||||||
|
|
||||||
|
#all the host on cloud runs on a single datacenter
|
||||||
|
number_of_host_on_cloud_datacenter=1
|
||||||
|
number_of_vm_on_cloud_host=4
|
||||||
|
core_for_cloud_vm=4
|
||||||
|
mips_for_cloud_vm=10000
|
||||||
|
ram_for_cloud_vm=32000
|
||||||
|
storage_for_cloud_vm=1000000
|
||||||
|
|
||||||
|
#mobile devices has no processing unit in this scenario
|
||||||
|
core_for_mobile_vm=4
|
||||||
|
mips_for_mobile_vm=1000
|
||||||
|
ram_for_mobile_vm=4000
|
||||||
|
storage_for_mobile_vm=16000
|
||||||
|
|
||||||
|
#use ',' for multiple values
|
||||||
|
orchestrator_policies=NEXT_FIT
|
||||||
|
|
||||||
|
#use ',' for multiple values
|
||||||
|
simulation_scenarios=SINGLE_TIER,TWO_TIER,TWO_TIER_WITH_EO
|
||||||
|
|
||||||
|
#mean waiting time in seconds
|
||||||
|
attractiveness_L1_mean_waiting_time=500
|
||||||
|
attractiveness_L2_mean_waiting_time=300
|
||||||
|
attractiveness_L3_mean_waiting_time=120
|
71
scripts/birbnetes/config/edge_devices.xml
Normal file
71
scripts/birbnetes/config/edge_devices.xml
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<edge_devices>
|
||||||
|
<datacenter arch="x86" os="Linux" vmm="Xen">
|
||||||
|
<costPerBw>0.1</costPerBw>
|
||||||
|
<costPerSec>3.0</costPerSec>
|
||||||
|
<costPerMem>0.05</costPerMem>
|
||||||
|
<costPerStorage>0.1</costPerStorage>
|
||||||
|
<location>
|
||||||
|
<x_pos>1</x_pos>
|
||||||
|
<y_pos>1</y_pos>
|
||||||
|
<wlan_id>0</wlan_id>
|
||||||
|
<attractiveness>0</attractiveness>
|
||||||
|
</location>
|
||||||
|
<hosts>
|
||||||
|
<host>
|
||||||
|
<core>8</core>
|
||||||
|
<mips>4000</mips>
|
||||||
|
<ram>8000</ram>
|
||||||
|
<storage>200000</storage>
|
||||||
|
<VMs>
|
||||||
|
<VM vmm="Xen">
|
||||||
|
<core>2</core>
|
||||||
|
<mips>1000</mips>
|
||||||
|
<ram>2000</ram>
|
||||||
|
<storage>50000</storage>
|
||||||
|
</VM>
|
||||||
|
<VM vmm="Xen">
|
||||||
|
<core>2</core>
|
||||||
|
<mips>1000</mips>
|
||||||
|
<ram>2000</ram>
|
||||||
|
<storage>50000</storage>
|
||||||
|
</VM>
|
||||||
|
</VMs>
|
||||||
|
</host>
|
||||||
|
</hosts>
|
||||||
|
</datacenter>
|
||||||
|
<datacenter arch="x86" os="Linux" vmm="Xen">
|
||||||
|
<costPerBw>0.1</costPerBw>
|
||||||
|
<costPerSec>3.0</costPerSec>
|
||||||
|
<costPerMem>0.05</costPerMem>
|
||||||
|
<costPerStorage>0.1</costPerStorage>
|
||||||
|
<location>
|
||||||
|
<x_pos>2</x_pos>
|
||||||
|
<y_pos>2</y_pos>
|
||||||
|
<wlan_id>1</wlan_id>
|
||||||
|
<attractiveness>0</attractiveness>
|
||||||
|
</location>
|
||||||
|
<hosts>
|
||||||
|
<host>
|
||||||
|
<core>8</core>
|
||||||
|
<mips>4000</mips>
|
||||||
|
<ram>8000</ram>
|
||||||
|
<storage>200000</storage>
|
||||||
|
<VMs>
|
||||||
|
<VM vmm="Xen">
|
||||||
|
<core>2</core>
|
||||||
|
<mips>1000</mips>
|
||||||
|
<ram>2000</ram>
|
||||||
|
<storage>50000</storage>
|
||||||
|
</VM>
|
||||||
|
<VM vmm="Xen">
|
||||||
|
<core>2</core>
|
||||||
|
<mips>1000</mips>
|
||||||
|
<ram>2000</ram>
|
||||||
|
<storage>50000</storage>
|
||||||
|
</VM>
|
||||||
|
</VMs>
|
||||||
|
</host>
|
||||||
|
</hosts>
|
||||||
|
</datacenter>
|
||||||
|
</edge_devices>
|
53
scripts/birbnetes/matlab/getConfiguration.m
Normal file
53
scripts/birbnetes/matlab/getConfiguration.m
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
%--------------------------------------------------------------
|
||||||
|
%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 = 1; %Number of iterations
|
||||||
|
elseif(argType == 3)
|
||||||
|
ret_val = 100; %min number of mobile device
|
||||||
|
elseif(argType == 4)
|
||||||
|
ret_val = 100; %step size of mobile device count
|
||||||
|
elseif(argType == 5)
|
||||||
|
ret_val =1000; %max number of mobile device
|
||||||
|
elseif(argType == 6)
|
||||||
|
ret_val = 1; %xTickLabelCoefficient
|
||||||
|
elseif(argType == 7)
|
||||||
|
ret_val = {'SINGLE_TIER','TWO_TIER','TWO_TIER_WITH_EO'};
|
||||||
|
elseif(argType == 8)
|
||||||
|
ret_val = {'1-tier','2-tier','2-tier with EO'};
|
||||||
|
elseif(argType == 9)
|
||||||
|
ret_val=[10 3 12 12]; %position of figure
|
||||||
|
elseif(argType == 10)
|
||||||
|
ret_val = 'Number of Mobile Devices'; %Common text for x axis
|
||||||
|
elseif(argType == 11)
|
||||||
|
ret_val = 1; %return 1 if you want to save figure as pdf
|
||||||
|
elseif(argType == 12)
|
||||||
|
ret_val = 0; %return 1 if you want to plot errors
|
||||||
|
elseif(argType == 20)
|
||||||
|
ret_val=1; %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
|
21
scripts/birbnetes/matlab/plotAvgFailedTask.m
Normal file
21
scripts/birbnetes/matlab/plotAvgFailedTask.m
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
function [] = plotAvgFailedTask()
|
||||||
|
|
||||||
|
plotGenericResult(1, 2, 'Failed Tasks (%)', 'ALL_APPS', 'percentage_for_all');
|
||||||
|
plotGenericResult(1, 2, {'Failed Tasks for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
|
||||||
|
plotGenericResult(1, 2, 'Failed Tasks for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
|
||||||
|
plotGenericResult(1, 2, {'Failed Tasks for';'Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_all');
|
||||||
|
plotGenericResult(1, 2, 'Failed Tasks for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
|
||||||
|
|
||||||
|
plotGenericResult(2, 2, 'Failed Tasks on Edge (%)', 'ALL_APPS', 'percentage_for_all');
|
||||||
|
plotGenericResult(2, 2, {'Failed Tasks on Edge';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
|
||||||
|
plotGenericResult(2, 2, 'Failed Tasks on Edge for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
|
||||||
|
plotGenericResult(2, 2, 'Failed Tasks on Edge for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
|
||||||
|
plotGenericResult(2, 2, 'Failed Tasks on Edge for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
|
||||||
|
|
||||||
|
plotGenericResult(3, 2, 'Failed Tasks on Cloud (%)', 'ALL_APPS', 'percentage_for_all');
|
||||||
|
plotGenericResult(3, 2, {'Failed Tasks on Cloud for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
|
||||||
|
plotGenericResult(3, 2, 'Failed Tasks on Cloud for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
|
||||||
|
plotGenericResult(3, 2, 'Failed Tasks on Cloud for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
|
||||||
|
plotGenericResult(3, 2, 'Failed Tasks on Cloud for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
|
||||||
|
|
||||||
|
end
|
21
scripts/birbnetes/matlab/plotAvgNetworkDelay.m
Normal file
21
scripts/birbnetes/matlab/plotAvgNetworkDelay.m
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
function [] = plotAvgNetworkDelay()
|
||||||
|
|
||||||
|
plotGenericResult(1, 7, 'Average Network Delay (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(1, 7, {'Average Network Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(1, 7, 'Average Network Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(1, 7, {'Average Network Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(1, 7, {'Average Network Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
plotGenericResult(5, 1, 'Average WLAN Delay (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(5, 1, {'Average WLAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(5, 1, 'Average WLAN Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(5, 1, {'Average WLAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(5, 1, {'Average WLAN Delay';'for Heavy Comp. App %(sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
plotGenericResult(5, 3, 'Average WAN Delay (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(5, 3, {'Average WAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(5, 3, 'Average WAN Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(5, 3, {'Average WAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(5, 3, {'Average WAN Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
end
|
21
scripts/birbnetes/matlab/plotAvgProcessingTime.m
Normal file
21
scripts/birbnetes/matlab/plotAvgProcessingTime.m
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
function [] = plotAvgProcessingTime()
|
||||||
|
|
||||||
|
plotGenericResult(1, 6, 'Processing Time (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(1, 6, 'Processing Time for Augmented Reality App (sec)', 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(1, 6, 'Processing Time for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(1, 6, 'Processing Time for Infotainment App (sec)', 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(1, 6, 'Processing Time for Heavy Comp. App (sec)', 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
plotGenericResult(2, 6, 'Processing Time on Edge (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(2, 6, {'Processing Time on Edge';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(2, 6, {'Processing Time on Edge';'for Health App (sec)'}, 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(2, 6, {'Processing Time on Edge';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(2, 6, {'Processing Time on Edge';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
plotGenericResult(3, 6, 'Processing Time on Cloud (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Health App (sec)'}, 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(3, 6, {'Processing Time on Cloud';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
end
|
21
scripts/birbnetes/matlab/plotAvgServiceTime.m
Normal file
21
scripts/birbnetes/matlab/plotAvgServiceTime.m
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
function [] = plotAvgServiceTime()
|
||||||
|
|
||||||
|
plotGenericResult(1, 5, 'Service Time (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(1, 5, {'Service Time for';'Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(1, 5, 'Service Time for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(1, 5, 'Service Time for Infotainment App (sec)', 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(1, 5, {'Service Time for';'Compute Intensive App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
plotGenericResult(2, 5, 'Service Time on Edge (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(2, 5, {'Service Time on Edge';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(2, 5, 'Service Time on Edge for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(2, 5, {'Service Time on Edge';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(2, 5, {'Service Time on Edge';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
plotGenericResult(3, 5, 'Service Time on Cloud (sec)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(3, 5, {'Service Time on Cloud';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(3, 5, 'Service Time on Cloud for Health App (sec)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(3, 5, {'Service Time on Cloud';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(3, 5, {'Service Time on Cloud';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
end
|
9
scripts/birbnetes/matlab/plotAvgVmUtilization.m
Normal file
9
scripts/birbnetes/matlab/plotAvgVmUtilization.m
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
function [] = plotAvgVmUtilization()
|
||||||
|
|
||||||
|
plotGenericResult(2, 8, 'Average VM Utilization (%)', 'ALL_APPS', '');
|
||||||
|
plotGenericResult(2, 8, {'Average VM Utilization';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', '');
|
||||||
|
plotGenericResult(2, 8, 'Average VM Utilization for Health App (%)', 'HEALTH_APP', '');
|
||||||
|
plotGenericResult(2, 8, 'Average VM Utilization for Infotainment App (%)', 'INFOTAINMENT_APP', '');
|
||||||
|
plotGenericResult(2, 8, 'Average VM Utilization for Heavy Comp. App (%)', 'HEAVY_COMP_APP', '');
|
||||||
|
|
||||||
|
end
|
149
scripts/birbnetes/matlab/plotGenericResult.m
Normal file
149
scripts/birbnetes/matlab/plotGenericResult.m
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
function [] = plotGenericResult(rowOfset, columnOfset, yLabel, appType, calculatePercentage)
|
||||||
|
folderPath = getConfiguration(1);
|
||||||
|
numOfSimulations = getConfiguration(2);
|
||||||
|
startOfMobileDeviceLoop = getConfiguration(3);
|
||||||
|
stepOfMobileDeviceLoop = getConfiguration(4);
|
||||||
|
endOfMobileDeviceLoop = getConfiguration(5);
|
||||||
|
xTickLabelCoefficient = getConfiguration(6);
|
||||||
|
|
||||||
|
scenarioType = getConfiguration(7);
|
||||||
|
legends = getConfiguration(8);
|
||||||
|
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
|
||||||
|
|
||||||
|
pos=getConfiguration(9);
|
||||||
|
|
||||||
|
all_results = zeros(numOfSimulations, size(scenarioType,2), numOfMobileDevices);
|
||||||
|
min_results = zeros(size(scenarioType,2), numOfMobileDevices);
|
||||||
|
max_results = zeros(size(scenarioType,2), numOfMobileDevices);
|
||||||
|
|
||||||
|
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_',char(scenarioType(i)),'_NEXT_FIT_',int2str(mobileDeviceNumber),'DEVICES_',appType,'_GENERIC.log');
|
||||||
|
|
||||||
|
readData = dlmread(filePath,';',rowOfset,0);
|
||||||
|
value = readData(1,columnOfset);
|
||||||
|
if(strcmp(calculatePercentage,'percentage_for_all'))
|
||||||
|
readData = dlmread(filePath,';',1,0);
|
||||||
|
totalTask = readData(1,1)+readData(1,2);
|
||||||
|
value = (100 * value) / totalTask;
|
||||||
|
elseif(strcmp(calculatePercentage,'percentage_for_completed'))
|
||||||
|
readData = dlmread(filePath,';',1,0);
|
||||||
|
totalTask = readData(1,1);
|
||||||
|
value = (100 * value) / totalTask;
|
||||||
|
elseif(strcmp(calculatePercentage,'percentage_for_failed'))
|
||||||
|
readData = dlmread(filePath,';',1,0);
|
||||||
|
totalTask = 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
|
||||||
|
results = mean(all_results); %still 3d matrix but 1xMxN format
|
||||||
|
end
|
||||||
|
|
||||||
|
results = squeeze(results); %remove singleton dimensions
|
||||||
|
|
||||||
|
for i=1:size(scenarioType,2)
|
||||||
|
for j=1:numOfMobileDevices
|
||||||
|
x=all_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;
|
||||||
|
set(hFig, 'Units','centimeters');
|
||||||
|
set(hFig, 'Position',pos);
|
||||||
|
set(0,'DefaultAxesFontName','Times New Roman');
|
||||||
|
set(0,'DefaultTextFontName','Times New Roman');
|
||||||
|
set(0,'DefaultAxesFontSize',10);
|
||||||
|
set(0,'DefaultTextFontSize',12);
|
||||||
|
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(12) == 1)
|
||||||
|
errorbar(types, results(j,:), min_results(j,:),max_results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
|
||||||
|
else
|
||||||
|
plot(types, results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.5);
|
||||||
|
end
|
||||||
|
hold on;
|
||||||
|
end
|
||||||
|
|
||||||
|
set(gca,'color','none');
|
||||||
|
else
|
||||||
|
markers = getConfiguration(40);
|
||||||
|
for j=1:size(scenarioType,2)
|
||||||
|
if(getConfiguration(12) == 1)
|
||||||
|
errorbar(types, results(j,:),min_results(j,:),max_results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.2);
|
||||||
|
else
|
||||||
|
plot(types, results(j,:),char(markers(j)),'MarkerFaceColor','w','LineWidth',1.2);
|
||||||
|
end
|
||||||
|
hold on;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
lgnd = legend(legends,'Location','NorthWest');
|
||||||
|
if(getConfiguration(20) == 1)
|
||||||
|
set(lgnd,'color','none');
|
||||||
|
end
|
||||||
|
|
||||||
|
hold off;
|
||||||
|
axis square
|
||||||
|
xlabel(getConfiguration(10));
|
||||||
|
set(gca,'XTick', (startOfMobileDeviceLoop*xTickLabelCoefficient):(stepOfMobileDeviceLoop*xTickLabelCoefficient):endOfMobileDeviceLoop);
|
||||||
|
set(gca,'XTickLabel', (startOfMobileDeviceLoop*xTickLabelCoefficient):(stepOfMobileDeviceLoop*xTickLabelCoefficient):endOfMobileDeviceLoop);
|
||||||
|
ylabel(yLabel);
|
||||||
|
set(gca,'XLim',[startOfMobileDeviceLoop-5 endOfMobileDeviceLoop+5]);
|
||||||
|
|
||||||
|
set(get(gca,'Xlabel'),'FontSize',12)
|
||||||
|
set(get(gca,'Ylabel'),'FontSize',12)
|
||||||
|
set(lgnd,'FontSize',11)
|
||||||
|
|
||||||
|
if(getConfiguration(11) == 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
|
27
scripts/birbnetes/matlab/plotTaskFailureReason.m
Normal file
27
scripts/birbnetes/matlab/plotTaskFailureReason.m
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
function [] = plotTaskFailureReason()
|
||||||
|
|
||||||
|
plotGenericResult(1, 10, 'Failed Task due to VM Capacity (%)', 'ALL_APPS', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed');
|
||||||
|
|
||||||
|
plotGenericResult(1, 11, 'Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed');
|
||||||
|
|
||||||
|
plotGenericResult(5, 5, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed');
|
||||||
|
|
||||||
|
plotGenericResult(5, 7, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'percentage_for_failed');
|
||||||
|
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'percentage_for_failed');
|
||||||
|
|
||||||
|
end
|
59
scripts/birbnetes/run_scenarios.sh
Normal file
59
scripts/birbnetes/run_scenarios.sh
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ "$#" -ne 2 ]; then
|
||||||
|
echo "Missing arguments! Please provide number of parallel processes and number of iterations."
|
||||||
|
echo "Usage: '$0 4 10'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
re='^[0-9]+$'
|
||||||
|
if ! [[ $1 =~ $re ]] ; then
|
||||||
|
echo "$1 is not an integer! Please provide number of parallel processes."
|
||||||
|
echo "Usage: '$0 4 10'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [[ $2 =~ $re ]] ; then
|
||||||
|
echo "$1 is not an integer! Please provide number of iterations."
|
||||||
|
echo "Usage: '$0 4 10'"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
script_root_path="$(dirname "$(readlink -f "$0")")"
|
||||||
|
root_out_folder=${script_root_path}/output
|
||||||
|
num_of_processes=$1
|
||||||
|
iterationNumber=$2
|
||||||
|
process_counter=0
|
||||||
|
|
||||||
|
date=$(date '+%d-%m-%Y_%H-%M')
|
||||||
|
simulation_out_folder=${root_out_folder}/${date}
|
||||||
|
mkdir -p $simulation_out_folder
|
||||||
|
|
||||||
|
simulations=$(cat ${script_root_path}/simulation.list)
|
||||||
|
|
||||||
|
rm -rf ${script_root_path}/tmp_runner*
|
||||||
|
|
||||||
|
for sim_args in $simulations
|
||||||
|
do
|
||||||
|
scenario_name=$(echo $sim_args | cut -d ';' -f1)
|
||||||
|
edge_devices_file=$(echo $sim_args | cut -d ';' -f2)
|
||||||
|
applications_file=$(echo $sim_args | cut -d ';' -f3)
|
||||||
|
for (( i=1; i<=$iterationNumber; i++ ))
|
||||||
|
do
|
||||||
|
process_id=$(($process_counter % $num_of_processes))
|
||||||
|
process_counter=$(($process_counter + 1))
|
||||||
|
|
||||||
|
echo "${script_root_path}/runner.sh $simulation_out_folder $scenario_name $edge_devices_file $applications_file ${i}" >> "${simulation_out_folder}/tmp_runner${process_id}.sh"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
#num_of_cores=$(grep -c ^processor /proc/cpuinfo)
|
||||||
|
|
||||||
|
for (( i=0; i<$num_of_processes; i++ ))
|
||||||
|
do
|
||||||
|
chmod +x ${simulation_out_folder}/tmp_runner${i}.sh
|
||||||
|
${simulation_out_folder}/tmp_runner${i}.sh &
|
||||||
|
|
||||||
|
# pid=$!
|
||||||
|
# cpu=$(($i % $num_of_cores))
|
||||||
|
# taskset -cp $cpu,$cpu $pid
|
||||||
|
done
|
18
scripts/birbnetes/runner.sh
Normal file
18
scripts/birbnetes/runner.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
script_root_path="$(dirname "$(readlink -f "$0")")"
|
||||||
|
simulation_out_folder=$1
|
||||||
|
scenario_name=$2
|
||||||
|
edge_devices_file=$3
|
||||||
|
applications_file=$4
|
||||||
|
iteration_number=$5
|
||||||
|
|
||||||
|
scenario_out_folder=${simulation_out_folder}/${scenario_name}/ite${iteration_number}
|
||||||
|
scenario_conf_file=${script_root_path}/config/${scenario_name}.properties
|
||||||
|
scenario_edge_devices_file=${script_root_path}/config/${edge_devices_file}
|
||||||
|
scenario_applications_file=${script_root_path}/config/${applications_file}
|
||||||
|
|
||||||
|
mkdir -p $scenario_out_folder
|
||||||
|
java -classpath '../../bin:../../lib/cloudsim-4.0.jar:../../lib/commons-math3-3.6.1.jar:../../lib/colt.jar' edu.boun.edgecloudsim.applications.birbnetes.MainApp $scenario_conf_file $scenario_edge_devices_file $scenario_applications_file $scenario_out_folder $iteration_number > ${scenario_out_folder}.log
|
||||||
|
tar -czf ${scenario_out_folder}.tar.gz -C $simulation_out_folder/${scenario_name} ite${iteration_number}
|
||||||
|
rm -rf $scenario_out_folder
|
1
scripts/birbnetes/simulation.list
Normal file
1
scripts/birbnetes/simulation.list
Normal file
@ -0,0 +1 @@
|
|||||||
|
default_config;edge_devices.xml;applications.xml
|
@ -0,0 +1,75 @@
|
|||||||
|
package edu.boun.edgecloudsim.applications.birbnetes;
|
||||||
|
|
||||||
|
import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
|
||||||
|
import edu.boun.edgecloudsim.cloud_server.DefaultCloudServerManager;
|
||||||
|
import edu.boun.edgecloudsim.edge_client.DefaultMobileDeviceManager;
|
||||||
|
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
|
||||||
|
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.DefaultMobileServerManager;
|
||||||
|
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
|
||||||
|
import edu.boun.edgecloudsim.edge_orchestrator.BasicEdgeOrchestrator;
|
||||||
|
import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
|
||||||
|
import edu.boun.edgecloudsim.edge_server.DefaultEdgeServerManager;
|
||||||
|
import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
|
||||||
|
import edu.boun.edgecloudsim.mobility.MobilityModel;
|
||||||
|
import edu.boun.edgecloudsim.mobility.StationaryMobility;
|
||||||
|
import edu.boun.edgecloudsim.network.MM1Queue;
|
||||||
|
import edu.boun.edgecloudsim.network.NetworkModel;
|
||||||
|
import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
|
||||||
|
import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
|
||||||
|
|
||||||
|
public class BirbnetesScenarioFactory implements edu.boun.edgecloudsim.core.ScenarioFactory {
|
||||||
|
private int numOfMobileDevice;
|
||||||
|
private double simulationTime;
|
||||||
|
private String orchestratorPolicy;
|
||||||
|
private String simScenario;
|
||||||
|
|
||||||
|
BirbnetesScenarioFactory(int _numOfMobileDevice,
|
||||||
|
double _simulationTime,
|
||||||
|
String _orchestratorPolicy,
|
||||||
|
String _simScenario){
|
||||||
|
orchestratorPolicy = _orchestratorPolicy;
|
||||||
|
numOfMobileDevice = _numOfMobileDevice;
|
||||||
|
simulationTime = _simulationTime;
|
||||||
|
simScenario = _simScenario;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadGeneratorModel getLoadGeneratorModel() {
|
||||||
|
return new IdleActiveLoadGenerator(numOfMobileDevice, simulationTime, simScenario);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdgeOrchestrator getEdgeOrchestrator() {
|
||||||
|
return new BasicEdgeOrchestrator(orchestratorPolicy, simScenario);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MobilityModel getMobilityModel() {
|
||||||
|
return new StationaryMobility(numOfMobileDevice,simulationTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NetworkModel getNetworkModel() {
|
||||||
|
return new MM1Queue(numOfMobileDevice, simScenario);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EdgeServerManager getEdgeServerManager() {
|
||||||
|
return new DefaultEdgeServerManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CloudServerManager getCloudServerManager() {
|
||||||
|
return new DefaultCloudServerManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MobileDeviceManager getMobileDeviceManager() throws Exception {
|
||||||
|
return new DefaultMobileDeviceManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MobileServerManager getMobileServerManager() {
|
||||||
|
return new DefaultMobileServerManager();
|
||||||
|
}
|
||||||
|
}
|
121
src/edu/boun/edgecloudsim/applications/birbnetes/MainApp.java
Normal file
121
src/edu/boun/edgecloudsim/applications/birbnetes/MainApp.java
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
package edu.boun.edgecloudsim.applications.birbnetes;
|
||||||
|
|
||||||
|
import edu.boun.edgecloudsim.core.ScenarioFactory;
|
||||||
|
import edu.boun.edgecloudsim.core.SimManager;
|
||||||
|
import edu.boun.edgecloudsim.core.SimSettings;
|
||||||
|
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||||
|
import edu.boun.edgecloudsim.utils.SimUtils;
|
||||||
|
import org.cloudbus.cloudsim.Log;
|
||||||
|
import org.cloudbus.cloudsim.core.CloudSim;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class MainApp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates main() to run this example
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//disable console output of cloudsim library
|
||||||
|
Log.disable();
|
||||||
|
|
||||||
|
//enable console output and file output of this application
|
||||||
|
SimLogger.enablePrintLog();
|
||||||
|
|
||||||
|
int iterationNumber = 1;
|
||||||
|
String configFile = "";
|
||||||
|
String outputFolder = "";
|
||||||
|
String edgeDevicesFile = "";
|
||||||
|
String applicationsFile = "";
|
||||||
|
if (args.length == 5){
|
||||||
|
configFile = args[0];
|
||||||
|
edgeDevicesFile = args[1];
|
||||||
|
applicationsFile = args[2];
|
||||||
|
outputFolder = args[3];
|
||||||
|
iterationNumber = Integer.parseInt(args[4]);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
SimLogger.printLine("Simulation setting file, output folder and iteration number are not provided! Using default ones...");
|
||||||
|
configFile = "scripts/birbnetes/config/default_config.properties";
|
||||||
|
applicationsFile = "scripts/birbnetes/config/applications.xml";
|
||||||
|
edgeDevicesFile = "scripts/birbnetes/config/edge_devices.xml";
|
||||||
|
outputFolder = "sim_results/ite" + iterationNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
//load settings from configuration file
|
||||||
|
SimSettings SS = SimSettings.getInstance();
|
||||||
|
if(SS.initialize(configFile, edgeDevicesFile, applicationsFile) == false){
|
||||||
|
SimLogger.printLine("cannot initialize simulation settings!");
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(SS.getFileLoggingEnabled()){
|
||||||
|
SimLogger.enableFileLog();
|
||||||
|
SimUtils.cleanOutputFolder(outputFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
DateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
Date SimulationStartDate = Calendar.getInstance().getTime();
|
||||||
|
String now = df.format(SimulationStartDate);
|
||||||
|
SimLogger.printLine("Simulation started at " + now);
|
||||||
|
SimLogger.printLine("----------------------------------------------------------------------");
|
||||||
|
|
||||||
|
for(int j=SS.getMinNumOfMobileDev(); j<=SS.getMaxNumOfMobileDev(); j+=SS.getMobileDevCounterSize())
|
||||||
|
{
|
||||||
|
for(int k=0; k<SS.getSimulationScenarios().length; k++)
|
||||||
|
{
|
||||||
|
for(int i=0; i<SS.getOrchestratorPolicies().length; i++)
|
||||||
|
{
|
||||||
|
String simScenario = SS.getSimulationScenarios()[k];
|
||||||
|
String orchestratorPolicy = SS.getOrchestratorPolicies()[i];
|
||||||
|
Date ScenarioStartDate = Calendar.getInstance().getTime();
|
||||||
|
now = df.format(ScenarioStartDate);
|
||||||
|
|
||||||
|
SimLogger.printLine("Scenario started at " + now);
|
||||||
|
SimLogger.printLine("Scenario: " + simScenario + " - Policy: " + orchestratorPolicy + " - #iteration: " + iterationNumber);
|
||||||
|
SimLogger.printLine("Duration: " + SS.getSimulationTime()/3600 + " hour(s) - Poisson: " + SS.getTaskLookUpTable()[0][2] + " - #devices: " + j);
|
||||||
|
SimLogger.getInstance().simStarted(outputFolder,"SIMRESULT_" + simScenario + "_" + orchestratorPolicy + "_" + j + "DEVICES");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// First step: Initialize the CloudSim package. It should be called
|
||||||
|
// before creating any entities.
|
||||||
|
int num_user = 2; // number of grid users
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
boolean trace_flag = false; // mean trace events
|
||||||
|
|
||||||
|
// Initialize the CloudSim library
|
||||||
|
CloudSim.init(num_user, calendar, trace_flag, 0.01);
|
||||||
|
|
||||||
|
// Generate EdgeCloudsim Scenario Factory
|
||||||
|
ScenarioFactory sampleFactory = new BirbnetesScenarioFactory(j,SS.getSimulationTime(), orchestratorPolicy, simScenario);
|
||||||
|
|
||||||
|
// Generate EdgeCloudSim Simulation Manager
|
||||||
|
SimManager manager = new SimManager(sampleFactory, j, simScenario, orchestratorPolicy);
|
||||||
|
|
||||||
|
// Start simulation
|
||||||
|
manager.startSimulation();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
SimLogger.printLine("The simulation has been terminated due to an unexpected error");
|
||||||
|
e.printStackTrace();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Date ScenarioEndDate = Calendar.getInstance().getTime();
|
||||||
|
now = df.format(ScenarioEndDate);
|
||||||
|
SimLogger.printLine("Scenario finished at " + now + ". It took " + SimUtils.getTimeDifference(ScenarioStartDate,ScenarioEndDate));
|
||||||
|
SimLogger.printLine("----------------------------------------------------------------------");
|
||||||
|
}//End of orchestrators loop
|
||||||
|
}//End of scenarios loop
|
||||||
|
}//End of mobile devices loop
|
||||||
|
|
||||||
|
Date SimulationEndDate = Calendar.getInstance().getTime();
|
||||||
|
now = df.format(SimulationEndDate);
|
||||||
|
SimLogger.printLine("Simulation finished at " + now + ". It took " + SimUtils.getTimeDifference(SimulationStartDate,SimulationEndDate));
|
||||||
|
}
|
||||||
|
}
|
110
src/edu/boun/edgecloudsim/mobility/StationaryMobility.java
Normal file
110
src/edu/boun/edgecloudsim/mobility/StationaryMobility.java
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
package edu.boun.edgecloudsim.mobility;
|
||||||
|
|
||||||
|
import edu.boun.edgecloudsim.core.SimSettings;
|
||||||
|
import edu.boun.edgecloudsim.utils.Location;
|
||||||
|
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||||
|
import edu.boun.edgecloudsim.utils.SimUtils;
|
||||||
|
import org.apache.commons.math3.distribution.ExponentialDistribution;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.w3c.dom.Element;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
public class StationaryMobility extends MobilityModel {
|
||||||
|
private List<TreeMap<Double, Location>> treeMapArray;
|
||||||
|
|
||||||
|
public StationaryMobility(int _numberOfMobileDevices, double _simulationTime) {
|
||||||
|
super(_numberOfMobileDevices, _simulationTime);
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialize() {
|
||||||
|
treeMapArray = new ArrayList<TreeMap<Double, Location>>();
|
||||||
|
|
||||||
|
ExponentialDistribution[] expRngList = new ExponentialDistribution[SimSettings.getInstance().getNumOfEdgeDatacenters()];
|
||||||
|
|
||||||
|
//create random number generator for each place
|
||||||
|
Document doc = SimSettings.getInstance().getEdgeDevicesDocument();
|
||||||
|
NodeList datacenterList = doc.getElementsByTagName("datacenter");
|
||||||
|
for (int i = 0; i < datacenterList.getLength(); i++) {
|
||||||
|
Node datacenterNode = datacenterList.item(i);
|
||||||
|
Element datacenterElement = (Element) datacenterNode;
|
||||||
|
Element location = (Element)datacenterElement.getElementsByTagName("location").item(0);
|
||||||
|
String attractiveness = location.getElementsByTagName("attractiveness").item(0).getTextContent();
|
||||||
|
int placeTypeIndex = Integer.parseInt(attractiveness);
|
||||||
|
|
||||||
|
expRngList[i] = new ExponentialDistribution(SimSettings.getInstance().getMobilityLookUpTable()[placeTypeIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//initialize tree maps and position of mobile devices
|
||||||
|
for(int i=0; i<numberOfMobileDevices; i++) {
|
||||||
|
treeMapArray.add(i, new TreeMap<Double, Location>());
|
||||||
|
|
||||||
|
int randDatacenterId = SimUtils.getRandomNumber(0, SimSettings.getInstance().getNumOfEdgeDatacenters()-1);
|
||||||
|
Node datacenterNode = datacenterList.item(randDatacenterId);
|
||||||
|
Element datacenterElement = (Element) datacenterNode;
|
||||||
|
Element location = (Element)datacenterElement.getElementsByTagName("location").item(0);
|
||||||
|
String attractiveness = location.getElementsByTagName("attractiveness").item(0).getTextContent();
|
||||||
|
int placeTypeIndex = Integer.parseInt(attractiveness);
|
||||||
|
int wlan_id = Integer.parseInt(location.getElementsByTagName("wlan_id").item(0).getTextContent());
|
||||||
|
int x_pos = Integer.parseInt(location.getElementsByTagName("x_pos").item(0).getTextContent());
|
||||||
|
int y_pos = Integer.parseInt(location.getElementsByTagName("y_pos").item(0).getTextContent());
|
||||||
|
|
||||||
|
//start locating user shortly after the simulation started (e.g. 10 seconds)
|
||||||
|
treeMapArray.get(i).put(SimSettings.CLIENT_ACTIVITY_START_TIME, new Location(placeTypeIndex, wlan_id, x_pos, y_pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i=0; i<numberOfMobileDevices; i++) {
|
||||||
|
TreeMap<Double, Location> treeMap = treeMapArray.get(i);
|
||||||
|
|
||||||
|
while(treeMap.lastKey() < SimSettings.getInstance().getSimulationTime()) {
|
||||||
|
boolean placeFound = false;
|
||||||
|
int currentLocationId = treeMap.lastEntry().getValue().getServingWlanId();
|
||||||
|
double waitingTime = expRngList[currentLocationId].sample();
|
||||||
|
|
||||||
|
while(placeFound == false){
|
||||||
|
int newDatacenterId = SimUtils.getRandomNumber(0, SimSettings.getInstance().getNumOfEdgeDatacenters()-1);
|
||||||
|
if(newDatacenterId != currentLocationId){
|
||||||
|
placeFound = true;
|
||||||
|
Node datacenterNode = datacenterList.item(newDatacenterId);
|
||||||
|
Element datacenterElement = (Element) datacenterNode;
|
||||||
|
Element location = (Element)datacenterElement.getElementsByTagName("location").item(0);
|
||||||
|
String attractiveness = location.getElementsByTagName("attractiveness").item(0).getTextContent();
|
||||||
|
int placeTypeIndex = Integer.parseInt(attractiveness);
|
||||||
|
int wlan_id = Integer.parseInt(location.getElementsByTagName("wlan_id").item(0).getTextContent());
|
||||||
|
int x_pos = Integer.parseInt(location.getElementsByTagName("x_pos").item(0).getTextContent());
|
||||||
|
int y_pos = Integer.parseInt(location.getElementsByTagName("y_pos").item(0).getTextContent());
|
||||||
|
|
||||||
|
treeMap.put(treeMap.lastKey()+waitingTime, new Location(placeTypeIndex, wlan_id, x_pos, y_pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!placeFound){
|
||||||
|
SimLogger.printLine("impossible is occurred! location cannot be assigned to the device!");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Location getLocation(int deviceId, double time) {
|
||||||
|
TreeMap<Double, Location> treeMap = treeMapArray.get(deviceId);
|
||||||
|
|
||||||
|
Map.Entry<Double, Location> e = treeMap.floorEntry(0.0);
|
||||||
|
|
||||||
|
if(e == null){
|
||||||
|
SimLogger.printLine("impossible is occurred! no location is found for the device '" + deviceId + "' at " + time);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user