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')
E=Exit('E','Exit')
route1=[{"stationIdsList": ["T1"]},
{"stationIdsList": ["Tr1"],"processingTime":{'Fixed':{'mean':1}}},
{"stationIdsList": ["Tr1"],"processingTime":{'Fixed':{'mean':0.17341}}},
{"stationIdsList": ["T2"]},
{"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}}},
{"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}},'volume':1000},
{"stationIdsList": ["E"]}]
route2=[{"stationIdsList": ["T3"]},
{"stationIdsList": ["Tr3"],"processingTime":{'Fixed':{'mean':1}}},
{"stationIdsList": ["Tr3"],"processingTime":{'Fixed':{'mean':1.11111}}},
{"stationIdsList": ["T2"]},
{"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}}},
{"stationIdsList": ["Tr2"],"processingTime":{'Fixed':{'mean':1}},'volume':1000},
{"stationIdsList": ["E"]}]
MPList=[]
......
......@@ -34,21 +34,27 @@ class MilkTank(QueueJobShop):
QueueJobShop.__init__(self,id,name,capacity)
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)
def getFat(self):
return self.getTotalFat()/float(self.getTotalLiters())
def getTotalLiters(self):
totalLiters=0
totalFat=0
for pack in self.getActiveObjectQueue():
totalLiters+=pack.liters
totalFat+=pack.fat
return totalFat/float(totalLiters)
totalLiters+=pack.liters
return 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