SINRwithMIMO - getPhyMode(..., ..., lqm)

Asked by kharny on 2009-12-17

Hello dear developers,
i've implemented a 4x4 MIMO scenario (AP-->STA) using SINRwithMIMO-Rate adaptation. Binary Search for saturation point has been used.
http://docs.openwns.org/api/SINRwithMIMO_8cpp-source.htm

The number of used spatialstreams and the MCS should be modified inside the getPhyMode
00055 SINRwithMIMO::getPhyMode(const wns::service::dll::UnicastAddress receiver, size_t numTransmissions, const wns::Ratio lqm)
The debug-informations after adding some control-messages just led me to the conclusion, that only the second getPhyMode from line 126 has been used through the whole simalution-time.
00126 SINRwithMIMO::getPhyMode(const wns::service::dll::UnicastAddress receiver, size_t numTransmissions)

The matter is, I'd like to stored the SINR-values of previous transmissions and then use this informations to modify the function getPhyMode from line 55, so that, i could be able to use the previous SINR values before setting a MCS.
As far i can see, the storage of previous values can be managed by the SINRInformationBase.(c|h)pp located in
~/myOpenWNS/modules/dll/wifimac/src/management (slidingWindowMap measuredSINRHolder). Isn't it?

One of the control-information inside SINRwithMode::getPhyMode (line 126) is
MESSAGE_SINGLE(NORMAL, *logger, "mess_single, inside second getPhy...");
Below some lines of the debug-Informations. It's quite the same control-information all through the debug-output (./open-dbg)
at a scenario
----------------------------------
( 1.0209582) [WiFiM] AP1.L2.1.Aggregation Send aggregated compound with frame exchange duration set to8.4e-05
( 1.0209582) [WiFiM] AP1.L2.1.TXOP accepting First compound
( 1.0209582) [WiFiM] AP1.L2.1.RateAdaptation No matching RA found for receiver 2, create new of type SINRwithMIMO
( 1.0209582) [WiFiM] AP1.L2.1.RateAdaptation RA, second getPhyMode-Funktion to receiver 2 transmissions: 1 this is just a dbg-info
( 1.0209582) [WiFiM] AP1.L2.1.RateAdaptation mess_single, inside second getPhy...
( 1.0209582) [WiFiM] VCIB.VCIB Query for node 2, key numAntennas --> 4
( 1.0209582) [WiFiM] AP1.L2.1.RateAdaptation Send data frame to rx: 2 with (BPSK-1/2)*48*1 (-> 24 dbps)
( 1.0209582) [WiFiM] AP1.L2.1.TXOP accepting First compound
----------------------------------
It seems like the RateAdaptation.cpp at line 105 calls the SINRwithMode::getPhyMode (line 126) all the time.

In fact, i couldn't find a function like the main, that defines which function at which time will be called. The main-function(/home/cal/myOpenWNS/framework/application/src) was not that clear.

Thanks for helping me out
Kharny

Question information

Language:
English Edit question
Status:
Solved
For:
openWNS WiFiMAC Edit question
Assignee:
No assignee Edit question
Solved by:
kharny
Solved:
2010-01-14
Last query:
2010-01-14
Last reply:
2010-01-13

This question was reopened

Sebastian Max (smx-comnets) said : #1

Dear Kharny,

All what you said is correct :-)

> The matter is, I'd like to stored the SINR-values of previous
> transmissions and then use this informations to modify the function
> getPhyMode from line 55, so that, i could be able to use the previous
> SINR values before setting a MCS.
No :-)

What you really would like to do is
1. measure the SINR-values of previous transmissions at the STA
2. send these measurements to the AP
3. which then can use this information to set the phy mode

In the current implementation, there is no SINR-feedback from the STA to
the AP. Hence, the AP cannot fill its SINRInformationBase with peer
measurements, and thus the rate adaptation has to use the getPhyMode
without the lqm:
http://docs.openwns.org/api/RateAdaptation_8cpp-source.htm, line 132.

> As far i can see, the storage of
> previous values can be managed by the SINRInformationBase.(c|h)pp
> located in ~/myOpenWNS/modules/dll/wifimac/src/management
> (slidingWindowMap measuredSINRHolder). Isn't it?
Correct.

> It seems like the RateAdaptation.cpp at line 105 calls the SINRwithMode::getPhyMode (line 126) all the time.
Correct, see above.

