This repository has been archived by the owner on Jul 5, 2021. It is now read-only.
forked from darolt/wsn
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
152 lines (134 loc) · 4.46 KB
/
config.py
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
import math
# Describe the scenarios that will be simulated
# scenarios should be described in the following format:
# scenario_name = (routing_topology, sleep_scheduling, aggregation_model)
# where routing_topology may be:
# 'DC' : Direct Communication
# 'MTE' : Minimum Transmission Energy
# 'LEACH': LEACH
# 'FCM ': Fuzzy C-Means
# and sleep_scheduling may be:
# None : No sleep scheduling (mind that None is not a string)
# 'Pso' : Particle Swarm Optimization
# 'ModifiedPso' : Modified PSO
# 'GeneticAlgorithm' : Genetic Algorithm
# 'Ecca' : Energy Efficient Collision Aware Multipath Routing
# and aggregation_model may be:
# 'zero' : Zero cost
# 'total' : 100% cost
# 'linear': TODO spec
# 'log' : log cost
# the 4th argument is the nickname of that plot, if not specified (None),
# then the name is: routing_topology + sleep_scheduling
# for convenience, the scenarios list also accepts commands that are
# executed in run.py
scenario0 = ('DC', None, 'zero', None)
scenario1 = ('LEACH', None, 'zero', None)
scenario2 = ('MTE', None, 'total', None)
scenario3 = ('FCM', None, 'zero', None)
scenario4 = ('FCM', 'ModifiedPso', 'zero', 'LFE')
scenario5 = ('FCM', 'Pso', 'zero', None)
scenario6 = ('FCM', 'Ecca', 'zero', 'ECCA')
scenario7 = ('FCM', 'GeneticAlgorithm', 'zero', None)
scenario31 = ('FCM', None, 'zero', 'BS at (125,125)')
scenario32 = ('FCM', None, 'zero', 'BS at (65,65)')
scenario33 = ('FCM', None, 'zero', 'BS at (0,0)')
scenario34 = ('FCM', None, 'zero', 'BS at (-65,-65)')
# list with all scenarios to simulate
# example of configuration to get first part of results
#scenarios = [
# "cf.FITNESS_ALPHA=0.5",
# "cf.FITNESS_BETA=0.5",
#scenario3,
# "plot_clusters(network)",
# scenario0,
#scenario1,
#scenario2,
#scenario5,
# scenario4,
# "plot_time_of_death(network)",
# "plot_traces(traces)",
# "network.get_BS().pos_y=-75.0",
# scenario3,
# scenario0,
# scenario1,
# scenario2,
# scenario5,
# scenario4,
# "save2csv(traces)",
# ]
scenarios = [
"cf.FITNESS_ALPHA=0.7",
"cf.FITNESS_BETA=0.3",
scenario4,
scenario6,
"save2csv_raw(traces)",
"plot_traces(traces)",
]
## tracer options
TRACE_ENERGY = 1
TRACE_ALIVE_NODES = 1
TRACE_COVERAGE = 1
TRACE_LEARNING_CURVE = 0
## Runtime configuration
MAX_ROUNDS = 15000
# number of transmissions of sensed information to cluster heads or to
# base station (per round)
MAX_TX_PER_ROUND = 1
NOTIFY_POSITION = 0
## Network configurations:
# number of nodes
NB_NODES = 200
# node sensor range
COVERAGE_RADIUS = 75 # meters
MIN_RADIUS = 10
MAX_RADIUS = 20
# node transmission range
TX_RANGE = 150 # meters
BSID = -1
# area definition
AREA_WIDTH = 1000.0
AREA_LENGTH = 1000.0
AREA_DEPTH = 1000.0
# base station position
BS_POS_X = 500.0
BS_POS_Y = 500.0
BS_POS_D = 0.0
# packet configs
MSG_LENGTH = 4000 # bits
HEADER_LENGTH = 150 # bits
# initial energy at every node's battery
INITIAL_ENERGY = 2 # Joules
## Energy Configurations
# energy dissipated at the transceiver electronic (/bit)
E_ELEC = 50e-9 # Joules
# energy dissipated at the data aggregation (/bit)
E_DA = 5e-9 # Joules
# energy dissipated at the power amplifier (supposing a multi-path
# fading channel) (/bin/m^4)
E_MP = 0.0013e-12 # Joules
# energy dissipated at the power amplifier (supposing a line-of-sight
# free-space channel (/bin/m^2)
E_FS = 10e-12 # Joules
THRESHOLD_DIST = math.sqrt(E_FS/E_MP) # meters
## Routing configurations:
NB_CLUSTERS = 5
# FCM fuzzyness coeficient
FUZZY_M = 2
## Sleep Scheduling configurations:
NB_INDIVIDUALS = 10
MAX_ITERATIONS = 50
# ALPHA and BETA are the fitness function' weights
# where ALPHA optimizes energy lifetime, BETA the coverage
FITNESS_ALPHA = 0.34
FITNESS_BETA = 0.33
FITNESS_GAMMA = 0.33
WMAX = 0.6
WMIN = 0.1
## Other configurations:
# grid precision (the bigger the faster the simulation)
GRID_PRECISION = 1 # in meters
# useful constants (for readability)
INFINITY = float('inf')
MINUS_INFINITY = float('-inf')
RESULTS_PATH = './results/'