-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsim_float_parallel_complex.sh
executable file
·268 lines (238 loc) · 5.51 KB
/
sim_float_parallel_complex.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
#!/bin/sh
#
# Simulating floating content for different anchor points every 200m in HCS
#
# IMPORTANT: Remember that hcs_default.txt included in the ONE distribution
# conflicts with hcs_floating.txt and thus hcs_default.txt should not be in
# the directory where you run one.sh (e.g., from this script).
# number of simulation runs
runs=10
# radio range
radio=50
# number of nodes: 40, 80, 160
node_list="160 80 40"
# load expressed as mean interval between messages per node: 3600, 1800, 900
load_list="3600 1800 900"
# anchor point (for simulations with fixed anchor)
x=1800
y=1900
# anchor zone parameters
r=200
r_max=500
r_gran=100
a=500
a_max=2000
a_gran=100
del_alg=none
repl_alg=linear
ratio=1
# number of parallel simulation runs
processes=8
# node buffer
buffer=50M
# interface rate + optional interference
rate=250k
int=
# immediate deletion when leaving the anchor zone?
immediate=
# "real-world" parameterization
loc_error=0
scan=0
size=100k
size_max=1000k
size_gran=100k
ttl=1800
ttl_max=10800
ttl_gran=1800
delay=0
delay_max=0
# restrictions for random anchor points
# default:
x_base=0
y_base=0
max_x=4500
max_y=3400
# restricted to the core area (defined in core-def)
core=
while [ $# -ge 1 ]
do
case $1 in
radio)
radio=$2
shift
shift
;;
nodes)
node_list="$2"
shift
shift
;;
load)
load_list="$2"
shift
shift
;;
r)
r=$2
r_max=$3
shift
shift
shift
;;
a)
a=$2
a_max=$3
shift
shift
shift
;;
ttl)
ttl=$2
ttl_max=$3
shift
shift
shift
;;
buffer)
buffer=$2
shift
shift
;;
size)
size=$2
size_max=$3
shift
shift
shift
;;
rate)
rate=$2
shift
shift
;;
error)
loc_error="$2"_"$3"
gps_update=$2
gps_error=$3
shift
shift
shift
;;
ratio)
ratio=$2
shift
shift
;;
immediate)
immediate=-immediate
shift
;;
core)
# this overwrites base_x, base_y, max_x, and max_y
core=-core
source core-def
shift
;;
proc)
processes=$2
shift
shift
;;
runs)
runs=$2
shift
shift
;;
*)
echo "Parameter error"
exit
;;
esac
done
if [ $ratio \!= 1 ]
then
loc_error=$loc_error"_"$ratio
fi
serial=1
trackdir=.trackdir.$$
scen_base=scen_file.$$
mkdir $trackdir
for nodes in $node_list
do
scenario_base_name=new_$radio"_"$nodes
# for del_alg in none cosine linear exp
for del_alg in none
do
# for repl_alg in none cosine linear exp
for repl_alg in none
do
for load in $load_list
do
# for repl in saf svf stf svf2 stf2 fifo rnd
for repl in stf2
do
scen_file=$scen_base.$serial
date "+%Y-%m-%d %H:%M:%S" | head -c19
echo " [$serial] Running HCS scenario for radio $radio, nodes $nodes, r=$r-$r_max a=$a-$a_max size=$size-$size_max t=$ttl-$ttl_max buffer=$buffer repl=$repl load=$load error=$loc_error delay=$delay-$delay_max scan=$scan int=$int repl_alg=$repl_alg del_alg=$del_alg"
echo "Scenario.name=$scenario_base_name-r$r-$r_max-a$a-$a_max-t$ttl-$ttl_max-s$size-$size_max-b$buffer-d$rate-l$load-e$loc_error-D$delay-$delay_max-s$scan-$repl-R$repl_alg-E$del_alg$immediate$int$core" > $scen_file
echo "firstinterface.transmitSpeed = $rate" >> $scen_file
if [ a$immediate = a-immediate ]
then
echo "FloatingContentRouter.deletionPolicy = immediate" >> $scen_file
else
echo "FloatingContentRouter.deletionPolicy = encounter" >> $scen_file
fi
if [ a$gps_error \!= a ]
then
echo "FloatingContentRouter.locationError = $gps_error" >> $scen_file
echo "FloatingContentRouter.locationSource = gps" >> $scen_file
fi
if [ a$gps_update \!= a ]
then
echo "FloatingContentRouter.locationUpdate = $gps_update" >> $scen_file
echo "FloatingContentRouter.locationSource = gps" >> $scen_file
fi
if [ $ratio \!= 1 ]
then
echo "FloatingContentRouter.locationRatio = $ratio" >> $scen_file
fi
echo "FloatingContentRouter.replicationPolicy = $repl" >> $scen_file
echo "FloatingContentRouter.replicationAlgorithm = $repl_alg" >> $scen_file
echo "FloatingContentRouter.deletionAlgorithm = $del_alg" >> $scen_file
echo "floatingApp.anchor = $x_base,$y_base,$r,$a" >> $scen_file
echo "floatingApp.anchorMax = $max_x,$max_y,$r_max,$a_max" >> $scen_file
echo "floatingApp.anchorGranularity = 1,1,$r_gran,$a_gran" >> $scen_file
echo "floatingApp.ttl = $ttl,$ttl_max,$ttl_gran" >> $scen_file
echo "floatingApp.interval = $load" >> $scen_file
echo "floatingApp.start = 0" >> $scen_file
echo "firstinterface.transmitRange = $radio" >> $scen_file
echo "Group.nrofHosts = $nodes" >> $scen_file
trams=`expr $nodes / 20`
echo "Group4.nrofHosts = $trams" >> $scen_file
echo "Group5.nrofHosts = $trams" >> $scen_file
echo "Group6.nrofHosts = $trams" >> $scen_file
echo "Group.bufferSize = $buffer" >> $scen_file
ttl_min=`expr $ttl_max / 60 + 1`
ttl_min=$ttl_max
echo "Group.msgTtl = $ttl_min" >> $scen_file
echo "floatingApp.messageSize = $size,$size_max,$size_gran" >> $scen_file
touch $trackdir/$serial
(
./one.sh -b $runs hcs_floating.txt floating_app.txt $scen_file > $trackdir/$serial ; rm $trackdir/$serial
) &
serial=`expr $serial + 1`
while [ `ls $trackdir | wc -l` -ge $processes ]
do
sleep 10
done
done # repl (prio)
done # load
done # repl_alg
done # del_alg
done # nodes
if [ `ls $trackdir | wc -l` -gt 0 ]
then
wait
fi
rmdir .trackdir.$$
rm $scen_base.*