> In fact, i couldn't find a function like the main, that defines which
> function at which time will be called.
Essentially, the RateAdaptation uses the factory (aka strategy) pattern
to determine the specific type of rate adaptation (here, SINRwithMIMO,
as configured in the PyConfig). But, the function which is called is
determined then by the availability of SINR information - which is not
the case in your scenario.

I think that there are three possibilities for you:
1. Implement the link feedback and link adaptation as given in 802.11n
2. Use MPs instead of STAs: Here, the link feedback (averaged SINR only)
is done using the beacons.
3. Wait until we implement 1. - which is currently ongoing and will be
published when ready.

BR,
Sebastian

kharny (kharny) said : #2

Hello Sebastian,
thanks for your message.
I had the wrong assumption, that the SINR-values would be measured inside the simulator, even thought, the different factors inside the simulator are known.

>I think that there are three possibilities for you:
>2. Use MPs instead of STAs: Here, the link feedback (averaged SINR only)
>is done using the beacons.

I'm about the use the MPs instead of STAs, but somehow i've got the following error-message while executing ./openwns-dbg in a scenario:
----------------------------------------------
openWNS: Caught wns::Assure::Exception:

In 'wns::container::Matrix<T, (N - 1), R>& wns::container::Matrix<T, N, R>::operator[](const typename wns::container::MultiReadWriteAccessible<T, N, R, unsigned int>::IndexType&) [with T = wifimac::pathselection::Metric, unsigned int N = 2u, R = const wifimac::pathselection::Metric&]' (include/WNS/container/Matrix.hpp:75):
failed assertion (index < v.size()).
Reason: out of range: index 2 >= 2
----------------------------------------------

Somehow, I think that the reason might be in wifimac.evaluation.ip.installEvaluation.
------------------------------------------------------------------------------------------------------
wifimac.evaluation.default.installEvaluation(WNS,
                                             settlingTime,
                                             apIDs, mpIDs, staIDs,
                                             apAdrs, mpAdrs, staIDs,
                                             maxHopCount = 1, #numHops,
                                             performanceProbes = True, networkProbes = False)

wifimac.evaluation.ip.installEvaluation(sim = WNS,
                                        staIds = mpIDs, #staIDs, because STA hasn't been created
                                        rangId = rang.nodeID,
                                        settlingTime = settlingTime,
                                        maxPacketDelay = 0.1, # s
                                        maxBitThroughput = 1.1*(offeredDL+offeredUL)) # Bit/s
------------------------------------------------------------------------------------------------------
By the way, how can we get the imformation, when something new is published? Or is there a particular link to be checked?
Thanks
Regards
Kharny

Sebastian Max (smx-comnets) said : #3

Dear Kharny,

> I had the wrong assumption, that the SINR-values would be measured
> inside the simulator, even thought, the different factors inside the
> simulator are known.
Of course the SINR is known in the simulator - but not processed for the
rate adaptation (especially the feedback to the transmitter does not
exists besides in the beacons).

> I'm about the use the MPs instead of STAs, but somehow i've got the
> following error-message while executing ./openwns-dbg in a scenario:
[...]
Most likely you have to adapt the number of nodes in the createVPS
statment in your config.py. Somewhere you should find:

# create (magic) service nodes for ARP, DNS, Pathselection, Capability
Information
...
WNS.simulationModel.nodes.append(nc.createVPS((XYZ), commonLoggerLevel))
...
Try to set XYZ to some higher value. This should solve the problem.

> By the way, how can we get the imformation, when something new is
> published? Or is there a particular link to be checked?

You should be subscribed to the openwns-developer mailing list.

@Maciej, I cannot find any link (neither on launchpad nor on
openwns.org) for this. Can you change this??

BR & happy holidays,
Sebastian

kharny (kharny) said : #4

