The mobile processing unit support is added to EdgeCloudSim

This commit is contained in:
Cagatay Sonmez 2018-11-26 02:06:05 -07:00
commit 31e534cdba
40 changed files with 3177 additions and 90 deletions

View File

@ -12,16 +12,16 @@ function [] = plotTaskFailureReason()
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(5, 4, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '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', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(5, 6, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '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', 'for_failed');
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
end

View File

@ -12,22 +12,22 @@ function [] = plotTaskFailureReason()
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(5, 4, 'Failed Tasks due to WLAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 4, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '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', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to WLAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(5, 5, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 5, {'Failed Tasks due to MAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(5, 6, 'Failed Tasks due to MAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to MAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(5, 6, 'Failed Tasks due to WAN failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 6, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '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', 'for_failed');
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(5, 7, {'Failed Tasks due to WAN failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
end

4
scripts/sample_app3/compile.sh Executable file
View 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/sample_app3/MainApp.java -d ../../bin

View File

@ -0,0 +1,59 @@
<?xml version="1.0"?>
<applications>
<application name="AUGMENTED_REALITY">
<usage_percentage>30</usage_percentage>
<prob_cloud_selection>20</prob_cloud_selection>
<poisson_interarrival>2</poisson_interarrival>
<active_period>40</active_period>
<idle_period>20</idle_period>
<data_upload>1500</data_upload>
<data_download>250</data_download>
<task_length>12000</task_length>
<required_core>1</required_core>
<vm_utilization_on_edge>8</vm_utilization_on_edge>
<vm_utilization_on_cloud>0.8</vm_utilization_on_cloud>
<vm_utilization_on_mobile>20</vm_utilization_on_mobile>
</application>
<application name="HEALTH_APP">
<usage_percentage>20</usage_percentage>
<prob_cloud_selection>20</prob_cloud_selection>
<poisson_interarrival>3</poisson_interarrival>
<active_period>45</active_period>
<idle_period>90</idle_period>
<data_upload>200</data_upload>
<data_download>1250</data_download>
<task_length>6000</task_length>
<required_core>1</required_core>
<vm_utilization_on_edge>4</vm_utilization_on_edge>
<vm_utilization_on_cloud>0.4</vm_utilization_on_cloud>
<vm_utilization_on_mobile>10</vm_utilization_on_mobile>
</application>
<application name="HEAVY_COMP_APP">
<usage_percentage>20</usage_percentage>
<prob_cloud_selection>40</prob_cloud_selection>
<poisson_interarrival>20</poisson_interarrival>
<active_period>60</active_period>
<idle_period>120</idle_period>
<data_upload>2500</data_upload>
<data_download>200</data_download>
<task_length>30000</task_length>
<required_core>1</required_core>
<vm_utilization_on_edge>20</vm_utilization_on_edge>
<vm_utilization_on_cloud>2</vm_utilization_on_cloud>
<vm_utilization_on_mobile>50</vm_utilization_on_mobile>
</application>
<application name="INFOTAINMENT_APP">
<usage_percentage>30</usage_percentage>
<prob_cloud_selection>10</prob_cloud_selection>
<poisson_interarrival>7</poisson_interarrival>
<active_period>30</active_period>
<idle_period>45</idle_period>
<data_upload>250</data_upload>
<data_download>1000</data_download>
<task_length>15000</task_length>
<required_core>1</required_core>
<vm_utilization_on_edge>10</vm_utilization_on_edge>
<vm_utilization_on_cloud>1</vm_utilization_on_cloud>
<vm_utilization_on_mobile>25</vm_utilization_on_mobile>
</application>
</applications>

View File

@ -0,0 +1,43 @@
#default config file
simulation_time=33
warm_up_period=3
vm_load_check_interval=0.1
vm_location_check_interval=0.1
file_log_enabled=true
deep_file_log_enabled=false
min_number_of_mobile_devices=200
max_number_of_mobile_devices=2000
mobile_device_counter_size=200
wan_propogation_delay=0.1
lan_internal_delay=0.005
wlan_bandwidth=0
wan_bandwidth=0
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=100000
ram_for_cloud_vm=32000
storage_for_cloud_vm=1000000
#each mobile device has one host which serves one VM
#all the host runs on a single datacenter due to the out of memory (oom) issue
core_for_mobile_vm=1
mips_for_mobile_vm=4000
ram_for_mobile_vm=2000
storage_for_mobile_vm=32000
#use ',' for multiple values
orchestrator_policies=ONLY_EDGE,ONLY_MOBILE,HYBRID
#use ',' for multiple values
simulation_scenarios=MOBILE_PROCESSING_SCENARIO
#mean waiting time in seconds
attractiveness_L1_mean_waiting_time=480
attractiveness_L2_mean_waiting_time=300
attractiveness_L3_mean_waiting_time=120

View File

@ -0,0 +1,983 @@
<?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>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>3</x_pos>
<y_pos>3</y_pos>
<wlan_id>2</wlan_id>
<attractiveness>1</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>4</x_pos>
<y_pos>4</y_pos>
<wlan_id>3</wlan_id>
<attractiveness>1</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>5</x_pos>
<y_pos>5</y_pos>
<wlan_id>4</wlan_id>
<attractiveness>1</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>6</x_pos>
<y_pos>6</y_pos>
<wlan_id>5</wlan_id>
<attractiveness>1</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>7</x_pos>
<y_pos>7</y_pos>
<wlan_id>6</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>8</x_pos>
<y_pos>8</y_pos>
<wlan_id>7</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>9</x_pos>
<y_pos>9</y_pos>
<wlan_id>8</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>10</x_pos>
<y_pos>10</y_pos>
<wlan_id>9</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>11</x_pos>
<y_pos>11</y_pos>
<wlan_id>10</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>12</x_pos>
<y_pos>12</y_pos>
<wlan_id>11</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>13</x_pos>
<y_pos>13</y_pos>
<wlan_id>12</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</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>14</x_pos>
<y_pos>14</y_pos>
<wlan_id>13</wlan_id>
<attractiveness>2</attractiveness>
</location>
<hosts>
<host>
<core>16</core>
<mips>80000</mips>
<ram>16000</ram>
<storage>400000</storage>
<VMs>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
<VM vmm="Xen">
<core>2</core>
<mips>10000</mips>
<ram>2000</ram>
<storage>50000</storage>
</VM>
</VMs>
</host>
</hosts>
</datacenter>
</edge_devices>

View 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 = 10; %Number of iterations
elseif(argType == 3)
ret_val = 200; %min number of mobile device
elseif(argType == 4)
ret_val = 200; %step size of mobile device count
elseif(argType == 5)
ret_val =2000; %max number of mobile device
elseif(argType == 6)
ret_val = 1; %xTickLabelCoefficient
elseif(argType == 7)
ret_val = {'ONLY_EDGE','ONLY_MOBILE','HYBRID'};
elseif(argType == 8)
ret_val = {'only edge','only mobile','hybrid'};
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

View 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(4, 2, 'Failed Tasks on Mobile (%)', 'ALL_APPS', 'percentage_for_all');
plotGenericResult(4, 2, {'Failed Tasks on Mobile for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
plotGenericResult(4, 2, 'Failed Tasks on Mobile for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
plotGenericResult(4, 2, 'Failed Tasks on Mobile for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
plotGenericResult(4, 2, 'Failed Tasks on Mobile for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
end

View File

@ -0,0 +1,14 @@
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', '');
end

View 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(4, 6, 'Processing Time on Mobile (sec)', 'ALL_APPS', '');
plotGenericResult(4, 6, {'Processing Time on Mobile';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
plotGenericResult(4, 6, {'Processing Time on Mobile';'for Health App (sec)'}, 'HEALTH_APP', '');
plotGenericResult(4, 6, {'Processing Time on Mobile';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
plotGenericResult(4, 6, {'Processing Time on Mobile';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
end

View 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(4, 5, 'Service Time on Mobile (sec)', 'ALL_APPS', '');
plotGenericResult(4, 5, {'Service Time on Mobile';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
plotGenericResult(4, 5, 'Service Time on Mobile for Health App (sec)', 'HEALTH_APP', '');
plotGenericResult(4, 5, {'Service Time on Mobile';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
plotGenericResult(4, 5, {'Service Time on Mobile';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
end

View File

@ -0,0 +1,14 @@
function [] = plotAvgVmUtilization()
plotGenericResult(2, 8, 'Average VM Utilization of Edge (%)', 'ALL_APPS', '');
plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', '');
plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Health App (%)'}, 'HEALTH_APP', '');
plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', '');
plotGenericResult(2, 8, {'Average VM Utilization of Edge';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '');
plotGenericResult(4, 8, 'Average VM Utilization of Mobile(%)', 'ALL_APPS', '');
plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', '');
plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Health App (%)'}, 'HEALTH_APP', '');
plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', '');
plotGenericResult(4, 8, {'Average VM Utilization of Mobile';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', '');
end

View 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_MOBILE_PROCESSING_SCENARIO_',char(scenarioType(i)),'_',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

View File

@ -0,0 +1,20 @@
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', 'for_failed');
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 10, {'Failed Task due to VM Capacity';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', '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', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 11, {'Failed Task due to Mobility';'for Heavy Computation App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
plotGenericResult(1, 4, 'Failed Tasks due to Network failure (%)', 'ALL_APPS', 'percentage_for_failed');
plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
plotGenericResult(1, 4, {'Failed Tasks due to Network failure';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
end

View 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/sample_app3/runner.sh Executable file
View 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.sample_app3.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

View File

@ -0,0 +1 @@
default_config;edge_devices.xml;applications.xml

View File

@ -19,6 +19,8 @@ import edu.boun.edgecloudsim.edge_server.DefaultEdgeServerManager;
import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
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.mobility.MobilityModel;
import edu.boun.edgecloudsim.mobility.NomadicMobility;
import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
@ -71,8 +73,14 @@ public class SampleScenarioFactory implements ScenarioFactory {
public CloudServerManager getCloudServerManager() {
return new DefaultCloudServerManager();
}
@Override
public MobileDeviceManager getMobileDeviceManager() throws Exception {
return new DefaultMobileDeviceManager();
}
@Override
public MobileServerManager getMobileServerManager() {
return new DefaultMobileServerManager();
}
}

View File

@ -17,6 +17,8 @@ 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.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.mobility.MobilityModel;
import edu.boun.edgecloudsim.mobility.NomadicMobility;
import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
@ -73,4 +75,9 @@ public class SampleScenarioFactory implements ScenarioFactory {
public MobileDeviceManager getMobileDeviceManager() throws Exception {
return new SampleMobileDeviceManager();
}
@Override
public MobileServerManager getMobileServerManager() {
return new DefaultMobileServerManager();
}
}

View File

@ -0,0 +1,131 @@
/*
* Title: EdgeCloudSim - Main Application
*
* Description: Main application for Sample App3
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app3;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.core.CloudSim;
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;
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 ourput 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/sample_app3/config/default_config.properties";
applicationsFile = "scripts/sample_app3/config/applications.xml";
edgeDevicesFile = "scripts/sample_app3/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()/60 + " min (warm up period: "+ SS.getWarmUpPeriod()/60 +" min) - #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 SampleScenarioFactory(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));
}
}

View File

@ -0,0 +1,125 @@
/*
* Title: EdgeCloudSim - Edge Orchestrator
*
* Description:
* SampleEdgeOrchestrator offloads tasks to proper server
* In this scenario mobile devices can also execute tasks
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app3;
import java.util.List;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.SimEvent;
import edu.boun.edgecloudsim.core.SimManager;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
import edu.boun.edgecloudsim.edge_server.EdgeVM;
import edu.boun.edgecloudsim.edge_client.CpuUtilizationModel_Custom;
import edu.boun.edgecloudsim.edge_client.Task;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileVM;
import edu.boun.edgecloudsim.utils.SimLogger;
public class SampleEdgeOrchestrator extends EdgeOrchestrator {
private int numberOfHost; //used by load balancer
public SampleEdgeOrchestrator(String _policy, String _simScenario) {
super(_policy, _simScenario);
}
@Override
public void initialize() {
numberOfHost=SimSettings.getInstance().getNumOfEdgeHosts();
}
/*
* (non-Javadoc)
* @see edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator#getDeviceToOffload(edu.boun.edgecloudsim.edge_client.Task)
*
*/
@Override
public int getDeviceToOffload(Task task) {
int result = 0;
if(policy.equals("ONLY_EDGE")){
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
}
else if(policy.equals("ONLY_MOBILE")){
result = SimSettings.MOBILE_DATACENTER_ID;
}
else if(policy.equals("HYBRID")){
List<MobileVM> vmArray = SimManager.getInstance().getMobileServerManager().getVmList(task.getMobileDeviceId());
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(0).getVmType());
double targetVmCapacity = (double) 100 - vmArray.get(0).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
if (requiredCapacity <= targetVmCapacity)
result = SimSettings.MOBILE_DATACENTER_ID;
else
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
}
else {
SimLogger.printLine("Unknow edge orchestrator policy! Terminating simulation...");
System.exit(0);
}
return result;
}
@Override
public Vm getVmToOffload(Task task, int deviceId) {
Vm selectedVM = null;
if (deviceId == SimSettings.MOBILE_DATACENTER_ID) {
List<MobileVM> vmArray = SimManager.getInstance().getMobileServerManager().getVmList(task.getMobileDeviceId());
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(0).getVmType());
double targetVmCapacity = (double) 100 - vmArray.get(0).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
if (requiredCapacity <= targetVmCapacity)
selectedVM = vmArray.get(0);
}
else if(deviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
//Select VM on edge devices via Least Loaded algorithm!
double selectedVmCapacity = 0; //start with min value
for(int hostIndex=0; hostIndex<numberOfHost; hostIndex++){
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(hostIndex);
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
double requiredCapacity = ((CpuUtilizationModel_Custom)task.getUtilizationModelCpu()).predictUtilization(vmArray.get(vmIndex).getVmType());
double targetVmCapacity = (double)100 - vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
if(requiredCapacity <= targetVmCapacity && targetVmCapacity > selectedVmCapacity){
selectedVM = vmArray.get(vmIndex);
selectedVmCapacity = targetVmCapacity;
}
}
}
}
else{
SimLogger.printLine("Unknown device id! The simulation has been terminated.");
System.exit(0);
}
return selectedVM;
}
@Override
public void processEvent(SimEvent arg0) {
// Nothing to do!
}
@Override
public void shutdownEntity() {
// Nothing to do!
}
@Override
public void startEntity() {
// Nothing to do!
}
}

View File

@ -0,0 +1,299 @@
/*
* Title: EdgeCloudSim - Mobile Device Manager
*
* Description:
* Mobile Device Manager is one of the most important component
* in EdgeCloudSim. It is responsible for creating the tasks,
* submitting them to the related VM with respect to the
* Edge Orchestrator decision, and takes proper actions when
* the execution of the tasks are finished. It also feeds the
* SimLogger with the relevant results.
* SampleMobileDeviceManager sends tasks to the edge servers or
* mobile device processing unit.
*
* If you want to use different topology, you should modify
* the flow implemented in this class.
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app3;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.core.CloudSimTags;
import org.cloudbus.cloudsim.core.SimEvent;
import edu.boun.edgecloudsim.core.SimManager;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.core.SimSettings.NETWORK_DELAY_TYPES;
import edu.boun.edgecloudsim.core.SimSettings.VM_TYPES;
import edu.boun.edgecloudsim.edge_client.CpuUtilizationModel_Custom;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
import edu.boun.edgecloudsim.edge_client.Task;
import edu.boun.edgecloudsim.network.NetworkModel;
import edu.boun.edgecloudsim.utils.EdgeTask;
import edu.boun.edgecloudsim.utils.Location;
import edu.boun.edgecloudsim.utils.SimLogger;
public class SampleMobileDeviceManager extends MobileDeviceManager {
private static final int BASE = 100000; //start from base in order not to conflict cloudsim tag!
private static final int REQUEST_RECEIVED_BY_EDGE_DEVICE = BASE + 1;
private static final int REQUEST_RECEIVED_BY_MOBILE_DEVICE = BASE + 2;
private static final int RESPONSE_RECEIVED_BY_MOBILE_DEVICE = BASE + 3;
private int taskIdCounter=0;
public SampleMobileDeviceManager() throws Exception{
}
@Override
public void initialize() {
}
@Override
public UtilizationModel getCpuUtilizationModel() {
return new CpuUtilizationModel_Custom();
}
@Override
public void startEntity() {
super.startEntity();
}
/**
* Submit cloudlets to the created VMs.
*
* @pre $none
* @post $none
*/
protected void submitCloudlets() {
//do nothing!
}
/**
* Process a cloudlet return event.
*
* @param ev a SimEvent object
* @pre ev != $null
* @post $none
*/
protected void processCloudletReturn(SimEvent ev) {
NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
Task task = (Task) ev.getData();
SimLogger.getInstance().taskExecuted(task.getCloudletId());
if(task.getAssociatedDatacenterId() == SimSettings.GENERIC_EDGE_DEVICE_ID){
double delay = networkModel.getDownloadDelay(task.getAssociatedDatacenterId(), task.getMobileDeviceId(), task);
if(delay > 0)
{
Location currentLocation = SimManager.getInstance().getMobilityModel().getLocation(task.getMobileDeviceId(),CloudSim.clock()+delay);
if(task.getSubmittedLocation().getServingWlanId() == currentLocation.getServingWlanId())
{
networkModel.downloadStarted(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
SimLogger.getInstance().setDownloadDelay(task.getCloudletId(), delay, NETWORK_DELAY_TYPES.WLAN_DELAY);
schedule(getId(), delay, RESPONSE_RECEIVED_BY_MOBILE_DEVICE, task);
}
else
{
SimLogger.getInstance().failedDueToMobility(task.getCloudletId(), CloudSim.clock());
}
}
else
{
SimLogger.getInstance().failedDueToBandwidth(task.getCloudletId(), CloudSim.clock(), NETWORK_DELAY_TYPES.WLAN_DELAY);
}
}
else if(task.getAssociatedDatacenterId() == SimSettings.MOBILE_DATACENTER_ID) {
SimLogger.getInstance().taskEnded(task.getCloudletId(), CloudSim.clock());
/*
* TODO: In this scenario device to device (D2D) communication is ignored.
* If you want to consider D2D communication, you should transmit the result
* of the task to the sender mobile device. Hence, you should calculate
* D2D_DELAY here and send the following event:
*
* schedule(getId(), delay, RESPONSE_RECEIVED_BY_MOBILE_DEVICE, task);
*
* Please not that you should deal with the mobility and D2D delay calculation.
* The task can be failed due to the network bandwidth or the nobility.
*/
}
else {
SimLogger.printLine("Unknown datacenter id! Terminating simulation...");
System.exit(0);
}
}
protected void processOtherEvent(SimEvent ev) {
if (ev == null) {
SimLogger.printLine(getName() + ".processOtherEvent(): " + "Error - an event is null! Terminating simulation...");
System.exit(0);
return;
}
NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
switch (ev.getTag()) {
case REQUEST_RECEIVED_BY_MOBILE_DEVICE:
{
Task task = (Task) ev.getData();
submitTaskToVm(task, SimSettings.VM_TYPES.MOBILE_VM);
break;
}
case REQUEST_RECEIVED_BY_EDGE_DEVICE:
{
Task task = (Task) ev.getData();
networkModel.uploadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
submitTaskToVm(task, SimSettings.VM_TYPES.EDGE_VM);
break;
}
case RESPONSE_RECEIVED_BY_MOBILE_DEVICE:
{
Task task = (Task) ev.getData();
networkModel.downloadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
SimLogger.getInstance().taskEnded(task.getCloudletId(), CloudSim.clock());
break;
}
default:
SimLogger.printLine(getName() + ".processOtherEvent(): " + "Error - event unknown by this DatacenterBroker. Terminating simulation...");
System.exit(0);
break;
}
}
public void submitTask(EdgeTask edgeTask) {
double delay = 0;
int nextEvent = 0;
int nextDeviceForNetworkModel = 0;
VM_TYPES vmType = null;
NETWORK_DELAY_TYPES delayType = null;
NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
//create a task
Task task = createTask(edgeTask);
Location currentLocation = SimManager.getInstance().getMobilityModel().
getLocation(task.getMobileDeviceId(), CloudSim.clock());
//set location of the mobile device which generates this task
task.setSubmittedLocation(currentLocation);
//add related task to log list
SimLogger.getInstance().addLog(task.getCloudletId(),
task.getTaskType(),
(int)task.getCloudletLength(),
(int)task.getCloudletFileSize(),
(int)task.getCloudletOutputSize());
int nextHopId = SimManager.getInstance().getEdgeOrchestrator().getDeviceToOffload(task);
if(nextHopId == SimSettings.GENERIC_EDGE_DEVICE_ID){
delay = networkModel.getUploadDelay(task.getMobileDeviceId(), nextHopId, task);
vmType = SimSettings.VM_TYPES.EDGE_VM;
nextEvent = REQUEST_RECEIVED_BY_EDGE_DEVICE;
delayType = NETWORK_DELAY_TYPES.WLAN_DELAY;
nextDeviceForNetworkModel = SimSettings.GENERIC_EDGE_DEVICE_ID;
}
else if(nextHopId == SimSettings.MOBILE_DATACENTER_ID){
vmType = VM_TYPES.MOBILE_VM;
nextEvent = REQUEST_RECEIVED_BY_MOBILE_DEVICE;
/*
* TODO: In this scenario device to device (D2D) communication is ignored.
* If you want to consider D2D communication, you should calculate D2D
* network delay here.
*
* You should also add D2D_DELAY to the following enum in SimSettings
* public static enum NETWORK_DELAY_TYPES { WLAN_DELAY, MAN_DELAY, WAN_DELAY }
*
* If you want to get statistics of the D2D networking, you should modify
* SimLogger in a way to consider D2D_DELAY statistics.
*/
}
else {
SimLogger.printLine("Unknown nextHopId! Terminating simulation...");
System.exit(0);
}
if(delay>0 || nextHopId == SimSettings.MOBILE_DATACENTER_ID){
Vm selectedVM = SimManager.getInstance().getEdgeOrchestrator().getVmToOffload(task, nextHopId);
if(selectedVM != null){
//set related host id
task.setAssociatedDatacenterId(nextHopId);
//set related host id
task.setAssociatedHostId(selectedVM.getHost().getId());
//set related vm id
task.setAssociatedVmId(selectedVM.getId());
//bind task to related VM
getCloudletList().add(task);
bindCloudletToVm(task.getCloudletId(), selectedVM.getId());
SimLogger.getInstance().taskStarted(task.getCloudletId(), CloudSim.clock());
if(nextHopId != SimSettings.MOBILE_DATACENTER_ID) {
networkModel.uploadStarted(task.getSubmittedLocation(), nextDeviceForNetworkModel);
SimLogger.getInstance().setUploadDelay(task.getCloudletId(), delay, delayType);
}
schedule(getId(), delay, nextEvent, task);
}
else{
//SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
SimLogger.getInstance().rejectedDueToVMCapacity(task.getCloudletId(), CloudSim.clock(), vmType.ordinal());
}
}
else
{
//SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock(), vmType.ordinal(), delayType);
}
}
private void submitTaskToVm(Task task, SimSettings.VM_TYPES vmType) {
//SimLogger.printLine(CloudSim.clock() + ": Cloudlet#" + task.getCloudletId() + " is submitted to VM#" + task.getVmId());
schedule(getVmsToDatacentersMap().get(task.getVmId()), 0, CloudSimTags.CLOUDLET_SUBMIT, task);
SimLogger.getInstance().taskAssigned(task.getCloudletId(),
task.getAssociatedDatacenterId(),
task.getAssociatedHostId(),
task.getAssociatedVmId(),
vmType.ordinal());
}
private Task createTask(EdgeTask edgeTask){
UtilizationModel utilizationModel = new UtilizationModelFull(); /*UtilizationModelStochastic*/
UtilizationModel utilizationModelCPU = getCpuUtilizationModel();
Task task = new Task(edgeTask.mobileDeviceId, ++taskIdCounter,
edgeTask.length, edgeTask.pesNumber,
edgeTask.inputFileSize, edgeTask.outputFileSize,
utilizationModelCPU, utilizationModel, utilizationModel);
//set the owner of this task
task.setUserId(this.getId());
task.setTaskType(edgeTask.taskType);
if (utilizationModelCPU instanceof CpuUtilizationModel_Custom) {
((CpuUtilizationModel_Custom)utilizationModelCPU).setTask(task);
}
return task;
}
}

View File

@ -0,0 +1,184 @@
/*
* Title: EdgeCloudSim - Mobile Server Manager
*
* Description:
* VehicularDefaultMobileServerManager is responsible for creating
* mobile datacenters, hosts and VMs.
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app3;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.Storage;
import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.VmSchedulerSpaceShared;
import org.cloudbus.cloudsim.core.CloudSim;
import org.cloudbus.cloudsim.provisioners.BwProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.PeProvisionerSimple;
import org.cloudbus.cloudsim.provisioners.RamProvisionerSimple;
import edu.boun.edgecloudsim.core.SimManager;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileHost;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileVM;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileVmAllocationPolicy_Custom;
public class SampleMobileServerManager extends MobileServerManager{
private int numOfMobileDevices=0;
public SampleMobileServerManager(int _numOfMobileDevices) {
numOfMobileDevices=_numOfMobileDevices;
}
@Override
public void initialize() {
}
@Override
public VmAllocationPolicy getVmAllocationPolicy(List<? extends Host> list, int dataCenterIndex) {
return new MobileVmAllocationPolicy_Custom(list, dataCenterIndex);
}
@Override
public void startDatacenters() throws Exception {
//in the initial version, each mobile device has a separate datacenter
//however, this approach encounters with out of memory (oom) problem.
//therefore, we use single datacenter for all mobile devices!
localDatacenter = createDatacenter(SimSettings.MOBILE_DATACENTER_ID);
}
@Override
public void terminateDatacenters() {
localDatacenter.shutdownEntity();
}
@Override
public void createVmList(int brockerId) {
//VMs should have unique IDs, so create Mobile VMs after Edge+Cloud VMs
int vmCounter=SimSettings.getInstance().getNumOfEdgeVMs() + SimSettings.getInstance().getNumOfCloudVMs();
//Create VMs for each hosts
//Note that each mobile device has one host with one VM!
for (int i = 0; i < numOfMobileDevices; i++) {
vmList.add(i, new ArrayList<MobileVM>());
String vmm = "Xen";
int numOfCores = SimSettings.getInstance().getCoreForMobileVM();
double mips = SimSettings.getInstance().getMipsForMobileVM();
int ram = SimSettings.getInstance().getRamForMobileVM();
long storage = SimSettings.getInstance().getStorageForMobileVM();
long bandwidth = 0;
//VM Parameters
MobileVM vm = new MobileVM(vmCounter, brockerId, mips, numOfCores, ram, bandwidth, storage, vmm, new CloudletSchedulerTimeShared());
vmList.get(i).add(vm);
vmCounter++;
}
}
@Override
public double getAvgUtilization() {
double totalUtilization = 0;
double vmCounter = 0;
List<? extends Host> list = localDatacenter.getHostList();
// for each host...
for (int hostIndex=0; hostIndex < list.size(); hostIndex++) {
List<MobileVM> vmArray = SimManager.getInstance().getMobileServerManager().getVmList(hostIndex);
//for each vm...
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
totalUtilization += vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
vmCounter++;
}
}
return totalUtilization / vmCounter;
}
private Datacenter createDatacenter(int index) throws Exception{
String arch = "x86";
String os = "Linux";
String vmm = "Xen";
double costPerBw = 0;
double costPerSec = 0;
double costPerMem = 0;
double costPerStorage = 0;
List<MobileHost> hostList=createHosts();
String name = "MobileDatacenter_" + Integer.toString(index);
double time_zone = 3.0; // time zone this resource located
LinkedList<Storage> storageList = new LinkedList<Storage>(); //we are not adding SAN devices by now
// 5. Create a DatacenterCharacteristics object that stores the
// properties of a data center: architecture, OS, list of
// Machines, allocation policy: time- or space-shared, time zone
// and its price (G$/Pe time unit).
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, costPerSec, costPerMem, costPerStorage, costPerBw);
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
VmAllocationPolicy vm_policy = getVmAllocationPolicy(hostList,index);
datacenter = new Datacenter(name, characteristics, vm_policy, storageList, 0);
return datacenter;
}
private List<MobileHost> createHosts(){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store one or more Machines
List<MobileHost> hostList = new ArrayList<MobileHost>();
for (int i = 0; i < numOfMobileDevices; i++) {
int numOfCores = SimSettings.getInstance().getCoreForMobileVM();
double mips = SimSettings.getInstance().getMipsForMobileVM();
int ram = SimSettings.getInstance().getRamForMobileVM();
long storage = SimSettings.getInstance().getStorageForMobileVM();
long bandwidth = 0;
// 2. A Machine contains one or more PEs or CPUs/Cores. Therefore, should
// create a list to store these PEs before creating
// a Machine.
List<Pe> peList = new ArrayList<Pe>();
// 3. Create PEs and add these into the list.
//for a quad-core machine, a list of 4 PEs is required:
for(int j=0; j<numOfCores; j++){
peList.add(new Pe(j, new PeProvisionerSimple(mips))); // need to store Pe id and MIPS Rating
}
//4. Create Hosts with its id and list of PEs and add them to the list of machines
MobileHost host = new MobileHost(
//Hosts should have unique IDs, so create Mobile Hosts after Edge+Cloud Hosts
i+SimSettings.getInstance().getNumOfEdgeHosts()+SimSettings.getInstance().getNumOfCoudHost(),
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bandwidth), //kbps
storage,
peList,
new VmSchedulerSpaceShared(peList)
);
host.setMobileDeviceId(i);
hostList.add(host);
}
return hostList;
}
}

View File

@ -0,0 +1,243 @@
/*
* Title: EdgeCloudSim - Network Model
*
* Description:
* SampleNetworkModel uses
* the result of an empirical study for the WLAN delay
* The experimental network model is developed
* by taking measurements from the real life deployments.
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app3;
import org.cloudbus.cloudsim.core.CloudSim;
import edu.boun.edgecloudsim.core.SimManager;
import edu.boun.edgecloudsim.core.SimSettings;
import edu.boun.edgecloudsim.edge_client.Task;
import edu.boun.edgecloudsim.network.NetworkModel;
import edu.boun.edgecloudsim.utils.Location;
import edu.boun.edgecloudsim.utils.SimLogger;
public class SampleNetworkModel extends NetworkModel {
private int[] wlanClients;
public static final double[] experimentalWlanDelay = {
/*1 Client*/ 88040.279 /*(Kbps)*/,
/*2 Clients*/ 45150.982 /*(Kbps)*/,
/*3 Clients*/ 30303.641 /*(Kbps)*/,
/*4 Clients*/ 27617.211 /*(Kbps)*/,
/*5 Clients*/ 24868.616 /*(Kbps)*/,
/*6 Clients*/ 22242.296 /*(Kbps)*/,
/*7 Clients*/ 20524.064 /*(Kbps)*/,
/*8 Clients*/ 18744.889 /*(Kbps)*/,
/*9 Clients*/ 17058.827 /*(Kbps)*/,
/*10 Clients*/ 15690.455 /*(Kbps)*/,
/*11 Clients*/ 14127.744 /*(Kbps)*/,
/*12 Clients*/ 13522.408 /*(Kbps)*/,
/*13 Clients*/ 13177.631 /*(Kbps)*/,
/*14 Clients*/ 12811.330 /*(Kbps)*/,
/*15 Clients*/ 12584.387 /*(Kbps)*/,
/*15 Clients*/ 12135.161 /*(Kbps)*/,
/*16 Clients*/ 11705.638 /*(Kbps)*/,
/*17 Clients*/ 11276.116 /*(Kbps)*/,
/*18 Clients*/ 10846.594 /*(Kbps)*/,
/*19 Clients*/ 10417.071 /*(Kbps)*/,
/*20 Clients*/ 9987.549 /*(Kbps)*/,
/*21 Clients*/ 9367.587 /*(Kbps)*/,
/*22 Clients*/ 8747.625 /*(Kbps)*/,
/*23 Clients*/ 8127.663 /*(Kbps)*/,
/*24 Clients*/ 7907.701 /*(Kbps)*/,
/*25 Clients*/ 7887.739 /*(Kbps)*/,
/*26 Clients*/ 7690.831 /*(Kbps)*/,
/*27 Clients*/ 7393.922 /*(Kbps)*/,
/*28 Clients*/ 7297.014 /*(Kbps)*/,
/*29 Clients*/ 7100.106 /*(Kbps)*/,
/*30 Clients*/ 6903.197 /*(Kbps)*/,
/*31 Clients*/ 6701.986 /*(Kbps)*/,
/*32 Clients*/ 6500.776 /*(Kbps)*/,
/*33 Clients*/ 6399.565 /*(Kbps)*/,
/*34 Clients*/ 6098.354 /*(Kbps)*/,
/*35 Clients*/ 5897.143 /*(Kbps)*/,
/*36 Clients*/ 5552.127 /*(Kbps)*/,
/*37 Clients*/ 5207.111 /*(Kbps)*/,
/*38 Clients*/ 4862.096 /*(Kbps)*/,
/*39 Clients*/ 4517.080 /*(Kbps)*/,
/*40 Clients*/ 4172.064 /*(Kbps)*/,
/*41 Clients*/ 4092.922 /*(Kbps)*/,
/*42 Clients*/ 4013.781 /*(Kbps)*/,
/*43 Clients*/ 3934.639 /*(Kbps)*/,
/*44 Clients*/ 3855.498 /*(Kbps)*/,
/*45 Clients*/ 3776.356 /*(Kbps)*/,
/*46 Clients*/ 3697.215 /*(Kbps)*/,
/*47 Clients*/ 3618.073 /*(Kbps)*/,
/*48 Clients*/ 3538.932 /*(Kbps)*/,
/*49 Clients*/ 3459.790 /*(Kbps)*/,
/*50 Clients*/ 3380.649 /*(Kbps)*/,
/*51 Clients*/ 3274.611 /*(Kbps)*/,
/*52 Clients*/ 3168.573 /*(Kbps)*/,
/*53 Clients*/ 3062.536 /*(Kbps)*/,
/*54 Clients*/ 2956.498 /*(Kbps)*/,
/*55 Clients*/ 2850.461 /*(Kbps)*/,
/*56 Clients*/ 2744.423 /*(Kbps)*/,
/*57 Clients*/ 2638.386 /*(Kbps)*/,
/*58 Clients*/ 2532.348 /*(Kbps)*/,
/*59 Clients*/ 2426.310 /*(Kbps)*/,
/*60 Clients*/ 2320.273 /*(Kbps)*/,
/*61 Clients*/ 2283.828 /*(Kbps)*/,
/*62 Clients*/ 2247.383 /*(Kbps)*/,
/*63 Clients*/ 2210.939 /*(Kbps)*/,
/*64 Clients*/ 2174.494 /*(Kbps)*/,
/*65 Clients*/ 2138.049 /*(Kbps)*/,
/*66 Clients*/ 2101.604 /*(Kbps)*/,
/*67 Clients*/ 2065.160 /*(Kbps)*/,
/*68 Clients*/ 2028.715 /*(Kbps)*/,
/*69 Clients*/ 1992.270 /*(Kbps)*/,
/*70 Clients*/ 1955.825 /*(Kbps)*/,
/*71 Clients*/ 1946.788 /*(Kbps)*/,
/*72 Clients*/ 1937.751 /*(Kbps)*/,
/*73 Clients*/ 1928.714 /*(Kbps)*/,
/*74 Clients*/ 1919.677 /*(Kbps)*/,
/*75 Clients*/ 1910.640 /*(Kbps)*/,
/*76 Clients*/ 1901.603 /*(Kbps)*/,
/*77 Clients*/ 1892.566 /*(Kbps)*/,
/*78 Clients*/ 1883.529 /*(Kbps)*/,
/*79 Clients*/ 1874.492 /*(Kbps)*/,
/*80 Clients*/ 1865.455 /*(Kbps)*/,
/*81 Clients*/ 1833.185 /*(Kbps)*/,
/*82 Clients*/ 1800.915 /*(Kbps)*/,
/*83 Clients*/ 1768.645 /*(Kbps)*/,
/*84 Clients*/ 1736.375 /*(Kbps)*/,
/*85 Clients*/ 1704.106 /*(Kbps)*/,
/*86 Clients*/ 1671.836 /*(Kbps)*/,
/*87 Clients*/ 1639.566 /*(Kbps)*/,
/*88 Clients*/ 1607.296 /*(Kbps)*/,
/*89 Clients*/ 1575.026 /*(Kbps)*/,
/*90 Clients*/ 1542.756 /*(Kbps)*/,
/*91 Clients*/ 1538.544 /*(Kbps)*/,
/*92 Clients*/ 1534.331 /*(Kbps)*/,
/*93 Clients*/ 1530.119 /*(Kbps)*/,
/*94 Clients*/ 1525.906 /*(Kbps)*/,
/*95 Clients*/ 1521.694 /*(Kbps)*/,
/*96 Clients*/ 1517.481 /*(Kbps)*/,
/*97 Clients*/ 1513.269 /*(Kbps)*/,
/*98 Clients*/ 1509.056 /*(Kbps)*/,
/*99 Clients*/ 1504.844 /*(Kbps)*/,
/*100 Clients*/ 1500.631 /*(Kbps)*/
};
public SampleNetworkModel(int _numberOfMobileDevices, String _simScenario) {
super(_numberOfMobileDevices, _simScenario);
}
@Override
public void initialize() {
wlanClients = new int[SimSettings.getInstance().getNumOfEdgeDatacenters()]; //we have one access point for each datacenter
}
/**
* source device is always mobile device in our simulation scenarios!
*/
@Override
public double getUploadDelay(int sourceDeviceId, int destDeviceId, Task task) {
double delay = 0;
//mobile device to edge device (wifi access point)
if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
delay = getWlanUploadDelay(task.getSubmittedLocation(), task.getCloudletFileSize());
}
else {
SimLogger.printLine("Error - unknown device id in getUploadDelay(). Terminating simulation...");
System.exit(0);
}
return delay;
}
/**
* destination device is always mobile device in our simulation scenarios!
*/
@Override
public double getDownloadDelay(int sourceDeviceId, int destDeviceId, Task task) {
double delay = 0;
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(destDeviceId,CloudSim.clock());
//edge device (wifi access point) to mobile device
if (sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
delay = getWlanDownloadDelay(accessPointLocation, task.getCloudletOutputSize());
}
else {
SimLogger.printLine("Error - unknown device id in getDownloadDelay(). Terminating simulation...");
System.exit(0);
}
return delay;
}
@Override
public void uploadStarted(Location accessPointLocation, int destDeviceId) {
if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
wlanClients[accessPointLocation.getServingWlanId()]++;
}
else {
SimLogger.printLine("Error - unknown device id in uploadStarted(). Terminating simulation...");
System.exit(0);
}
}
@Override
public void uploadFinished(Location accessPointLocation, int destDeviceId) {
if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
wlanClients[accessPointLocation.getServingWlanId()]--;
}
else {
SimLogger.printLine("Error - unknown device id in uploadFinished(). Terminating simulation...");
System.exit(0);
}
}
@Override
public void downloadStarted(Location accessPointLocation, int sourceDeviceId) {
if(sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
wlanClients[accessPointLocation.getServingWlanId()]++;
}
else {
SimLogger.printLine("Error - unknown device id in downloadStarted(). Terminating simulation...");
System.exit(0);
}
}
@Override
public void downloadFinished(Location accessPointLocation, int sourceDeviceId) {
if(sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
wlanClients[accessPointLocation.getServingWlanId()]--;
}
else {
SimLogger.printLine("Error - unknown device id in downloadFinished(). Terminating simulation...");
System.exit(0);
}
}
private double getWlanDownloadDelay(Location accessPointLocation, double dataSize) {
int numOfWlanUser = wlanClients[accessPointLocation.getServingWlanId()];
double taskSizeInKb = dataSize * (double)8; //KB to Kb
double result=0;
if(numOfWlanUser < 0)
System.out.println("--> ");
if(numOfWlanUser < experimentalWlanDelay.length)
result = taskSizeInKb /*Kb*/ / (experimentalWlanDelay[numOfWlanUser] * (double) 3 ) /*Kbps*/; //802.11ac is around 3 times faster than 802.11n
//System.out.println("--> " + numOfWlanUser + " user, " + taskSizeInKb + " KB, " +result + " sec");
return result;
}
//wlan upload and download delay is symmetric in this model
private double getWlanUploadDelay(Location accessPointLocation, double dataSize) {
return getWlanDownloadDelay(accessPointLocation, dataSize);
}
}

View File

@ -0,0 +1,82 @@
/*
* Title: EdgeCloudSim - Scenario Factory
*
* Description: Sample scenario factory providing the default
* instances of required abstract classes
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.applications.sample_app3;
import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
import edu.boun.edgecloudsim.cloud_server.DefaultCloudServerManager;
import edu.boun.edgecloudsim.core.ScenarioFactory;
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.edge_client.MobileDeviceManager;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
import edu.boun.edgecloudsim.mobility.NomadicMobility;
import edu.boun.edgecloudsim.task_generator.IdleActiveLoadGenerator;
import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
import edu.boun.edgecloudsim.network.NetworkModel;
public class SampleScenarioFactory implements ScenarioFactory {
private int numOfMobileDevice;
private double simulationTime;
private String orchestratorPolicy;
private String simScenario;
SampleScenarioFactory(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 SampleEdgeOrchestrator(orchestratorPolicy, simScenario);
}
@Override
public MobilityModel getMobilityModel() {
return new NomadicMobility(numOfMobileDevice,simulationTime);
}
@Override
public NetworkModel getNetworkModel() {
return new SampleNetworkModel(numOfMobileDevice, simScenario);
}
@Override
public EdgeServerManager getEdgeServerManager() {
return new DefaultEdgeServerManager();
}
@Override
public CloudServerManager getCloudServerManager() {
return new DefaultCloudServerManager();
}
@Override
public MobileDeviceManager getMobileDeviceManager() throws Exception {
return new SampleMobileDeviceManager();
}
@Override
public MobileServerManager getMobileServerManager() {
return new SampleMobileServerManager(numOfMobileDevice);
}
}

View File

@ -1,3 +1,19 @@
/*
* Title: EdgeCloudSim - CloudServerManager
*
* Description:
* CloudServerManager is responsible for creating and terminating
* the cloud datacenters which operates the hosts and VMs.
* It also provides the list of VMs running on the hosts and
* the average utilization of all VMs.
*
* Please note that, EdgeCloudSim is built on top of CloudSim
* Therefore, all the computational units are handled by CloudSim
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.cloud_server;
import java.util.ArrayList;

View File

@ -3,9 +3,9 @@
*
* Description:
* VmAllocationPolicy_Custom implements VmAllocationPolicy to decide which.
* VM is created on which host locatied on the datacenters. For those
* VM is created on which host located on the datacenters. For those
* who wants to add another Vm Allocation Policy to EdgeCloudSim should
* provide another concreate instance of VmAllocationPolicy via ScenarioFactory
* provide another concrete instance of VmAllocationPolicy via ScenarioFactory
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey

View File

@ -15,6 +15,7 @@ package edu.boun.edgecloudsim.core;
import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator;
import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
@ -52,6 +53,11 @@ public interface ScenarioFactory {
*/
public CloudServerManager getCloudServerManager();
/**
* provides abstract Mobile Server Model
*/
public MobileServerManager getMobileServerManager();
/**
* provides abstract Mobile Device Manager Model
*/

View File

@ -26,6 +26,7 @@ import edu.boun.edgecloudsim.edge_server.EdgeServerManager;
import edu.boun.edgecloudsim.edge_server.EdgeVmAllocationPolicy_Custom;
import edu.boun.edgecloudsim.cloud_server.CloudServerManager;
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerManager;
import edu.boun.edgecloudsim.mobility.MobilityModel;
import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
import edu.boun.edgecloudsim.network.NetworkModel;
@ -48,6 +49,7 @@ public class SimManager extends SimEntity {
private EdgeOrchestrator edgeOrchestrator;
private EdgeServerManager edgeServerManager;
private CloudServerManager cloudServerManager;
private MobileServerManager mobileServerManager;
private LoadGeneratorModel loadGeneratorModel;
private MobileDeviceManager mobileDeviceManager;
@ -85,6 +87,10 @@ public class SimManager extends SimEntity {
//Create Physical Servers on cloud
cloudServerManager = scenarioFactory.getCloudServerManager();
cloudServerManager.initialize();
//Create Physical Servers on mobile devices
mobileServerManager = scenarioFactory.getMobileServerManager();
mobileServerManager.initialize();
//Create Client Manager
mobileDeviceManager = scenarioFactory.getMobileDeviceManager();
@ -111,7 +117,11 @@ public class SimManager extends SimEntity {
//Start Edge Datacenters & Generate VMs
cloudServerManager.startDatacenters();
cloudServerManager.createVmList(mobileDeviceManager.getId());
//Start Mobile Datacenters & Generate VMs
mobileServerManager.startDatacenters();
mobileServerManager.createVmList(mobileDeviceManager.getId());
CloudSim.startSimulation();
}
@ -151,6 +161,10 @@ public class SimManager extends SimEntity {
return cloudServerManager;
}
public MobileServerManager getMobileServerManager(){
return mobileServerManager;
}
public LoadGeneratorModel getLoadGeneratorModel(){
return loadGeneratorModel;
}
@ -175,6 +189,11 @@ public class SimManager extends SimEntity {
mobileDeviceManager.submitVmList(cloudServerManager.getVmList(i));
}
for(int i=0; i<numOfMobileDevice; i++){
if(mobileServerManager.getVmList(i) != null)
mobileDeviceManager.submitVmList(mobileServerManager.getVmList(i));
}
//Creation of tasks are scheduled here!
for(int i=0; i< loadGeneratorModel.getTaskList().size(); i++)
schedule(getId(), loadGeneratorModel.getTaskList().get(i).startTime, CREATE_TASK, loadGeneratorModel.getTaskList().get(i));
@ -212,7 +231,8 @@ public class SimManager extends SimEntity {
SimLogger.getInstance().addVmUtilizationLog(
CloudSim.clock(),
edgeServerManager.getAvgUtilization(),
cloudServerManager.getAvgUtilization());
cloudServerManager.getAvgUtilization(),
mobileServerManager.getAvgUtilization());
schedule(getId(), SimSettings.getInstance().getVmLoadLogInterval(), GET_LOAD_LOG);
break;
@ -247,5 +267,6 @@ public class SimManager extends SimEntity {
public void shutdownEntity() {
edgeServerManager.terminateDatacenters();
cloudServerManager.terminateDatacenters();
mobileServerManager.terminateDatacenters();
}
}

View File

@ -36,15 +36,16 @@ public class SimSettings {
public static final double CLIENT_ACTIVITY_START_TIME = 10;
//enumarations for the VM types
public static enum VM_TYPES { EDGE_VM, CLOUD_VM }
public static enum VM_TYPES { MOBILE_VM, EDGE_VM, CLOUD_VM }
//enumarations for the VM types
public static enum NETWORK_DELAY_TYPES { WLAN_DELAY, MAN_DELAY, WAN_DELAY }
//predifined IDs for the components.
public static final int CLOUD_DATACENTER_ID = 1000;
public static final int EDGE_ORCHESTRATOR_ID = 1001;
public static final int GENERIC_EDGE_DEVICE_ID = 1002;
public static final int MOBILE_DATACENTER_ID = 1001;
public static final int EDGE_ORCHESTRATOR_ID = 1002;
public static final int GENERIC_EDGE_DEVICE_ID = 1003;
//delimiter for output file.
public static final String DELIMITER = ";";
@ -78,6 +79,11 @@ public class SimSettings {
private int RAM_FOR_CLOUD_VM; //MB
private int STORAGE_FOR_CLOUD_VM; //Byte
private int CORE_FOR_VM;
private int MIPS_FOR_VM; //MIPS
private int RAM_FOR_VM; //MB
private int STORAGE_FOR_VM; //Byte
private String[] SIMULATION_SCENARIOS;
private String[] ORCHESTRATOR_POLICIES;
@ -152,6 +158,11 @@ public class SimSettings {
RAM_FOR_CLOUD_VM = Integer.parseInt(prop.getProperty("ram_for_cloud_vm"));
STORAGE_FOR_CLOUD_VM = Integer.parseInt(prop.getProperty("storage_for_cloud_vm"));
RAM_FOR_VM = Integer.parseInt(prop.getProperty("ram_for_mobile_vm"));
CORE_FOR_VM = Integer.parseInt(prop.getProperty("core_for_mobile_vm"));
MIPS_FOR_VM = Integer.parseInt(prop.getProperty("mips_for_mobile_vm"));
STORAGE_FOR_VM = Integer.parseInt(prop.getProperty("storage_for_mobile_vm"));
ORCHESTRATOR_POLICIES = prop.getProperty("orchestrator_policies").split(",");
SIMULATION_SCENARIOS = prop.getProperty("simulation_scenarios").split(",");
@ -395,6 +406,38 @@ public class SimSettings {
{
return STORAGE_FOR_CLOUD_VM;
}
/**
* returns RAM of the mobile (processing unit) VMs
*/
public int getRamForMobileVM()
{
return RAM_FOR_VM;
}
/**
* returns the number of cores for mobile VMs
*/
public int getCoreForMobileVM()
{
return CORE_FOR_VM;
}
/**
* returns MIPS of the mobile (processing unit) VMs
*/
public int getMipsForMobileVM()
{
return MIPS_FOR_VM;
}
/**
* returns Storage of the mobile (processing unit) VMs
*/
public int getStorageForMobileVM()
{
return STORAGE_FOR_VM;
}
/**
* returns simulation screnarios as string
@ -433,8 +476,9 @@ public class SimSettings {
* [6] avg data download (KB)
* [7] avg task length (MI)
* [8] required # of cores
* [9] vm utilization on edge (%)
* [10] vm utilization on cloud (%)
* [9] vm utilization on edge (%)
* [10] vm utilization on cloud (%)
* [11] vm utilization on mobile (%)
*/
public double[][] getTaskLookUpTable()
{
@ -493,6 +537,7 @@ public class SimSettings {
isElementPresent(appElement, "required_core");
isElementPresent(appElement, "vm_utilization_on_edge");
isElementPresent(appElement, "vm_utilization_on_cloud");
isElementPresent(appElement, "vm_utilization_on_mobile");
String taskName = appElement.getAttribute("name");
taskNames[i] = taskName;
@ -508,7 +553,8 @@ public class SimSettings {
double required_core = Double.parseDouble(appElement.getElementsByTagName("required_core").item(0).getTextContent());
double vm_utilization_on_edge = Double.parseDouble(appElement.getElementsByTagName("vm_utilization_on_edge").item(0).getTextContent());
double vm_utilization_on_cloud = Double.parseDouble(appElement.getElementsByTagName("vm_utilization_on_cloud").item(0).getTextContent());
double vm_utilization_on_mobile = Double.parseDouble(appElement.getElementsByTagName("vm_utilization_on_mobile").item(0).getTextContent());
taskLookUpTable[i][0] = usage_percentage; //usage percentage [0-100]
taskLookUpTable[i][1] = prob_cloud_selection; //prob. of selecting cloud [0-100]
taskLookUpTable[i][2] = poisson_interarrival; //poisson mean (sec)
@ -520,6 +566,7 @@ public class SimSettings {
taskLookUpTable[i][8] = required_core; //required # of core
taskLookUpTable[i][9] = vm_utilization_on_edge; //vm utilization on edge vm [0-100]
taskLookUpTable[i][10] = vm_utilization_on_cloud; //vm utilization on cloud vm [0-100]
taskLookUpTable[i][11] = vm_utilization_on_mobile; //vm utilization on mobile vm [0-100]
}
} catch (Exception e) {
@ -595,4 +642,4 @@ public class SimSettings {
System.exit(0);
}
}
}
}

View File

@ -36,6 +36,8 @@ public class CpuUtilizationModel_Custom implements UtilizationModel {
int index = 9;
if(task.getAssociatedDatacenterId() == SimSettings.CLOUD_DATACENTER_ID)
index = 10;
else if(task.getAssociatedDatacenterId() == SimSettings.MOBILE_DATACENTER_ID)
index = 11;
return SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType()][index];
}
@ -50,6 +52,8 @@ public class CpuUtilizationModel_Custom implements UtilizationModel {
index = 9;
else if(_vmType == SimSettings.VM_TYPES.CLOUD_VM)
index = 10;
else if(_vmType == SimSettings.VM_TYPES.MOBILE_VM)
index = 11;
else{
SimLogger.printLine("Unknown VM Type! Terminating simulation...");
System.exit(0);

View File

@ -154,7 +154,7 @@ public class DefaultMobileDeviceManager extends MobileDeviceManager {
if(task.getAssociatedDatacenterId() == SimSettings.CLOUD_DATACENTER_ID)
networkModel.downloadFinished(task.getSubmittedLocation(), SimSettings.CLOUD_DATACENTER_ID);
else
else if(task.getAssociatedDatacenterId() != SimSettings.MOBILE_DATACENTER_ID)
networkModel.downloadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
SimLogger.getInstance().taskEnded(task.getCloudletId(), CloudSim.clock());

View File

@ -0,0 +1,58 @@
/*
* Title: EdgeCloudSim - Mobile Server Manager
*
* Description:
* DefaultMobileServerManager is responsible for creating datacenters, hosts and VMs.
*
* Please note that the mobile processing units are simulated via
* CloudSim. It is assumed that the mobile devices operate Hosts
* and VMs like a server. That is why the class names are similar
* to other Cloud and Edge components (to provide consistency).
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
import java.util.List;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.VmAllocationPolicy;
public class DefaultMobileServerManager extends MobileServerManager{
public DefaultMobileServerManager() {
}
@Override
public void initialize() {
}
@Override
public VmAllocationPolicy getVmAllocationPolicy(List<? extends Host> list, int dataCenterIndex) {
return new MobileVmAllocationPolicy_Custom(list, dataCenterIndex);
}
@Override
public void startDatacenters() throws Exception {
//local computation is not supported in default Mobile Device Manager
}
@Override
public void terminateDatacenters() {
//local computation is not supported in default Mobile Device Manager
}
@Override
public void createVmList(int brockerId) {
//local computation is not supported in default Mobile Device Manager
}
@Override
public double getAvgUtilization() {
//local computation is not supported in default Mobile Device Manager
return 0;
}
}

View File

@ -0,0 +1,43 @@
/*
* Title: EdgeCloudSim - MobileHost
*
* Description:
* MobileHost adds associated mobile device id information over CloudSim's Host class
*
* Please note that the mobile processing units are simulated via
* CloudSim. It is assumed that the mobile devices operate Hosts
* and VMs like a server. That is why the class names are similar
* to other Cloud and Edge components (to provide consistency).
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
import java.util.List;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.VmScheduler;
import org.cloudbus.cloudsim.provisioners.BwProvisioner;
import org.cloudbus.cloudsim.provisioners.RamProvisioner;
public class MobileHost extends Host {
private int mobileDeviceId;
public MobileHost(int id, RamProvisioner ramProvisioner,
BwProvisioner bwProvisioner, long storage,
List<? extends Pe> peList, VmScheduler vmScheduler) {
super(id, ramProvisioner, bwProvisioner, storage, peList, vmScheduler);
}
public void setMobileDeviceId(int _mobileDeviceId){
mobileDeviceId=_mobileDeviceId;
}
public int getMobileDeviceId(){
return mobileDeviceId;
}
}

View File

@ -0,0 +1,78 @@
/*
* Title: EdgeCloudSim - MobileServerManager
*
* Description:
* MobileServerManager is responsible for creating and terminating
* the mobile datacenters which operates the hosts and VMs.
* It also provides the list of VMs running on the hosts and
* the average utilization of all VMs.
*
* Please note that, EdgeCloudSim is built on top of CloudSim
* Therefore, all the computational units are handled by CloudSim
*
* The mobile processing units are simulated via CloudSim as well.
* It is assumed that the mobile devices operate Hosts and VMs
* like a server. That is why the class names are similar to other
* Cloud and Edge components.
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
import java.util.ArrayList;
import java.util.List;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.VmAllocationPolicy;
public abstract class MobileServerManager {
protected Datacenter localDatacenter;
protected List<List<MobileVM>> vmList;
public MobileServerManager() {
vmList = new ArrayList<List<MobileVM>>();
}
public List<MobileVM> getVmList(int hostId){
if(vmList.size() > hostId)
return vmList.get(hostId);
else
return null;
}
public Datacenter getDatacenter(){
return localDatacenter;
}
/*
* initialize edge server manager if needed
*/
public abstract void initialize();
/*
* provides abstract Vm Allocation Policy for Mobile Datacenters
*/
public abstract VmAllocationPolicy getVmAllocationPolicy(List<? extends Host> list, int dataCenterIndex);
/*
* Starts Datacenters
*/
public abstract void startDatacenters() throws Exception;
/*
* Terminates Datacenters
*/
public abstract void terminateDatacenters();
/*
* Creates VM List
*/
public abstract void createVmList(int brockerId);
/*
* returns average utilization of all VMs
*/
public abstract double getAvgUtilization();
}

View File

@ -0,0 +1,36 @@
/*
* Title: EdgeCloudSim - MobileVM
*
* Description:
* MobileVM adds vm type information over CloudSim's VM class
*
* Please note that the mobile processing units are simulated via
* CloudSim. It is assumed that the mobile devices operate Hosts
* and VMs like a server. That is why the class names are similar
* to other Cloud and Edge components (to provide consistency).
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
import org.cloudbus.cloudsim.CloudletScheduler;
import org.cloudbus.cloudsim.Vm;
import edu.boun.edgecloudsim.core.SimSettings;
public class MobileVM extends Vm {
private SimSettings.VM_TYPES type;
public MobileVM(int id, int userId, double mips, int numberOfPes, int ram,
long bw, long size, String vmm, CloudletScheduler cloudletScheduler) {
super(id, userId, mips, numberOfPes, ram, bw, size, vmm, cloudletScheduler);
type = SimSettings.VM_TYPES.MOBILE_VM;
}
public SimSettings.VM_TYPES getVmType(){
return type;
}
}

View File

@ -0,0 +1,132 @@
/*
* Title: EdgeCloudSim - Custom VM Allocation Policy for Mobile Devices' VMs
*
* Description:
* VmAllocationPolicy_Custom implements VmAllocationPolicy to decide which.
* VM is created on which host located on the datacenters. For those
* who wants to add another Vm Allocation Policy to EdgeCloudSim should
* provide another concrete instance of VmAllocationPolicy via ScenarioFactory
*
* Please note that the mobile processing units are simulated via
* CloudSim. It is assumed that the mobile devices operate Hosts
* and VMs like a server. That is why the class names are similar
* to other Cloud and Edge components (to provide consistency).
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_client.mobile_processing_unit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Vm;
import org.cloudbus.cloudsim.VmAllocationPolicy;
import org.cloudbus.cloudsim.core.CloudSim;
import edu.boun.edgecloudsim.core.SimSettings;
/*
* Same as VmAllocationPolicySimple.
*/
public class MobileVmAllocationPolicy_Custom extends VmAllocationPolicy {
/** The vm table. */
private Map<String, Host> vmTable;
private static int createdVmNum;
private int DataCenterIndex;
public MobileVmAllocationPolicy_Custom(List<? extends Host> list, int _DataCenterIndex) {
super(list);
setVmTable(new HashMap<String, Host>());
DataCenterIndex = _DataCenterIndex;
createdVmNum = 0;
}
@Override
public boolean allocateHostForVm(Vm vm) {
boolean result = false;
if (!getVmTable().containsKey(vm.getUid()) && vm instanceof MobileVM) { // if this vm was not created
int hostIndex = vm.getId() - SimSettings.getInstance().getNumOfEdgeVMs() - SimSettings.getInstance().getNumOfCloudVMs();
if(DataCenterIndex == SimSettings.MOBILE_DATACENTER_ID){
Host host = getHostList().get(hostIndex);
result = host.vmCreate(vm);
if (result) { // if vm were succesfully created in the host
getVmTable().put(vm.getUid(), host);
createdVmNum++;
Log.formatLine("%.2f: Mobile VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),CloudSim.clock());
result = true;
}
}
}
return result;
}
@Override
public boolean allocateHostForVm(Vm vm, Host host) {
if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
getVmTable().put(vm.getUid(), host);
createdVmNum++;
Log.formatLine("%.2f: Mobile VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),CloudSim.clock());
return true;
}
return false;
}
@Override
public List<Map<String, Object>> optimizeAllocation(
List<? extends Vm> vmList) {
// TODO Auto-generated method stub
return null;
}
@Override
public void deallocateHostForVm(Vm vm) {
Host host = getVmTable().remove(vm.getUid());
if (host != null) {
host.vmDestroy(vm);
}
}
@Override
public Host getHost(Vm vm) {
return getVmTable().get(vm.getUid());
}
@Override
public Host getHost(int vmId, int userId) {
return getVmTable().get(Vm.getUid(userId, vmId));
}
public static int getCreatedVmNum(){
return createdVmNum;
}
/**
* Gets the vm table.
*
* @return the vm table
*/
public Map<String, Host> getVmTable() {
return vmTable;
}
/**
* Sets the vm table.
*
* @param vmTable the vm table
*/
protected void setVmTable(Map<String, Host> vmTable) {
this.vmTable = vmTable;
}
}

View File

@ -1,3 +1,19 @@
/*
* Title: EdgeCloudSim - EdgeServerManager
*
* Description:
* EdgeServerManager is responsible for creating and terminating
* the edge datacenters which operates the hosts and VMs.
* It also provides the list of VMs running on the hosts and
* the average utilization of all VMs.
*
* Please note that, EdgeCloudSim is built on top of CloudSim
* Therefore, all the computational units are handled by CloudSim
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
*/
package edu.boun.edgecloudsim.edge_server;
import java.util.ArrayList;

View File

@ -3,9 +3,9 @@
*
* Description:
* VmAllocationPolicy_Custom implements VmAllocationPolicy to decide which.
* VM is created on which host locatied on the datacenters. For those
* VM is created on which host located on the datacenters. For those
* who wants to add another Vm Allocation Policy to EdgeCloudSim should
* provide another concreate instance of VmAllocationPolicy via ScenarioFactory
* provide another concrete instance of VmAllocationPolicy via ScenarioFactory
*
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey

View File

@ -144,8 +144,8 @@ public class SimLogger {
taskMap.get(taskId).taskFailedDueToMobility(time);
}
public void addVmUtilizationLog(double time, double loadOnEdge, double loadOnCloud) {
vmLoadList.add(new VmLoadLogItem(time, loadOnEdge, loadOnCloud));
public void addVmUtilizationLog(double time, double loadOnEdge, double loadOnCloud, double loadOnMobile) {
vmLoadList.add(new VmLoadLogItem(time, loadOnEdge, loadOnCloud, loadOnMobile));
}
public void simStopped() throws IOException {
@ -166,32 +166,41 @@ public class SimLogger {
int[] uncompletedTask = new int[numOfAppTypes + 1];
int[] uncompletedTaskOnCloud = new int[numOfAppTypes + 1];
int[] uncompletedTaskOnEdge = new int[numOfAppTypes + 1];
int[] uncompletedTaskOnMobile = new int[numOfAppTypes + 1];
int[] completedTask = new int[numOfAppTypes + 1];
int[] completedTaskOnCloud = new int[numOfAppTypes + 1];
int[] completedTaskOnEdge = new int[numOfAppTypes + 1];
int[] completedTaskOnRemoteEdge = new int[numOfAppTypes + 1];
int[] completedTaskOnMobile = new int[numOfAppTypes + 1];
int[] failedTask = new int[numOfAppTypes + 1];
int[] failedTaskOnCloud = new int[numOfAppTypes + 1];
int[] failedTaskOnEdge = new int[numOfAppTypes + 1];
int[] failedTaskOnMobile = new int[numOfAppTypes + 1];
double[] networkDelay = new double[numOfAppTypes + 1];
double[] wanDelay = new double[numOfAppTypes + 1];
double[] manDelay = new double[numOfAppTypes + 1];
double[] lanDelay = new double[numOfAppTypes + 1];
double[] wanUsage = new double[numOfAppTypes + 1];
double[] manUsage = new double[numOfAppTypes + 1];
double[] lanUsage = new double[numOfAppTypes + 1];
double[] serviceTime = new double[numOfAppTypes + 1];
double[] serviceTimeOnCloud = new double[numOfAppTypes + 1];
double[] serviceTimeOnEdge = new double[numOfAppTypes + 1];
double[] serviceTimeOnMobile = new double[numOfAppTypes + 1];
double[] processingTime = new double[numOfAppTypes + 1];
double[] processingTimeOnCloud = new double[numOfAppTypes + 1];
double[] processingTimeOnEdge = new double[numOfAppTypes + 1];
double[] processingTimeOnMobile = new double[numOfAppTypes + 1];
int[] failedTaskDueToVmCapacity = new int[numOfAppTypes + 1];
int[] failedTaskDueToVmCapacityOnCloud = new int[numOfAppTypes + 1];
int[] failedTaskDueToVmCapacityOnEdge = new int[numOfAppTypes + 1];
int[] failedTaskDueToVmCapacityOnMobile = new int[numOfAppTypes + 1];
double[] cost = new double[numOfAppTypes + 1];
int[] failedTaskDuetoBw = new int[numOfAppTypes + 1];
@ -260,7 +269,9 @@ public class SimLogger {
if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal())
completedTaskOnCloud[value.getTaskType()]++;
else if (value.getVmType() == SimSettings.VM_TYPES.EDGE_VM.ordinal())
else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal())
completedTaskOnMobile[value.getTaskType()]++;
else
completedTaskOnEdge[value.getTaskType()]++;
}
else if(value.getStatus() == SimLogger.TASK_STATUS.CREATED ||
@ -271,7 +282,9 @@ public class SimLogger {
uncompletedTask[value.getTaskType()]++;
if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal())
uncompletedTaskOnCloud[value.getTaskType()]++;
else if (value.getVmType() == SimSettings.VM_TYPES.EDGE_VM.ordinal())
else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal())
uncompletedTaskOnMobile[value.getTaskType()]++;
else
uncompletedTaskOnEdge[value.getTaskType()]++;
}
else {
@ -279,7 +292,9 @@ public class SimLogger {
if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal())
failedTaskOnCloud[value.getTaskType()]++;
else if (value.getVmType() == SimSettings.VM_TYPES.EDGE_VM.ordinal())
else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal())
failedTaskOnMobile[value.getTaskType()]++;
else
failedTaskOnEdge[value.getTaskType()]++;
}
@ -288,18 +303,30 @@ public class SimLogger {
serviceTime[value.getTaskType()] += value.getServiceTime();
networkDelay[value.getTaskType()] += value.getNetworkDelay();
processingTime[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay());
if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) {
wanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY);
serviceTimeOnCloud[value.getTaskType()] += value.getServiceTime();
processingTimeOnCloud[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY));
}
else if (value.getVmType() == SimSettings.VM_TYPES.EDGE_VM.ordinal()) {
if(value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY) != 0){
completedTaskOnRemoteEdge[value.getTaskType()]++;
manDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY);
}
if(value.getNetworkDelay(NETWORK_DELAY_TYPES.WLAN_DELAY) != 0) {
lanUsage[value.getTaskType()]++;
lanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WLAN_DELAY);
}
if(value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY) != 0) {
manUsage[value.getTaskType()]++;
manDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.MAN_DELAY);
}
if(value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY) != 0) {
wanUsage[value.getTaskType()]++;
wanDelay[value.getTaskType()] += value.getNetworkDelay(NETWORK_DELAY_TYPES.WAN_DELAY);
}
if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal()) {
serviceTimeOnCloud[value.getTaskType()] += value.getServiceTime();
processingTimeOnCloud[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay());
}
else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal()) {
serviceTimeOnMobile[value.getTaskType()] += value.getServiceTime();
processingTimeOnMobile[value.getTaskType()] += value.getServiceTime();
}
else {
serviceTimeOnEdge[value.getTaskType()] += value.getServiceTime();
processingTimeOnEdge[value.getTaskType()] += (value.getServiceTime() - value.getNetworkDelay());
}
@ -311,7 +338,9 @@ public class SimLogger {
if (value.getVmType() == SimSettings.VM_TYPES.CLOUD_VM.ordinal())
failedTaskDueToVmCapacityOnCloud[value.getTaskType()]++;
else if (value.getVmType() == SimSettings.VM_TYPES.EDGE_VM.ordinal())
else if (value.getVmType() == SimSettings.VM_TYPES.MOBILE_VM.ordinal())
failedTaskDueToVmCapacityOnMobile[value.getTaskType()]++;
else
failedTaskDueToVmCapacityOnEdge[value.getTaskType()]++;
if (fileLogEnabled && SimSettings.getInstance().getDeepFileLoggingEnabled())
@ -339,32 +368,41 @@ public class SimLogger {
uncompletedTask[numOfAppTypes] = IntStream.of(uncompletedTask).sum();
uncompletedTaskOnCloud[numOfAppTypes] = IntStream.of(uncompletedTaskOnCloud).sum();
uncompletedTaskOnEdge[numOfAppTypes] = IntStream.of(uncompletedTaskOnEdge).sum();
uncompletedTaskOnMobile[numOfAppTypes] = IntStream.of(uncompletedTaskOnMobile).sum();
completedTask[numOfAppTypes] = IntStream.of(completedTask).sum();
completedTaskOnCloud[numOfAppTypes] = IntStream.of(completedTaskOnCloud).sum();
completedTaskOnEdge[numOfAppTypes] = IntStream.of(completedTaskOnEdge).sum();
completedTaskOnRemoteEdge[numOfAppTypes] = IntStream.of(completedTaskOnRemoteEdge).sum();
completedTaskOnMobile[numOfAppTypes] = IntStream.of(completedTaskOnMobile).sum();
failedTask[numOfAppTypes] = IntStream.of(failedTask).sum();
failedTaskOnCloud[numOfAppTypes] = IntStream.of(failedTaskOnCloud).sum();
failedTaskOnEdge[numOfAppTypes] = IntStream.of(failedTaskOnEdge).sum();
failedTaskOnMobile[numOfAppTypes] = IntStream.of(failedTaskOnMobile).sum();
networkDelay[numOfAppTypes] = DoubleStream.of(networkDelay).sum();
lanDelay[numOfAppTypes] = DoubleStream.of(lanDelay).sum();
manDelay[numOfAppTypes] = DoubleStream.of(manDelay).sum();
wanDelay[numOfAppTypes] = DoubleStream.of(wanDelay).sum();
lanUsage[numOfAppTypes] = DoubleStream.of(lanUsage).sum();
manUsage[numOfAppTypes] = DoubleStream.of(manUsage).sum();
wanUsage[numOfAppTypes] = DoubleStream.of(wanUsage).sum();
serviceTime[numOfAppTypes] = DoubleStream.of(serviceTime).sum();
serviceTimeOnCloud[numOfAppTypes] = DoubleStream.of(serviceTimeOnCloud).sum();
serviceTimeOnEdge[numOfAppTypes] = DoubleStream.of(serviceTimeOnEdge).sum();
serviceTimeOnMobile[numOfAppTypes] = DoubleStream.of(serviceTimeOnMobile).sum();
processingTime[numOfAppTypes] = DoubleStream.of(processingTime).sum();
processingTimeOnCloud[numOfAppTypes] = DoubleStream.of(processingTimeOnCloud).sum();
processingTimeOnEdge[numOfAppTypes] = DoubleStream.of(processingTimeOnEdge).sum();
processingTimeOnMobile[numOfAppTypes] = DoubleStream.of(processingTimeOnMobile).sum();
failedTaskDueToVmCapacity[numOfAppTypes] = IntStream.of(failedTaskDueToVmCapacity).sum();
failedTaskDueToVmCapacityOnCloud[numOfAppTypes] = IntStream.of(failedTaskDueToVmCapacityOnCloud).sum();
failedTaskDueToVmCapacityOnEdge[numOfAppTypes] = IntStream.of(failedTaskDueToVmCapacityOnEdge).sum();
failedTaskDueToVmCapacityOnMobile[numOfAppTypes] = IntStream.of(failedTaskDueToVmCapacityOnMobile).sum();
cost[numOfAppTypes] = DoubleStream.of(cost).sum();
failedTaskDuetoBw[numOfAppTypes] = IntStream.of(failedTaskDuetoBw).sum();
@ -376,9 +414,11 @@ public class SimLogger {
// calculate server load
double totalVmLoadOnEdge = 0;
double totalVmLoadOnCloud = 0;
double totalVmLoadOnMobile = 0;
for (VmLoadLogItem entry : vmLoadList) {
totalVmLoadOnEdge += entry.getEdgeLoad();
totalVmLoadOnCloud += entry.getCloudLoad();
totalVmLoadOnMobile += entry.getMobileLoad();
if (fileLogEnabled)
appendToFile(vmLoadBW, entry.toString());
}
@ -419,19 +459,20 @@ public class SimLogger {
// check if the divisor is zero in order to avoid division by
// zero problem
double _serviceTime = (completedTask[i] == 0) ? 0.0 : (serviceTime[i] / (double) completedTask[i]);
double _networkDelay = (completedTask[i] == 0) ? 0.0 : (networkDelay[i] / (double) completedTask[i]);
double _networkDelay = (completedTask[i] == 0) ? 0.0 : (networkDelay[i] / ((double) completedTask[i] - (double)completedTaskOnMobile[i]));
double _processingTime = (completedTask[i] == 0) ? 0.0 : (processingTime[i] / (double) completedTask[i]);
double _vmLoadOnEdge = (vmLoadList.size() == 0) ? 0.0 : (totalVmLoadOnEdge / (double) vmLoadList.size());
double _vmLoadOnClould = (vmLoadList.size() == 0) ? 0.0 : (totalVmLoadOnCloud / (double) vmLoadList.size());
double _vmLoadOnMobile = (vmLoadList.size() == 0) ? 0.0 : (totalVmLoadOnMobile / (double) vmLoadList.size());
double _cost = (completedTask[i] == 0) ? 0.0 : (cost[i] / (double) completedTask[i]);
double _lanDelay = (completedTaskOnEdge[i] == 0) ? 0.0
: (lanDelay[i] / (double) completedTaskOnEdge[i]);
double _manDelay = (completedTaskOnRemoteEdge[i] == 0) ? 0.0
: (manDelay[i] / (double) completedTaskOnRemoteEdge[i]);
double _wanDelay = (completedTaskOnCloud[i] == 0) ? 0.0
: (wanDelay[i] / (double) completedTaskOnCloud[i]);
double _lanDelay = (lanUsage[i] == 0) ? 0.0
: (lanDelay[i] / (double) lanUsage[i]);
double _manDelay = (manUsage[i] == 0) ? 0.0
: (manDelay[i] / (double) manUsage[i]);
double _wanDelay = (wanUsage[i] == 0) ? 0.0
: (wanDelay[i] / (double) wanUsage[i]);
// write generic results
String genericResult1 = Integer.toString(completedTask[i]) + SimSettings.DELIMITER
+ Integer.toString(failedTask[i]) + SimSettings.DELIMITER
@ -474,13 +515,26 @@ public class SimLogger {
+ Double.toString(0.0) + SimSettings.DELIMITER
+ Double.toString(_vmLoadOnClould) + SimSettings.DELIMITER
+ Integer.toString(failedTaskDueToVmCapacityOnCloud[i]);
//for future use
String genericResult4 = "0;0;0;0;0;0;0;0;0";
// check if the divisor is zero in order to avoid division by zero problem
double _serviceTimeOnMobile = (completedTaskOnMobile[i] == 0) ? 0.0
: (serviceTimeOnMobile[i] / (double) completedTaskOnMobile[i]);
double _processingTimeOnMobile = (completedTaskOnMobile[i] == 0) ? 0.0
: (processingTimeOnMobile[i] / (double) completedTaskOnMobile[i]);
String genericResult4 = Integer.toString(completedTaskOnMobile[i]) + SimSettings.DELIMITER
+ Integer.toString(failedTaskOnMobile[i]) + SimSettings.DELIMITER
+ Integer.toString(uncompletedTaskOnMobile[i]) + SimSettings.DELIMITER
+ Integer.toString(0) + SimSettings.DELIMITER
+ Double.toString(_serviceTimeOnMobile) + SimSettings.DELIMITER
+ Double.toString(_processingTimeOnMobile) + SimSettings.DELIMITER
+ Double.toString(0.0) + SimSettings.DELIMITER
+ Double.toString(_vmLoadOnMobile) + SimSettings.DELIMITER
+ Integer.toString(failedTaskDueToVmCapacityOnMobile[i]);
String genericResult5 = Double.toString(_lanDelay) + SimSettings.DELIMITER
+ Double.toString(_manDelay) + SimSettings.DELIMITER
+ Double.toString(_wanDelay) + SimSettings.DELIMITER
+ 0 + SimSettings.DELIMITER //for future use
+ Integer.toString(failedTaskDuetoLanBw[i]) + SimSettings.DELIMITER
+ Integer.toString(failedTaskDuetoManBw[i]) + SimSettings.DELIMITER
+ Integer.toString(failedTaskDuetoWanBw[i]);
@ -511,30 +565,35 @@ public class SimLogger {
}
// printout important results
printLine("# of tasks (Edge/Cloud): "
printLine("# of tasks (Edge/Cloud/Mobile): "
+ (failedTask[numOfAppTypes] + completedTask[numOfAppTypes]) + "("
+ (failedTaskOnEdge[numOfAppTypes] + completedTaskOnEdge[numOfAppTypes]) + "/"
+ (failedTaskOnCloud[numOfAppTypes]+ completedTaskOnCloud[numOfAppTypes]) + ")");
+ (failedTaskOnCloud[numOfAppTypes]+ completedTaskOnCloud[numOfAppTypes]) + "/"
+ (failedTaskOnMobile[numOfAppTypes]+ completedTaskOnMobile[numOfAppTypes]) + ")");
printLine("# of failed tasks (Edge/Cloud): "
printLine("# of failed tasks (Edge/Cloud/Mobile): "
+ failedTask[numOfAppTypes] + "("
+ failedTaskOnEdge[numOfAppTypes] + "/"
+ failedTaskOnCloud[numOfAppTypes] + ")");
+ failedTaskOnCloud[numOfAppTypes] + "/"
+ failedTaskOnMobile[numOfAppTypes] + ")");
printLine("# of completed tasks (Edge/Cloud): "
printLine("# of completed tasks (Edge/Cloud/Mobile): "
+ completedTask[numOfAppTypes] + "("
+ completedTaskOnEdge[numOfAppTypes] + "/"
+ completedTaskOnCloud[numOfAppTypes] + ")");
+ completedTaskOnCloud[numOfAppTypes] + "/"
+ completedTaskOnMobile[numOfAppTypes] + ")");
printLine("# of uncompleted tasks (Edge/Cloud): "
printLine("# of uncompleted tasks (Edge/Cloud/Mobile): "
+ uncompletedTask[numOfAppTypes] + "("
+ uncompletedTaskOnEdge[numOfAppTypes] + "/"
+ uncompletedTaskOnCloud[numOfAppTypes] + ")");
+ uncompletedTaskOnCloud[numOfAppTypes] + "/"
+ uncompletedTaskOnMobile[numOfAppTypes] + ")");
printLine("# of failed tasks due to vm capacity (Edge/Cloud): "
printLine("# of failed tasks due to vm capacity (Edge/Cloud/Mobile): "
+ failedTaskDueToVmCapacity[numOfAppTypes] + "("
+ failedTaskDueToVmCapacityOnEdge[numOfAppTypes] + "/"
+ failedTaskDueToVmCapacityOnCloud[numOfAppTypes] + ")");
+ failedTaskDueToVmCapacityOnCloud[numOfAppTypes] + "/"
+ failedTaskDueToVmCapacityOnMobile[numOfAppTypes] + ")");
printLine("# of failed tasks due to Mobility/Network(WLAN/MAN/WAN): "
+ failedTaskDuetoMobility[numOfAppTypes]
@ -554,6 +613,8 @@ public class SimLogger {
+ String.format("%.6f", serviceTimeOnEdge[numOfAppTypes] / (double) completedTaskOnEdge[numOfAppTypes])
+ ", " + "on Cloud: "
+ String.format("%.6f", serviceTimeOnCloud[numOfAppTypes] / (double) completedTaskOnCloud[numOfAppTypes])
+ ", " + "on Mobile: "
+ String.format("%.6f", serviceTimeOnMobile[numOfAppTypes] / (double) completedTaskOnMobile[numOfAppTypes])
+ ")");
printLine("average processing time: "
@ -562,20 +623,23 @@ public class SimLogger {
+ String.format("%.6f", processingTimeOnEdge[numOfAppTypes] / (double) completedTaskOnEdge[numOfAppTypes])
+ ", " + "on Cloud: "
+ String.format("%.6f", processingTimeOnCloud[numOfAppTypes] / (double) completedTaskOnCloud[numOfAppTypes])
+ ", " + "on Mobile: "
+ String.format("%.6f", processingTimeOnMobile[numOfAppTypes] / (double) completedTaskOnMobile[numOfAppTypes])
+ ")");
printLine("average network delay: "
+ String.format("%.6f", networkDelay[numOfAppTypes] / (double) completedTask[numOfAppTypes])
+ String.format("%.6f", networkDelay[numOfAppTypes] / ((double) completedTask[numOfAppTypes] - (double) completedTaskOnMobile[numOfAppTypes]))
+ " seconds. (" + "LAN delay: "
+ String.format("%.6f", lanDelay[numOfAppTypes] / (double) completedTaskOnEdge[numOfAppTypes])
+ String.format("%.6f", lanDelay[numOfAppTypes] / (double) lanUsage[numOfAppTypes])
+ ", " + "MAN delay: "
+ String.format("%.6f", manDelay[numOfAppTypes] / (double) completedTaskOnRemoteEdge[numOfAppTypes])
+ String.format("%.6f", manDelay[numOfAppTypes] / (double) manUsage[numOfAppTypes])
+ ", " + "WAN delay: "
+ String.format("%.6f", wanDelay[numOfAppTypes] / (double) completedTaskOnCloud[numOfAppTypes]) + ")");
+ String.format("%.6f", wanDelay[numOfAppTypes] / (double) wanUsage[numOfAppTypes]) + ")");
printLine("average server utilization Edge/Cloud: "
printLine("average server utilization Edge/Cloud/Mobile: "
+ String.format("%.6f", totalVmLoadOnEdge / (double) vmLoadList.size()) + "/"
+ String.format("%.6f", totalVmLoadOnCloud / (double) vmLoadList.size()));
+ String.format("%.6f", totalVmLoadOnCloud / (double) vmLoadList.size()) + "/"
+ String.format("%.6f", totalVmLoadOnMobile / (double) vmLoadList.size()));
printLine("average cost: " + cost[numOfAppTypes] / completedTask[numOfAppTypes] + "$");
@ -589,11 +653,13 @@ class VmLoadLogItem {
private double time;
private double vmLoadOnEdge;
private double vmLoadOnCloud;
private double vmLoadOnMobile;
VmLoadLogItem(double _time, double _vmLoadOnEdge, double _vmLoadOnCloud) {
VmLoadLogItem(double _time, double _vmLoadOnEdge, double _vmLoadOnCloud, double _vmLoadOnMobile) {
time = _time;
vmLoadOnEdge = _vmLoadOnEdge;
vmLoadOnCloud = _vmLoadOnCloud;
vmLoadOnMobile = _vmLoadOnMobile;
}
public double getEdgeLoad() {
@ -604,10 +670,15 @@ class VmLoadLogItem {
return vmLoadOnCloud;
}
public double getMobileLoad() {
return vmLoadOnMobile;
}
public String toString() {
return time +
SimSettings.DELIMITER + vmLoadOnEdge +
SimSettings.DELIMITER + vmLoadOnCloud;
SimSettings.DELIMITER + vmLoadOnCloud +
SimSettings.DELIMITER + vmLoadOnMobile;
}
}
@ -828,4 +899,4 @@ class LogItem {
result += "0"; // default failure reason
return result;
}
}
}