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
|
import openwns
from openwns.pyconfig import Frozen
import openwns.evaluation.default
import scenarios
import scenarios.builders
import scenarios.placer
import scenarios.antenna
import ip
import ip.BackboneHelpers
import wimac.support.nodecreators
import wimac.support.helper
import wimac.evaluation.default
import wimac.support.PostProcessor as PostProcessor
from wimac.support.WiMACParameters import ParametersOFDM, ParametersMAC
import random
random.seed(7)
# Global station id generator
def stationID():
id = 1
while (True):
yield id
id += 1
stationIDs = stationID()
associations = {}
####################################################
### Distinguished Simulation Settings #
####################################################
class Config(Frozen):
# Set basic WiMAX Parameters
parametersPhy = ParametersOFDM
parametersMAC = ParametersMAC
parametersPhy.slotDuration = 3.0 * parametersPhy.symbolDuration
numberOfTimeSlots = 100
packetSize = 86.0
trafficUL = 5E5 # bit/s per station
trafficDL = 5E5 # bit/s per station
noIPHeader = True #Set to true to set IP header to 0
probeWindowSize = 0.01 # Probe per frame
scheduler = "RoundRobin" # "PropFair"
settlingTime = 0.0
# General Setup
WNS = openwns.Simulator(simulationModel = openwns.node.NodeSimulationModel())
openwns.setSimulator(WNS)
WNS.maxSimTime = 0.07999 # seconds
WNS.masterLogger.backtrace.enabled = False
WNS.masterLogger.enabled = True
WNS.outputStrategy = openwns.simulator.OutputStrategy.DELETE
WNS.statusWriteInterval = 30 # in seconds
WNS.probesWriteInterval = 300 # in seconds
# Pass WiMAX Phy parameters to wimac::parameter::PHY singleton
WNS.modules.wimac.parametersPHY = Config.parametersPhy
WNS.modules.rise.debug.antennas = True
# Create and place the nodes:
# One BS (25m omnidirectional antenna height) with two nodes, one near, one far
bsPlacer = scenarios.placer.HexagonalPlacer(numberOfCircles = 0, interSiteDistance = 100.0, rotate=0.0)
uePlacer = scenarios.placer.LinearPlacer(numberOfNodes = 2, positionsList = [10, 4000])
bsAntenna = scenarios.antenna.IsotropicAntennaCreator([0.0, 0.0, 5.0])
bsCreator = wimac.support.nodecreators.WiMAXBSCreator(stationIDs, Config)
ueCreator = wimac.support.nodecreators.WiMAXUECreator(stationIDs, Config)
channelmodelcreator = wimac.support.helper.TestChannelModelCreator()
scenarios.builders.CreatorPlacerBuilder(bsCreator, bsPlacer, bsAntenna, ueCreator, uePlacer, channelmodelcreator)
wimac.support.helper.setupPhy(WNS, Config, "LoS_Test")
# Set the scheduler
wimac.support.helper.setupScheduler(WNS, Config.scheduler)
# Set IP Header to 0 (else it is 20 byte)
if Config.noIPHeader:
wimac.support.helper.disableIPHeader(WNS)
# Always create uplink traffic, if traffic UL is 0 we sent exacly
# one packet for initialization
wimac.support.helper.createULPoissonTraffic(WNS, Config.trafficUL, Config.packetSize)
# Only create downlink traffic if we have any
if Config.trafficDL > 0.0:
wimac.support.helper.createDLPoissonTraffic(WNS, Config.trafficDL, Config.packetSize)
# Configure the window probes
wimac.support.helper.setL2ProbeWindowSize(WNS, Config.probeWindowSize)
utNodes = WNS.simulationModel.getNodesByProperty("Type", "UE")
bsNodes = WNS.simulationModel.getNodesByProperty("Type", "BS")
##################################################################################################
# Configure the scheduler to use the BypassQueue
for bs in bsNodes:
# Use the Bypass Queue
# DL Master
bs.dll.dlscheduler.config.txScheduler.queue = wimac.Scheduler.BypassQueue()
bs.dll.dlscheduler.config.txScheduler.alwaysAcceptIfQueueAccepts = True
# Use the Simple Queue
# UL Master
bs.dll.ulscheduler.config.rxScheduler.queue = openwns.Scheduler.SimpleQueue()
bs.dll.ulscheduler.config.rxScheduler.alwaysAcceptIfQueueAccepts = True
# Pop the Reassembly FU
bs.dll.subFUN.connects.pop(0)
bs.dll.group.bottom = "buffer"
# We need PseudeBWRequests with the Bypass Queue
bs.dll.ulscheduler.config.rxScheduler.pseudoGenerator = wimac.Scheduler.PseudoBWRequestGenerator(
'connectionManager',
'ulscheduler',
_packetSize = Config.packetSize,
_pduOverhead = Config.parametersMAC.pduOverhead)
if Config.noIPHeader:
bs.dll.ulscheduler.config.rxScheduler.pseudoGenerator.pduOverhead -= 160
for ss in utNodes:
# Use the Bypass Queue
# UL Slave
ss.dll.ulscheduler.config.txScheduler.queue = wimac.Scheduler.BypassQueue()
ss.dll.ulscheduler.config.txScheduler.alwaysAcceptIfQueueAccepts = True
# Pop the Reassembly FU
ss.dll.subFUN.connects.pop(0)
ss.dll.group.bottom = "buffer"
##################################################################################################
# DHCP, ARP, DNS for IP
ip.BackboneHelpers.createIPInfrastructure(WNS, "WIMAXRAN")
# Probe configuration
loggingStationIDs = []
for node in utNodes + bsNodes:
loggingStationIDs.append(node.dll.stationID)
wimac.evaluation.default.installDebugEvaluation(WNS, loggingStationIDs, Config.settlingTime, "Moments")
#wimac.evaluation.default.installOverFrameOffsetEvaluation(WNS,
# Config.parametersPhy.symbolsFrame,
# [1],
# loggingStationIDs)
# Not present with BypassQueue
WNS.environment.probeBusRegistry.removeMeasurementSource("wimac.schedulerQueue.delay")
openwns.evaluation.default.installEvaluation(WNS)
|