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

« back to all changes in this revision

Viewing changes to configBase/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
    randomStartDelayMax = None
 
75
 
 
76
    def __init__(self, node, stationName, config):
 
77
        super(Layer2, self).__init__(node, stationName)
 
78
        self.nameInComponentFactory = "wimac.Layer2"
 
79
 
 
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 )
 
85
        
 
86
        self.managementServices.append(
 
87
            wimac.Services.ConnectionManager( "connectionManager", "fuReseter" ) )
 
88
 
 
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 )
 
96
 
 
97
        self.connectionControl = wimac.Services.ConnectionControl("connectionControl") 
 
98
        self.controlServices.append( self.connectionControl )
 
99
        
 
100
        self.classifier = Classifier()
 
101
        self.synchronizer = wns.Tools.Synchronizer()
 
102
 
 
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"
 
111
                                       )))
 
112
 
 
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,
 
118
                               isDropping = False)
 
119
        self.errormodelling = wimac.ErrorModelling.ErrorModelling('phyUser','phyUser',PrintMappings=False)
 
120
        self.compoundSwitch = wimac.CompoundSwitch.CompoundSwitch()
 
121
 
 
122
        self.phyUser = wimac.PhyUser.PhyUser(
 
123
            centerFrequency = config.parametersSystem.centerFrequency,
 
124
            bandwidth = config.parametersPhy.channelBandwidth,
 
125
            numberOfSubCarrier = config.parametersPhy.subchannels )
 
126
 
 
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" )
 
131
 
 
132
    def buildFUN(self, config):
 
133
        #DataPlane
 
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)
 
152
 
 
153
        #Dataplane
 
154
        self.compoundSwitch = Node('compoundSwitch', self.compoundSwitch)
 
155
 
 
156
        self.fun.setFunctionalUnits(
 
157
            self.compoundSwitch,
 
158
            self.upperconvergence,
 
159
            self.topTpProbe,
 
160
            self.topPProbe,
 
161
            self.classifier,
 
162
            self.synchronizer,
 
163
            self.crc,
 
164
            self.errormodelling,
 
165
            self.phyUser,
 
166
            self.bufferSep,
 
167
            self.framehead,
 
168
            self.dlmapcollector,
 
169
            self.ulmapcollector,
 
170
            self.dlscheduler,
 
171
            self.ulContentionRNGc,
 
172
            self.ulscheduler,
 
173
            self.frameBuilder
 
174
            )
 
175
 
 
176
 
 
177
 
 
178
 
 
179