【问题标题】:DREAM: ManPy simple server example not working梦想:ManPy 简单服务器示例不起作用
【发布时间】:2017-08-31 04:39:51
【问题描述】:

我正在尝试运行 ManPy 模拟引擎。我安装了所有依赖项并安装了 DREAM 模块。现在我正在尝试从 ManPy 网站 (http://www.manpy-simulation.org) 运行简单的服务器示例:

from dream.simulation.imports import Source, Queue, Machine, Exit  
from dream.simulation.Globals import runSimulation

#define the objects of the model 
S=Source('S1','Source',interarrivalTime={'distributionType':'Fixed','mean':0.5}, entity='Dream.Part')
Q=Queue('Q1','Queue', capacity=1)
M=Machine('M1','Machine', processingTime={'distributionType':'Fixed','mean':0.25})
E=Exit('E1','Exit')  

#define predecessors and successors for the objects    
S.defineRouting(successorList=[Q])
Q.defineRouting(predecessorList=[S],successorList=[M])
M.defineRouting(predecessorList=[Q],successorList=[E])
E.defineRouting(predecessorList=[M])

# call the runSimulation giving the objects and the length of the experiment
runSimulation(objectList=[S,Q,M,E], maxSimTime=1440.0)

# calculate metrics
working_ratio = (M.totalWorkingTime/1440.0)*100 

#print the results
print "the system produced", E.numOfExits, "parts"
print "the total working ratio of the Machine is", working_ratio, "%"'

根据网站的预期结果是

系统生产了 2880 个零件

机器总工作率为50.0%

但与此相反,当我执行脚本时,我收到以下语句:

系统生产了 1440 个零件

机器总工作比例为0.0%

生产的零件数量只是最大模拟时间(以秒为单位)。

有什么建议或有同样问题的人吗?

【问题讨论】:

    标签: python simulation simpy


    【解决方案1】:

    这是因为更新了 ManPy API 以便更灵活地声明分布​​。网站上的文档(我想是 http://www.manpy-simulation.org/ ?)从未更新过,实际上计划是在找到时间时做更多示例(请参阅下面的 PDF I 链接)。

    这个例子的正确代码在这里: https://lab.nexedi.com/nexedi/dream/blob/master/dream/simulation/Examples/SingleServer.py

    所以不是:

    processingTime={'distributionType':'Fixed','mean':0.25}

    但是: processingTime={'Fixed':{'mean':0.25}}

    通常,我们将分布类型作为外部字典的键和内部字典中的所有参数。

    文档的更新版本(遗憾的是仍然是 PDF 版本,还没有 html 版本)在这里: https://lab.nexedi.com/nexedi/dream/blob/master/ManPy_documentation.pdf。这包含更多示例。

    如果这不起作用请告知

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多