Commit 04cb55a6 authored by Georgios Dagkakis's avatar Georgios Dagkakis

MilkTank to give for transport only when the volume is gathered

parent bf63da2a
...@@ -14,15 +14,15 @@ Tr3=MilkTransport('Tr3','Tr3') ...@@ -14,15 +14,15 @@ Tr3=MilkTransport('Tr3','Tr3')
E=Exit('E','Exit') E=Exit('E','Exit')
route1=[{"stationIdsList": ["T1"]}, route1=[{"stationIdsList": ["T1"]},
{"stationIdsList": ["Tr1"],"processingTime":{'Fixed':{'mean':1}}}, {"stationIdsList": ["Tr1"],"processingTime":{'Fixed':{'mean':0.17341}}},
{"stationIdsList": ["T2"]}, {"stationIdsList": ["T2"]},
{"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}}}, {"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}},'volume':1000},
{"stationIdsList": ["E"]}] {"stationIdsList": ["E"]}]
route2=[{"stationIdsList": ["T3"]}, route2=[{"stationIdsList": ["T3"]},
{"stationIdsList": ["Tr3"],"processingTime":{'Fixed':{'mean':1}}}, {"stationIdsList": ["Tr3"],"processingTime":{'Fixed':{'mean':1.11111}}},
{"stationIdsList": ["T2"]}, {"stationIdsList": ["T2"]},
{"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}}}, {"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}},'volume':1000},
{"stationIdsList": ["E"]}] {"stationIdsList": ["E"]}]
MPList=[] MPList=[]
......
...@@ -34,21 +34,27 @@ class MilkTank(QueueJobShop): ...@@ -34,21 +34,27 @@ class MilkTank(QueueJobShop):
QueueJobShop.__init__(self,id,name,capacity) QueueJobShop.__init__(self,id,name,capacity)
def haveToDispose(self, callerObject=None): def haveToDispose(self, callerObject=None):
if len(self.getActiveObjectQueue()):
requestedVolume=self.getActiveObjectQueue()[0].remainingRoute[0].get('volume',-1)
totalLiters=self.getTotalLiters()
if totalLiters<requestedVolume:
return False
return QueueJobShop.haveToDispose(self, callerObject) return QueueJobShop.haveToDispose(self, callerObject)
def getFat(self): def getFat(self):
return self.getTotalFat()/float(self.getTotalLiters())
def getTotalLiters(self):
totalLiters=0 totalLiters=0
totalFat=0
for pack in self.getActiveObjectQueue(): for pack in self.getActiveObjectQueue():
totalLiters+=pack.liters totalLiters+=pack.liters
totalFat+=pack.fat return totalLiters
return totalFat/float(totalLiters)
def getTotalFat(self):
totalFat=0
for pack in self.getActiveObjectQueue():
totalFat+=pack.fat*pack.liters
return totalFat
\ No newline at end of file
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