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
randomStartDelayMax = None
76
def __init__(self, node, stationName, config):
77
super(Layer2, self).__init__(node, stationName)
78
self.nameInComponentFactory = "wimac.Layer2"
80
self.associations = []
81
self.randomStartDelayMax = 0.0
82
self.frameBuilder = wns.FCF.FrameBuilder(0, wimac.FrameBuilder.TimingControl(),
83
frameDuration = config.parametersPhy.frameDuration,
84
symbolDuration = config.parametersPhy.symbolDuration )
86
self.managementServices.append(
87
wimac.Services.ConnectionManager( "connectionManager", "fuReseter" ) )
89
interferenceCache = dll.Services.InterferenceCache( "interferenceCache", alphaLocal = 0.2, alphaRemote= 0.05 )
90
interferenceCache.notFoundStrategy.averageCarrier = "-88.0 dBm"
91
interferenceCache.notFoundStrategy.averageInterference = "-96.0 dBm"
92
interferenceCache.notFoundStrategy.deviationCarrier = "0.0 mW"
93
interferenceCache.notFoundStrategy.deviationInterference = "0.0 mW"
94
interferenceCache.notFoundStrategy.averagePathloss = "0.0 dB"
95
self.managementServices.append( interferenceCache )
97
self.connectionControl = wimac.Services.ConnectionControl("connectionControl")
98
self.controlServices.append( self.connectionControl )
100
self.classifier = Classifier()
101
self.synchronizer = wns.Tools.Synchronizer()
103
self.bufferSep = FlowSeparator(
104
wimac.KeyBuilder.CIDKeyBuilder(),
105
wns.FlowSeparator.PrototypeCreator(
106
'buffer', BufferDropping( size = 100,
107
lossRatioProbeName = "wimac.buffer.lossRatio",
108
sizeProbeName = "wimac.buffer.size",
109
resetedBitsProbeName = "wimac.buffer.reseted.bits",
110
resetedCompoundsProbeName = "wimac.buffer.reseted.compounds"
113
self.branchDispatcher = wns.ldk.Multiplexer.Dispatcher(opcodeSize = 0)
114
# size of CRC command is abused to model overhead due to entire MAC header (48 bit without CRC)
115
self.crc = wns.CRC.CRC("errormodelling",
116
lossRatioProbeName = "wimac.crc.CRCLossRatio",
117
CRCsize = config.parametersMAC.pduOverhead,
119
self.errormodelling = wimac.ErrorModelling.ErrorModelling('phyUser','phyUser',PrintMappings=False)
120
self.compoundSwitch = wimac.CompoundSwitch.CompoundSwitch()
122
self.phyUser = wimac.PhyUser.PhyUser(
123
centerFrequency = config.parametersSystem.centerFrequency,
124
bandwidth = config.parametersPhy.channelBandwidth,
125
numberOfSubCarrier = config.parametersPhy.subchannels )
127
self.topTpProbe = wns.Probe.Window( "TopTp", "wimac.top", 0.01 )
128
self.topPProbe = wns.Probe.Packet( "TopP", "wimac.top" )
129
self.bottomThroughputProbe = wns.Probe.Window( "BottomThroughput", "wimac.bottom", 0.01 )
130
self.bottomPacketProbe = wns.Probe.Packet( "BottomPacket", "wimac.bottom" )
132
def buildFUN(self, config):
134
self.upperconvergence = Node('upperConvergence', self.upperconvergence)
135
self.topTpProbe = Node('topTpProbe', self.topTpProbe)
136
self.topPProbe = Node('topPProbe', self.topPProbe)
137
self.bottomThroughputProbe = Node('bottomThroughputProbe', self.bottomThroughputProbe)
138
self.bottomPacketProbe = Node('bottomPacketProbe', self.bottomPacketProbe)
139
self.classifier = Node('classifier', self.classifier)
140
self.synchronizer = Node('synchronizer', self.synchronizer)
141
self.bufferSep = Node('bufferSep', self.bufferSep)
142
self.crc = Node('crc', self.crc)
143
self.errormodelling = Node('errormodelling', self.errormodelling)
144
self.phyUser = Node('phyUser', self.phyUser)
145
self.framehead = Node('framehead', self.framehead)
146
self.dlmapcollector = Node('dlmapcollector', self.dlmapcollector)
147
self.ulmapcollector = Node('ulmapcollector', self.ulmapcollector)
148
self.dlscheduler = Node('dlscheduler', self.dlscheduler)
149
self.ulscheduler = Node('ulscheduler', self.ulscheduler)
150
self.ulContentionRNGc = Node('ulcontentionrngc', self.ulContentionRNGc)
151
self.frameBuilder = Node('frameBuilder', self.frameBuilder)
154
self.compoundSwitch = Node('compoundSwitch', self.compoundSwitch)
156
self.fun.setFunctionalUnits(
158
self.upperconvergence,
171
self.ulContentionRNGc,