Thanks Sebastian,
i've changed the virtual pathselection (VPS) and could solve that problem. Unfortunately i got another one coming from the Registry.hpp (/home/cal/myOpenWNS/framework/library/src/container).
--------------------------------------------
( 0.0000000) [CONST] Constanze onNodeCreated(): initializing 0 generators, 0 listeners.
( 0.0000000) [ IP] VARP.theOnlyZone MAC address 2 has 192.168.1.2
( 0.0000000) [ IP] VDNS.ip.DEFAULT.GLOBAL Domain 192.168.1.2 is at 192.168.1.2
( 0.0000000) [ IP] MP2.IP.Forwarding Adding 192.168.1.2 to listening addresses
( 0.0000000) [ IP] MP2.IP.Routing Destination Gateway Genmask Iface
( 0.0000000) [WiFiM] AP1.L2.APUpperConv AP1: APUpperConv registered dataHandler
( 0.0000000) [ DLL] RANG.L2 Added AP1 with MAC Adr.: 1 to RANG!
( 0.0000000) [ IP] VARP.theOnlyZone MAC address -1 has 192.168.255.254
...
...
...
No ip::VirtualARP* with this key registered.
Key:
Elements with the following keys are registered:
 - theOnlyZone
--------------------------------------------

I don't know exactly, what went wrong. I've configured a MP with
mpConfig.transceivers.append(MyMeshTransceiver(beaconDelay = 0.001+0.001))
and most of the time, just replaced "sta" by "mp", also in the ipListenerBinding; even thought, it didn't make a change with or without this ipListenerBinding for DL (if(dlIsActive)).

Thanks in advance
regards
Kharny

Harald Radke (rat-comnets) said : #5

Hello Kharny,

Maybe you forgot to add/adjust the route from RANG to the MP after creating it?

rang.nl.addRoute(mp.nl.dataLinkLayers[0].addressResolver.address,
                 "255.255.255.255",
                 mp.nl.dataLinkLayers[0].addressResolver.address,
                 "wifi")

Regards,

Harry

kharny (kharny) said : #6

Hi Harry,
thanks a lot for your message. That's was the last information i needed.
I've made some changes about the route RANG-MP in the NodeCreator.py (~/myFirstCampaign/sandbox/.../wifimac/support/) instead of changing it in the /module/../wifimac/support or in the config.py. After i've updated the campaign, all the changes was gone and i didn't check the NodeCreator again. I should have applied the changes in the config.py first.
Thanks once more
BR
Kharny

kharny (kharny) said : #7

Hi everybody,
there might be a problem in the implementation of my config.py-File.
I'd like to know, if there is a helpfull link to a tutorial , that gives informations about how to implement a MP for a scenario AP->MP ? I've got the following throughput (aggregated) results with almost the same configuration:
--------------------------------
--------------------------------
AP --> STA
        124,8*10(^6) ... 128,0*10(^6) Bit/s
AP --> MP
          187 500 ... 193 750 Bit/s
--------------------------------
--------------------------------

Thanks
Regards
Kharny

Harald Radke (rat-comnets) said : #8

hm...since I don't know your config file I can just guess...
did you run the simulation in debug mode? if not try that please to see if some assure statement failed, there errors that won't cause the opt run to crash but the debug version....

one hint: make sure that the beacon delays of AP and MP differ since after the succesive failure to receive beacons, a link is closed.... this won't cause the opt version of the simulator to crash but the debug version should exit with an appropriate error message

hoe that helps

Harry

kharny (kharny) said : #9

Dear Harald,
thanks for your mail. The debug version work till the end with "wns::simulator::Application: shutdown complete" as last information. I'm also able to view the results through the wrowser.
In fact, i've just used the same configuration as in experiment 7

http://docs.openwns.org/usersGuide/modules/dll/wifimac/experiment7.html

and just adapt some parameters like number of antennas (4) and distance AP-STA (20m).
Then if just try to adapt this configuration to the other scenario (AP->MP).
That's why, i've guessed, that i must have made something wriong at the second scenario.
Regards
Kharny

Harald Radke (rat-comnets) said : #10

I am sorry, but I still can't imagine how the config might look like....if you use experiment7, I guess you removed the STA part and kept the MP configuration (for a single MP), adjustet the traffic configuration (listener / binder) to the MP and also added the correct routes?

(sorry for being that vague but it is really hard to guess what the problem might be without a line of code)

Regards,

Harry

kharny (kharny) said : #11

Here is a copy of my code. I've add a wall in the middle, just for the see how the attenuation will affect the transmission results: so AP-->(Wall)-->MP.
The throughput results i mentioned are results by walllength = 0.

Thanks for helping me out
Kharny
------------------------------------------------------------------
------------------------------------------------------------------
-----------------------------------------------------------------

# begin example "wifimac.tutorial.experiment7.config.imports"
import random
random.seed(22)

