Commit bd460546 authored by Georgios Dagkakis's avatar Georgios Dagkakis Committed by Sebastien Robin

main script changed so that it can read the mode where we ran the simulation...

main script changed so that it can read the mode where we ran the simulation until we have no more Entities. This mode is given with the dummy maxSimTime=-1 in the inputs for now
parent d762d546
...@@ -128,14 +128,28 @@ class CoreObject(Process): ...@@ -128,14 +128,28 @@ class CoreObject(Process):
difValuesFlag=True difValuesFlag=True
return difValuesFlag return difValuesFlag
#get the active object. This always returns self
def getActiveObject(self): def getActiveObject(self):
return self return self
#get the activeQ of the active object.
def getActiveObjectQueue(self): def getActiveObjectQueue(self):
return self.Res.activeQ return self.Res.activeQ
#get the giver object in a getEntity transaction.
def getGiverObject(self): def getGiverObject(self):
return self.previous[self.predecessorIndex] return self.previous[self.predecessorIndex]
#get the giver object queue in a getEntity transaction.
def getGiverObjectQueue(self): def getGiverObjectQueue(self):
return self.getGiverObject().Res.activeQ return self.getGiverObject().Res.activeQ
#get the receiver object in a removeEntity transaction.
def getReceiverObject(self):
return self.next[self.predecessorIndex]
#get the receiver object queue in a removeEntity transaction.
def getReceiverObjectQueue(self):
return self.getReceiverObject().Res.activeQ
\ No newline at end of file
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"general": { "general": {
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "1", "numberOfReplications": "1",
"maxSimTime": "1000", "maxSimTime": "-1",
"trace": "Yes", "trace": "Yes",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"general": { "general": {
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "1", "numberOfReplications": "1",
"maxSimTime": "1000", "maxSimTime": "-1",
"trace": "Yes", "trace": "Yes",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
"general": { "general": {
"_class": "Dream.Configuration", "_class": "Dream.Configuration",
"numberOfReplications": "1", "numberOfReplications": "1",
"maxSimTime": "1000", "maxSimTime": "-1",
"trace": "Yes", "trace": "Yes",
"confidenceLevel": "0.95" "confidenceLevel": "0.95"
}, },
......
...@@ -50,7 +50,7 @@ except ImportError: ...@@ -50,7 +50,7 @@ except ImportError:
sys.modules['scipy'] = scipy sys.modules['scipy'] = scipy
logger.error("Scipy cannot be imported, using dummy implementation") logger.error("Scipy cannot be imported, using dummy implementation")
from SimPy.Simulation import activate, initialize, simulate, now from SimPy.Simulation import activate, initialize, simulate, now, infinity
from Source import Source from Source import Source
from Globals import G from Globals import G
from Machine import Machine from Machine import Machine
...@@ -211,6 +211,7 @@ def createObjects(): ...@@ -211,6 +211,7 @@ def createObjects():
name=element.get('name', 'not found') name=element.get('name', 'not found')
E=ExitJobShop(id, name) E=ExitJobShop(id, name)
G.ExitJobShopList.append(E) G.ExitJobShopList.append(E)
G.ExitList.append(E)
G.ObjList.append(E) G.ObjList.append(E)
elif objClass=='Dream.Queue': elif objClass=='Dream.Queue':
...@@ -433,7 +434,17 @@ def main(argv=[], input_data=None): ...@@ -433,7 +434,17 @@ def main(argv=[], input_data=None):
activateObjects() activateObjects()
simulate(until=G.maxSimTime) #start the simulation #if the simulation is ran until no more events are scheduled, then we have to find the end time as the time the last entity ended.
if G.maxSimTime==-1:
simulate(until=infinity) #simulate until there are no more events. If someone does it for a model that has always events, then it will run forever!
#identify from the exits what is the time that the last entity has ended.
endList=[]
for exit in G.ExitList:
endList.append(exit.timeLastEntityLeft)
G.maxSimTime=float(max(endList))
#else we simulate until the given maxSimTime
else:
simulate(until=G.maxSimTime) #simulate until the given maxSimTime
#carry on the post processing operations for every object in the topology #carry on the post processing operations for every object in the topology
for element in G.ObjList: for element in G.ObjList:
......
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