1
from wns.Sealed import Sealed
2
from wns.FUN import FUN, Node
3
from wns.FlowSeparator import FlowSeparator
4
from wns.Multiplexer import Dispatcher
10
import wimac.KeyBuilder
12
from wns.FUN import FUN, Node
13
from wns.FlowSeparator import FlowSeparator
21
import wimac.CompoundSwitch
23
import dll.UpperConvergence
24
import wimac.FrameBuilder
25
import wimac.KeyBuilder
26
import wimac.ErrorModelling
29
import wimac.MessageExchanger
30
import wimac.SetupConnection
35
from wimac.ProbeStartStop import ProbeStartStop
36
from wimac.FUs import Classifier, BufferDropping, ACKSwitch
39
class Layer2(dll.Layer2.Layer2):
41
rngCompoundSwitch = None
46
bottomThroughputProbe = None
47
bottomPacketProbe = None
50
upperconvergence = None
53
controlPlaneSync = None
56
branchDispatcher = None
62
compoundBacktracker = None
63
# functional units for scheduling
68
ulContentionRNGc = None
71
connectionControl = None
74
centerFrequency = None
77
randomStartDelayMax = None
79
def __init__(self, node, stationName, config):
80
super(Layer2, self).__init__(node, stationName)
81
self.nameInComponentFactory = "wimac.Layer2"
83
self.associations = []
84
self.randomStartDelayMax = 0.0
85
self.frameBuilder = wns.FCF.FrameBuilder(0, wimac.FrameBuilder.TimingControl(),
86
frameDuration = config.parametersPhy.frameDuration,
87
symbolDuration = config.parametersPhy.symbolDuration )
89
self.managementServices.append(
90
wimac.Services.ConnectionManager( "connectionManager", "fuReseter" ) )
92
interferenceCache = dll.Services.InterferenceCache( "interferenceCache", alphaLocal = 0.2, alphaRemote= 0.05 )
93
interferenceCache.notFoundStrategy.averageCarrier = "-96.0 dBm"
94
interferenceCache.notFoundStrategy.averageInterference = "-88.0 dBm"
95
interferenceCache.notFoundStrategy.deviationCarrier = "0.0 mW"
96
interferenceCache.notFoundStrategy.deviationInterference = "0.0 mW"
97
interferenceCache.notFoundStrategy.averagePathloss = "0.0 dB"
98
self.managementServices.append( interferenceCache )
101
self.connectionControl = wimac.Services.ConnectionControl("connectionControl")
102
self.controlServices.append( self.connectionControl )
104
self.classifier = Classifier()
105
self.synchronizer = wns.Tools.Synchronizer()
107
self.bufferSep = FlowSeparator(
108
wimac.KeyBuilder.CIDKeyBuilder(),
109
wns.FlowSeparator.PrototypeCreator(
110
'buffer', BufferDropping( size = 100,
111
lossRatioProbeName = "wimac.buffer.lossRatio",
112
sizeProbeName = "wimac.buffer.size",
113
resetedBitsProbeName = "wimac.buffer.reseted.bits",
114
resetedCompoundsProbeName = "wimac.buffer.reseted.compounds"
117
self.branchDispatcher = wns.ldk.Multiplexer.Dispatcher(opcodeSize = 0)
118
# size of CRC command is abused to model overhead due to entire MAC header (48 bit without CRC)
119
self.crc = wns.CRC.CRC("errormodelling",
120
lossRatioProbeName = "wimac.crc.CRCLossRatio",
121
CRCsize = config.parametersMAC.pduOverhead,
123
self.errormodelling = wimac.ErrorModelling.ErrorModelling('phyUser','phyUser',PrintMappings=False)
124
self.compoundSwitch = wimac.CompoundSwitch.CompoundSwitch()
126
self.phyUser = wimac.PhyUser.PhyUser(
127
frequency = config.parametersSystem.centerFrequency,
128
bandwidth = config.parametersPhy.channelBandwidth,
129
numberOfSubCarrier = config.parametersPhy.subchannels )
131
self.topTpProbe = wns.Probe.Window( "TopTp", "wimac.top", 0.01 )
132
self.topPProbe = wns.Probe.Packet( "TopP", "wimac.top" )
133
self.bottomThroughputProbe = wns.Probe.Window( "BottomThroughput", "wimac.bottom", 0.01 )
134
self.bottomPacketProbe = wns.Probe.Packet( "BottomPacket", "wimac.bottom" )
136
def buildFUN(self, config):
138
self.upperconvergence = Node('upperConvergence', self.upperconvergence)
139
self.topTpProbe = Node('topTpProbe', self.topTpProbe)
140
self.topPProbe = Node('topPProbe', self.topPProbe)
141
self.bottomThroughputProbe = Node('bottomThroughputProbe', self.bottomThroughputProbe)
142
self.bottomPacketProbe = Node('bottomPacketProbe', self.bottomPacketProbe)
143
self.classifier = Node('classifier', self.classifier)
144
self.synchronizer = Node('synchronizer', self.synchronizer)
145
self.bufferSep = Node('bufferSep', self.bufferSep)
146
self.crc = Node('crc', self.crc)
147
self.errormodelling = Node('errormodelling', self.errormodelling)
148
self.phyUser = Node('phyUser', self.phyUser)
149
self.framehead = Node('framehead', self.framehead)
150
self.dlmapcollector = Node('dlmapcollector', self.dlmapcollector)
151
self.ulmapcollector = Node('ulmapcollector', self.ulmapcollector)
152
self.dlscheduler = Node('dlscheduler', self.dlscheduler)
153
self.ulscheduler = Node('ulscheduler', self.ulscheduler)
154
self.ulContentionRNGc = Node('ulcontentionrngc', self.ulContentionRNGc)
155
self.frameBuilder = Node('frameBuilder', self.frameBuilder)
158
self.compoundSwitch = Node('compoundSwitch', self.compoundSwitch)
160
self.fun.setFunctionalUnits(
162
self.upperconvergence,
175
self.ulContentionRNGc,