import openwns
from openwns import dB, dBm, fromdB, fromdBm
from openwns.interval import Interval
import constanze.traffic
import constanze.node
import wifimac.support
import wifimac.evaluation.default
import wifimac.evaluation.ip
from wifimac.lowerMAC.RateAdaptation import SINRwithMIMO, Opportunistic, OpportunisticwithMIMO

import rise.Scenario
# end example

import ofdmaphy.Station # will be used here for phy of MP

# begin example "wifimac.tutorial.experiment7.config.simulationParameter"
#######################
# Simulation parameters
#
from SimConfig import params
simTime = params.simTime
settlingTime = 2.0
commonLoggerLevel = 2
dllLoggerLevel = 2

# mesh scenario parameter
numHops = params.numHops
distance = params.distance # Int-parameter
wallLength = params.wallLength

# load
packetSize = params.packetSize
offeredDL = (1.0-params.ulRatio) * params.offeredTraffic
offeredUL = params.ulRatio * params.offeredTraffic
ulIsActive = (params.ulRatio > 0.0)
dlIsActive = (params.ulRatio < 1.0)
startDelayUL = 1.01
startDelayDL = 1.02

# Frequencies
networkFrequency = 2400 #5500
# End simulation parameters
###########################
# end example

# begin example "wifimac.tutorial.experiment7.nodeConfig.AP"
####################
# Node configuration

# configuration class for AP and MP BSS transceivers
class MyMeshTransceiver(wifimac.support.Transceiver.Mesh):
    def __init__(self, beaconDelay):
        super(MyMeshTransceiver, self).__init__(frequency = networkFrequency)

        # Transmission power
        self.txPower = dBm(20)
        # set the inital start delay of the beacon so that beacons from multiple APs do not collide
        self.layer2.beacon.delay = beaconDelay

        # Use IEEE 802.11 DraftN enhancements
        self.layer2.funTemplate = wifimac.draftn.FUNTemplate
        self.layer2.phyUser.phyModesDeliverer = wifimac.draftn.PhyModes()

        # Block-ACKs are longer than (default) normal ACKs
        self.layer2.expectedACKDuration = 68E-6

        # settings for frame aggregation and block acknowledgement
        self.layer2.aggregation.maxEntries = 10
        self.layer2.blockACK.maxOnAir = 10

        # number of antennas for MIMO transmissions
        self.layer2.manager.numAntennas = 4

        # rate adaptation uses MIMO transmissions if possible
        self.layer2.ra.raStrategy = SINRwithMIMO() #OpportunisticwithMIMO()

        # For frames above this threshold (in bit) RTS/CTS will be used
        self.layer2.rtsctsThreshold = 8e6
# end example

# begin example "wifimac.tutorial.experiment7.nodeConfig.STA"
# configuration class for STAs
class MySTATransceiver(wifimac.support.Transceiver.DraftNStation):#Station):
    def __init__(self, position):
        super(MySTATransceiver, self).__init__(frequency = networkFrequency,
                                               position = position,
                                               scanFrequencies = [networkFrequency],
                                               scanDuration = 0.3,
                           numAntennas = 4,
                           maxAggregation = 10)

        # Transmission power
        self.txPower = dBm(20)

        # Use IEEE 802.11 DraftN enhancements
        self.layer2.funTemplate = wifimac.draftn.FUNTemplate
        self.layer2.phyUser.phyModesDeliverer = wifimac.draftn.PhyModes()

        # Block-ACKs are longer than (default) normal ACKs
        self.layer2.expectedACKDuration = 68E-6

        # settings for frame aggregation and block acknowledgement
        #self.layer2.aggregation.maxEntries = 10
        #self.layer2.blockACK.maxOnAir = 10

        # number of antennas for MIMO transmissions
        #self.layer2.manager.numAntennas = 1

        # rate adaptation strategy: STAs do not have link quality
        # feedback, hence no SINR-based rate adaptation
        self.layer2.ra.raStrategy = Opportunistic() #OpportunisticwithMIMO()

        # For frames above this threshold (in bit) RTS/CTS will be used
        self.layer2.rtsctsThreshold = 8e6

# End node configuration
#########################
##end example

