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
49
trafficUL = 5E5 # bit/s per station
50
trafficDL = 5E5 # bit/s per station
52
noIPHeader = True #Set to true to set IP header to 0
53
probeWindowSize = 0.01 # Probe per frame
54
scheduler = "RoundRobin" # "PropFair"
57
WNS = openwns.Simulator(simulationModel = openwns.node.NodeSimulationModel())
58
openwns.setSimulator(WNS)
59
WNS.maxSimTime = 0.07999 # seconds
60
WNS.masterLogger.backtrace.enabled = False
61
WNS.masterLogger.enabled = True
62
WNS.outputStrategy = openwns.simulator.OutputStrategy.DELETE
63
WNS.statusWriteInterval = 30 # in seconds
64
WNS.probesWriteInterval = 300 # in seconds
66
# Pass WiMAX Phy parameters to wimac::parameter::PHY singleton
67
WNS.modules.wimac.parametersPHY = Config.parametersPhy
69
WNS.modules.rise.debug.antennas = True
71
# Create and place the nodes:
72
# One BS (25m omnidirectional antenna height) with two nodes, one near, one far
74
bsPlacer = scenarios.placer.HexagonalPlacer(numberOfCircles = 0, interSiteDistance = 100.0, rotate=0.0)
75
uePlacer = scenarios.placer.LinearPlacer(numberOfNodes = 2, positionsList = [10, 1700])
76
bsAntenna = scenarios.antenna.IsotropicAntennaCreator([0.0, 0.0, 5.0])
77
bsCreator = wimac.support.nodecreators.WiMAXBSCreator(stationIDs, Config)
78
ueCreator = wimac.support.nodecreators.WiMAXUECreator(stationIDs, Config)
79
scenarios.builders.CreatorPlacerBuilder(bsCreator, bsPlacer, bsAntenna, ueCreator, uePlacer)
81
wimac.support.helper.setupPhy(WNS, Config, "LoS_Test")
84
wimac.support.helper.setupScheduler(WNS, Config.scheduler)
86
# Set IP Header to 0 (else it is 20 byte)
88
wimac.support.helper.disableIPHeader(WNS)
90
# Always create uplink traffic, if traffic UL is 0 we sent exacly
91
# one packet for initialization
92
wimac.support.helper.createULPoissonTraffic(WNS, Config.trafficUL, Config.packetSize)
94
# Only create downlink traffic if we have any
95
if Config.trafficDL > 0.0:
96
wimac.support.helper.createDLPoissonTraffic(WNS, Config.trafficDL, Config.packetSize)
98
# Configure the window probes
99
wimac.support.helper.setL2ProbeWindowSize(WNS, Config.probeWindowSize)
101
utNodes = WNS.simulationModel.getNodesByProperty("Type", "UE")
103
# DHCP, ARP, DNS for IP
104
ip.BackboneHelpers.createIPInfrastructure(WNS, "WIMAXRAN")
106
# Probe configuration
107
loggingStationIDs = []
110
loggingStationIDs.append(node.dll.stationID)
112
wimac.evaluation.default.installDebugEvaluation(WNS, loggingStationIDs, "Moments")
114
wimac.evaluation.default.installOverFrameOffsetEvaluation(WNS,
115
Config.parametersPhy.symbolsFrame,
119
openwns.evaluation.default.installEvaluation(WNS)