Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
473c53e5
Commit
473c53e5
authored
Sep 10, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
objects to use ManPyObject.sendSignal
parent
6c1013bc
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
31 additions
and
80 deletions
+31
-80
dream/simulation/CapacityStationController.py
dream/simulation/CapacityStationController.py
+2
-6
dream/simulation/Machine.py
dream/simulation/Machine.py
+6
-12
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+1
-3
dream/simulation/ManPyObject.py
dream/simulation/ManPyObject.py
+0
-1
dream/simulation/MouldAssemblyBuffer.py
dream/simulation/MouldAssemblyBuffer.py
+1
-3
dream/simulation/NonStarvingEntry.py
dream/simulation/NonStarvingEntry.py
+1
-3
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+5
-8
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+4
-13
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+2
-6
dream/simulation/OperatorRouterManaged.py
dream/simulation/OperatorRouterManaged.py
+2
-6
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+4
-10
dream/simulation/SkilledOperatorRouter.py
dream/simulation/SkilledOperatorRouter.py
+2
-6
dream/simulation/Source.py
dream/simulation/Source.py
+1
-3
No files found.
dream/simulation/CapacityStationController.py
View file @
473c53e5
...
@@ -63,9 +63,7 @@ class CapacityStationController(EventGenerator):
...
@@ -63,9 +63,7 @@ class CapacityStationController(EventGenerator):
for
entity
in
entitiesToCheck
:
for
entity
in
entitiesToCheck
:
if
not
exit
.
isRequested
.
triggered
:
# this is needed because the signal can be triggered also by the buffer
if
not
exit
.
isRequested
.
triggered
:
# this is needed because the signal can be triggered also by the buffer
if
exit
.
expectedSignals
[
'isRequested'
]:
if
exit
.
expectedSignals
[
'isRequested'
]:
succeedTuple
=
(
station
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
exit
,
signal
=
exit
.
isRequested
)
exit
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
exit
.
expectedSignals
[
'isRequested'
]
=
0
# wait until the entity is removed
# wait until the entity is removed
station
.
waitEntityRemoval
=
True
station
.
waitEntityRemoval
=
True
...
@@ -125,9 +123,7 @@ class CapacityStationController(EventGenerator):
...
@@ -125,9 +123,7 @@ class CapacityStationController(EventGenerator):
break
break
# ToDo, here we do not check if station.expectedSignals['isRequested']==1
# ToDo, here we do not check if station.expectedSignals['isRequested']==1
# consistency problem?
# consistency problem?
succeedTuple
=
(
buffer
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
isRequested
)
station
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
station
.
expectedSignals
[
'isRequested'
]
=
0
buffer
.
waitEntityRemoval
=
True
buffer
.
waitEntityRemoval
=
True
buffer
.
expectedSignals
[
'entityRemoved'
]
=
1
buffer
.
expectedSignals
[
'entityRemoved'
]
=
1
...
...
dream/simulation/Machine.py
View file @
473c53e5
...
@@ -577,10 +577,7 @@ class Machine(CoreObject):
...
@@ -577,10 +577,7 @@ class Machine(CoreObject):
if
oi
.
type
==
'Failure'
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
expectedSignals
[
'victimStartsProcess'
]:
if
oi
.
expectedSignals
[
'victimStartsProcess'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimStartsProcess
)
oi
.
victimStartsProcess
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimStartsProcess'
]
=
0
# this loop is repeated until the processing time is expired with no failure
# this loop is repeated until the processing time is expired with no failure
# check when the processingEndedFlag switched to false
# check when the processingEndedFlag switched to false
...
@@ -654,7 +651,8 @@ class Machine(CoreObject):
...
@@ -654,7 +651,8 @@ class Machine(CoreObject):
self
.
operatorWaitTimeCurrentEntity
+=
self
.
timeWaitForOperatorEnded
-
self
.
timeWaitForOperatorStarted
self
.
operatorWaitTimeCurrentEntity
+=
self
.
timeWaitForOperatorEnded
-
self
.
timeWaitForOperatorStarted
# if the processing operator left
# if the processing operator left
elif
self
.
processOperatorUnavailable
in
receivedEvent
:
elif
self
.
processOperatorUnavailable
in
receivedEvent
:
assert
self
.
env
.
now
==
self
.
processOperatorUnavailable
.
value
,
'the operator leaving has not been processed at
\
transmitter
,
eventTime
=
self
.
processOperatorUnavailable
.
value
assert
self
.
env
.
now
==
eventTime
,
'the operator leaving has not been processed at
\
the time it should'
the time it should'
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
# carry interruption actions
# carry interruption actions
...
@@ -852,9 +850,7 @@ class Machine(CoreObject):
...
@@ -852,9 +850,7 @@ class Machine(CoreObject):
if
oi
.
type
==
'Failure'
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
expectedSignals
[
'victimEndsProcess'
]:
if
oi
.
expectedSignals
[
'victimEndsProcess'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimEndsProcess
)
oi
.
victimEndsProcess
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimEndsProcess'
]
=
0
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if
self
.
isWorkingOnTheLast
:
if
self
.
isWorkingOnTheLast
:
...
@@ -865,10 +861,8 @@ class Machine(CoreObject):
...
@@ -865,10 +861,8 @@ class Machine(CoreObject):
if
interruption
.
victim
==
self
and
interruption
.
waitingSignal
:
if
interruption
.
victim
==
self
and
interruption
.
waitingSignal
:
# signal it and reset the flags
# signal it and reset the flags
if
interruption
.
expectedSignals
[
'endedLastProcessing'
]:
if
interruption
.
expectedSignals
[
'endedLastProcessing'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
endedLastProcessing
)
self
.
endedLastProcessing
.
succeed
(
succeedTuple
)
interruption
.
waitingSignal
=
False
interruption
.
waitingSignal
=
False
interruption
.
expectedSignals
[
'endedLastProcessing'
]
=
0
self
.
isWorkingOnTheLast
=
False
self
.
isWorkingOnTheLast
=
False
# set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time
# set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time
if
self
.
interruptedBy
==
'ShiftScheduler'
:
if
self
.
interruptedBy
==
'ShiftScheduler'
:
...
...
dream/simulation/MachineJobShop.py
View file @
473c53e5
...
@@ -293,9 +293,7 @@ class MachineJobShop(Machine):
...
@@ -293,9 +293,7 @@ class MachineJobShop(Machine):
# TODO: use a signal and wait for it, reactivation is not recognised as interruption
# TODO: use a signal and wait for it, reactivation is not recognised as interruption
# reactivate(self)
# reactivate(self)
if
self
.
expectedSignals
[
'preemptQueue'
]:
if
self
.
expectedSignals
[
'preemptQueue'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
preemptQueue
)
self
.
preemptQueue
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'preemptQueue'
]
=
0
# TODO: consider the case when a failure has the Station down. The event preempt will not be received now()
# TODO: consider the case when a failure has the Station down. The event preempt will not be received now()
# but at a later simulation time.
# but at a later simulation time.
...
...
dream/simulation/ManPyObject.py
View file @
473c53e5
...
@@ -152,7 +152,6 @@ class ManPyObject(object):
...
@@ -152,7 +152,6 @@ class ManPyObject(object):
def
sendSignal
(
self
,
sender
=
None
,
receiver
=
None
,
signal
=
None
,
succeedTuple
=
None
):
def
sendSignal
(
self
,
sender
=
None
,
receiver
=
None
,
signal
=
None
,
succeedTuple
=
None
):
assert
signal
,
'there is no signal defined'
assert
signal
,
'there is no signal defined'
assert
receiver
,
'there is no receiver defined for the signal'
assert
receiver
,
'there is no receiver defined for the signal'
# give default values if not given
if
not
sender
:
if
not
sender
:
sender
=
self
sender
=
self
if
not
succeedTuple
:
if
not
succeedTuple
:
...
...
dream/simulation/MouldAssemblyBuffer.py
View file @
473c53e5
...
@@ -111,9 +111,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
...
@@ -111,9 +111,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
if
secondary
.
currentStation
.
__class__
.
__name__
==
'ConditionalBuffer'
:
if
secondary
.
currentStation
.
__class__
.
__name__
==
'ConditionalBuffer'
:
# print now(), self.id, ' signalling conditional buffer'
# print now(), self.id, ' signalling conditional buffer'
if
secondary
.
currentStation
.
expectedSignals
[
'canDispose'
]:
if
secondary
.
currentStation
.
expectedSignals
[
'canDispose'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
secondary
.
currentStation
,
signal
=
secondary
.
currentStation
.
canDispose
)
secondary
.
currentStation
.
canDispose
.
succeed
(
succeedTuple
)
secondary
.
currentStation
.
expectedSignals
[
'canDispose'
]
=
0
break
break
# for all the components that have the same parent Order as the activeEntity
# for all the components that have the same parent Order as the activeEntity
activeEntity
.
order
.
componentsReadyForAssembly
=
1
activeEntity
.
order
.
componentsReadyForAssembly
=
1
...
...
dream/simulation/NonStarvingEntry.py
View file @
473c53e5
...
@@ -81,7 +81,5 @@ class NonStarvingEntry(Queue):
...
@@ -81,7 +81,5 @@ class NonStarvingEntry(Queue):
G
.
numberOfEntities
+=
1
G
.
numberOfEntities
+=
1
if
not
self
.
canDispose
.
triggered
:
if
not
self
.
canDispose
.
triggered
:
if
self
.
expectedSignals
[
'canDispose'
]:
if
self
.
expectedSignals
[
'canDispose'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
canDispose
)
self
.
canDispose
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'canDispose'
]
=
0
\ No newline at end of file
dream/simulation/ObjectInterruption.py
View file @
473c53e5
...
@@ -96,8 +96,7 @@ class ObjectInterruption(ManPyObject):
...
@@ -96,8 +96,7 @@ class ObjectInterruption(ManPyObject):
def
invoke
(
self
):
def
invoke
(
self
):
if
self
.
expectedSignals
[
'isCalled'
]:
if
self
.
expectedSignals
[
'isCalled'
]:
succeedTuple
=
(
self
.
victim
,
self
.
env
.
now
)
succeedTuple
=
(
self
.
victim
,
self
.
env
.
now
)
self
.
isCalled
.
succeed
(
succeedTuple
)
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
isCalled
,
succeedTuple
=
succeedTuple
)
self
.
expectedSignals
[
'isCalled'
]
=
0
#===========================================================================
#===========================================================================
# returns the internal queue of the victim
# returns the internal queue of the victim
...
@@ -120,9 +119,9 @@ class ObjectInterruption(ManPyObject):
...
@@ -120,9 +119,9 @@ class ObjectInterruption(ManPyObject):
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
if
self
.
victim
.
expectedSignals
[
'interruptionStart'
]:
if
self
.
victim
.
expectedSignals
[
'interruptionStart'
]:
self
.
victim
.
interruptedBy
=
self
.
type
self
.
victim
.
interruptedBy
=
self
.
type
s
ucceedTuple
=
(
self
,
self
.
env
.
now
)
s
elf
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
interruptionStart
)
self
.
victim
.
interruptionStart
.
succeed
(
succeedTuple
)
# ToDo following is needed for synching, check why
self
.
victim
.
expectedSignals
[
'interruption
Start'
]
=
0
self
.
victim
.
expectedSignals
[
'interruption
End'
]
=
1
# if the machines are operated by dedicated operators
# if the machines are operated by dedicated operators
if
self
.
victim
.
dedicatedOperator
:
if
self
.
victim
.
dedicatedOperator
:
# request allocation
# request allocation
...
@@ -133,9 +132,7 @@ class ObjectInterruption(ManPyObject):
...
@@ -133,9 +132,7 @@ class ObjectInterruption(ManPyObject):
#===========================================================================
#===========================================================================
def
reactivateVictim
(
self
):
def
reactivateVictim
(
self
):
if
self
.
victim
.
expectedSignals
[
'interruptionEnd'
]:
if
self
.
victim
.
expectedSignals
[
'interruptionEnd'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
interruptionEnd
)
self
.
victim
.
interruptionEnd
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'interruptionEnd'
]
=
0
#reset the interruptionStart event of the victim
#reset the interruptionStart event of the victim
self
.
victim
.
interruptionStart
=
self
.
env
.
event
()
self
.
victim
.
interruptionStart
=
self
.
env
.
event
()
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
...
...
dream/simulation/OperatedPoolBroker.py
View file @
473c53e5
...
@@ -100,10 +100,8 @@ class Broker(ObjectInterruption):
...
@@ -100,10 +100,8 @@ class Broker(ObjectInterruption):
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
G
.
Router
.
isCalled
)
G
.
Router
.
invoked
=
True
G
.
Router
.
invoked
=
True
succeedTuple
=
(
self
,
self
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
self
.
waitForOperator
=
True
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
...
@@ -156,9 +154,7 @@ class Broker(ObjectInterruption):
...
@@ -156,9 +154,7 @@ class Broker(ObjectInterruption):
self
.
victim
.
currentOperator
.
timeLastOperationStarted
=
self
.
env
.
now
#()
self
.
victim
.
currentOperator
.
timeLastOperationStarted
=
self
.
env
.
now
#()
# signal the machine that an operator is reserved
# signal the machine that an operator is reserved
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
brokerIsSet
)
self
.
victim
.
brokerIsSet
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]
=
0
# update the schedule of the operator
# update the schedule of the operator
self
.
victim
.
currentOperator
.
schedule
.
append
([
self
.
victim
,
self
.
env
.
now
])
self
.
victim
.
currentOperator
.
schedule
.
append
([
self
.
victim
,
self
.
env
.
now
])
...
@@ -184,9 +180,7 @@ class Broker(ObjectInterruption):
...
@@ -184,9 +180,7 @@ class Broker(ObjectInterruption):
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
G
.
Router
.
invoked
=
True
G
.
Router
.
invoked
=
True
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
G
.
Router
.
isCalled
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# after signalling the broker will signal it's victim that it has finished it's processes
# after signalling the broker will signal it's victim that it has finished it's processes
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
...
@@ -202,7 +196,4 @@ class Broker(ObjectInterruption):
...
@@ -202,7 +196,4 @@ class Broker(ObjectInterruption):
pass
pass
# return the control to the victim
# return the control to the victim
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
brokerIsSet
)
self
.
victim
.
brokerIsSet
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]
=
0
dream/simulation/OperatorRouter.py
View file @
473c53e5
...
@@ -245,19 +245,15 @@ class Router(ObjectInterruption):
...
@@ -245,19 +245,15 @@ class Router(ObjectInterruption):
elif
station
.
broker
.
waitForOperator
:
elif
station
.
broker
.
waitForOperator
:
# signal this station's broker that the resource is available
# signal this station's broker that the resource is available
if
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]:
if
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]:
self
.
sendSignal
(
receiver
=
station
.
broker
,
signal
=
station
.
broker
.
resourceAvailable
)
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
station
.
broker
.
resourceAvailable
.
succeed
(
succeedTuple
)
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]
=
0
else
:
else
:
# signal the queue proceeding the station
# signal the queue proceeding the station
if
station
.
canAccept
()
\
if
station
.
canAccept
()
\
and
any
(
type
==
'Load'
for
type
in
station
.
multOperationTypeList
):
and
any
(
type
==
'Load'
for
type
in
station
.
multOperationTypeList
):
if
station
.
expectedSignals
[
'loadOperatorAvailable'
]:
if
station
.
expectedSignals
[
'loadOperatorAvailable'
]:
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
loadOperatorAvailable
)
self
.
printTrace
(
'router'
,
'signalling'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
self
.
printTrace
(
'router'
,
'signalling'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
station
.
loadOperatorAvailable
.
succeed
(
succeedTuple
)
station
.
expectedSignals
[
'loadOperatorAvailable'
]
=
0
#===========================================================================
#===========================================================================
# clear the pending lists of the router
# clear the pending lists of the router
...
...
dream/simulation/OperatorRouterManaged.py
View file @
473c53e5
...
@@ -200,9 +200,7 @@ class RouterManaged(Router):
...
@@ -200,9 +200,7 @@ class RouterManaged(Router):
# signal this station's broker that the resource is available
# signal this station's broker that the resource is available
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
if
operator
.
isAssignedTo
().
broker
.
expectedSignals
[
'resourceAvailable'
]:
if
operator
.
isAssignedTo
().
broker
.
expectedSignals
[
'resourceAvailable'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
operator
.
isAssignedTo
().
broker
,
signal
=
operator
.
isAssignedTo
().
broker
.
resourceAvailable
)
operator
.
isAssignedTo
().
broker
.
resourceAvailable
.
succeed
(
succeedTuple
)
operator
.
isAssignedTo
().
broker
.
expectedSignals
[
'resourceAvailable'
]
=
0
elif
(
not
station
in
self
.
pendingMachines
)
or
(
not
station
in
self
.
toBeSignalled
):
elif
(
not
station
in
self
.
pendingMachines
)
or
(
not
station
in
self
.
toBeSignalled
):
# signal the queue proceeding the station
# signal the queue proceeding the station
assert
operator
.
candidateEntity
.
currentStation
in
self
.
toBeSignalled
,
'the candidateEntity currentStation is not picked by the Router'
assert
operator
.
candidateEntity
.
currentStation
in
self
.
toBeSignalled
,
'the candidateEntity currentStation is not picked by the Router'
...
@@ -213,9 +211,7 @@ class RouterManaged(Router):
...
@@ -213,9 +211,7 @@ class RouterManaged(Router):
if
not
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
.
triggered
:
if
not
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
.
triggered
:
self
.
printTrace
(
'router'
,
'signalling queue'
+
' '
*
50
+
operator
.
candidateEntity
.
currentStation
.
id
)
self
.
printTrace
(
'router'
,
'signalling queue'
+
' '
*
50
+
operator
.
candidateEntity
.
currentStation
.
id
)
if
operator
.
candidateEntity
.
currentStation
.
expectedSignals
[
'loadOperatorAvailable'
]:
if
operator
.
candidateEntity
.
currentStation
.
expectedSignals
[
'loadOperatorAvailable'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
operator
.
candidateEntity
.
currentStation
,
signal
=
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
)
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
.
succeed
(
succeedTuple
)
operator
.
candidateEntity
.
currentStation
.
expectedSignals
[
'loadOperatorAvailable'
]
=
0
#===========================================================================
#===========================================================================
# clear the pending lists of the router
# clear the pending lists of the router
...
...
dream/simulation/ShiftScheduler.py
View file @
473c53e5
...
@@ -99,9 +99,7 @@ class ShiftScheduler(ObjectInterruption):
...
@@ -99,9 +99,7 @@ class ShiftScheduler(ObjectInterruption):
for
oi
in
self
.
victim
.
objectInterruptions
:
for
oi
in
self
.
victim
.
objectInterruptions
:
if
oi
.
isWaitingForVictimOnShift
:
if
oi
.
isWaitingForVictimOnShift
:
if
oi
.
expectedSignals
[
'victimOnShift'
]:
if
oi
.
expectedSignals
[
'victimOnShift'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimOnShift
)
oi
.
victimOnShift
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimOnShift'
]
=
0
else
:
else
:
timeToEndShift
=
float
(
self
.
remainingShiftPattern
[
0
][
1
]
-
self
.
env
.
now
)
timeToEndShift
=
float
(
self
.
remainingShiftPattern
[
0
][
1
]
-
self
.
env
.
now
)
yield
self
.
env
.
timeout
(
timeToEndShift
-
self
.
receiveBeforeEndThreshold
)
# wait until the entry threshold
yield
self
.
env
.
timeout
(
timeToEndShift
-
self
.
receiveBeforeEndThreshold
)
# wait until the entry threshold
...
@@ -129,19 +127,15 @@ class ShiftScheduler(ObjectInterruption):
...
@@ -129,19 +127,15 @@ class ShiftScheduler(ObjectInterruption):
# signal to the station that the operator has to leave
# signal to the station that the operator has to leave
station
=
self
.
victim
.
workingStation
station
=
self
.
victim
.
workingStation
if
station
:
if
station
:
if
not
self
.
endUnfinished
and
station
.
isProcessing
:
if
not
self
.
endUnfinished
and
station
.
expectedSignals
[
'processOperatorUnavailable'
]:
station
.
processOperatorUnavailable
.
succeed
(
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
processOperatorUnavailable
)
station
.
expectedSignals
[
'processOperatorUnavailable'
]
=
0
self
.
requestAllocation
()
self
.
requestAllocation
()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
# if the victim has interruptions that measure only the on-shift time, they have to be notified
for
oi
in
self
.
victim
.
objectInterruptions
:
for
oi
in
self
.
victim
.
objectInterruptions
:
if
oi
.
isWaitingForVictimOffShift
:
if
oi
.
isWaitingForVictimOffShift
:
if
oi
.
expectedSignals
[
'victimOffShift'
]:
if
oi
.
expectedSignals
[
'victimOffShift'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimOffShift
)
oi
.
victimOffShift
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimOnShift'
]
=
0
self
.
victim
.
onShift
=
False
# get the victim off-shift
self
.
victim
.
onShift
=
False
# get the victim off-shift
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
...
...
dream/simulation/SkilledOperatorRouter.py
View file @
473c53e5
...
@@ -254,19 +254,15 @@ class SkilledRouter(Router):
...
@@ -254,19 +254,15 @@ class SkilledRouter(Router):
if
station
.
broker
.
waitForOperator
:
if
station
.
broker
.
waitForOperator
:
# signal this station's broker that the resource is available
# signal this station's broker that the resource is available
if
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]:
if
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]:
self
.
sendSignal
(
receiver
=
station
.
broker
,
signal
=
station
.
broker
.
resourceAvailable
)
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
station
.
id
)
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
station
.
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
station
.
broker
.
resourceAvailable
.
succeed
(
succeedTuple
)
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]
=
0
else
:
else
:
# signal the queue proceeding the station
# signal the queue proceeding the station
if
station
.
canAccept
()
\
if
station
.
canAccept
()
\
and
any
(
type
==
'Load'
for
type
in
station
.
multOperationTypeList
):
and
any
(
type
==
'Load'
for
type
in
station
.
multOperationTypeList
):
if
station
.
expectedSignals
[
'loadOperatorAvailable'
]:
if
station
.
expectedSignals
[
'loadOperatorAvailable'
]:
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
loadOperatorAvailable
)
self
.
printTrace
(
'router'
,
'signalling'
+
' '
*
50
+
station
.
id
)
self
.
printTrace
(
'router'
,
'signalling'
+
' '
*
50
+
station
.
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
station
.
loadOperatorAvailable
.
succeed
(
succeedTuple
)
station
.
expectedSignals
[
'loadOperatorAvailable'
]
=
0
#===================================================================
#===================================================================
# default behaviour
# default behaviour
...
...
dream/simulation/Source.py
View file @
473c53e5
...
@@ -207,7 +207,5 @@ class Source(CoreObject):
...
@@ -207,7 +207,5 @@ class Source(CoreObject):
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
# run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
# run the default method
if
len
(
self
.
getActiveObjectQueue
())
==
1
:
if
len
(
self
.
getActiveObjectQueue
())
==
1
:
if
self
.
expectedSignals
[
'entityCreated'
]:
if
self
.
expectedSignals
[
'entityCreated'
]:
succeedTuple
=
(
newEntity
,
self
.
env
.
now
)
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
entityCreated
)
self
.
entityCreated
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'entityCreated'
]
=
0
return
activeEntity
return
activeEntity
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment