Skip to content

Commit ee1f991

Browse files
author
LucaParenti
committed
Merge remote-tracking branch 'origin/develop'
2 parents 607366c + d5986b5 commit ee1f991

32 files changed

+953
-563
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ cleanall: checkmakefiles
99
cd src && $(MAKE) MODE=debug clean
1010
rm -f src/Makefile
1111

12+
# makefiles:
13+
# cd src && opp_makemake -f --deep
14+
1215
makefiles:
13-
cd src && opp_makemake -f --deep
16+
cd src && opp_makemake -f --deep -O out -KINET_PROJ=../../inet -KVEINS_VEINS_5_2_PROJ=../../veins-veins-5.2 -DINET_IMPORT -DVEINS_IMPORT -I. -I$$\(INET_PROJ\)/src -I$$\(VEINS_VEINS_5_2_PROJ\)/src -Isrc -L$$\(INET_PROJ\)/src -L$$\(VEINS_VEINS_5_2_PROJ\)/src -lINET$$\(D\) -lveins$$\(D\)
1417

1518
checkmakefiles:
1619
@if [ ! -f src/Makefile ]; then \

simulations/task_offloading/omnetpp.ini

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ print-undisposed = true
4848
# #
4949
# #
5050
##########################################################
51-
#*.rsu[0].mobility.x = 2000
52-
#*.rsu[0].mobility.y = 2000
53-
#*.rsu[0].mobility.z = 3
51+
# *.rsu[0].mobility.x = 2000
52+
# *.rsu[0].mobility.y = 2000
53+
# *.rsu[0].mobility.z = 3
5454
#
55-
#*.rsu[*].applType = "RSU"
56-
#*.rsu[*].appl.headerLength = 80 bit
57-
#*.rsu[*].appl.sendBeacons = false
58-
#*.rsu[*].appl.dataOnSch = false
59-
#*.rsu[*].appl.beaconInterval = 1s
60-
#*.rsu[*].appl.beaconUserPriority = 7
61-
#*.rsu[*].appl.dataUserPriority = 5
62-
#*.rsu[*].nic.phy80211p.antennaOffsetZ = 0 m
55+
# *.rsu[*].applType = "RSU"
56+
# *.rsu[*].appl.headerLength = 80 bit
57+
# *.rsu[*].appl.sendBeacons = false
58+
# *.rsu[*].appl.dataOnSch = false
59+
# *.rsu[*].appl.beaconInterval = 1s
60+
# *.rsu[*].appl.beaconUserPriority = 7
61+
# *.rsu[*].appl.dataUserPriority = 5
62+
# *.rsu[*].nic.phy80211p.antennaOffsetZ = 0 m
6363

6464
##########################################################
6565
# 11p specific parameters #
@@ -97,7 +97,7 @@ print-undisposed = true
9797
# App Layer #
9898
##########################################################
9999
# Match the car and bus modules with the XML .rou file
100-
*.manager.moduleDisplayString = ""
100+
*.manager.moduleDisplayString = "BUS='i=veins/node/car_vs' CAR='i=veins/node/car_vs'"
101101
*.manager.moduleType = "BUS=org.car2x.veins.nodes.Car CAR=org.car2x.veins.nodes.Car"
102102
*.manager.moduleName = "BUS=bus CAR=car"
103103

@@ -124,14 +124,25 @@ print-undisposed = true
124124
# -- Task generator -- #
125125
##########################################################
126126
# Time to wait in s for the help request to be sent
127-
*.bus[*].appl.randomTimeHelpMessage = uniform(30s, 40s)
127+
*.bus[*].appl.randomTimeFirstHelpMessage = uniform(30s, 40s)
128+
129+
*.bus[*].appl.randomTimeHelpRequest = uniform(1s, 2s)
128130

129131
# Time in ms for the bus to wait for ok messages
130-
*.bus[*].appl.busWaitingTime = uniform(100ms, 200ms)
132+
*.bus[*].appl.busWaitingTimeForAvailability = uniform(100ms, 200ms)
131133

132134
# Time in s for data computation extra time
133135
*.bus[*].appl.dataComputationThreshold = uniform(500ms, 600ms)
134136

137+
# Total computation load for the bus
138+
*.bus[*].appl.computationLoad = 10MB
139+
140+
# Bus load capacity
141+
*.bus[*].appl.busVehicleLoad = 4MB
142+
143+
# The minimum vehicle load accepted by the bus
144+
*.bus[*].appl.minimumVehicleLoadRequested = 700kB
145+
135146
# Select sorting algorithm for load balancing
136147
# Types available: FIFO, ComputationTime
137148
*.loadBalancingAlgorithm.typename = "ComputationTime"
@@ -146,37 +157,32 @@ print-undisposed = true
146157
*.car[*].appl.stillAvailableThreshold = 0.5
147158

148159
# The common load of all vehicles except for bus
149-
*.car[*].appl.commonVehicleLoad = 1GB
160+
*.car[*].appl.commonVehicleLoad = 1MB
150161

151162
# Time in ms for the ok messages
152-
*.car[*].appl.vehicleOkMessageTime = uniform(0ms, 100ms)
163+
*.car[*].appl.vehicleAvailabilityMessageTime = uniform(0ms, 100ms)
153164

154165
# Time in s for ack message extra time
155166
*.car[*].appl.ackMessageThreshold = uniform(300ms, 400ms)
156167

168+
# These parameters are for the current load of a vehicle and the
169+
# respective CPU frequency
170+
*.car[*].appl.randomVehicleFreeLoadPercentage = uniform(0, 1)
171+
*.car[*].appl.randomVehicleCpuFreq = uniform(1.20GHz, 2.70GHz)
172+
157173
##########################################################
158174
# Task offloading parameters #
159175
# -- Shared -- #
160176
##########################################################
161-
# CPI for all vehicles
162-
*.**[*].appl.vehicleCPI = 3
163-
164-
# These parameters are for the current load of a vehicle and the
165-
# respective CPU frequency
166-
*.**[*].appl.randomVehicleLoadActual = uniform(0, 1)
167-
*.**[*].appl.randomCpuVehicleFreq = uniform(1.20GHz, 2.70GHz)
168-
169-
# The minimum vehicle load accepted by the bus
170-
*.**[*].appl.minimumVehicleLoadActual = 700MB
171177

172178
[Config Default]
173179

174180
[Config WithBeaconing]
175-
#*.rsu[*].appl.sendBeacons = true
181+
# *.rsu[*].appl.sendBeacons = true
176182
*.**[*].appl.sendBeacons = true
177183

178184
[Config WithChannelSwitching]
179185
*.**.nic.mac1609_4.useServiceChannel = true
180186
*.**[*].appl.dataOnSch = true
181-
#*.rsu[*].appl.dataOnSch = true
187+
# *.rsu[*].appl.dataOnSch = true
182188

src/app/Task.cc

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
//
2+
// This program is free software: you can redistribute it and/or modify
3+
// it under the terms of the GNU Lesser General Public License as published by
4+
// the Free Software Foundation, either version 3 of the License, or
5+
// (at your option) any later version.
6+
//
7+
// This program is distributed in the hope that it will be useful,
8+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
// GNU Lesser General Public License for more details.
11+
//
12+
// You should have received a copy of the GNU Lesser General Public License
13+
// along with this program. If not, see http://www.gnu.org/licenses/.
14+
//
15+
16+
#include "Task.h"
17+
18+
using namespace task_offloading;
19+
20+
/**
21+
* Constructors section
22+
*/
23+
24+
Task::Task() {
25+
this->id = 0;
26+
this->data = 10e6;
27+
this->helpReceivedCounter = 0;
28+
this->dataPartitionId = 0;
29+
this->loadBalancingId = 0;
30+
this->availableReceivedCounter = 0;
31+
this->responseReceivedCounter = 0;
32+
this->cpi = 1;
33+
}
34+
35+
Task::Task(int id, double data, double loadRequested, int cpi) {
36+
this->id = id;
37+
this->data = data;
38+
this->minimumLoadRequested = loadRequested;
39+
this->helpReceivedCounter = 0;
40+
this->dataPartitionId = 0;
41+
this->loadBalancingId = 0;
42+
this->availableReceivedCounter = 0;
43+
this->responseReceivedCounter = 0;
44+
this->cpi = cpi;
45+
}
46+
47+
Task::~Task() {
48+
}
49+
50+
/**
51+
* Getters section
52+
*/
53+
54+
/**
55+
* Get the current id of the task
56+
*
57+
* @return int
58+
*/
59+
int Task::getId() {
60+
return this->id;
61+
}
62+
63+
/**
64+
* Get the total computation data
65+
*
66+
* @return double
67+
*/
68+
double Task::getData() {
69+
return this->data;
70+
}
71+
72+
/**
73+
* Get the counter of how many times the BUS received help
74+
*
75+
* @return int
76+
*/
77+
int Task::getHelpReceivedCounter() {
78+
return this->helpReceivedCounter;
79+
}
80+
81+
82+
/**
83+
* Get the current data partition id
84+
*
85+
* @return int
86+
*/
87+
int Task::getDataPartitionId() {
88+
return this->dataPartitionId;
89+
}
90+
91+
/**
92+
* Get the current load balancing id
93+
*
94+
* @return int
95+
*/
96+
int Task::getLoadBalancingId() {
97+
return this->loadBalancingId;
98+
}
99+
100+
/**
101+
* Get the counter of vehicles available
102+
*
103+
* @return int
104+
*/
105+
int Task::getAvailableReceivedCounter() {
106+
return this->availableReceivedCounter;
107+
}
108+
109+
/**
110+
* Get the counter of response received from vehicles
111+
*
112+
* @return int
113+
*/
114+
int Task::getResponseReceivedCounter() {
115+
return this->responseReceivedCounter;
116+
}
117+
118+
/**
119+
* Get the minimum load requested accepted by bus
120+
*
121+
* @return double
122+
*/
123+
double Task::getMinimumLoadRequested() {
124+
return this->minimumLoadRequested;
125+
}
126+
127+
/**
128+
* Get the CPI for the task, it's a constant that represent the difficulty of it
129+
*
130+
* @return int
131+
*/
132+
int Task::getCpi() {
133+
return this->cpi;
134+
}
135+
136+
/**
137+
* Setters section
138+
*/
139+
140+
/**
141+
* Set the current task id
142+
*
143+
* @return void
144+
*/
145+
void Task::setId(int newId) {
146+
this->id = newId;
147+
}
148+
149+
/**
150+
* Set the current computation load
151+
*
152+
* @return void
153+
*/
154+
void Task::setData(double newData) {
155+
this->data = newData;
156+
}
157+
158+
/**
159+
* Increment the help received counter by one
160+
*
161+
* @return void
162+
*/
163+
void Task::setHelpReceivedCounter(int newCounter) {
164+
this->helpReceivedCounter = newCounter;
165+
}
166+
167+
/**
168+
* Set the new data partition id
169+
*
170+
* @return void
171+
*/
172+
void Task::setDataPartitionId(int newDataPartitionId) {
173+
this->dataPartitionId = newDataPartitionId;
174+
}
175+
176+
/**
177+
* Set the new load balancing id
178+
*
179+
* @return void
180+
*/
181+
void Task::setLoadBalancingId(int newLoadBalancingId) {
182+
this->loadBalancingId = newLoadBalancingId;
183+
}
184+
185+
/**
186+
* Set the new vehicles available counter
187+
*
188+
* @return void
189+
*/
190+
void Task::setAvailableReceivedCounter(int newCounter) {
191+
this->availableReceivedCounter = newCounter;
192+
}
193+
194+
/**
195+
* Set the new responses received counter
196+
*
197+
* @return void
198+
*/
199+
void Task::setResponseReceivedCounter(int newCounter) {
200+
this->responseReceivedCounter = newCounter;
201+
}
202+
203+
/**
204+
* Set the minimum load requested accepted by bus
205+
*
206+
* @return void
207+
*/
208+
void Task::setMinimumLoadRequested(double newMinimumLoad) {
209+
this->minimumLoadRequested = newMinimumLoad;
210+
}
211+
212+
/**
213+
* Set the CPI for the task, it's a constant that represent the difficulty of it
214+
*
215+
* @return void
216+
*/
217+
void Task::setCpi(int newCpi) {
218+
this->cpi = newCpi;
219+
}

0 commit comments

Comments
 (0)