2017-04-05 7 views
0

ManPyシミュレーションエンジンを実行しようとしています。私はすべての依存関係をインストールし、DREAMモジュールをインストールしました。今、私はManPyのウェブサイト(http://www.manpy-simulation.org)から簡単なサーバーの例を実行しようとしています:DREAM:ManPyシンプルサーバーの例が動作しない

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%です

これに対して、私がスクリプトを実行すると、私はstatを受け取りますement:システム1440個の部分

マシンの総加工度を生成

は、製造される部品の数は単に秒で最大シミュレーション時間である0.0%

あります。

同じ問題が発生した場合は、

答えて

1

これは、配布をより柔軟に宣言するためにManPy APIが更新されたことに起因します。ウェブサイトの文書(私はhttp://www.manpy-simulation.org/と思われます)は決して更新されませんでした。実際には、時間が見つかると実際にはもっと多くの事例を実行する予定です。

この例の正しいコードはここにある: https://lab.nexedi.com/nexedi/dream/blob/master/dream/simulation/Examples/SingleServer.py

そうではない:

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

しかし: processingTime={'Fixed':{'mean':0.25}}

は一般的に、我々はのキーとして配布タイプを与えます外部dictと内部dictのすべてのパラメータ。

ドキュメントの更新版(悲しいことにまだPDFで、まだHTML版ではない)は https://lab.nexedi.com/nexedi/dream/blob/master/ManPy_documentation.pdfです。これにはさらに多くの例があります。

これが機能しない場合は、お知らせください

関連する問題