当前位置: 首页>>代码示例>>Python>>正文


Python Simulator.getStaticsInfo方法代码示例

本文整理汇总了Python中Simulator.Simulator.getStaticsInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.getStaticsInfo方法的具体用法?Python Simulator.getStaticsInfo怎么用?Python Simulator.getStaticsInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Simulator.Simulator的用法示例。


在下文中一共展示了Simulator.getStaticsInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: oneRoundDelay

# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import getStaticsInfo [as 别名]
def oneRoundDelay(step = 10000):
    injectRate = 0.9
    factory = GridNetworkFactory(makeSimpleNode(),Queues)
    factory.constructNetwork(6,6)\
        .setFlow(Flow((0,0),(0,5),injectRate))\
        .setFlow(Flow((5,0),(5,5),injectRate))\
        .setFlow(Flow((2,0),(3,5),injectRate))

    network = factory.getNetwork()

    packetFactory = PacketFactory()
    simulator = \
        Simulator(network,step,ConstLinkRateGenerator(1),packetFactory)
    simulator.run()
    #simulator.printNetwork()
    stat = simulator.getStaticsInfo()
    print stat['aveDelay']
    packetPool = sorted(stat['packetPool'],key=lambda p: p.getID)


    
    py.subplot(211)
    py.vlines([p.getCreateTime() for p in packetPool],[1],[p.getDelay() for p in packetPool],'r')
    py.xlabel('Packet create time(bp with $\lambda$ = 0.9)')
    py.ylabel('delay')
    py.grid(True)




    injectRate = 0.9
    factory = GridNetworkFactory(makeMNode(2),Queues)
    factory.constructNetwork(6,6)\
        .setFlow(Flow((0,0),(0,5),injectRate))\
        .setFlow(Flow((5,0),(5,5),injectRate))\
        .setFlow(Flow((2,0),(3,5),injectRate))

    network = factory.getNetwork()

    packetFactory = PacketFactory()
    simulator = \
        Simulator(network,step,ConstLinkRateGenerator(1),packetFactory)
    simulator.run()
    #simulator.printNetwork()

    stat = simulator.getStaticsInfo()
    print stat['aveDelay']
    packetPool = sorted(stat['packetPool'],key=lambda p: p.getID)

    py.subplot(212)
    py.vlines([p.getCreateTime() for p in packetPool],[1],[p.getDelay() for p in packetPool],'b')
    py.xlabel('Packet create time (m=2 with $\lambda$ = 0.9)')
    py.ylabel('delay')
    py.grid(True)
    py.savefig('packetDelayInOneRound_09')
    py.show()
开发者ID:nwpuCipher,项目名称:MaxWeightSim,代码行数:58,代码来源:Main.py

示例2: CounterTest

# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import getStaticsInfo [as 别名]
def CounterTest(step = 10000):
    injectRate = 1
    factory = GridNetworkFactory(makeCNode(0),Queues)
    factory.constructNetwork(8,8)\
        .setFlow(Flow((0,0),(0,7),injectRate))\
        .setFlow(Flow((7,0),(7,7),injectRate))
                                
    network = factory.getNetwork()

    packetFactory = PacketFactory()
    simulator = \
    Simulator(network,step,ConstLinkRateGenerator(1),packetFactory)
    simulator.run()
    #simulator.printNetwork()
    stat = simulator.getStaticsInfo()
    print stat
开发者ID:nwpuCipher,项目名称:MaxWeightSim,代码行数:18,代码来源:modMain.py

示例3: OrdTest

# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import getStaticsInfo [as 别名]
def OrdTest():
    injectRate = 0.5
    factory = GridNetworkFactory(makeMNode(1),ShadowQueues)
    factory.constructNetwork(8,8)\
        .setFlow(Flow((2,0),(2,7),injectRate),Flow((4,0),(4,7),injectRate),\
                     Flow((0,2),(7,2),injectRate),Flow((0,4),(7,4),injectRate),\
                     Flow((1,1),(5,1),injectRate),Flow((6,1),(6,6),injectRate),\
                     Flow((5,6),(1,6),injectRate),Flow((1,5),(1,2),injectRate))
    network = factory.getNetwork()

    packetFactory = PacketFactory()
    simulator = \
    Simulator(network,gobalMaxStep,ConstLinkRateGenerator(1),packetFactory)
    simulator.run()
    stat = simulator.getStaticsInfo()
    print stat
开发者ID:nwpuCipher,项目名称:MaxWeightSim,代码行数:18,代码来源:modMain.py

示例4: __init__

# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import getStaticsInfo [as 别名]
class DifferentInjectRateTest:
    def __init__(self,linkRate=1,maxStep=gobalMaxStep,injectRate=0.5,\
                     factory=gobalGridNetworkFactory):
        factory.constructNetwork(8,8)\
            .setFlow(Flow((2,0),(2,7),injectRate),Flow((4,0),(4,7),injectRate),
                     Flow((0,2),(7,2),injectRate),Flow((0,4),(7,4),injectRate),
                     Flow((1,1),(5,1),injectRate),Flow((6,1),(6,6),injectRate)
                     ,Flow((5,6),(1,6),injectRate),Flow((1,5),(1,2),injectRate))
        network = factory.getNetwork()

        self.packetFactory = PacketFactory()
        self.simulator = \
            Simulator(network,maxStep,ConstLinkRateGenerator(linkRate),self.packetFactory)

    def run(self):
        self.simulator.run(flag = False)

    def getStaticsInfo(self):
        return self.simulator.getStaticsInfo()
开发者ID:nwpuCipher,项目名称:MaxWeightSim,代码行数:21,代码来源:Main.py


注:本文中的Simulator.Simulator.getStaticsInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。