Commit 20e93ba0 authored by Georgios Dagkakis's avatar Georgios Dagkakis

objects do not have to set flags to 0

parent ecb52198
......@@ -101,9 +101,7 @@ class BatchDecomposition(CoreObject):
self.expectedSignals['interruptionEnd']=1
yield self.interruptionEnd
self.expectedSignals['interruptionEnd']=0
transmitter, eventTime=self.interruptionEnd.value
assert self==transmitter, 'the victim of the failure is not the object that received the interruptionEnd event'
self.interruptionEnd=self.env.event()
......@@ -122,11 +120,7 @@ class BatchDecomposition(CoreObject):
assert requestingObject==self.giver, 'the giver is not the requestingObject'
self.isRequested=self.env.event()
break
self.expectedSignals['isRequested']=0
self.expectedSignals['interruptionStart']=0
self.expectedSignals['initialWIP']=0
if not self.isProcessingInitialWIP: # if we are in the state of having initial wip no need to take an Entity
self.currentEntity=self.getEntity()
......@@ -169,8 +163,6 @@ class BatchDecomposition(CoreObject):
yield self.entityRemoved
self.expectedSignals['entityRemoved']=0
transmitter, eventTime=self.entityRemoved.value
self.waitEntityRemoval=False
break
......@@ -190,17 +182,13 @@ class BatchDecomposition(CoreObject):
self.expectedSignals['entityRemoved']=1
yield self.entityRemoved
self.expectedSignals['entityRemoved']=0
transmitter, eventTime=self.entityRemoved.value
self.waitEntityRemoval=False
break
self.entityRemoved=self.env.event()
self.expectedSignals['canDispose']=0
# =======================================================================
# removes an entity from the Machine
# =======================================================================
......
......@@ -96,8 +96,6 @@ class BatchReassembly(CoreObject):
yield self.interruptionEnd
self.expectedSignals['interruptionEnd']=0
transmitter, eventTime=self.interruptionEnd.value
assert self==transmitter, 'the victim of the failure is not the object that received the interruptionEnd event'
self.interruptionEnd=self.env.event()
......@@ -118,10 +116,6 @@ class BatchReassembly(CoreObject):
self.isProcessingInitialWIP=False
break
self.expectedSignals['isRequested']=0
self.expectedSignals['interruptionStart']=0
self.expectedSignals['initialWIP']=0
if not self.isProcessingInitialWIP: # if we are in the state of having initial wip no need to take an Entity
self.currentEntity=self.getEntity()
......@@ -163,8 +157,6 @@ class BatchReassembly(CoreObject):
yield self.interruptionEnd # interruptionEnd to be triggered by ObjectInterruption
self.expectedSignals['interruptionEnd']=0
transmitter, eventTime=self.interruptionEnd.value
assert eventTime==self.env.now, 'the victim of the failure is not the object that received it'
self.interruptionEnd=self.env.event()
......@@ -201,8 +193,6 @@ class BatchReassembly(CoreObject):
yield self.entityRemoved
self.expectedSignals['entityRemoved']=0
transmitter, eventTime=self.entityRemoved.value
self.printTrace(self.id, entityRemoved=eventTime)
assert eventTime==self.env.now,'entityRemoved event activated earlier than received'
......@@ -211,10 +201,7 @@ class BatchReassembly(CoreObject):
# if while waiting (for a canDispose event) became free as the machines that follows emptied it, then proceed
if not self.haveToDispose():
break
self.expectedSignals['interruptionStart']=0
self.expectedSignals['canDispose']=0
# =======================================================================
# removes an entity from the Machine
# =======================================================================
......
......@@ -70,9 +70,7 @@ class CapacityStationController(EventGenerator):
station.expectedSignals['entityRemoved']=1
yield station.entityRemoved
station.expectedSignals['entityRemoved']=0
transmitter, eventTime=station.entityRemoved.value
station.waitEntityRemoval=False
exit.currentlyObtainedEntities.append(entity)
......@@ -129,9 +127,7 @@ class CapacityStationController(EventGenerator):
buffer.expectedSignals['entityRemoved']=1
yield buffer.entityRemoved
buffer.expectedSignals['entityRemoved']=0
transmitter, eventTime=buffer.entityRemoved.value
buffer.waitEntityRemoval=False
buffer.entityRemoved=self.env.event()
......
......@@ -130,9 +130,6 @@ class Dismantle(CoreObject):
self.expectedSignals['isRequested']=1
yield self.isRequested #[self.isRequested,self.canDispose, self.loadOperatorAvailable]
self.expectedSignals['isRequested']=0
if self.isRequested.value:
# self.printTrace(self.id, isRequested=self.isRequested.value.id)
# reset the isRequested signal parameter
......@@ -176,9 +173,6 @@ class Dismantle(CoreObject):
self.expectedSignals['entityRemoved']=1
yield self.entityRemoved
self.expectedSignals['entityRemoved']=0
self.waitEntityRemoval=False
self.entityRemoved=self.env.event()
......@@ -189,8 +183,7 @@ class Dismantle(CoreObject):
if self.isEmpty():
self.waitToDisposeFrame=False #the Dismantle has no Frame to dispose now
break
self.expectedSignals['canDispose']=0
#===========================================================================
# checks if the Dismantle can accept an entity and there is a Frame
......
......@@ -126,18 +126,14 @@ class Failure(ObjectInterruption):
self.expectedSignals['victimOnShift']=1
yield self.victimOnShift
self.expectedSignals['victimOnShift']=0
self.isWaitingForVictimOnShift=False
self.victimOnShift=self.env.event()
assert self.victim.onShift==True, 'the victim of shiftFailure must be onShift to continue counting the TTF'
else:
self.isWaitingForVictimOffShift=False
failureNotTriggered=False
self.expectedSignals['victimOffShift']=0
# if time to failure counts only in working time
elif self.deteriorationType=='working':
# wait for victim to start process
......@@ -145,9 +141,7 @@ class Failure(ObjectInterruption):
self.expectedSignals['victimStartsProcess']=1
yield self.victimStartsProcess
self.expectedSignals['victimStartsProcess']=0
self.victimStartsProcess=self.env.event()
while failureNotTriggered:
timeRestartedCounting=self.env.now
......@@ -163,15 +157,11 @@ class Failure(ObjectInterruption):
self.expectedSignals['victimStartsProcess']=1
yield self.victimStartsProcess
self.expectedSignals['victimStartsProcess']=0
# wait for victim to start again processing
self.victimStartsProcess=self.env.event()
else:
failureNotTriggered=False
self.expectedSignals['victimEndsProcess']=0
# interrupt the victim
self.interruptVictim() # interrupt the victim
......
......@@ -427,12 +427,7 @@ class Machine(CoreObject):
self.loadOperatorWaitTimeCurrentEntity = 0
self.loadTimeCurrentEntity = 0
self.setupTimeCurrentEntity = 0
self.expectedSignals['isRequested']=0
self.expectedSignals['interruptionEnd']=0
self.expectedSignals['loadOperatorAvailable']=0
self.expectedSignals['initialWIP']=0
# ======= request a resource
if(self.operatorPool!="None") and any(type=='Load' for type in self.multOperationTypeList):
# when it's ready to accept (canAcceptAndIsRequested) then inform the broker
......
......@@ -75,9 +75,7 @@ class Broker(ObjectInterruption):
self.expectedSignals['isCalled']=1
yield self.isCalled
self.expectedSignals['isCalled']=0
transmitter, eventTime=self.isCalled.value
assert eventTime==self.env.now, 'the broker should be granted control instantly'
self.isCalled=self.env.event()
......@@ -109,9 +107,7 @@ class Broker(ObjectInterruption):
self.expectedSignals['resourceAvailable']=1
yield self.resourceAvailable
self.expectedSignals['resourceAvailable']=0
transmitter, eventTime=self.resourceAvailable.value
self.resourceAvailable=self.env.event()
# remove the currentEntity from the pendingEntities
......@@ -127,9 +123,7 @@ class Broker(ObjectInterruption):
self.expectedSignals['resourceAvailable']=1
yield self.resourceAvailable
self.expectedSignals['resourceAvailable']=0
transmitter, eventTime=self.resourceAvailable.value
self.resourceAvailable=self.env.event()
self.waitForOperator=False
......@@ -162,8 +156,7 @@ class Broker(ObjectInterruption):
self.expectedSignals['isCalled']=1
yield self.isCalled
self.expectedSignals['isCalled']=0
transmitter, eventTime=self.isCalled.value
assert eventTime==self.env.now, 'the broker should be granted control instantly'
self.isCalled=self.env.event()
......
......@@ -110,9 +110,7 @@ class Router(ObjectInterruption):
self.expectedSignals['isCalled']=1
yield self.isCalled
self.expectedSignals['isCalled']=0
transmitter, eventTime=self.isCalled.value
self.isCalled=self.env.event()
self.printTrace('','=-'*15)
......
......@@ -82,9 +82,7 @@ class RouterManaged(Router):
self.expectedSignals['isCalled']=1
yield self.isCalled
self.expectedSignals['isCalled']=0
transmitter, eventTime=self.isCalled.value
self.isCalled=self.env.event()
self.printTrace('','=-'*15)
......
......@@ -89,9 +89,6 @@ class OrderDecomposition(CoreObject):
transmitter, eventTime=self.canDispose.value
self.canDispose=self.env.event()
self.expectedSignals['isRequested']=0
self.expectedSignals['canDispose']=0
# if the event that activated the thread is canDispose then signalReceiver
if self.haveToDispose():
# print now(), self.id, 'will try to signal a receiver from generator'
......
......@@ -87,8 +87,6 @@ class ScheduledMaintenance(ObjectInterruption):
yield self.victim.endedLastProcessing # there is no signal yet that signals the change of such state (an object getting empty)
self.expectedSignals['endedLastProcessing']=0
transmitter, eventTime=self.victim.endedLastProcessing.value
assert eventTime==self.env.now, 'the processing end signal is not received by maintenance on time'
self.victim.endedLastProcessing=self.env.event()
......@@ -104,8 +102,6 @@ class ScheduledMaintenance(ObjectInterruption):
yield self.victimIsEmptyBeforeMaintenance # there is no signal yet that signals the change of such state (an object getting empty)
self.expectedSignals['victimIsEmptyBeforeMaintenance']=0
transmitter, eventTime=self.victimIsEmptyBeforeMaintenance.value
assert eventTime==self.env.now, 'the processing end signal is not received by maintenance on time'
self.victimIsEmptyBeforeMaintenance=self.env.event()
......
......@@ -116,7 +116,6 @@ class ShiftScheduler(ObjectInterruption):
self.waitingSignal=True
self.expectedSignals['endedLastProcessing']=1
yield self.victim.endedLastProcessing
self.expectedSignals['endedLastProcessing']=0
transmitter, eventTime=self.victim.endedLastProcessing.value
self.victim.endedLastProcessing=self.env.event()
self.interruptVictim()
......
......@@ -74,9 +74,7 @@ class SkilledRouter(Router):
self.expectedSignals['isCalled']=1
yield self.isCalled
self.expectedSignals['isCalled']=0
transmitter, eventTime=self.isCalled.value
self.isCalled=self.env.event()
self.printTrace('','=-'*15)
......@@ -137,8 +135,6 @@ class SkilledRouter(Router):
receivedEvent=yield self.env.all_of(self.endProcessingSignals)
self.expectedSignals['endedLastProcessing']=0
for station in self.busyStations:
if station.endedLastProcessing in receivedEvent:
transmitter, eventTime=station.endedLastProcessing.value
......
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