本文整理汇总了Python中Simulator.Simulator.init方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.init方法的具体用法?Python Simulator.init怎么用?Python Simulator.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: simulationLoop
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import init [as 别名]
def simulationLoop(server, capacity, period, scaled, ex_time, int_time):
name = server + ".csv"
s = Simulator(stats = name)
# Set the server
if server == 'polling':
s.server = PollingServer(capacity, period)
elif server == 'deferrable':
s.server = DeferrableServer(capacity, period)
else:
s.server = BackgroundServer()
# Load the taskset
for t in scaled:
s.tasks.append(t)
# Create the aperiodic task
ap = AperiodicTask("Soft", ex_time, int_time)
s.tasks.append(ap)
# RUUUUUUUUN !!!
s.init(until)
s.run()
return computeAverage(name)
示例2: Simulator
# 需要导入模块: from Simulator import Simulator [as 别名]
# 或者: from Simulator.Simulator import init [as 别名]
#for load in [0.05, 0.10, 0.15, 0.20, 0.25, 0.30]:
for load in [0.05]:
# Try the simulator
s = Simulator(render = "results.svg")
server_period = min([t.period for t in taskset])
server_period = 18
#server_period = max([t.period for t in taskset]) + 1
server_capacity = server_period * 0.248
s.server = PollingServer(server_capacity, server_period)
server_capacity = server_period * 0.239
s.server = DeferrableServer(server_capacity, server_period)
#s.server = DeferrableServer(server_period, server_period)
#s.server = BackgroundServer()
for t in taskset:
s.tasks.append(t)
# Building the aperiodic task
interrarival = 18
computation = load * interrarival
t = AperiodicTask("S", computation, interrarival)
s.tasks.append(t)
until = PeriodicTask.lcm(taskset)
until = 1000
s.init(until)
s.run()