# begin example "wifimac.tutorial.experiment7.config.WNS"
# create an instance of the WNS configuration
# The variable must be called WNS!!!!
WNS = openwns.Simulator(simulationModel = openwns.node.NodeSimulationModel())
WNS.outputStrategy = openwns.simulator.OutputStrategy.DELETE
WNS.maxSimTime = simTime
WNS.statusWriteInterval = 120 # in seconds realTime
WNS.probesWriteInterval = 3600 # in seconds realTime
# end example

# begin example "wifimac.tutorial.experiment7.config.scenario"
#################
# Create scenario
#sizeX = distance
sizeX = (numHops)*distance
sizeY = 10 + wallLength#10
scenario = rise.Scenario.Scenario(sizeX, sizeY)

riseConfig = WNS.modules.rise
riseConfig.debug.transmitter = (commonLoggerLevel > 1)
riseConfig.debug.receiver = (commonLoggerLevel > 1)
riseConfig.debug.main = (commonLoggerLevel > 1)

ofdmaPhyConfig = WNS.modules.ofdmaPhy
managerPool = wifimac.support.ChannelManagerPool(scenario = scenario,
                                                 numMeshChannels = 1,
                                                 ofdmaPhyConfig = ofdmaPhyConfig)

# end example
# begin example "wifimac.tutorial.experiment4.config.scenario.createWallObj"
# single wall from (0,5) to (wallLength,5)
objs = []
objs.append(rise.scenario.Shadowing.Shape2D(pointA = [distance/2, 0.0, 0.0], pointB = [distance/2, wallLength, 0.0], attenuation = dB(10))) #dB(100)))
print "Created Wall from (",distance/2,",0.0 ,0.0) till (",distance/2,",",wallLength,", 0.0) with wallLength:",wallLength
#makeABreak #####################debug-info#############################################
# end example
# End create scenario
#####################
# end example

# begin example "wifimac.tutorial.experiment7.config.radioChannel"
######################################
# Radio channel propagation parameters
myPathloss = rise.scenario.Pathloss.PyFunction(
    validFrequencies = Interval(2000, 6000),
    validDistances = Interval(2, 5000), #[m]
    offset = dB(-27.552219),
    freqFactor = 20,
    distFactor = 35,
    distanceUnit = "m", # only for the formula, not for validDistances
    minPathloss = dB(42), # pathloss at 2m distance
    outOfMinRange = rise.scenario.Pathloss.Constant("42 dB"),
    outOfMaxRange = rise.scenario.Pathloss.Deny(),
    scenarioWrap = False,
    sizeX = sizeX,
    sizeY = sizeY)
#myShadowing = rise.scenario.Shadowing.No()
myShadowing = rise.scenario.Shadowing.Objects(obstructionList = objs,
                                              xGridBlocks = 1,
                                              yGridBlocks = 1,
                                              scenario = scenario)
myFastFading = rise.scenario.FastFading.No()
propagationConfig = rise.scenario.Propagation.Configuration(
    pathloss = myPathloss,
    shadowing = myShadowing,
    fastFading = myFastFading)
# End radio channel propagation parameters
##########################################
#end example

# begin example "wifimac.tutorial.experiment7.config.NodeCreation.Virtual"
###################################
#Create nodes using the NodeCreator
nc = wifimac.support.NodeCreator(propagationConfig)

# one RANG
rang = nc.createRANG(listener = ulIsActive, loggerLevel = commonLoggerLevel)
WNS.simulationModel.nodes.append(rang)

# create (magic) service nodes for ARP, DNS, Pathselection, Capability Information
WNS.simulationModel.nodes.append(nc.createVARP(commonLoggerLevel))
WNS.simulationModel.nodes.append(nc.createVDNS(commonLoggerLevel))
WNS.simulationModel.nodes.append(nc.createVPS(1+2*numHops+7, commonLoggerLevel))
WNS.simulationModel.nodes.append(nc.createVCIB(commonLoggerLevel))
# end example

# begin example "wifimac.tutorial.experiment7.config.NodeCreation.Init"
# Single instance of id-generator for all nodes with ids
idGen = wifimac.support.idGenerator()

# save IDs for probes
apIDs = []
mpIDs = []
staIDs = []
apAdrs = []
mpAdrs = []
# end example

