~comnets/openwns-systemtest-wimac/systemtest-wimac--main--1.0

« back to all changes in this revision

Viewing changes to configOFDMA/Layer2.py

  • Committer: Daniel Bültmann
  • Date: 2008-01-18 16:51:04 UTC
  • Revision ID: dbn@comnets.rwth-aachen.de-20080118165104-kcvus2lhi1trbzsl
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
from math import ceil
 
6
 
 
7
import wns.ldk
 
8
import dll.Layer2
 
9
import dll.Association
 
10
import wimac.KeyBuilder
 
11
 
 
12
from wns.FUN import FUN, Node
 
13
from wns.FlowSeparator import FlowSeparator
 
14
 
 
15
import wns.Probe
 
16
import wns.Buffer
 
17
import wns.ARQ
 
18
import wns.SAR
 
19
import wns.Tools
 
20
import wns.FCF
 
21
import wimac.CompoundSwitch
 
22
import wimac.Relay
 
23
import dll.UpperConvergence
 
24
import wimac.FrameBuilder
 
25
import wimac.KeyBuilder
 
26
import wimac.ErrorModelling
 
27
import wimac.Scanning
 
28
import wimac.Ranging
 
29
import wimac.MessageExchanger
 
30
import wimac.SetupConnection
 
31
import wimac.Handover
 
32
import wimac.PhyUser
 
33
import dll.Services
 
34
import wimac.Services
 
35
from wimac.ProbeStartStop import ProbeStartStop
 
36
from wimac.FUs import Classifier, BufferDropping, ACKSwitch
 
37
 
 
38
 
 
39
class Layer2(dll.Layer2.Layer2):
 
40
    frameBuilder = None
 
41
    rngCompoundSwitch = None
 
42
 
 
43
    # probes
 
44
    topTpProbe = None
 
45
    topPProbe = None
 
46
    bottomThroughputProbe = None
 
47
    bottomPacketProbe = None
 
48
 
 
49
    # DataPlane
 
50
    upperconvergence = None
 
51
    classifier = None
 
52
    synchronizer = None
 
53
    controlPlaneSync = None
 
54
 
 
55
    bufferSep = None
 
56
    branchDispatcher = None
 
57
    crc = None
 
58
    errormodelling = None
 
59
    compoundSwitch = None
 
60
    phyUser = None
 
61
 
 
62
    compoundBacktracker = None
 
63
    # functional units for scheduling
 
64
    framehead = None
 
65
    dlmapcollector = None
 
66
    ulmapcollector = None
 
67
    dlscheduler = None
 
68
    ulContentionRNGc = None
 
69
    ulscheduler = None
 
70
 
 
71
    connectionControl = None
 
72
    associateTo = None
 
73
    qosCategory = None
 
74
    centerFrequency = None
 
75
    bandwidth = None
 
76
    subCarriers = None
 
77
    randomStartDelayMax = None
 
78
 
 
79
    def __init__(self, node, stationName, config):
 
80
        super(Layer2, self).__init__(node, stationName)
 
81
        self.nameInComponentFactory = "wimac.Layer2"
 
82
 
 
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 )
 
88
        
 
89
        self.managementServices.append(
 
90
            wimac.Services.ConnectionManager( "connectionManager", "fuReseter" ) )
 
91
 
 
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 )
 
99
 
 
100
 
 
101
        self.connectionControl = wimac.Services.ConnectionControl("connectionControl") 
 
102
        self.controlServices.append( self.connectionControl )
 
103
        
 
104
        self.classifier = Classifier()
 
105
        self.synchronizer = wns.Tools.Synchronizer()
 
106
 
 
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"
 
115
                                       )))
 
116
 
 
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,
 
122
                               isDropping = False)
 
123
        self.errormodelling = wimac.ErrorModelling.ErrorModelling('phyUser','phyUser',PrintMappings=False)
 
124
        self.compoundSwitch = wimac.CompoundSwitch.CompoundSwitch()
 
125
 
 
126
        self.phyUser = wimac.PhyUser.PhyUser(
 
127
            frequency = config.parametersSystem.centerFrequency,
 
128
            bandwidth = config.parametersPhy.channelBandwidth,
 
129
            numberOfSubCarrier = config.parametersPhy.subchannels )
 
130
 
 
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" )
 
135
 
 
136
    def buildFUN(self, config):
 
137
        #DataPlane
 
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)
 
156
 
 
157
        #Dataplane
 
158
        self.compoundSwitch = Node('compoundSwitch', self.compoundSwitch)
 
159
 
 
160
        self.fun.setFunctionalUnits(
 
161
            self.compoundSwitch,
 
162
            self.upperconvergence,
 
163
            self.topTpProbe,
 
164
            self.topPProbe,
 
165
            self.classifier,
 
166
            self.synchronizer,
 
167
            self.crc,
 
168
            self.errormodelling,
 
169
            self.phyUser,
 
170
            self.bufferSep,
 
171
            self.framehead,
 
172
            self.dlmapcollector,
 
173
            self.ulmapcollector,
 
174
            self.dlscheduler,
 
175
            self.ulContentionRNGc,
 
176
            self.ulscheduler,
 
177
            self.frameBuilder
 
178
            )
 
179
 
 
180
 
 
181
 
 
182
 
 
183