2
from openwns.pyconfig import Frozen
3
import openwns.evaluation.default
6
import scenarios.builders
7
import scenarios.placer
8
import scenarios.antenna
11
import ip.BackboneHelpers
13
import wimac.support.nodecreators
14
import wimac.support.helper
15
import wimac.evaluation.default
16
import wimac.support.PostProcessor as PostProcessor
18
from wimac.support.Parameters16m import ParametersOFDMA, ParametersMAC
23
# Global station id generator
30
stationIDs = stationID()
34
####################################################
35
### Distinguished Simulation Settings #
36
####################################################
38
# Set basic WiMAX Parameters
39
parametersPhy = ParametersOFDMA(_bandwidth = 5)
40
parametersMAC = ParametersMAC
42
parametersPhy.slotDuration = 6 * parametersPhy.symbolDuration
44
# 3 * 6 = 18 symbols UD and 18 DL, total of 36 symbols. Other 47 - 36 = 11 symbols
45
# are for PYH, control, and management traffic
46
parametersPhy.maximalBeams = 4
47
parametersPhy.beamforming = True
51
trafficUL = 5E5 # bit/s per station
52
trafficDL = 5E5 # bit/s per station
54
noIPHeader = True #Set to true to set IP header to 0
55
probeWindowSize = 0.01 # Probe per frame
56
scheduler = "RoundRobin" # "PropFair"
59
WNS = openwns.Simulator(simulationModel = openwns.node.NodeSimulationModel())
60
openwns.setSimulator(WNS)
61
WNS.maxSimTime = 0.07999 # seconds
62
WNS.masterLogger.backtrace.enabled = False
63
WNS.masterLogger.enabled = True
64
WNS.outputStrategy = openwns.simulator.OutputStrategy.DELETE
65
WNS.statusWriteInterval = 30 # in seconds
66
WNS.probesWriteInterval = 300 # in seconds
68
# Pass WiMAX Phy parameters to wimac::parameter::PHY singleton
69
WNS.modules.wimac.parametersPHY = Config.parametersPhy
71
WNS.modules.rise.debug.antennas = True
73
# Create and place the nodes:
74
# One BS (25m omnidirectional antenna height) with two nodes, one near, one far
76
bsPlacer = scenarios.placer.HexagonalPlacer(numberOfCircles = 0, interSiteDistance = 1000.0, rotate=0.0)
77
uePlacer = scenarios.placer.PositionListPlacer(numberOfNodes = 3, positionsList = [
78
openwns.geometry.position.Position(x = 0.0, y = 10.0),
79
openwns.geometry.position.Position(x = 10.0, y = 0.0),
80
openwns.geometry.position.Position(x = 0.0, y = 500.0)],
82
bsAntenna = scenarios.antenna.IsotropicAntennaCreator([0.0, 0.0, 1.5])
83
bsCreator = wimac.support.nodecreators.WiMAXBSCreator(stationIDs, Config)
84
ueCreator = wimac.support.nodecreators.WiMAXUECreator(stationIDs, Config)
85
scenarios.builders.CreatorPlacerBuilder(bsCreator, bsPlacer, bsAntenna, ueCreator, uePlacer)
87
wimac.support.helper.setupPhy(WNS, Config, "LoS_Test")
90
wimac.support.helper.setupScheduler(WNS, Config.scheduler)
92
# Set IP Header to 0 (else it is 20 byte)
94
wimac.support.helper.disableIPHeader(WNS)
96
# Always create uplink traffic, if traffic UL is 0 we sent exacly
97
# one packet for initialization
98
wimac.support.helper.createULPoissonTraffic(WNS, Config.trafficUL, Config.packetSize)
100
# Only create downlink traffic if we have any
101
if Config.trafficDL > 0.0:
102
wimac.support.helper.createDLPoissonTraffic(WNS, Config.trafficDL, Config.packetSize)
104
# Configure the window probes
105
wimac.support.helper.setL2ProbeWindowSize(WNS, Config.probeWindowSize)
107
# DHCP, ARP, DNS for IP
108
ip.BackboneHelpers.createIPInfrastructure(WNS, "WIMAXRAN")
110
utNodes = WNS.simulationModel.getNodesByProperty("Type", "UE")
111
bsNodes = WNS.simulationModel.getNodesByProperty("Type", "BS")
113
# Probe configuration
114
loggingStationIDs = []
116
for node in utNodes + bsNodes:
117
loggingStationIDs.append(node.dll.stationID)
119
wimac.evaluation.default.installDebugEvaluation(WNS, loggingStationIDs, "Moments")
121
openwns.evaluation.default.installEvaluation(WNS)