# begin example "wifimac.tutorial.experiment7.config.NodeCreation.AP"
# Create AP
apConfig = wifimac.support.Node(position = openwns.Position(0,10,0))
apConfig.transceivers.append(MyMeshTransceiver(beaconDelay = 0.001))
ap = nc.createAP(idGen, managerPool, apConfig)
ap.logger.level = commonLoggerLevel
ap.dll.logger.level = dllLoggerLevel
WNS.simulationModel.nodes.append(ap)
apIDs.append(ap.id)
apAdrs.extend(ap.dll.addresses)
rang.dll.addAP(ap)
print "Created AP at (0,10,0) with id ", ap.id, " and addresses ", ap.dll.addresses
# end example
#makeABreak #####################debug-info#############################################

# begin example "wifimac.tutorial.experiment7.config.NodeCreation.MP"
mpConfig = wifimac.support.Node(position = openwns.Position(distance,10,0))
mpConfig.transceivers.append(MyMeshTransceiver(beaconDelay = 0.001+0.001))
mp = nc.createMP(idGen, managerPool, mpConfig)
mp.logger.level = commonLoggerLevel
mp.dll.logger.level = dllLoggerLevel

rang.nl.addRoute(mp.nl.dataLinkLayers[0].addressResolver.address,
                 "255.255.255.255",
                 mp.nl.dataLinkLayers[0].addressResolver.address,
                 "wifi")
# end example

# begin example "wifimac.tutorial.experiment7.config.NodeCreation.STA.Traffic"
if(dlIsActive):
    # DL load RANG->STA
    cbrDL = constanze.traffic.Poisson(startDelayDL+random.random()*0.001,
                                        offeredDL,
                                        packetSize,
                                        parentLogger=rang.logger)
    ipBinding = constanze.node.IPBinding(rang.nl.domainName,
                                         mp.nl.domainName,#sta.nl.domainName,
                                         parentLogger=rang.logger)
    rang.load.addTraffic(ipBinding, cbrDL)

    # Listener at STA for DL
    ipListenerBinding = constanze.node.IPListenerBinding(mp.nl.domainName,
                                                         parentLogger=mp.logger)
    listener = constanze.node.Listener(mp.nl.domainName + ".listener",
                                       probeWindow = 1.0,
                                       parentLogger=mp.logger)
    mp.load.addListener(ipListenerBinding, listener)

if(ulIsActive):
    # UL load STA->RANG
    cbrUL = constanze.traffic.Poisson(startDelayUL+random.random()*0.001,
                                        offeredUL,
                                        packetSize,
                                        parentLogger=mp.logger)#parentLogger=sta.logger)
    ipBinding = constanze.node.IPBinding(mp.nl.domainName,
                                         rang.nl.domainName,
                                         parentLogger=mp.logger)
    mp.load.addTraffic(ipBinding, cbrUL)

# begin example "wifimac.tutorial.experiment7.config.NodeCreation.STA.Add"
# Add STA
#WNS.simulationModel.nodes.append(sta)
#staIDs.append(sta.id)
#print "Created STA at (",distance, ",10,0) with id ", sta.id

WNS.simulationModel.nodes.append(mp)
mpIDs.append(mp.id)
mpAdrs.extend(mp.dll.addresses)
print "Created MP at (", distance, ",10,0)",
print "with id ", mp.id, " and addresses ", mp.dll.addresses

#makeABreak #####################debug-info#############################################
# End create nodes
##################
# end example

# begin example "wifimac.tutorial.experiment7.config.Probing"
#########
# Probing

# wifimac probes
wifimac.evaluation.default.installEvaluation(WNS,
                                             settlingTime,
                                             apIDs, mpIDs, staIDs,
                                             apAdrs, mpAdrs, staIDs,
                                             maxHopCount = 1, #numHops,
                                             performanceProbes = True, networkProbes = False)

wifimac.evaluation.ip.installEvaluation(sim = WNS,
                                        staIds = mpIDs, #staIDs,
                                        rangId = rang.nodeID,
                                        settlingTime = settlingTime,
                                        maxPacketDelay = 0.1, # s
                                        maxBitThroughput = 1.1*(offeredDL+offeredUL)) # Bit/s

# end example
openwns.setSimulator(WNS)

--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
campaignConfiguration.py

import sys
import os

def searchPathToSDK(path):
    rootSign = ".thisIsTheRootOfWNS"
    while rootSign not in os.listdir(path):
        if path == os.sep:
            # arrived in root dir
            return None
        path, tail = os.path.split(path)
    return os.path.abspath(path)

