Commit 60c58500 authored by Jérome Perrin's avatar Jérome Perrin

update Source, the key in JSON is "entity", not "item"

parent 22b26c67
...@@ -31,9 +31,9 @@ from RandomNumberGenerator import RandomNumberGenerator ...@@ -31,9 +31,9 @@ from RandomNumberGenerator import RandomNumberGenerator
class BatchSource(Source): class BatchSource(Source):
def __init__(self, id, name, interarrivalTime=None, def __init__(self, id, name, interarrivalTime=None,
item='Dream.Batch', batchNumberOfUnits=1, **kw): entity='Dream.Batch', batchNumberOfUnits=1, **kw):
Source.__init__(self, id=id, name=name, Source.__init__(self, id=id, name=name,
interarrivalTime=interarrivalTime, item=item, **kw) interarrivalTime=interarrivalTime, entity=entity, **kw)
self.numberOfUnits = batchNumberOfUnits self.numberOfUnits = batchNumberOfUnits
......
...@@ -3,8 +3,8 @@ from dream.simulation.imports import simulate, activate, initialize ...@@ -3,8 +3,8 @@ from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model #define the objects of the model
Frame.capacity=4 Frame.capacity=4
Sp=Source('SP','Parts', mean=0.5, item=Part) Sp=Source('SP','Parts', mean=0.5, entity='Dream.Part')
Sf=Source('SF','Frames', mean=2, item=Frame) Sf=Source('SF','Frames', mean=2, entity='Dream.Frame')
M=Machine('M','Machine', mean=0.25) M=Machine('M','Machine', mean=0.25)
A=Assembly('A','Assembly', mean=2) A=Assembly('A','Assembly', mean=2)
E=Exit('E1','Exit') E=Exit('E1','Exit')
......
...@@ -5,7 +5,7 @@ from dream.simulation.imports import simulate, activate, initialize ...@@ -5,7 +5,7 @@ from dream.simulation.imports import simulate, activate, initialize
# choose to output trace or not # choose to output trace or not
G.trace='Yes' G.trace='Yes'
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',mean=1.5, item=Batch,batchNumberOfUnits=100) S=BatchSource('S','Source',mean=1.5, entity='Dream.Batch', batchNumberOfUnits=100)
Q=Queue('Q','StartQueue',capacity=-1) Q=Queue('Q','StartQueue',capacity=-1)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1) BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1)
M1=Machine('M1','Machine1',mean=0.5) M1=Machine('M1','Machine1',mean=0.5)
......
...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDec ...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDec
from dream.simulation.imports import simulate, activate, initialize from dream.simulation.imports import simulate, activate, initialize
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',mean=0.5, item=Batch,batchNumberOfUnits=4) S=BatchSource('S','Source',mean=0.5, entity='Dream.Batch', batchNumberOfUnits=4)
Q=Queue('Q','StartQueue',capacity=100000) Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1) BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1)
M=Machine('M','Machine',mean=0.5) M=Machine('M','Machine',mean=0.5)
...@@ -34,4 +34,4 @@ for object in G.ObjList: ...@@ -34,4 +34,4 @@ for object in G.ObjList:
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
print "the working ratio of", M.objName, "is", (M.totalWorkingTime/G.maxSimTime)*100 print "the working ratio of", M.objName, "is", (M.totalWorkingTime/G.maxSimTime)*100
print "the blockage ratio of", M.objName, 'is', (M.totalBlockageTime/G.maxSimTime)*100 print "the blockage ratio of", M.objName, 'is', (M.totalBlockageTime/G.maxSimTime)*100
print "the waiting ratio of", M.objName, 'is', (M.totalWaitingTime/G.maxSimTime)*100 print "the waiting ratio of", M.objName, 'is', (M.totalWaitingTime/G.maxSimTime)*100
\ No newline at end of file
...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Fail ...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, Source, Exit, Part, Queue, G, Fail
from dream.simulation.imports import simulate, activate, initialize, infinity from dream.simulation.imports import simulate, activate, initialize, infinity
#define the objects of the model #define the objects of the model
S=Source('S','Source', mean=0.5, item=Part) S=Source('S','Source', mean=0.5, entity='Dream.Part')
Q=Queue('Q','Queue', capacity=infinity) Q=Queue('Q','Queue', capacity=infinity)
M1=Machine('M1','Milling1', mean=0.25) M1=Machine('M1','Milling1', mean=0.25)
M2=Machine('M2','Milling2', mean=0.25) M2=Machine('M2','Milling2', mean=0.25)
......
...@@ -15,7 +15,7 @@ class SelectiveQueue(Queue): ...@@ -15,7 +15,7 @@ class SelectiveQueue(Queue):
return len(self.getActiveObjectQueue())>0 and (not (M1.canAccept())) return len(self.getActiveObjectQueue())>0 and (not (M1.canAccept()))
#define the objects of the model #define the objects of the model
S=Source('S','Source', mean=0.5, item=Part) S=Source('S','Source', mean=0.5, entity='Dream.Part')
Q=SelectiveQueue('Q','Queue', capacity=infinity) Q=SelectiveQueue('Q','Queue', capacity=infinity)
M1=Machine('M1','Milling1', mean=0.25) M1=Machine('M1','Milling1', mean=0.25)
M2=Machine('M2','Milling2', mean=0.25) M2=Machine('M2','Milling2', mean=0.25)
......
...@@ -34,7 +34,7 @@ class CountingExit(Exit): ...@@ -34,7 +34,7 @@ class CountingExit(Exit):
return activeEntity #return the entity obtained return activeEntity #return the entity obtained
#define the objects of the model #define the objects of the model
S=Source('S','Source', mean=0.5, item=Part) S=Source('S','Source', mean=0.5, entity='Dream.Part')
Q=SelectiveQueue('Q','Queue', capacity=infinity) Q=SelectiveQueue('Q','Queue', capacity=infinity)
M1=Milling('M1','Milling1', mean=0.25) M1=Milling('M1','Milling1', mean=0.25)
M2=Milling('M2','Milling2', mean=0.25) M2=Milling('M2','Milling2', mean=0.25)
......
...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDec ...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, BatchSource, Exit, Batch, BatchDec
from dream.simulation.imports import simulate, activate, initialize from dream.simulation.imports import simulate, activate, initialize
# define the objects of the model # define the objects of the model
S=BatchSource('S','Source',mean=1.5, item=Batch,batchNumberOfUnits=100) S=BatchSource('S','Source',mean=1.5, entity='Dream.Batch', batchNumberOfUnits=100)
Q=Queue('Q','StartQueue',capacity=100000) Q=Queue('Q','StartQueue',capacity=100000)
BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1) BD=BatchDecomposition('BC', 'BatchDecomposition', numberOfSubBatches=4, mean=1)
M1=Machine('M1','Machine1',mean=0.5) M1=Machine('M1','Machine1',mean=0.5)
......
...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, Source, Exit, Part, G ...@@ -2,7 +2,7 @@ from dream.simulation.imports import Machine, Source, Exit, Part, G
from dream.simulation.imports import simulate, activate, initialize from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model #define the objects of the model
S=Source('S1','Source',distribution='Fixed', mean=0.5, item=Part) S=Source('S1','Source',distribution='Fixed', mean=0.5, entity='Dream.Part')
M=Machine('M1','Machine', mean=0.25) M=Machine('M1','Machine', mean=0.25)
E=Exit('E1','Exit') E=Exit('E1','Exit')
......
...@@ -3,7 +3,7 @@ from dream.simulation.imports import simulate, activate, initialize ...@@ -3,7 +3,7 @@ from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
S=Source('S1','Source', mean=0.5, item=Part) S=Source('S1','Source', mean=0.5, entity='Dream.Part')
M1=Machine('M1','Machine1', mean=0.25) M1=Machine('M1','Machine1', mean=0.25)
Q=Queue('Q1','Queue') Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', mean=1.5) M2=Machine('M2','Machine2', mean=1.5)
...@@ -55,4 +55,4 @@ R.postProcessing() ...@@ -55,4 +55,4 @@ R.postProcessing()
#print the results #print the results
print "the system produced", E.numOfExits, "parts" print "the system produced", E.numOfExits, "parts"
print "the blockage ratio of", M1.objName, "is", (M1.totalBlockageTime/G.maxSimTime)*100, "%" print "the blockage ratio of", M1.objName, "is", (M1.totalBlockageTime/G.maxSimTime)*100, "%"
print "the working ratio of", R.objName,"is", (R.totalWorkingTime/G.maxSimTime)*100, "%" print "the working ratio of", R.objName,"is", (R.totalWorkingTime/G.maxSimTime)*100, "%"
\ No newline at end of file
...@@ -6,7 +6,7 @@ from dream.KnowledgeExtraction.Plots import Graphs ...@@ -6,7 +6,7 @@ from dream.KnowledgeExtraction.Plots import Graphs
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
S=Source('S1','Source', mean=0.5, item=Part) S=Source('S1','Source', mean=0.5, entity='Dream.Part')
M1=Machine('M1','Machine1', mean=0.25, failureDistribution='Fixed', MTTF=60, MTTR=5, repairman=R) M1=Machine('M1','Machine1', mean=0.25, failureDistribution='Fixed', MTTF=60, MTTR=5, repairman=R)
Q=Queue('Q1','Queue') Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', mean=1.5, failureDistribution='Fixed', MTTF=40, MTTR=10,repairman=R) M2=Machine('M2','Machine2', mean=1.5, failureDistribution='Fixed', MTTF=40, MTTR=10,repairman=R)
......
...@@ -3,7 +3,7 @@ from dream.simulation.imports import simulate, activate, initialize ...@@ -3,7 +3,7 @@ from dream.simulation.imports import simulate, activate, initialize
#define the objects of the model #define the objects of the model
R=Repairman('R1', 'Bob') R=Repairman('R1', 'Bob')
S=Source('S1','Source', mean=0.5, item=Part) S=Source('S1','Source', mean=0.5, entity='Dream.Part')
M1=Machine('M1','Machine1', distribution='Normal', mean=0.25, stdev=0.1, min=0.1, max=1) M1=Machine('M1','Machine1', distribution='Normal', mean=0.25, stdev=0.1, min=0.1, max=1)
Q=Queue('Q1','Queue') Q=Queue('Q1','Queue')
M2=Machine('M2','Machine2', distribution='Normal', mean=1.5, stdev=0.3, min=0.5, max=5) M2=Machine('M2','Machine2', distribution='Normal', mean=1.5, stdev=0.3, min=0.5, max=5)
......
...@@ -35,7 +35,7 @@ import Globals ...@@ -35,7 +35,7 @@ import Globals
# The Source object is a Process # The Source object is a Process
#============================================================================ #============================================================================
class Source(CoreObject): class Source(CoreObject):
def __init__(self, id, name, interarrivalTime=None, item='Dream.Part', **kw): def __init__(self, id, name, interarrivalTime=None, entity='Dream.Part', **kw):
# Default values # Default values
if not interarrivalTime: if not interarrivalTime:
interarrivalTime = {'distributionType': 'Fixed', 'mean': 1} interarrivalTime = {'distributionType': 'Fixed', 'mean': 1}
...@@ -53,7 +53,7 @@ class Source(CoreObject): ...@@ -53,7 +53,7 @@ class Source(CoreObject):
self.rng = RandomNumberGenerator(self, **interarrivalTime) self.rng = RandomNumberGenerator(self, **interarrivalTime)
self.item=Globals.getClassFromName(item) #the type of object that the Source will generate self.item=Globals.getClassFromName(entity) #the type of object that the Source will generate
def initialize(self): def initialize(self):
# using the Process __init__ and not the CoreObject __init__ # using the Process __init__ and not the CoreObject __init__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment