Sample application 4 which is used in IEEE TNSM journal paper is published.
Important Notes: * EdgeTask class name is updated as TaskProperty. You may need to modify your existing application's source code if you use EdgeTask class in your application.
This commit is contained in:
parent
6e37b14ba7
commit
9412796b22
BIN
doc/images/sample_app4/env.png
Executable file
BIN
doc/images/sample_app4/env.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 213 KiB |
BIN
doc/images/sample_app4/fls.png
Executable file
BIN
doc/images/sample_app4/fls.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
BIN
lib/jFuzzyLogic_v3.0.jar
Normal file
BIN
lib/jFuzzyLogic_v3.0.jar
Normal file
Binary file not shown.
1
scripts/sample_app1/.gitignore
vendored
Normal file
1
scripts/sample_app1/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
output
|
1
scripts/sample_app2/.gitignore
vendored
Normal file
1
scripts/sample_app2/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
output
|
1
scripts/sample_app3/.gitignore
vendored
Normal file
1
scripts/sample_app3/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
output
|
1
scripts/sample_app4/.gitignore
vendored
Normal file
1
scripts/sample_app4/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
output
|
4
scripts/sample_app4/compile.sh
Executable file
4
scripts/sample_app4/compile.sh
Executable 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/jFuzzyLogic_v3.0.jar:../../lib/colt.jar" -sourcepath ../../src ../../src/edu/boun/edgecloudsim/applications/sample_app4/FuzzyMainApp.java -d ../../bin
|
63
scripts/sample_app4/config/applications.xml
Normal file
63
scripts/sample_app4/config/applications.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<?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>
|
||||
<delay_sensitivity>0.9</delay_sensitivity>
|
||||
<active_period>40</active_period>
|
||||
<idle_period>20</idle_period>
|
||||
<data_upload>1500</data_upload>
|
||||
<data_download>25</data_download>
|
||||
<task_length>9000</task_length>
|
||||
<required_core>1</required_core>
|
||||
<vm_utilization_on_edge>6</vm_utilization_on_edge>
|
||||
<vm_utilization_on_cloud>0.6</vm_utilization_on_cloud>
|
||||
<vm_utilization_on_mobile>0</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>
|
||||
<delay_sensitivity>0.7</delay_sensitivity>
|
||||
<active_period>45</active_period>
|
||||
<idle_period>90</idle_period>
|
||||
<data_upload>20</data_upload>
|
||||
<data_download>1250</data_download>
|
||||
<task_length>3000</task_length>
|
||||
<required_core>1</required_core>
|
||||
<vm_utilization_on_edge>2</vm_utilization_on_edge>
|
||||
<vm_utilization_on_cloud>0.2</vm_utilization_on_cloud>
|
||||
<vm_utilization_on_mobile>0</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>
|
||||
<delay_sensitivity>0.1</delay_sensitivity>
|
||||
<active_period>60</active_period>
|
||||
<idle_period>120</idle_period>
|
||||
<data_upload>2500</data_upload>
|
||||
<data_download>200</data_download>
|
||||
<task_length>45000</task_length>
|
||||
<required_core>1</required_core>
|
||||
<vm_utilization_on_edge>30</vm_utilization_on_edge>
|
||||
<vm_utilization_on_cloud>3</vm_utilization_on_cloud>
|
||||
<vm_utilization_on_mobile>0</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>
|
||||
<delay_sensitivity>0.3</delay_sensitivity>
|
||||
<active_period>30</active_period>
|
||||
<idle_period>45</idle_period>
|
||||
<data_upload>25</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>0</vm_utilization_on_mobile>
|
||||
</application>
|
||||
</applications>
|
42
scripts/sample_app4/config/default_config.properties
Normal file
42
scripts/sample_app4/config/default_config.properties
Normal file
@ -0,0 +1,42 @@
|
||||
#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=2400
|
||||
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
|
||||
|
||||
#mobile devices has no processing unit in this scenario
|
||||
core_for_mobile_vm=0
|
||||
mips_for_mobile_vm=0
|
||||
ram_for_mobile_vm=0
|
||||
storage_for_mobile_vm=0
|
||||
|
||||
#use ',' for multiple values
|
||||
orchestrator_policies=NETWORK_BASED,UTILIZATION_BASED,FUZZY_BASED,FUZZY_COMPETITOR,HYBRID
|
||||
|
||||
#use ',' for multiple values
|
||||
simulation_scenarios=TWO_TIER_WITH_EO
|
||||
|
||||
#mean waiting time in seconds
|
||||
attractiveness_L1_mean_waiting_time=480
|
||||
attractiveness_L2_mean_waiting_time=300
|
||||
attractiveness_L3_mean_waiting_time=120
|
983
scripts/sample_app4/config/edge_devices.xml
Normal file
983
scripts/sample_app4/config/edge_devices.xml
Normal 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>
|
59
scripts/sample_app4/matlab/getConfiguration.m
Executable file
59
scripts/sample_app4/matlab/getConfiguration.m
Executable file
@ -0,0 +1,59 @@
|
||||
%--------------------------------------------------------------
|
||||
%description
|
||||
% returns a value according to the given argumentssss
|
||||
%--------------------------------------------------------------
|
||||
function [ret_val] = getConfiguration(argType)
|
||||
if(argType == 1)
|
||||
ret_val = 'D:\sim_results';
|
||||
elseif(argType == 2)
|
||||
ret_val = 60 * 20; %simulation time (in seconds)
|
||||
elseif(argType == 3)
|
||||
ret_val = 50; %Number of iterations
|
||||
elseif(argType == 4)
|
||||
ret_val = 1; %x tick interval for number of mobile devices
|
||||
elseif(argType == 5)
|
||||
ret_val = {'FUZZY_BASED','UTILIZATION_BASED','NETWORK_BASED','FUZZY_COMPETITOR','HYBRID'};
|
||||
elseif(argType == 6)
|
||||
ret_val = {'fuzzy','util.','bw','Flores*','hybrid'};
|
||||
elseif(argType == 7)
|
||||
ret_val=[10 3 9 8]; %position of figure
|
||||
elseif(argType == 8)
|
||||
ret_val=0; %for future usage
|
||||
elseif(argType == 9)
|
||||
ret_val = 'Number of Mobile Devices'; %Common text for x axis
|
||||
elseif(argType == 10)
|
||||
ret_val = 200; %min number of mobile device
|
||||
elseif(argType == 11)
|
||||
ret_val = 200; %step size of mobile device count
|
||||
elseif(argType == 12)
|
||||
ret_val =2400; %max number of mobile device
|
||||
elseif(argType == 17)
|
||||
ret_val = 2; %xTickLabelCoefficient
|
||||
elseif(argType == 18)
|
||||
ret_val = 0; %return 1 if you want to save figure as pdf
|
||||
elseif(argType == 19)
|
||||
ret_val = 0; %return 1 if you want to plot errors
|
||||
elseif(argType == 20)
|
||||
ret_val=0; %return 1 if graph is plotted colerful
|
||||
elseif(argType == 21)
|
||||
ret_val=[0.55 0 0]; %color of first line
|
||||
elseif(argType == 22)
|
||||
ret_val=[0 0.15 0.6]; %color of second line
|
||||
elseif(argType == 23)
|
||||
ret_val=[0 0.23 0]; %color of third line
|
||||
elseif(argType == 24)
|
||||
ret_val=[0.6 0 0.6]; %color of fourth line
|
||||
elseif(argType == 25)
|
||||
ret_val=[0.08 0.08 0.08]; %color of fifth line
|
||||
elseif(argType == 26)
|
||||
ret_val=[0 0.8 0.8]; %color of sixth line
|
||||
elseif(argType == 27)
|
||||
ret_val=[0.8 0.4 0]; %color of seventh line
|
||||
elseif(argType == 28)
|
||||
ret_val=[0.8 0.8 0]; %color of eighth line
|
||||
elseif(argType == 40)
|
||||
ret_val={'-k*','-ko','-ks','-kv','-kp','-kd','-kx','-kh'}; %line style (marker) of the colerless line
|
||||
elseif(argType == 50)
|
||||
ret_val={':k*',':ko',':ks',':kv',':kp',':kd',':kx',':kh'}; %line style (marker) of the colerfull line
|
||||
end
|
||||
end
|
20
scripts/sample_app4/matlab/plotAvgFailedTask.m
Executable file
20
scripts/sample_app4/matlab/plotAvgFailedTask.m
Executable file
@ -0,0 +1,20 @@
|
||||
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 Cloudlet (%)', 'ALL_APPS', 'percentage_for_all');
|
||||
% plotGenericResult(2, 2, {'Failed Tasks on Cloudlet';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
|
||||
% plotGenericResult(2, 2, 'Failed Tasks on Cloudlet for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
|
||||
% plotGenericResult(2, 2, 'Failed Tasks on Cloudlet for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
|
||||
% plotGenericResult(2, 2, 'Failed Tasks on Cloudlet for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
|
||||
|
||||
% plotGenericResult(3, 2, 'Failed Tasks on Cloud (%)', 'ALL_APPS', 'percentage_for_all');
|
||||
% plotGenericResult(3, 2, {'Failed Tasks on Cloud for';'Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'percentage_for_all');
|
||||
% plotGenericResult(3, 2, 'Failed Tasks on Cloud for Health App (%)', 'HEALTH_APP', 'percentage_for_all');
|
||||
% plotGenericResult(3, 2, 'Failed Tasks on Cloud for Infotainment App (%)', 'INFOTAINMENT_APP', 'percentage_for_all');
|
||||
% plotGenericResult(3, 2, 'Failed Tasks on Cloud for Heavy Comp. App (%)', 'HEAVY_COMP_APP', 'percentage_for_all');
|
||||
end
|
26
scripts/sample_app4/matlab/plotAvgNetworkDelay.m
Executable file
26
scripts/sample_app4/matlab/plotAvgNetworkDelay.m
Executable file
@ -0,0 +1,26 @@
|
||||
function [] = plotAvgNetworkDelay()
|
||||
|
||||
plotGenericResult(1, 7, 'Average Network Delay (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(1, 7, {'Average Network Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(1, 7, 'Average Network Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(1, 7, {'Average Network Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(1, 7, {'Average Network Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
|
||||
plotGenericResult(5, 1, 'Average WLAN Delay (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(5, 1, {'Average WLAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(5, 1, 'Average WLAN Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(5, 1, {'Average WLAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(5, 1, {'Average WLAN Delay';'for Heavy Comp. App %(sec)'}, 'HEAVY_COMP_APP', '');
|
||||
|
||||
plotGenericResult(5, 2, 'Average MAN Delay (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(5, 2, {'Average MAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(5, 2, 'Average MAN Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(5, 2, {'Average MAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(5, 2, {'Average MAN Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
|
||||
plotGenericResult(5, 3, 'Average WAN Delay (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(5, 3, {'Average WAN Delay';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(5, 3, 'Average WAN Delay for Health App (sec)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(5, 3, {'Average WAN Delay';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(5, 3, {'Average WAN Delay';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
end
|
20
scripts/sample_app4/matlab/plotAvgProcessingTime.m
Executable file
20
scripts/sample_app4/matlab/plotAvgProcessingTime.m
Executable file
@ -0,0 +1,20 @@
|
||||
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 Cloudlet (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Health App (sec)'}, 'HEALTH_APP', '');
|
||||
% plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(2, 6, {'Processing Time on Cloudlet';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
|
||||
% plotGenericResult(3, 6, 'Processing Time on Cloud (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(3, 6, {'Processing Time on Cloud';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(3, 6, {'Processing Time on Cloud';'for Health App (sec)'}, 'HEALTH_APP', '');
|
||||
% plotGenericResult(3, 6, {'Processing Time on Cloud';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(3, 6, {'Processing Time on Cloud';'for Heavy Computation App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
end
|
21
scripts/sample_app4/matlab/plotAvgServiceTime.m
Executable file
21
scripts/sample_app4/matlab/plotAvgServiceTime.m
Executable 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 Cloudlet (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(2, 5, {'Service Time on Cloudlet';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(2, 5, 'Service Time on Cloudlet for Health App (sec)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(2, 5, {'Service Time on Cloudlet';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(2, 5, {'Service Time on Cloudlet';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
%
|
||||
% plotGenericResult(3, 5, 'Service Time on Cloud (sec)', 'ALL_APPS', '');
|
||||
% plotGenericResult(3, 5, {'Service Time on Cloud';'for Augmented Reality App (sec)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(3, 5, 'Service Time on Cloud for Health App (sec)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(3, 5, {'Service Time on Cloud';'for Infotainment App (sec)'}, 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(3, 5, {'Service Time on Cloud';'for Heavy Comp. App (sec)'}, 'HEAVY_COMP_APP', '');
|
||||
|
||||
end
|
9
scripts/sample_app4/matlab/plotAvgVmUtilization.m
Executable file
9
scripts/sample_app4/matlab/plotAvgVmUtilization.m
Executable file
@ -0,0 +1,9 @@
|
||||
function [] = plotAvgVmUtilization()
|
||||
|
||||
plotGenericResult(2, 8, 'Average VM Utilization (%)', 'ALL_APPS', '');
|
||||
% plotGenericResult(2, 8, {'Average VM Utilization';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', '');
|
||||
% plotGenericResult(2, 8, 'Average VM Utilization for Health App (%)', 'HEALTH_APP', '');
|
||||
% plotGenericResult(2, 8, 'Average VM Utilization for Infotainment App (%)', 'INFOTAINMENT_APP', '');
|
||||
% plotGenericResult(2, 8, 'Average VM Utilization for Heavy Comp. App (%)', 'HEAVY_COMP_APP', '');
|
||||
|
||||
end
|
148
scripts/sample_app4/matlab/plotGenericResult.m
Executable file
148
scripts/sample_app4/matlab/plotGenericResult.m
Executable file
@ -0,0 +1,148 @@
|
||||
function [] = plotGenericResult(rowOfset, columnOfset, yLabel, appType, calculatePercentage)
|
||||
folderPath = getConfiguration(1);
|
||||
numOfSimulations = getConfiguration(3);
|
||||
stepOfxAxis = getConfiguration(4);
|
||||
scenarioType = getConfiguration(5);
|
||||
legends = getConfiguration(6);
|
||||
startOfMobileDeviceLoop = getConfiguration(10);
|
||||
stepOfMobileDeviceLoop = getConfiguration(11);
|
||||
endOfMobileDeviceLoop = getConfiguration(12);
|
||||
numOfMobileDevices = (endOfMobileDeviceLoop - startOfMobileDeviceLoop)/stepOfMobileDeviceLoop + 1;
|
||||
xTickLabelCoefficient = getConfiguration(17);
|
||||
|
||||
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_TWO_TIER_WITH_EO_',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;
|
||||
pos=getConfiguration(7);
|
||||
set(hFig, 'Units','centimeters');
|
||||
set(hFig, 'Position',pos);
|
||||
set(0,'DefaultAxesFontName','Times New Roman');
|
||||
set(0,'DefaultTextFontName','Times New Roman');
|
||||
set(0,'DefaultAxesFontSize',10);
|
||||
set(0,'DefaultTextFontSize',12);
|
||||
if(getConfiguration(20) == 1)
|
||||
for i=stepOfxAxis:stepOfxAxis:numOfMobileDevices
|
||||
xIndex=startOfMobileDeviceLoop+((i-1)*stepOfMobileDeviceLoop);
|
||||
|
||||
markers = getConfiguration(50);
|
||||
for j=1:size(scenarioType,2)
|
||||
plot(xIndex, results(j,i),char(markers(j)),'MarkerFaceColor',getConfiguration(20+j),'color',getConfiguration(20+j));
|
||||
hold on;
|
||||
end
|
||||
end
|
||||
|
||||
for j=1:size(scenarioType,2)
|
||||
if(getConfiguration(19) == 1)
|
||||
errorbar(types, results(j,:), min_results(j,:),max_results(j,:),':k','color',getConfiguration(20+j),'LineWidth',1.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(19) == 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(9));
|
||||
set(gca,'XTick', (startOfMobileDeviceLoop*xTickLabelCoefficient):(stepOfxAxis*stepOfMobileDeviceLoop*xTickLabelCoefficient):endOfMobileDeviceLoop);
|
||||
set(gca,'XTickLabel', (startOfMobileDeviceLoop*xTickLabelCoefficient):(stepOfxAxis*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(18) == 1)
|
||||
set(hFig, 'PaperUnits', 'centimeters');
|
||||
set(hFig, 'PaperPositionMode', 'manual');
|
||||
set(hFig, 'PaperPosition',[0 0 pos(3) pos(4)]);
|
||||
set(gcf, 'PaperSize', [pos(3) pos(4)]); %Keep the same paper size
|
||||
filename = strcat(folderPath,'\',int2str(rowOfset),'_',int2str(columnOfset),'_',appType);
|
||||
saveas(gcf, filename, 'pdf');
|
||||
end
|
||||
end
|
31
scripts/sample_app4/matlab/plotTaskFailureReason.m
Executable file
31
scripts/sample_app4/matlab/plotTaskFailureReason.m
Executable file
@ -0,0 +1,31 @@
|
||||
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, 'Average Failed Task due to Mobility (%)', 'ALL_APPS', 'percentage_for_failed');
|
||||
% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
|
||||
% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
|
||||
% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
|
||||
% plotGenericResult(1, 11, {'Failed Task due to VM Capacity';'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';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
|
||||
% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
|
||||
% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
|
||||
% plotGenericResult(5, 4, {'Failed Tasks due to WLAN';'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';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
|
||||
% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
|
||||
% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
|
||||
% plotGenericResult(5, 5, {'Failed Tasks due to MAN';'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';'for Augmented Reality App (%)'}, 'AUGMENTED_REALITY', 'for_failed');
|
||||
% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Health App (%)'}, 'HEALTH_APP', 'for_failed');
|
||||
% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Infotainment App (%)'}, 'INFOTAINMENT_APP', 'for_failed');
|
||||
% plotGenericResult(5, 6, {'Failed Tasks due to WAN';'for Heavy Comp. App (%)'}, 'HEAVY_COMP_APP', 'for_failed');
|
||||
end
|
59
scripts/sample_app4/run_scenarios.sh
Executable file
59
scripts/sample_app4/run_scenarios.sh
Executable 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_app4/runner.sh
Executable file
18
scripts/sample_app4/runner.sh
Executable 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/jFuzzyLogic_v3.0.jar:../../lib/colt.jar' edu.boun.edgecloudsim.applications.sample_app4.FuzzyMainApp $scenario_conf_file $scenario_edge_devices_file $scenario_applications_file $scenario_out_folder $iteration_number > ${scenario_out_folder}.log
|
||||
tar -czf ${scenario_out_folder}.tar.gz -C $simulation_out_folder/${scenario_name} ite${iteration_number}
|
||||
rm -rf $scenario_out_folder
|
1
scripts/sample_app4/simulation.list
Normal file
1
scripts/sample_app4/simulation.list
Normal file
@ -0,0 +1 @@
|
||||
default_config;edge_devices.xml;applications.xml
|
@ -43,7 +43,7 @@ import edu.boun.edgecloudsim.edge_client.Task;
|
||||
import edu.boun.edgecloudsim.edge_server.EdgeHost;
|
||||
import edu.boun.edgecloudsim.edge_server.EdgeVM;
|
||||
import edu.boun.edgecloudsim.network.NetworkModel;
|
||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
import edu.boun.edgecloudsim.utils.Location;
|
||||
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||
|
||||
@ -279,7 +279,7 @@ public class SampleMobileDeviceManager extends MobileDeviceManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void submitTask(EdgeTask edgeTask) {
|
||||
public void submitTask(TaskProperty edgeTask) {
|
||||
int vmType=0;
|
||||
int nextEvent=0;
|
||||
int nextDeviceForNetworkModel;
|
||||
@ -377,18 +377,18 @@ public class SampleMobileDeviceManager extends MobileDeviceManager {
|
||||
vmType.ordinal());
|
||||
}
|
||||
|
||||
private Task createTask(EdgeTask edgeTask){
|
||||
private Task createTask(TaskProperty edgeTask){
|
||||
UtilizationModel utilizationModel = new UtilizationModelFull(); /*UtilizationModelStochastic*/
|
||||
UtilizationModel utilizationModelCPU = getCpuUtilizationModel();
|
||||
|
||||
Task task = new Task(edgeTask.mobileDeviceId, ++taskIdCounter,
|
||||
edgeTask.length, edgeTask.pesNumber,
|
||||
edgeTask.inputFileSize, edgeTask.outputFileSize,
|
||||
Task task = new Task(edgeTask.getMobileDeviceId(), ++taskIdCounter,
|
||||
edgeTask.getLength(), edgeTask.getPesNumber(),
|
||||
edgeTask.getInputFileSize(), edgeTask.getOutputFileSize(),
|
||||
utilizationModelCPU, utilizationModel, utilizationModel);
|
||||
|
||||
//set the owner of this task
|
||||
task.setUserId(this.getId());
|
||||
task.setTaskType(edgeTask.taskType);
|
||||
task.setTaskType(edgeTask.getTaskType());
|
||||
|
||||
if (utilizationModelCPU instanceof CpuUtilizationModel_Custom) {
|
||||
((CpuUtilizationModel_Custom)utilizationModelCPU).setTask(task);
|
||||
|
@ -36,7 +36,7 @@ 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.TaskProperty;
|
||||
import edu.boun.edgecloudsim.utils.Location;
|
||||
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||
|
||||
@ -172,7 +172,7 @@ public class SampleMobileDeviceManager extends MobileDeviceManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void submitTask(EdgeTask edgeTask) {
|
||||
public void submitTask(TaskProperty edgeTask) {
|
||||
double delay = 0;
|
||||
int nextEvent = 0;
|
||||
int nextDeviceForNetworkModel = 0;
|
||||
@ -277,18 +277,18 @@ public class SampleMobileDeviceManager extends MobileDeviceManager {
|
||||
vmType.ordinal());
|
||||
}
|
||||
|
||||
private Task createTask(EdgeTask edgeTask){
|
||||
private Task createTask(TaskProperty edgeTask){
|
||||
UtilizationModel utilizationModel = new UtilizationModelFull(); /*UtilizationModelStochastic*/
|
||||
UtilizationModel utilizationModelCPU = getCpuUtilizationModel();
|
||||
|
||||
Task task = new Task(edgeTask.mobileDeviceId, ++taskIdCounter,
|
||||
edgeTask.length, edgeTask.pesNumber,
|
||||
edgeTask.inputFileSize, edgeTask.outputFileSize,
|
||||
Task task = new Task(edgeTask.getMobileDeviceId(), ++taskIdCounter,
|
||||
edgeTask.getLength(), edgeTask.getPesNumber(),
|
||||
edgeTask.getInputFileSize(), edgeTask.getOutputFileSize(),
|
||||
utilizationModelCPU, utilizationModel, utilizationModel);
|
||||
|
||||
//set the owner of this task
|
||||
task.setUserId(this.getId());
|
||||
task.setTaskType(edgeTask.taskType);
|
||||
task.setTaskType(edgeTask.getTaskType());
|
||||
|
||||
if (utilizationModelCPU instanceof CpuUtilizationModel_Custom) {
|
||||
((CpuUtilizationModel_Custom)utilizationModelCPU).setTask(task);
|
||||
|
@ -0,0 +1,320 @@
|
||||
package edu.boun.edgecloudsim.applications.sample_app4;
|
||||
|
||||
public final class FCL_definition {
|
||||
public final static String memberShipFunctions1 = String.join("\n"
|
||||
, "FUNCTION_BLOCK tipper"
|
||||
, "VAR_INPUT"
|
||||
, " wan_bw : REAL;"
|
||||
, " task_size : REAL;"
|
||||
, " delay_sensitivity : REAL;"
|
||||
, " avg_edge_util : REAL;"
|
||||
, "END_VAR"
|
||||
, "VAR_OUTPUT"
|
||||
, " offload_decision : REAL;"
|
||||
, "END_VAR"
|
||||
, "FUZZIFY wan_bw"
|
||||
, " TERM low := (0, 1) (2, 1) (4, 0);"
|
||||
, " TERM medium := (3, 0) (5, 1) (7, 0);"
|
||||
, " TERM high := (6, 0) (8, 1) (21, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY task_size"
|
||||
, " TERM low := (0, 1) (4000, 1) (8000, 0) ; "
|
||||
, " TERM medium := (6000, 0) (12000,1) (18000,0);"
|
||||
, " TERM high := (16000, 0) (20000, 1) (50000, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY delay_sensitivity"
|
||||
, " TERM low := (0, 1) (0.2, 1) (0.4, 0) ; "
|
||||
, " TERM medium := (0.3, 0) (0.5,1) (0.7,0);"
|
||||
, " TERM high := (0.6, 0) (0.8, 1) (1, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY avg_edge_util"
|
||||
, " TERM low := (0, 1) (20, 1) (40, 0);"
|
||||
, " TERM medium := (30, 0) (50,1) (70,0);"
|
||||
, " TERM high := (60, 0) (80, 1) (100, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "DEFUZZIFY offload_decision"
|
||||
, " TERM edge := (0, 0) (30, 1) (60, 0);"
|
||||
, " TERM cloud := (40, 0) (70, 1) (100, 0);"
|
||||
, " METHOD : LM;"
|
||||
, " DEFAULT := 0;"
|
||||
, "END_DEFUZZIFY"
|
||||
);
|
||||
|
||||
public final static String fclDefinition1 = String.join("\n"
|
||||
, memberShipFunctions1
|
||||
, "RULEBLOCK No1"
|
||||
, " AND : MIN;"
|
||||
, " ACT : MIN;"
|
||||
, " ACCU : MAX;"
|
||||
, " RULE 1 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS edge;"
|
||||
, " RULE 2 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 3 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 4 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 5 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 6 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 7 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 8 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 9 : IF avg_edge_util IS low AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 10 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS edge;"
|
||||
, " RULE 11 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 12 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 13 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 14 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 15 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 16 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 17 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 18 : IF avg_edge_util IS low AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 19 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS edge;"
|
||||
, " RULE 20 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 21 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 22 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 23 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 24 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 25 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 26 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 27 : IF avg_edge_util IS low AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 28 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS edge;"
|
||||
, " RULE 29 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 30 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 31 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 32 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 33 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 34 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 35 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 36 : IF avg_edge_util IS medium AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 37 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS edge;"
|
||||
, " RULE 38 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS edge;"
|
||||
, " RULE 39 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 40 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 41 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 42 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 43 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 44 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 45 : IF avg_edge_util IS medium AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 46 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 47 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 48 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 49 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 50 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 51 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 52 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 53 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 54 : IF avg_edge_util IS medium AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 55 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 56 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 57 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 58 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 59 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 60 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS cloud;"
|
||||
, " RULE 61 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 62 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 63 : IF avg_edge_util IS high AND task_size IS low AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS cloud;"
|
||||
, " RULE 64 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 65 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 66 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 67 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 68 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 69 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS cloud;"
|
||||
, " RULE 70 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 71 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 72 : IF avg_edge_util IS high AND task_size IS medium AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS cloud;"
|
||||
, " RULE 73 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 74 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 75 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS low AND delay_sensitivity IS high THEN offload_decision IS edge;"
|
||||
, " RULE 76 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 77 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 78 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS medium AND delay_sensitivity IS high THEN offload_decision IS cloud;"
|
||||
, " RULE 79 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS low THEN offload_decision IS cloud;"
|
||||
, " RULE 80 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS medium THEN offload_decision IS cloud;"
|
||||
, " RULE 81 : IF avg_edge_util IS high AND task_size IS high AND wan_bw IS high AND delay_sensitivity IS high THEN offload_decision IS cloud;"
|
||||
, "END_RULEBLOCK"
|
||||
, "END_FUNCTION_BLOCK"
|
||||
);
|
||||
|
||||
public final static String memberShipFunctions2 = String.join("\n"
|
||||
, "FUNCTION_BLOCK tipper"
|
||||
, "VAR_INPUT"
|
||||
, " nearest_edge_uitl : REAL;"
|
||||
, " best_remote_edge_uitl : REAL;"
|
||||
, " man_delay : REAL;"
|
||||
, "END_VAR"
|
||||
, "VAR_OUTPUT"
|
||||
, " offload_decision : REAL;"
|
||||
, "END_VAR"
|
||||
, "FUZZIFY man_delay"
|
||||
, " TERM low := (0, 1) (0.001, 1) (0.004, 0);"
|
||||
, " TERM medium := (0.002, 0) (0.007, 1) (0.012, 0);"
|
||||
, " TERM high := (0.01, 0) (0.013, 1) (10, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY best_remote_edge_uitl"
|
||||
, " TERM low := (0, 1) (20, 1) (40, 0);"
|
||||
, " TERM medium := (30, 0) (50,1) (70,0);"
|
||||
, " TERM high := (60, 0) (80, 1) (100, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY nearest_edge_uitl"
|
||||
, " TERM low := (0, 1) (20, 1) (40, 0);"
|
||||
, " TERM medium := (30, 0) (50,1) (70,0);"
|
||||
, " TERM high := (60, 0) (80, 1) (100, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "DEFUZZIFY offload_decision"
|
||||
, " TERM nearest_edge := (0, 0) (30, 1) (60, 0);"
|
||||
, " TERM remote_edge := (40, 0) (70, 1) (100, 0);"
|
||||
, " METHOD : LM;"
|
||||
, " DEFAULT := 0;"
|
||||
, "END_DEFUZZIFY"
|
||||
);
|
||||
|
||||
public final static String fclDefinition2 = String.join("\n"
|
||||
, memberShipFunctions2
|
||||
, "RULEBLOCK No1"
|
||||
, " AND : MIN;"
|
||||
, " ACT : MIN;"
|
||||
, " ACCU : MAX;"
|
||||
, " RULE 1 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS low AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 2 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS low AND man_delay IS medium THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 3 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS low AND man_delay IS low THEN offload_decision IS remote_edge;"
|
||||
, " RULE 4 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS medium AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 5 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS medium AND man_delay IS medium THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 6 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS medium AND man_delay IS low THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 7 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS high AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 8 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS high AND man_delay IS medium THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 9 : IF nearest_edge_uitl IS low AND best_remote_edge_uitl IS high AND man_delay IS low THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 10 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS low AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 11 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS low AND man_delay IS medium THEN offload_decision IS remote_edge;"
|
||||
, " RULE 12 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS low AND man_delay IS low THEN offload_decision IS remote_edge;"
|
||||
, " RULE 13 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS medium AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 14 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS medium AND man_delay IS medium THEN offload_decision IS remote_edge;"
|
||||
, " RULE 15 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS medium AND man_delay IS low THEN offload_decision IS remote_edge;"
|
||||
, " RULE 16 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS high AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 17 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS high AND man_delay IS medium THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 18 : IF nearest_edge_uitl IS medium AND best_remote_edge_uitl IS high AND man_delay IS low THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 19 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS low AND man_delay IS high THEN offload_decision IS remote_edge;"
|
||||
, " RULE 20 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS low AND man_delay IS medium THEN offload_decision IS remote_edge;"
|
||||
, " RULE 21 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS low AND man_delay IS low THEN offload_decision IS remote_edge;"
|
||||
, " RULE 22 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS medium AND man_delay IS high THEN offload_decision IS remote_edge;"
|
||||
, " RULE 23 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS medium AND man_delay IS medium THEN offload_decision IS remote_edge;"
|
||||
, " RULE 24 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS medium AND man_delay IS low THEN offload_decision IS remote_edge;"
|
||||
, " RULE 25 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS high AND man_delay IS high THEN offload_decision IS nearest_edge;"
|
||||
, " RULE 26 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS high AND man_delay IS medium THEN offload_decision IS remote_edge;"
|
||||
, " RULE 27 : IF nearest_edge_uitl IS high AND best_remote_edge_uitl IS high AND man_delay IS low THEN offload_decision IS remote_edge;"
|
||||
, "END_RULEBLOCK"
|
||||
, "END_FUNCTION_BLOCK"
|
||||
);
|
||||
|
||||
public final static String memberShipFunctions3 = String.join("\n"
|
||||
, "FUNCTION_BLOCK tipper"
|
||||
, "VAR_INPUT"
|
||||
, " wan_bw : REAL;"
|
||||
, " video_execution : REAL;"
|
||||
, " data_size : REAL;"
|
||||
, " cpu_speed : REAL;"
|
||||
, "END_VAR"
|
||||
, "VAR_OUTPUT"
|
||||
, " offload_decision : REAL;"
|
||||
, "END_VAR"
|
||||
, "FUZZIFY wan_bw"
|
||||
, " TERM low := (0, 1) (2, 1) (4, 0);"
|
||||
, " TERM medium := (3, 0) (5, 1) (7, 0);"
|
||||
, " TERM high := (6, 0) (8, 1) (21, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY video_execution"
|
||||
, " TERM low := (0, 1) (0.2, 1) (0.4, 0) ; "
|
||||
, " TERM normal := (0.3, 0) (0.5,1) (0.7,0);"
|
||||
, " TERM high := (0.6, 0) (0.8, 1) (1, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY data_size"
|
||||
, " TERM small := (0, 1) (0.2, 1) (0.4, 0) ; "
|
||||
, " TERM medium := (0.3, 0) (0.5,1) (0.7,0);"
|
||||
, " TERM high := (0.6, 0) (0.8, 1) (1, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "FUZZIFY cpu_speed"
|
||||
, " TERM low := (0, 1) (20, 1) (40, 0);"
|
||||
, " TERM medium := (30, 0) (50,1) (70,0);"
|
||||
, " TERM high := (60, 0) (80, 1) (100, 1);"
|
||||
, "END_FUZZIFY"
|
||||
, "DEFUZZIFY offload_decision"
|
||||
, " TERM local_processing := (0, 1) (40, 1) (60, 0);"
|
||||
, " TERM remote_processing := (40, 0) (60, 1) (100, 1);"
|
||||
, " METHOD : COG;"
|
||||
, " DEFAULT := 0;"
|
||||
, "END_DEFUZZIFY"
|
||||
);
|
||||
|
||||
public final static String fclDefinition3 = String.join("\n"
|
||||
, memberShipFunctions3
|
||||
, "RULEBLOCK No1"
|
||||
, " AND : MIN;"
|
||||
, " ACT : MIN;"
|
||||
, " ACCU : MAX;"
|
||||
, " RULE 1 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 2 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 3 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS low AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 5 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS remote_processing;"
|
||||
, " RULE 6 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 7 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS high AND video_execution IS low THEN offload_decision IS remote_processing;"
|
||||
, " RULE 8 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS remote_processing;"
|
||||
, " RULE 9 : IF cpu_speed IS low AND data_size IS small AND wan_bw IS high AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 10 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 11 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS low AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 12 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 13 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 14 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS high AND video_execution IS low THEN offload_decision IS remote_processing;"
|
||||
, " RULE 15 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS remote_processing;"
|
||||
, " RULE 16 : IF cpu_speed IS low AND data_size IS medium AND wan_bw IS high AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 17 : IF cpu_speed IS low AND data_size IS high AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing ;"
|
||||
, " RULE 18 : IF cpu_speed IS low AND data_size IS high AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 19 : IF cpu_speed IS low AND data_size IS high AND wan_bw IS high AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 20 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 21 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 22 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 23 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 24 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS low AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 25 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS medium AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 26 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 27 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 28 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 29 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 30 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS low AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 31 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS medium AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 32 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS remote_processing;"
|
||||
, " RULE 33 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 34 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 35 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS remote_processing;"
|
||||
, " RULE 36 : IF cpu_speed IS medium AND data_size IS small AND wan_bw IS high AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 37 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 38 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 39 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS low AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 40 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS medium AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 41 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 42 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 43 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 44 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS remote_processing;"
|
||||
, " RULE 45 : IF cpu_speed IS medium AND data_size IS medium AND wan_bw IS high AND video_execution IS high THEN offload_decision IS remote_processing;"
|
||||
, " RULE 46 : IF cpu_speed IS medium AND data_size IS high AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 47 : IF cpu_speed IS medium AND data_size IS high AND wan_bw IS medium AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 48 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 49 : IF cpu_speed IS high AND data_size IS high AND wan_bw IS high AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 50 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 51 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 52 : IF cpu_speed IS medium AND data_size IS high AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 53 : IF cpu_speed IS medium AND data_size IS high AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 54 : IF cpu_speed IS medium AND data_size IS high AND wan_bw IS high AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 55 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 56 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 57 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS low AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 58 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS medium AND video_execution IS low THEN offload_decision IS remote_processing;"
|
||||
, " RULE 59 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS medium AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 60 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 61 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS high AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 62 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS high AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 63 : IF cpu_speed IS high AND data_size IS small AND wan_bw IS high AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 64 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS low AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 65 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS low AND video_execution IS normal THEN offload_decision IS local_processing;"
|
||||
, " RULE 66 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS low AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 67 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS medium AND video_execution IS low THEN offload_decision IS local_processing;"
|
||||
, " RULE 68 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS high AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, " RULE 69 : IF cpu_speed IS high AND data_size IS medium AND wan_bw IS medium AND video_execution IS high THEN offload_decision IS local_processing;"
|
||||
, "END_RULEBLOCK"
|
||||
, "END_FUNCTION_BLOCK"
|
||||
);
|
||||
}
|
@ -0,0 +1,302 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - Basic Edge Orchestrator implementation
|
||||
*
|
||||
* Description:
|
||||
* BasicEdgeOrchestrator implements basic algorithms which are
|
||||
* first/next/best/worst/random fit algorithms while assigning
|
||||
* requests to the edge devices.
|
||||
*
|
||||
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
|
||||
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
|
||||
*/
|
||||
|
||||
package edu.boun.edgecloudsim.applications.sample_app4;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.cloudbus.cloudsim.Host;
|
||||
import org.cloudbus.cloudsim.UtilizationModelFull;
|
||||
import org.cloudbus.cloudsim.Vm;
|
||||
import org.cloudbus.cloudsim.core.CloudSim;
|
||||
import org.cloudbus.cloudsim.core.SimEvent;
|
||||
|
||||
import net.sourceforge.jFuzzyLogic.FIS;
|
||||
import edu.boun.edgecloudsim.cloud_server.CloudVM;
|
||||
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.EdgeHost;
|
||||
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.utils.SimLogger;
|
||||
|
||||
public class FuzzyEdgeOrchestrator extends EdgeOrchestrator {
|
||||
public static final double MAX_DATA_SIZE=2500;
|
||||
|
||||
private int numberOfHost; //used by load balancer
|
||||
private FIS fis1 = null;
|
||||
private FIS fis2 = null;
|
||||
private FIS fis3 = null;
|
||||
|
||||
public FuzzyEdgeOrchestrator(String _policy, String _simScenario) {
|
||||
super(_policy, _simScenario);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
numberOfHost=SimSettings.getInstance().getNumOfEdgeHosts();
|
||||
|
||||
try {
|
||||
fis1 = FIS.createFromString(FCL_definition.fclDefinition1, false);
|
||||
fis2 = FIS.createFromString(FCL_definition.fclDefinition2, false);
|
||||
fis3 = FIS.createFromString(FCL_definition.fclDefinition3, false);
|
||||
} catch (RecognitionException e) {
|
||||
SimLogger.printLine("Cannot generate FIS! Terminating simulation...");
|
||||
e.printStackTrace();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see edu.boun.edgecloudsim.edge_orchestrator.EdgeOrchestrator#getDeviceToOffload(edu.boun.edgecloudsim.edge_client.Task)
|
||||
*
|
||||
* It is assumed that the edge orchestrator app is running on the edge devices in a distributed manner
|
||||
*/
|
||||
@Override
|
||||
public int getDeviceToOffload(Task task) {
|
||||
int result = 0;
|
||||
|
||||
//RODO: return proper host ID
|
||||
|
||||
if(simScenario.equals("SINGLE_TIER")){
|
||||
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
}
|
||||
else if(simScenario.equals("TWO_TIER_WITH_EO")){
|
||||
int bestRemoteEdgeHostIndex = 0;
|
||||
int nearestEdgeHostIndex = 0;
|
||||
double nearestEdgeUtilization = 0;
|
||||
|
||||
//dummy task to simulate a task with 1 Mbit file size to upload and download
|
||||
Task dummyTask = new Task(0, 0, 0, 0, 128, 128, new UtilizationModelFull(), new UtilizationModelFull(), new UtilizationModelFull());
|
||||
|
||||
double wanDelay = SimManager.getInstance().getNetworkModel().getUploadDelay(task.getMobileDeviceId(),
|
||||
SimSettings.CLOUD_DATACENTER_ID, dummyTask /* 1 Mbit */);
|
||||
double wanBW = (wanDelay == 0) ? 0 : (1 / wanDelay); /* Mbps */
|
||||
|
||||
double manDelay = SimManager.getInstance().getNetworkModel().getUploadDelay(SimSettings.GENERIC_EDGE_DEVICE_ID,
|
||||
SimSettings.GENERIC_EDGE_DEVICE_ID, dummyTask /* 1 Mbit */);
|
||||
|
||||
double edgeUtilization = SimManager.getInstance().getEdgeServerManager().getAvgUtilization();
|
||||
|
||||
//finding least loaded neighbor edge host
|
||||
double bestRemoteEdgeUtilization = 100; //start with max value
|
||||
for(int hostIndex=0; hostIndex<numberOfHost; hostIndex++){
|
||||
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(hostIndex);
|
||||
|
||||
double totalUtlization=0;
|
||||
for(int vmIndex=0; vmIndex<vmArray.size(); vmIndex++){
|
||||
totalUtlization += vmArray.get(vmIndex).getCloudletScheduler().getTotalUtilizationOfCpu(CloudSim.clock());
|
||||
}
|
||||
|
||||
double avgUtilization = (totalUtlization / (double)(vmArray.size()));
|
||||
|
||||
EdgeHost host = (EdgeHost)(vmArray.get(0).getHost()); //all VMs have the same host
|
||||
if(host.getLocation().getServingWlanId() == task.getSubmittedLocation().getServingWlanId()){
|
||||
nearestEdgeUtilization = totalUtlization / (double)(vmArray.size());
|
||||
nearestEdgeHostIndex = hostIndex;
|
||||
}
|
||||
else if(avgUtilization < bestRemoteEdgeUtilization){
|
||||
bestRemoteEdgeHostIndex = hostIndex;
|
||||
bestRemoteEdgeUtilization = avgUtilization;
|
||||
}
|
||||
}
|
||||
|
||||
if(policy.equals("FUZZY_BASED")){
|
||||
int bestHostIndex = nearestEdgeHostIndex;
|
||||
double bestHostUtilization = nearestEdgeUtilization;
|
||||
|
||||
// Set inputs
|
||||
fis2.setVariable("man_delay", manDelay);
|
||||
fis2.setVariable("nearest_edge_uitl", nearestEdgeUtilization);
|
||||
fis2.setVariable("best_remote_edge_uitl", bestRemoteEdgeUtilization);
|
||||
|
||||
// Evaluate
|
||||
fis2.evaluate();
|
||||
|
||||
/*
|
||||
SimLogger.printLine("########################################");
|
||||
SimLogger.printLine("man bw: " + manBW);
|
||||
SimLogger.printLine("nearest_edge_uitl: " + nearestEdgeUtilization);
|
||||
SimLogger.printLine("best_remote_edge_uitl: " + bestRemoteEdgeHostUtilization);
|
||||
SimLogger.printLine("offload_decision: " + fis2.getVariable("offload_decision").getValue());
|
||||
SimLogger.printLine("########################################");
|
||||
*/
|
||||
|
||||
if(fis2.getVariable("offload_decision").getValue() > 50){
|
||||
bestHostIndex = bestRemoteEdgeHostIndex;
|
||||
bestHostUtilization = bestRemoteEdgeUtilization;
|
||||
}
|
||||
|
||||
double delay_sensitivity = SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType()][12];
|
||||
|
||||
// Set inputs
|
||||
fis1.setVariable("wan_bw", wanBW);
|
||||
fis1.setVariable("task_size", task.getCloudletLength());
|
||||
fis1.setVariable("delay_sensitivity", delay_sensitivity);
|
||||
fis1.setVariable("avg_edge_util", bestHostUtilization);
|
||||
|
||||
// Evaluate
|
||||
fis1.evaluate();
|
||||
|
||||
/*
|
||||
SimLogger.printLine("########################################");
|
||||
SimLogger.printLine("wan bw: " + wanBW);
|
||||
SimLogger.printLine("task_size: " + task.getCloudletLength());
|
||||
SimLogger.printLine("delay_sensitivity: " + delay_sensitivity);
|
||||
SimLogger.printLine("avg_edge_util: " + bestHostUtilization);
|
||||
SimLogger.printLine("offload_decision: " + fis1.getVariable("offload_decision").getValue());
|
||||
SimLogger.printLine("########################################");
|
||||
*/
|
||||
|
||||
if(fis1.getVariable("offload_decision").getValue() > 50){
|
||||
result = SimSettings.CLOUD_DATACENTER_ID;
|
||||
}
|
||||
else{
|
||||
result = bestHostIndex;
|
||||
}
|
||||
}
|
||||
else if(policy.equals("FUZZY_COMPETITOR")){
|
||||
double utilization = edgeUtilization;
|
||||
double cpuSpeed = (double)100 - utilization;
|
||||
double videoExecution = SimSettings.getInstance().getTaskLookUpTable()[task.getTaskType()][12];
|
||||
double dataSize = task.getCloudletFileSize() + task.getCloudletOutputSize();
|
||||
double normalizedDataSize = Math.min(MAX_DATA_SIZE, dataSize)/MAX_DATA_SIZE;
|
||||
|
||||
// Set inputs
|
||||
fis3.setVariable("wan_bw", wanBW);
|
||||
fis3.setVariable("cpu_speed", cpuSpeed);
|
||||
fis3.setVariable("video_execution", videoExecution);
|
||||
fis3.setVariable("data_size", normalizedDataSize);
|
||||
|
||||
// Evaluate
|
||||
fis3.evaluate();
|
||||
|
||||
/*
|
||||
SimLogger.printLine("########################################");
|
||||
SimLogger.printLine("wan bw: " + wanBW);
|
||||
SimLogger.printLine("cpu_speed: " + cpuSpeed);
|
||||
SimLogger.printLine("video_execution: " + videoExecution);
|
||||
SimLogger.printLine("data_size: " + normalizedDataSize);
|
||||
SimLogger.printLine("offload_decision: " + fis2.getVariable("offload_decision").getValue());
|
||||
SimLogger.printLine("########################################");
|
||||
*/
|
||||
|
||||
if(fis3.getVariable("offload_decision").getValue() > 50)
|
||||
result = SimSettings.CLOUD_DATACENTER_ID;
|
||||
else
|
||||
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
}
|
||||
else if(policy.equals("NETWORK_BASED")){
|
||||
if(wanBW > 6)
|
||||
result = SimSettings.CLOUD_DATACENTER_ID;
|
||||
else
|
||||
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
}
|
||||
else if(policy.equals("UTILIZATION_BASED")){
|
||||
double utilization = edgeUtilization;
|
||||
if(utilization > 80)
|
||||
result = SimSettings.CLOUD_DATACENTER_ID;
|
||||
else
|
||||
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
}
|
||||
else if(policy.equals("HYBRID")){
|
||||
double utilization = edgeUtilization;
|
||||
if(wanBW > 6 && utilization > 80)
|
||||
result = SimSettings.CLOUD_DATACENTER_ID;
|
||||
else
|
||||
result = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
}
|
||||
else {
|
||||
SimLogger.printLine("Unknow edge orchestrator policy! Terminating simulation...");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SimLogger.printLine("Unknow simulation scenario! Terminating simulation...");
|
||||
System.exit(0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vm getVmToOffload(Task task, int deviceId) {
|
||||
Vm selectedVM = null;
|
||||
|
||||
if(deviceId == SimSettings.CLOUD_DATACENTER_ID){
|
||||
//Select VM on cloud devices via Least Loaded algorithm!
|
||||
double selectedVmCapacity = 0; //start with min value
|
||||
List<Host> list = SimManager.getInstance().getCloudServerManager().getDatacenter().getHostList();
|
||||
for (int hostIndex=0; hostIndex < list.size(); hostIndex++) {
|
||||
List<CloudVM> vmArray = SimManager.getInstance().getCloudServerManager().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 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{
|
||||
//if the host is specifically defined!
|
||||
List<EdgeVM> vmArray = SimManager.getInstance().getEdgeServerManager().getVmList(deviceId);
|
||||
|
||||
//Select VM on edge devices via Least Loaded algorithm!
|
||||
double selectedVmCapacity = 0; //start with min value
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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!
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,425 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - M/M/1 Queue model implementation
|
||||
*
|
||||
* Description:
|
||||
* MM1Queue implements M/M/1 Queue model for WLAN and WAN communication
|
||||
*
|
||||
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
|
||||
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
|
||||
*/
|
||||
|
||||
package edu.boun.edgecloudsim.applications.sample_app4;
|
||||
|
||||
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 FuzzyExperimentalNetworkModel extends NetworkModel {
|
||||
public static enum NETWORK_TYPE {WLAN, LAN};
|
||||
public static enum LINK_TYPE {DOWNLOAD, UPLOAD};
|
||||
public static double MAN_BW = 1300*1024; //Kbps
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private int manClients;
|
||||
private int[] wanClients;
|
||||
private int[] wlanClients;
|
||||
|
||||
private double lastMM1QueeuUpdateTime;
|
||||
private double ManPoissonMeanForDownload; //seconds
|
||||
private double ManPoissonMeanForUpload; //seconds
|
||||
|
||||
private double avgManTaskInputSize; //bytes
|
||||
private double avgManTaskOutputSize; //bytes
|
||||
|
||||
//record last n task statistics during MM1_QUEUE_MODEL_UPDATE_INTEVAL seconds to simulate mmpp/m/1 queue model
|
||||
private double totalManTaskInputSize;
|
||||
private double totalManTaskOutputSize;
|
||||
private double numOfManTaskForDownload;
|
||||
private double numOfManTaskForUpload;
|
||||
|
||||
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 static final double[] experimentalWanDelay = {
|
||||
/*1 Client*/ 20703.973 /*(Kbps)*/,
|
||||
/*2 Clients*/ 12023.957 /*(Kbps)*/,
|
||||
/*3 Clients*/ 9887.785 /*(Kbps)*/,
|
||||
/*4 Clients*/ 8915.775 /*(Kbps)*/,
|
||||
/*5 Clients*/ 8259.277 /*(Kbps)*/,
|
||||
/*6 Clients*/ 7560.574 /*(Kbps)*/,
|
||||
/*7 Clients*/ 7262.140 /*(Kbps)*/,
|
||||
/*8 Clients*/ 7155.361 /*(Kbps)*/,
|
||||
/*9 Clients*/ 7041.153 /*(Kbps)*/,
|
||||
/*10 Clients*/ 6994.595 /*(Kbps)*/,
|
||||
/*11 Clients*/ 6653.232 /*(Kbps)*/,
|
||||
/*12 Clients*/ 6111.868 /*(Kbps)*/,
|
||||
/*13 Clients*/ 5570.505 /*(Kbps)*/,
|
||||
/*14 Clients*/ 5029.142 /*(Kbps)*/,
|
||||
/*15 Clients*/ 4487.779 /*(Kbps)*/,
|
||||
/*16 Clients*/ 3899.729 /*(Kbps)*/,
|
||||
/*17 Clients*/ 3311.680 /*(Kbps)*/,
|
||||
/*18 Clients*/ 2723.631 /*(Kbps)*/,
|
||||
/*19 Clients*/ 2135.582 /*(Kbps)*/,
|
||||
/*20 Clients*/ 1547.533 /*(Kbps)*/,
|
||||
/*21 Clients*/ 1500.252 /*(Kbps)*/,
|
||||
/*22 Clients*/ 1452.972 /*(Kbps)*/,
|
||||
/*23 Clients*/ 1405.692 /*(Kbps)*/,
|
||||
/*24 Clients*/ 1358.411 /*(Kbps)*/,
|
||||
/*25 Clients*/ 1311.131 /*(Kbps)*/
|
||||
};
|
||||
|
||||
public FuzzyExperimentalNetworkModel(int _numberOfMobileDevices, String _simScenario) {
|
||||
super(_numberOfMobileDevices, _simScenario);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
wanClients = new int[SimSettings.getInstance().getNumOfEdgeDatacenters()]; //we have one access point for each datacenter
|
||||
wlanClients = new int[SimSettings.getInstance().getNumOfEdgeDatacenters()]; //we have one access point for each datacenter
|
||||
|
||||
int numOfApp = SimSettings.getInstance().getTaskLookUpTable().length;
|
||||
SimSettings SS = SimSettings.getInstance();
|
||||
for(int taskIndex=0; taskIndex<numOfApp; taskIndex++) {
|
||||
if(SS.getTaskLookUpTable()[taskIndex][0] == 0) {
|
||||
SimLogger.printLine("Usage percantage of task " + taskIndex + " is 0! Terminating simulation...");
|
||||
System.exit(0);
|
||||
}
|
||||
else{
|
||||
double weight = SS.getTaskLookUpTable()[taskIndex][0]/(double)100;
|
||||
|
||||
//assume half of the tasks use the MAN at the beginning
|
||||
ManPoissonMeanForDownload += ((SS.getTaskLookUpTable()[taskIndex][2])*weight) * 4;
|
||||
ManPoissonMeanForUpload = ManPoissonMeanForDownload;
|
||||
|
||||
avgManTaskInputSize += SS.getTaskLookUpTable()[taskIndex][5]*weight;
|
||||
avgManTaskOutputSize += SS.getTaskLookUpTable()[taskIndex][6]*weight;
|
||||
}
|
||||
}
|
||||
|
||||
ManPoissonMeanForDownload = ManPoissonMeanForDownload/numOfApp;
|
||||
ManPoissonMeanForUpload = ManPoissonMeanForUpload/numOfApp;
|
||||
avgManTaskInputSize = avgManTaskInputSize/numOfApp;
|
||||
avgManTaskOutputSize = avgManTaskOutputSize/numOfApp;
|
||||
|
||||
lastMM1QueeuUpdateTime = SimSettings.CLIENT_ACTIVITY_START_TIME;
|
||||
totalManTaskOutputSize = 0;
|
||||
numOfManTaskForDownload = 0;
|
||||
totalManTaskInputSize = 0;
|
||||
numOfManTaskForUpload = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* source device is always mobile device in our simulation scenarios!
|
||||
*/
|
||||
@Override
|
||||
public double getUploadDelay(int sourceDeviceId, int destDeviceId, Task task) {
|
||||
double delay = 0;
|
||||
|
||||
//special case for man communication
|
||||
if(sourceDeviceId == destDeviceId && sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
|
||||
return delay = getManUploadDelay();
|
||||
}
|
||||
|
||||
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(sourceDeviceId,CloudSim.clock());
|
||||
|
||||
//mobile device to cloud server
|
||||
if(destDeviceId == SimSettings.CLOUD_DATACENTER_ID){
|
||||
delay = getWanUploadDelay(accessPointLocation, task.getCloudletFileSize());
|
||||
}
|
||||
//mobile device to edge device (wifi access point)
|
||||
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID) {
|
||||
delay = getWlanUploadDelay(accessPointLocation, task.getCloudletFileSize());
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
//special case for man communication
|
||||
if(sourceDeviceId == destDeviceId && sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID){
|
||||
return delay = getManDownloadDelay();
|
||||
}
|
||||
|
||||
Location accessPointLocation = SimManager.getInstance().getMobilityModel().getLocation(destDeviceId,CloudSim.clock());
|
||||
|
||||
//cloud server to mobile device
|
||||
if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID){
|
||||
delay = getWanDownloadDelay(accessPointLocation, task.getCloudletOutputSize());
|
||||
}
|
||||
//edge device (wifi access point) to mobile device
|
||||
else{
|
||||
delay = getWlanDownloadDelay(accessPointLocation, task.getCloudletOutputSize());
|
||||
}
|
||||
|
||||
return delay;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadStarted(Location accessPointLocation, int destDeviceId) {
|
||||
if(destDeviceId == SimSettings.CLOUD_DATACENTER_ID)
|
||||
wanClients[accessPointLocation.getServingWlanId()]++;
|
||||
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID)
|
||||
wlanClients[accessPointLocation.getServingWlanId()]++;
|
||||
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID+1)
|
||||
manClients++;
|
||||
else {
|
||||
SimLogger.printLine("Error - unknoqn device id in FuzzyExperimentalNetworkModel.uploadStarted(. Terminating simulation...");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFinished(Location accessPointLocation, int destDeviceId) {
|
||||
if(destDeviceId == SimSettings.CLOUD_DATACENTER_ID)
|
||||
wanClients[accessPointLocation.getServingWlanId()]--;
|
||||
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID)
|
||||
wlanClients[accessPointLocation.getServingWlanId()]--;
|
||||
else if (destDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID+1)
|
||||
manClients--;
|
||||
else {
|
||||
SimLogger.printLine("Error - unknoqn device id in FuzzyExperimentalNetworkModel.uploadFinished(. Terminating simulation...");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadStarted(Location accessPointLocation, int sourceDeviceId) {
|
||||
if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID)
|
||||
wanClients[accessPointLocation.getServingWlanId()]++;
|
||||
else if(sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID)
|
||||
wlanClients[accessPointLocation.getServingWlanId()]++;
|
||||
else if(sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID+1)
|
||||
manClients++;
|
||||
else {
|
||||
SimLogger.printLine("Error - unknoqn device id in FuzzyExperimentalNetworkModel.downloadStarted(. Terminating simulation...");
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadFinished(Location accessPointLocation, int sourceDeviceId) {
|
||||
if(sourceDeviceId == SimSettings.CLOUD_DATACENTER_ID)
|
||||
wanClients[accessPointLocation.getServingWlanId()]--;
|
||||
else if(sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID)
|
||||
wlanClients[accessPointLocation.getServingWlanId()]--;
|
||||
else if(sourceDeviceId == SimSettings.GENERIC_EDGE_DEVICE_ID+1)
|
||||
manClients--;
|
||||
else {
|
||||
SimLogger.printLine("Error - unknoqn device id in FuzzyExperimentalNetworkModel.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 < 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);
|
||||
}
|
||||
|
||||
private double getWanDownloadDelay(Location accessPointLocation, double dataSize) {
|
||||
int numOfWanUser = wanClients[accessPointLocation.getServingWlanId()];
|
||||
double taskSizeInKb = dataSize * (double)8; //KB to Kb
|
||||
double result=0;
|
||||
|
||||
if(numOfWanUser < experimentalWanDelay.length)
|
||||
result = taskSizeInKb /*Kb*/ / (experimentalWanDelay[numOfWanUser]) /*Kbps*/;
|
||||
|
||||
//System.out.println("--> " + numOfWanUser + " user, " + taskSizeInKb + " KB, " +result + " sec");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//wan upload and download delay is symmetric in this model
|
||||
private double getWanUploadDelay(Location accessPointLocation, double dataSize) {
|
||||
return getWanDownloadDelay(accessPointLocation, dataSize);
|
||||
}
|
||||
|
||||
private double calculateMM1(double propogationDelay, double bandwidth /*Kbps*/, double PoissonMean, double avgTaskSize /*KB*/, int deviceCount){
|
||||
double mu=0, lamda=0;
|
||||
|
||||
avgTaskSize = avgTaskSize * 8; //convert from KB to Kb
|
||||
|
||||
lamda = ((double)1/(double)PoissonMean); //task per seconds
|
||||
mu = bandwidth /*Kbps*/ / avgTaskSize /*Kb*/; //task per seconds
|
||||
double result = (double)1 / (mu-lamda*(double)deviceCount);
|
||||
|
||||
if(result < 0)
|
||||
return 0;
|
||||
|
||||
result += propogationDelay;
|
||||
|
||||
return (result > 15) ? 0 : result;
|
||||
}
|
||||
|
||||
private double getManDownloadDelay() {
|
||||
double result = calculateMM1(SimSettings.getInstance().getInternalLanDelay(),
|
||||
MAN_BW,
|
||||
ManPoissonMeanForDownload,
|
||||
avgManTaskOutputSize,
|
||||
numberOfMobileDevices);
|
||||
|
||||
totalManTaskOutputSize += avgManTaskOutputSize;
|
||||
numOfManTaskForDownload++;
|
||||
|
||||
//System.out.println("--> " + SimManager.getInstance().getNumOfMobileDevice() + " user, " +result + " sec");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private double getManUploadDelay() {
|
||||
double result = calculateMM1(SimSettings.getInstance().getInternalLanDelay(),
|
||||
MAN_BW,
|
||||
ManPoissonMeanForUpload,
|
||||
avgManTaskInputSize,
|
||||
numberOfMobileDevices);
|
||||
|
||||
totalManTaskInputSize += avgManTaskInputSize;
|
||||
numOfManTaskForUpload++;
|
||||
|
||||
//System.out.println(CloudSim.clock() + " -> " + SimManager.getInstance().getNumOfMobileDevice() + " user, " + result + " sec");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void updateMM1QueeuModel(){
|
||||
double lastInterval = CloudSim.clock() - lastMM1QueeuUpdateTime;
|
||||
lastMM1QueeuUpdateTime = CloudSim.clock();
|
||||
|
||||
if(numOfManTaskForDownload != 0){
|
||||
ManPoissonMeanForDownload = lastInterval / (numOfManTaskForDownload / (double)numberOfMobileDevices);
|
||||
avgManTaskOutputSize = totalManTaskOutputSize / numOfManTaskForDownload;
|
||||
}
|
||||
if(numOfManTaskForUpload != 0){
|
||||
ManPoissonMeanForUpload = lastInterval / (numOfManTaskForUpload / (double)numberOfMobileDevices);
|
||||
avgManTaskInputSize = totalManTaskInputSize / numOfManTaskForUpload;
|
||||
}
|
||||
|
||||
totalManTaskOutputSize = 0;
|
||||
numOfManTaskForDownload = 0;
|
||||
totalManTaskInputSize = 0;
|
||||
numOfManTaskForUpload = 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - Sample Application
|
||||
*
|
||||
* Description: Sample application for EdgeCloudSim
|
||||
*
|
||||
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
|
||||
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
|
||||
*/
|
||||
|
||||
package edu.boun.edgecloudsim.applications.sample_app4;
|
||||
|
||||
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 FuzzyMainApp {
|
||||
|
||||
/**
|
||||
* 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_app4/config/default_config.properties";
|
||||
applicationsFile = "scripts/sample_app4/config/applications.xml";
|
||||
edgeDevicesFile = "scripts/sample_app4/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 FuzzyScenarioFactory(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));
|
||||
}
|
||||
}
|
@ -0,0 +1,387 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - Mobile Device Manager
|
||||
*
|
||||
* Description:
|
||||
* DefaultMobileDeviceManager is responsible for submitting the tasks to the related
|
||||
* device by using the Edge Orchestrator. It also takes proper actions
|
||||
* when the execution of the tasks are finished.
|
||||
* By default, DefaultMobileDeviceManager sends tasks to the edge servers or
|
||||
* cloud servers. If you want to use different topology, for example
|
||||
* MAN edge server, you should modify the flow defined 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_app4;
|
||||
|
||||
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.edge_client.CpuUtilizationModel_Custom;
|
||||
import edu.boun.edgecloudsim.edge_client.MobileDeviceManager;
|
||||
import edu.boun.edgecloudsim.edge_client.Task;
|
||||
import edu.boun.edgecloudsim.edge_server.EdgeHost;
|
||||
import edu.boun.edgecloudsim.edge_server.EdgeVM;
|
||||
import edu.boun.edgecloudsim.network.NetworkModel;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
import edu.boun.edgecloudsim.utils.Location;
|
||||
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||
|
||||
public class FuzzyMobileDeviceManager extends MobileDeviceManager {
|
||||
private static final int BASE = 100000; //start from base in order not to conflict cloudsim tag!
|
||||
|
||||
private static final int UPDATE_MM1_QUEUE_MODEL = BASE + 1;
|
||||
private static final int REQUEST_RECEIVED_BY_CLOUD = BASE + 2;
|
||||
private static final int REQUEST_RECEIVED_BY_EDGE_DEVICE = BASE + 3;
|
||||
private static final int REQUEST_RECEIVED_BY_REMOTE_EDGE_DEVICE = BASE + 4;
|
||||
private static final int REQUEST_RECEIVED_BY_EDGE_DEVICE_TO_RELAY_NEIGHBOR = BASE + 5;
|
||||
private static final int RESPONSE_RECEIVED_BY_MOBILE_DEVICE = BASE + 6;
|
||||
private static final int RESPONSE_RECEIVED_BY_EDGE_DEVICE_TO_RELAY_MOBILE_DEVICE = BASE + 7;
|
||||
|
||||
private static final double MM1_QUEUE_MODEL_UPDATE_INTEVAL = 5; //seconds
|
||||
|
||||
private int taskIdCounter=0;
|
||||
|
||||
public FuzzyMobileDeviceManager() throws Exception{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UtilizationModel getCpuUtilizationModel() {
|
||||
return new CpuUtilizationModel_Custom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startEntity() {
|
||||
super.startEntity();
|
||||
schedule(getId(), SimSettings.CLIENT_ACTIVITY_START_TIME +
|
||||
MM1_QUEUE_MODEL_UPDATE_INTEVAL, UPDATE_MM1_QUEUE_MODEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.CLOUD_DATACENTER_ID){
|
||||
//SimLogger.printLine(CloudSim.clock() + ": " + getName() + ": task #" + task.getCloudletId() + " received from cloud");
|
||||
double WanDelay = networkModel.getDownloadDelay(SimSettings.CLOUD_DATACENTER_ID, task.getMobileDeviceId(), task);
|
||||
if(WanDelay > 0)
|
||||
{
|
||||
Location currentLocation = SimManager.getInstance().getMobilityModel().getLocation(task.getMobileDeviceId(),CloudSim.clock()+WanDelay);
|
||||
if(task.getSubmittedLocation().getServingWlanId() == currentLocation.getServingWlanId())
|
||||
{
|
||||
networkModel.downloadStarted(task.getSubmittedLocation(), SimSettings.CLOUD_DATACENTER_ID);
|
||||
SimLogger.getInstance().setDownloadDelay(task.getCloudletId(), WanDelay, NETWORK_DELAY_TYPES.WAN_DELAY);
|
||||
schedule(getId(), WanDelay, 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.WAN_DELAY);
|
||||
}
|
||||
}
|
||||
else{
|
||||
int nextEvent = RESPONSE_RECEIVED_BY_MOBILE_DEVICE;
|
||||
int nextDeviceForNetworkModel = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
NETWORK_DELAY_TYPES delayType = NETWORK_DELAY_TYPES.WLAN_DELAY;
|
||||
double delay = networkModel.getDownloadDelay(task.getAssociatedHostId(), task.getMobileDeviceId(), task);
|
||||
|
||||
EdgeHost host = (EdgeHost)(SimManager.
|
||||
getInstance().
|
||||
getEdgeServerManager().
|
||||
getDatacenterList().get(task.getAssociatedHostId()).
|
||||
getHostList().get(0));
|
||||
|
||||
//if neighbor edge device is selected
|
||||
if(host.getLocation().getServingWlanId() != task.getSubmittedLocation().getServingWlanId())
|
||||
{
|
||||
delay = networkModel.getDownloadDelay(SimSettings.GENERIC_EDGE_DEVICE_ID, SimSettings.GENERIC_EDGE_DEVICE_ID, task);
|
||||
nextEvent = RESPONSE_RECEIVED_BY_EDGE_DEVICE_TO_RELAY_MOBILE_DEVICE;
|
||||
nextDeviceForNetworkModel = SimSettings.GENERIC_EDGE_DEVICE_ID + 1;
|
||||
delayType = NETWORK_DELAY_TYPES.MAN_DELAY;
|
||||
}
|
||||
|
||||
if(delay > 0)
|
||||
{
|
||||
Location currentLocation = SimManager.getInstance().getMobilityModel().getLocation(task.getMobileDeviceId(),CloudSim.clock()+delay);
|
||||
if(task.getSubmittedLocation().getServingWlanId() == currentLocation.getServingWlanId())
|
||||
{
|
||||
networkModel.downloadStarted(currentLocation, nextDeviceForNetworkModel);
|
||||
SimLogger.getInstance().setDownloadDelay(task.getCloudletId(), delay, delayType);
|
||||
|
||||
schedule(getId(), delay, nextEvent, task);
|
||||
}
|
||||
else
|
||||
{
|
||||
SimLogger.getInstance().failedDueToMobility(task.getCloudletId(), CloudSim.clock());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SimLogger.getInstance().failedDueToBandwidth(task.getCloudletId(), CloudSim.clock(), delayType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 UPDATE_MM1_QUEUE_MODEL:
|
||||
{
|
||||
((FuzzyExperimentalNetworkModel)networkModel).updateMM1QueeuModel();
|
||||
schedule(getId(), MM1_QUEUE_MODEL_UPDATE_INTEVAL, UPDATE_MM1_QUEUE_MODEL);
|
||||
|
||||
break;
|
||||
}
|
||||
case REQUEST_RECEIVED_BY_CLOUD:
|
||||
{
|
||||
Task task = (Task) ev.getData();
|
||||
networkModel.uploadFinished(task.getSubmittedLocation(), SimSettings.CLOUD_DATACENTER_ID);
|
||||
submitTaskToVm(task, SimSettings.VM_TYPES.CLOUD_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 REQUEST_RECEIVED_BY_REMOTE_EDGE_DEVICE:
|
||||
{
|
||||
Task task = (Task) ev.getData();
|
||||
networkModel.uploadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID+1);
|
||||
submitTaskToVm(task, SimSettings.VM_TYPES.EDGE_VM);
|
||||
|
||||
break;
|
||||
}
|
||||
case REQUEST_RECEIVED_BY_EDGE_DEVICE_TO_RELAY_NEIGHBOR:
|
||||
{
|
||||
Task task = (Task) ev.getData();
|
||||
networkModel.uploadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID);
|
||||
|
||||
double manDelay = networkModel.getUploadDelay(SimSettings.GENERIC_EDGE_DEVICE_ID, SimSettings.GENERIC_EDGE_DEVICE_ID, task);
|
||||
if(manDelay>0){
|
||||
networkModel.uploadStarted(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID+1);
|
||||
SimLogger.getInstance().setUploadDelay(task.getCloudletId(), manDelay, NETWORK_DELAY_TYPES.MAN_DELAY);
|
||||
schedule(getId(), manDelay, REQUEST_RECEIVED_BY_REMOTE_EDGE_DEVICE, task);
|
||||
}
|
||||
else
|
||||
{
|
||||
//SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
|
||||
SimLogger.getInstance().rejectedDueToBandwidth(
|
||||
task.getCloudletId(),
|
||||
CloudSim.clock(),
|
||||
SimSettings.VM_TYPES.EDGE_VM.ordinal(),
|
||||
NETWORK_DELAY_TYPES.MAN_DELAY);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case RESPONSE_RECEIVED_BY_EDGE_DEVICE_TO_RELAY_MOBILE_DEVICE:
|
||||
{
|
||||
Task task = (Task) ev.getData();
|
||||
networkModel.downloadFinished(task.getSubmittedLocation(), SimSettings.GENERIC_EDGE_DEVICE_ID+1);
|
||||
|
||||
//SimLogger.printLine(CloudSim.clock() + ": " + getName() + ": task #" + task.getCloudletId() + " received from edge");
|
||||
double delay = networkModel.getDownloadDelay(task.getAssociatedHostId(), 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(currentLocation, 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);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case RESPONSE_RECEIVED_BY_MOBILE_DEVICE:
|
||||
{
|
||||
Task task = (Task) ev.getData();
|
||||
|
||||
if(task.getAssociatedDatacenterId() == SimSettings.CLOUD_DATACENTER_ID)
|
||||
networkModel.downloadFinished(task.getSubmittedLocation(), SimSettings.CLOUD_DATACENTER_ID);
|
||||
else if(task.getAssociatedDatacenterId() != SimSettings.MOBILE_DATACENTER_ID)
|
||||
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(TaskProperty edgeTask) {
|
||||
int vmType=0;
|
||||
int nextEvent=0;
|
||||
int nextDeviceForNetworkModel;
|
||||
NETWORK_DELAY_TYPES delayType;
|
||||
double delay=0;
|
||||
|
||||
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.CLOUD_DATACENTER_ID){
|
||||
delay = networkModel.getUploadDelay(task.getMobileDeviceId(), SimSettings.CLOUD_DATACENTER_ID, task);
|
||||
vmType = SimSettings.VM_TYPES.CLOUD_VM.ordinal();
|
||||
nextEvent = REQUEST_RECEIVED_BY_CLOUD;
|
||||
delayType = NETWORK_DELAY_TYPES.WAN_DELAY;
|
||||
nextDeviceForNetworkModel = SimSettings.CLOUD_DATACENTER_ID;
|
||||
}
|
||||
else {
|
||||
delay = networkModel.getUploadDelay(task.getMobileDeviceId(), SimSettings.GENERIC_EDGE_DEVICE_ID, task);
|
||||
vmType = SimSettings.VM_TYPES.EDGE_VM.ordinal();
|
||||
nextEvent = REQUEST_RECEIVED_BY_EDGE_DEVICE;
|
||||
delayType = NETWORK_DELAY_TYPES.WLAN_DELAY;
|
||||
nextDeviceForNetworkModel = SimSettings.GENERIC_EDGE_DEVICE_ID;
|
||||
}
|
||||
|
||||
if(delay>0){
|
||||
|
||||
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());
|
||||
|
||||
if(selectedVM instanceof EdgeVM){
|
||||
EdgeHost host = (EdgeHost)(selectedVM.getHost());
|
||||
|
||||
//if neighbor edge device is selected
|
||||
if(host.getLocation().getServingWlanId() != task.getSubmittedLocation().getServingWlanId()){
|
||||
nextEvent = REQUEST_RECEIVED_BY_EDGE_DEVICE_TO_RELAY_NEIGHBOR;
|
||||
}
|
||||
}
|
||||
networkModel.uploadStarted(currentLocation, nextDeviceForNetworkModel);
|
||||
|
||||
SimLogger.getInstance().taskStarted(task.getCloudletId(), CloudSim.clock());
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//SimLogger.printLine("Task #" + task.getCloudletId() + " cannot assign to any VM");
|
||||
SimLogger.getInstance().rejectedDueToBandwidth(task.getCloudletId(), CloudSim.clock(), vmType, 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(TaskProperty edgeTask){
|
||||
UtilizationModel utilizationModel = new UtilizationModelFull(); /*UtilizationModelStochastic*/
|
||||
UtilizationModel utilizationModelCPU = getCpuUtilizationModel();
|
||||
|
||||
Task task = new Task(edgeTask.getMobileDeviceId(), ++taskIdCounter,
|
||||
edgeTask.getLength(), edgeTask.getPesNumber(),
|
||||
edgeTask.getInputFileSize(), edgeTask.getOutputFileSize(),
|
||||
utilizationModelCPU, utilizationModel, utilizationModel);
|
||||
|
||||
//set the owner of this task
|
||||
task.setUserId(this.getId());
|
||||
task.setTaskType(edgeTask.getTaskType());
|
||||
|
||||
if (utilizationModelCPU instanceof CpuUtilizationModel_Custom) {
|
||||
((CpuUtilizationModel_Custom)utilizationModelCPU).setTask(task);
|
||||
}
|
||||
|
||||
return task;
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - Sample Scenario Factory
|
||||
*
|
||||
* Description: Sample 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_app4;
|
||||
|
||||
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.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;
|
||||
import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
|
||||
import edu.boun.edgecloudsim.network.NetworkModel;
|
||||
|
||||
public class FuzzyScenarioFactory implements ScenarioFactory {
|
||||
private int numOfMobileDevice;
|
||||
private double simulationTime;
|
||||
private String orchestratorPolicy;
|
||||
private String simScenario;
|
||||
|
||||
FuzzyScenarioFactory(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 FuzzyEdgeOrchestrator(orchestratorPolicy, simScenario);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobilityModel getMobilityModel() {
|
||||
return new NomadicMobility(numOfMobileDevice,simulationTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NetworkModel getNetworkModel() {
|
||||
return new FuzzyExperimentalNetworkModel(numOfMobileDevice, simScenario);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdgeServerManager getEdgeServerManager() {
|
||||
return new DefaultEdgeServerManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CloudServerManager getCloudServerManager() {
|
||||
return new DefaultCloudServerManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileServerManager getMobileServerManager() {
|
||||
return new DefaultMobileServerManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileDeviceManager getMobileDeviceManager() throws Exception {
|
||||
return new FuzzyMobileDeviceManager();
|
||||
}
|
||||
}
|
39
src/edu/boun/edgecloudsim/applications/sample_app4/README.md
Executable file
39
src/edu/boun/edgecloudsim/applications/sample_app4/README.md
Executable file
@ -0,0 +1,39 @@
|
||||
# Sample Application 4
|
||||
|
||||
This application includes the source code which is used in our paper submitted to IEEE Transactions on Network and Service Management [[1]](https://www.comsoc.org/publications/journals/ieee-tnsm).
|
||||
|
||||
The digital object identifier of the paper will be provide after it is published!
|
||||
|
||||
## Fuzzy Logic Based Workload Orchestrator
|
||||
|
||||
In this application we introduce a fuzzy logic based workload orchestrator. In our design, two stage fuzzy logic system is used as shown in Figure 1. In the first stage, the most convenient edge server in the edge layer is found. In the second stage, the candidate edge server and the cloud server are compared. As a result of these operations, the proposed fuzzy logic based workload orchestrator finds a target server which can be the local edge server, remote edge server or the cloud server.
|
||||
|
||||
<p align="center">
|
||||
<img src="/doc/images/sample_app4/fls.png" width="50%">
|
||||
<p align="center">
|
||||
Figure 1: Two stage fuzzy workload orchestration.
|
||||
</p>
|
||||
</p>
|
||||
|
||||
## Why Fuzzy Logic
|
||||
|
||||
* Computation offloading is NP-Hard with many inputs and output variables
|
||||
* Fuzzy logic easily handles multi-constraint optimization process
|
||||
* There is no simple decision model for offloading
|
||||
* Fuzzy logic lets us handle the uncertainty with simple if-then rules
|
||||
* Fuzzy logic abstracts complex operational details in a high level human understandable format
|
||||
|
||||
## Simulated Environment
|
||||
|
||||
A university campus environment is simulated in this application. The students demand services from the edge servers within the campus while moving around the predesignated locations such as the classroom buildings, cafeteria, dormitories, and administrative offices. The individuals are assumed to carry and/or wear the mobile gadgets which continuously run applications that in turn create a traffic due to offloading of the tasks. There exists certain number of edge servers located in the campus such that they provide coverage for edge computing requests. A user is connected to the nearest edge server via WLAN whereas the edge servers are interconnected by MAN. Also, the standard cloud infrastructure can be accessed over WAN. In this setting, it is possible for the user to offload a task to (i) Nearest edge server (we call this the local edge server) (ii) a neighboring edge server within the campus connected by AN (we call this the remote edge server), and (iii) to the global cloud servers. In our work, this decision is handled by the workload orchestrator.
|
||||
|
||||
<p align="center">
|
||||
<img src="/doc/images/sample_app4/env.png" width="75%">
|
||||
<p align="center">
|
||||
Figure 2: A university campus scenario representing multiple locations.
|
||||
</p>
|
||||
</p>
|
||||
|
||||
|
||||
## References
|
||||
**[1]** IEEE Transactions on Network and Service Management, [Online]. Available: https://www.comsoc.org/publications/journals/ieee-tnsm. [Accessed: 21- Jan- 2019].
|
@ -30,7 +30,7 @@ import edu.boun.edgecloudsim.edge_client.mobile_processing_unit.MobileServerMana
|
||||
import edu.boun.edgecloudsim.mobility.MobilityModel;
|
||||
import edu.boun.edgecloudsim.task_generator.LoadGeneratorModel;
|
||||
import edu.boun.edgecloudsim.network.NetworkModel;
|
||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||
|
||||
public class SimManager extends SimEntity {
|
||||
@ -196,7 +196,7 @@ public class SimManager extends SimEntity {
|
||||
|
||||
//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));
|
||||
schedule(getId(), loadGeneratorModel.getTaskList().get(i).getStartTime(), CREATE_TASK, loadGeneratorModel.getTaskList().get(i));
|
||||
|
||||
//Periodic event loops starts from here!
|
||||
schedule(getId(), 5, CHECK_ALL_VM);
|
||||
@ -213,7 +213,7 @@ public class SimManager extends SimEntity {
|
||||
switch (ev.getTag()) {
|
||||
case CREATE_TASK:
|
||||
try {
|
||||
EdgeTask edgeTask = (EdgeTask) ev.getData();
|
||||
TaskProperty edgeTask = (TaskProperty) ev.getData();
|
||||
mobileDeviceManager.submitTask(edgeTask);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -26,7 +26,7 @@ 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.network.NetworkModel;
|
||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
import edu.boun.edgecloudsim.utils.Location;
|
||||
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||
|
||||
@ -167,7 +167,7 @@ public class DefaultMobileDeviceManager extends MobileDeviceManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void submitTask(EdgeTask edgeTask) {
|
||||
public void submitTask(TaskProperty edgeTask) {
|
||||
NetworkModel networkModel = SimManager.getInstance().getNetworkModel();
|
||||
|
||||
//create a task
|
||||
@ -271,18 +271,18 @@ public class DefaultMobileDeviceManager extends MobileDeviceManager {
|
||||
}
|
||||
}
|
||||
|
||||
private Task createTask(EdgeTask edgeTask){
|
||||
private Task createTask(TaskProperty edgeTask){
|
||||
UtilizationModel utilizationModel = new UtilizationModelFull(); /*UtilizationModelStochastic*/
|
||||
UtilizationModel utilizationModelCPU = getCpuUtilizationModel();
|
||||
|
||||
Task task = new Task(edgeTask.mobileDeviceId, ++taskIdCounter,
|
||||
edgeTask.length, edgeTask.pesNumber,
|
||||
edgeTask.inputFileSize, edgeTask.outputFileSize,
|
||||
Task task = new Task(edgeTask.getMobileDeviceId(), ++taskIdCounter,
|
||||
edgeTask.getLength(), edgeTask.getPesNumber(),
|
||||
edgeTask.getInputFileSize(), edgeTask.getOutputFileSize(),
|
||||
utilizationModelCPU, utilizationModel, utilizationModel);
|
||||
|
||||
//set the owner of this task
|
||||
task.setUserId(this.getId());
|
||||
task.setTaskType(edgeTask.taskType);
|
||||
task.setTaskType(edgeTask.getTaskType());
|
||||
|
||||
if (utilizationModelCPU instanceof CpuUtilizationModel_Custom) {
|
||||
((CpuUtilizationModel_Custom)utilizationModelCPU).setTask(task);
|
||||
|
@ -3,7 +3,7 @@ package edu.boun.edgecloudsim.edge_client;
|
||||
import org.cloudbus.cloudsim.DatacenterBroker;
|
||||
import org.cloudbus.cloudsim.UtilizationModel;
|
||||
|
||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
|
||||
public abstract class MobileDeviceManager extends DatacenterBroker {
|
||||
|
||||
@ -21,5 +21,5 @@ public abstract class MobileDeviceManager extends DatacenterBroker {
|
||||
*/
|
||||
public abstract UtilizationModel getCpuUtilizationModel();
|
||||
|
||||
public abstract void submitTask(EdgeTask edgeTask);
|
||||
public abstract void submitTask(TaskProperty edgeTask);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ import java.util.ArrayList;
|
||||
import org.apache.commons.math3.distribution.ExponentialDistribution;
|
||||
|
||||
import edu.boun.edgecloudsim.core.SimSettings;
|
||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
import edu.boun.edgecloudsim.utils.SimLogger;
|
||||
import edu.boun.edgecloudsim.utils.SimUtils;
|
||||
|
||||
@ -30,7 +30,7 @@ public class IdleActiveLoadGenerator extends LoadGeneratorModel{
|
||||
|
||||
@Override
|
||||
public void initializeModel() {
|
||||
taskList = new ArrayList<EdgeTask>();
|
||||
taskList = new ArrayList<TaskProperty>();
|
||||
|
||||
//exponential number generator for file input size, file output size and task length
|
||||
ExponentialDistribution[][] expRngList = new ExponentialDistribution[SimSettings.getInstance().getTaskLookUpTable().length][3];
|
||||
@ -90,7 +90,7 @@ public class IdleActiveLoadGenerator extends LoadGeneratorModel{
|
||||
continue;
|
||||
}
|
||||
|
||||
taskList.add(new EdgeTask(i,randomTaskType, virtualTime, expRngList));
|
||||
taskList.add(new TaskProperty(i,randomTaskType, virtualTime, expRngList));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ package edu.boun.edgecloudsim.task_generator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import edu.boun.edgecloudsim.utils.EdgeTask;
|
||||
import edu.boun.edgecloudsim.utils.TaskProperty;
|
||||
|
||||
public abstract class LoadGeneratorModel {
|
||||
protected List<EdgeTask> taskList;
|
||||
protected List<TaskProperty> taskList;
|
||||
protected int numberOfMobileDevices;
|
||||
protected double simulationTime;
|
||||
protected String simScenario;
|
||||
@ -33,7 +33,7 @@ public abstract class LoadGeneratorModel {
|
||||
* each task has a virtual start time
|
||||
* it will be used while generating task
|
||||
*/
|
||||
public List<EdgeTask> getTaskList() {
|
||||
public List<TaskProperty> getTaskList() {
|
||||
return taskList;
|
||||
}
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - EdgeTask
|
||||
*
|
||||
* Description:
|
||||
* A custom class used in Load Generator Model to store tasks information
|
||||
*
|
||||
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
|
||||
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
|
||||
*/
|
||||
|
||||
package edu.boun.edgecloudsim.utils;
|
||||
|
||||
import org.apache.commons.math3.distribution.ExponentialDistribution;
|
||||
|
||||
import edu.boun.edgecloudsim.core.SimSettings;
|
||||
|
||||
public class EdgeTask {
|
||||
public double startTime;
|
||||
public long length, inputFileSize, outputFileSize;
|
||||
public int taskType;
|
||||
public int pesNumber;
|
||||
public int mobileDeviceId;
|
||||
|
||||
public EdgeTask(int _mobileDeviceId, int _taskType, double _startTime, ExponentialDistribution[][] expRngList) {
|
||||
mobileDeviceId=_mobileDeviceId;
|
||||
startTime=_startTime;
|
||||
taskType=_taskType;
|
||||
|
||||
inputFileSize = (long)expRngList[_taskType][0].sample();
|
||||
outputFileSize =(long)expRngList[_taskType][1].sample();
|
||||
length = (long)expRngList[_taskType][2].sample();
|
||||
|
||||
pesNumber = (int)SimSettings.getInstance().getTaskLookUpTable()[_taskType][8];
|
||||
}
|
||||
}
|
73
src/edu/boun/edgecloudsim/utils/TaskProperty.java
Normal file
73
src/edu/boun/edgecloudsim/utils/TaskProperty.java
Normal file
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Title: EdgeCloudSim - EdgeTask
|
||||
*
|
||||
* Description:
|
||||
* A custom class used in Load Generator Model to store tasks information
|
||||
*
|
||||
* Licence: GPL - http://www.gnu.org/copyleft/gpl.html
|
||||
* Copyright (c) 2017, Bogazici University, Istanbul, Turkey
|
||||
*/
|
||||
|
||||
package edu.boun.edgecloudsim.utils;
|
||||
|
||||
import org.apache.commons.math3.distribution.ExponentialDistribution;
|
||||
|
||||
import edu.boun.edgecloudsim.core.SimSettings;
|
||||
|
||||
public class TaskProperty {
|
||||
private double startTime;
|
||||
private long length, inputFileSize, outputFileSize;
|
||||
private int taskType;
|
||||
private int pesNumber;
|
||||
private int mobileDeviceId;
|
||||
|
||||
public TaskProperty(double _startTime, int _mobileDeviceId, int _taskType, int _pesNumber, long _length, long _inputFileSize, long _outputFileSize) {
|
||||
startTime=_startTime;
|
||||
mobileDeviceId=_mobileDeviceId;
|
||||
taskType=_taskType;
|
||||
pesNumber = _pesNumber;
|
||||
length = _length;
|
||||
outputFileSize = _inputFileSize;
|
||||
inputFileSize = _outputFileSize;
|
||||
}
|
||||
|
||||
public TaskProperty(int _mobileDeviceId, int _taskType, double _startTime, ExponentialDistribution[][] expRngList) {
|
||||
mobileDeviceId=_mobileDeviceId;
|
||||
startTime=_startTime;
|
||||
taskType=_taskType;
|
||||
|
||||
inputFileSize = (long)expRngList[_taskType][0].sample();
|
||||
outputFileSize =(long)expRngList[_taskType][1].sample();
|
||||
length = (long)expRngList[_taskType][2].sample();
|
||||
|
||||
pesNumber = (int)SimSettings.getInstance().getTaskLookUpTable()[_taskType][8];
|
||||
}
|
||||
|
||||
public double getStartTime(){
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public long getLength(){
|
||||
return length;
|
||||
}
|
||||
|
||||
public long getInputFileSize(){
|
||||
return inputFileSize;
|
||||
}
|
||||
|
||||
public long getOutputFileSize(){
|
||||
return outputFileSize;
|
||||
}
|
||||
|
||||
public int getTaskType(){
|
||||
return taskType;
|
||||
}
|
||||
|
||||
public int getPesNumber(){
|
||||
return pesNumber;
|
||||
}
|
||||
|
||||
public int getMobileDeviceId(){
|
||||
return mobileDeviceId;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user