pathToSDK = searchPathToSDK(os.path.abspath(os.path.dirname(sys.argv[0])))

if pathToSDK == None:
    print "Error! You are note within an openWNS-SDK. Giving up"
    exit(1)

# begin example "wifimac.tutorial.experiment7.db.campaignConfiguration.import"
from wrowser.simdb.Parameters import AutoSimulationParameters, Parameters, Bool, Int, Float, String
import wrowser.Configuration as config
import wrowser.simdb.Database as db
import subprocess
# end example

# begin example "wifimac.tutorial.experiment7.db.campaignConfiguration.Set"
class Set(AutoSimulationParameters):
    # scenario parameters
    simTime = Float(parameterRange = [5.0])
    numHops = Int(parameterRange = [1])
    wallLength = Float(parameterRange = [0.0, 5.0, 15.0, 25.0])
    distance = Int(parameterRange = [20]) #[20])#[30])#[50])
    ulRatio = Float(parameterRange = [0.0])
    packetSize = Int(parameterRange = [1480*8])

    # input parameter
    offeredTraffic = Int(default = 100000)
# end example

# begin example "wifimac.tutorial.experiment7.db.campaignConfiguration.GetTotalThroughput"
def getTotalThroughput(paramsString, inputName, cursor):
    myQuery = " \
       SELECT idResults.scenario_id, idResults." + inputName + ", VAL.mean \
       FROM moments VAL, (SELECT scenario_id, " + inputName + " FROM parameter_sets \
                          WHERE " + paramsString + ") AS idResults \
       WHERE VAL.scenario_id = idResults.scenario_id AND \
                VAL.alt_name = 'ip.endToEnd.window.incoming.bitThroughput_Moments' \
       ORDER BY idResults." + inputName + ";"
    cursor.execute(myQuery)
    resultsIn = cursor.fetchall()

    myQuery = " \
       SELECT idResults.scenario_id, idResults." + inputName + ", VAL.mean \
       FROM moments VAL, (SELECT scenario_id, " + inputName + " FROM parameter_sets \
                          WHERE " + paramsString + ") AS idResults \
       WHERE VAL.scenario_id = idResults.scenario_id AND \
             VAL.alt_name = 'ip.endToEnd.window.aggregated.bitThroughput_Moments' \
       ORDER BY idResults." + inputName + ";"
    cursor.execute(myQuery)
    resultsAgg = cursor.fetchall()

    results = []
    for i in zip(resultsAgg, resultsIn):
        agg = i[0]
        inc = i[1]
        assert(agg[0] == inc[0])
        assert(agg[1] == inc[1])
        results.append([agg[0], agg[1], agg[2] + inc[2]])

    return results
# end example

# begin example "wifimac.tutorial.experiment7.db.campaignConfiguration.Cursor"
conf = config.Configuration()
conf.read("./.campaign.conf")
db.Database.connectConf(conf)
cursor = db.Database.getCursor()
# end example

# begin example "wifimac.tutorial.experiment7.db.campaignConfiguration.params"
params = Set('offeredTraffic', cursor, conf.parser.getint("Campaign", "id"), getTotalThroughput)
[status, results] = params.binarySearch(maxError = 0.1,
                                        exactness = 0.05,
                                        createSimulations=True,
                                        debug=True)
# end example

Harald Radke (rat-comnets) said : #12

hm...how old is your openWNS version? e.g. you subclass your mesh transceiver from support.Transceiver.Mesh whereas there is a DraftNMesh class (now?) ...the antenna parameter is (now?) in layer1 not layer2 ... (there are also some changes to the configuration of walls but those are fairly new)

However, after getting your config to run, the result is quite normal (50 Mb/s with 1 antenna, > 100 Mb/s with 4)

I know this will cost you some time, but I suggest to update openWNS and modify e,g, the current experiment7 files

Regards,

Harry

kharny (kharny) said : #13

Hello Harald,
it works now. The size of an array, that i used to stored some SINR-values, was not big enough. I guess, this lead to the weird behavior of the compiler. Probably i've already made some changes in the src-code at the time i changed the scenario AP-->STA to AP-->MP and that might be the reason, why...
I've installed my Version of openWNS for about 5 mounths ;-)
Thanks to all of you once more, this solve my problem
Regards
Kharny