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
ecb52198
Commit
ecb52198
authored
Sep 10, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
objects to use ManPyObject.sendSignal
parent
d3b109b1
Changes
13
Hide 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 @
ecb52198
...
...
@@ -63,9 +63,7 @@ class CapacityStationController(EventGenerator):
for
entity
in
entitiesToCheck
:
if
not
exit
.
isRequested
.
triggered
:
# this is needed because the signal can be triggered also by the buffer
if
exit
.
expectedSignals
[
'isRequested'
]:
succeedTuple
=
(
station
,
self
.
env
.
now
)
exit
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
exit
.
expectedSignals
[
'isRequested'
]
=
0
self
.
sendSignal
(
receiver
=
exit
,
signal
=
exit
.
isRequested
)
# wait until the entity is removed
station
.
waitEntityRemoval
=
True
...
...
@@ -125,9 +123,7 @@ class CapacityStationController(EventGenerator):
break
# ToDo, here we do not check if station.expectedSignals['isRequested']==1
# consistency problem?
succeedTuple
=
(
buffer
,
self
.
env
.
now
)
station
.
isRequested
.
succeed
(
succeedTuple
)
# send is requested to station
station
.
expectedSignals
[
'isRequested'
]
=
0
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
isRequested
)
buffer
.
waitEntityRemoval
=
True
buffer
.
expectedSignals
[
'entityRemoved'
]
=
1
...
...
dream/simulation/Machine.py
View file @
ecb52198
...
...
@@ -577,10 +577,7 @@ class Machine(CoreObject):
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
expectedSignals
[
'victimStartsProcess'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimStartsProcess
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimStartsProcess'
]
=
0
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimStartsProcess
)
# this loop is repeated until the processing time is expired with no failure
# check when the processingEndedFlag switched to false
...
...
@@ -654,8 +651,9 @@ class Machine(CoreObject):
self
.
operatorWaitTimeCurrentEntity
+=
self
.
timeWaitForOperatorEnded
-
self
.
timeWaitForOperatorStarted
# if the processing operator left
elif
self
.
processOperatorUnavailable
in
receivedEvent
:
assert
self
.
env
.
now
==
self
.
processOperatorUnavailable
.
value
,
'the operator leaving has not been processed at
\
the time it should'
transmitter
,
eventTime
=
self
.
processOperatorUnavailable
.
value
assert
self
.
env
.
now
==
eventTime
,
'the operator leaving has not been processed at
\
the time it should'
self
.
processOperatorUnavailable
=
self
.
env
.
event
()
# carry interruption actions
self
.
interruptionActions
()
...
...
@@ -852,9 +850,7 @@ class Machine(CoreObject):
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
expectedSignals
[
'victimEndsProcess'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimEndsProcess
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimEndsProcess'
]
=
0
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimEndsProcess
)
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if
self
.
isWorkingOnTheLast
:
...
...
@@ -865,10 +861,8 @@ class Machine(CoreObject):
if
interruption
.
victim
==
self
and
interruption
.
waitingSignal
:
# signal it and reset the flags
if
interruption
.
expectedSignals
[
'endedLastProcessing'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
endedLastProcessing
.
succeed
(
succeedTuple
)
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
endedLastProcessing
)
interruption
.
waitingSignal
=
False
interruption
.
expectedSignals
[
'endedLastProcessing'
]
=
0
self
.
isWorkingOnTheLast
=
False
# set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time
if
self
.
interruptedBy
==
'ShiftScheduler'
:
...
...
dream/simulation/MachineJobShop.py
View file @
ecb52198
...
...
@@ -293,9 +293,7 @@ class MachineJobShop(Machine):
# TODO: use a signal and wait for it, reactivation is not recognised as interruption
# reactivate(self)
if
self
.
expectedSignals
[
'preemptQueue'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
preemptQueue
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'preemptQueue'
]
=
0
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
preemptQueue
)
# 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.
...
...
dream/simulation/ManPyObject.py
View file @
ecb52198
...
...
@@ -152,7 +152,6 @@ class ManPyObject(object):
def
sendSignal
(
self
,
sender
=
None
,
receiver
=
None
,
signal
=
None
,
succeedTuple
=
None
):
assert
signal
,
'there is no signal defined'
assert
receiver
,
'there is no receiver defined for the signal'
# give default values if not given
if
not
sender
:
sender
=
self
if
not
succeedTuple
:
...
...
dream/simulation/MouldAssemblyBuffer.py
View file @
ecb52198
...
...
@@ -111,9 +111,7 @@ class MouldAssemblyBuffer(QueueManagedJob):
if
secondary
.
currentStation
.
__class__
.
__name__
==
'ConditionalBuffer'
:
# print now(), self.id, ' signalling conditional buffer'
if
secondary
.
currentStation
.
expectedSignals
[
'canDispose'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
secondary
.
currentStation
.
canDispose
.
succeed
(
succeedTuple
)
secondary
.
currentStation
.
expectedSignals
[
'canDispose'
]
=
0
self
.
sendSignal
(
receiver
=
secondary
.
currentStation
,
signal
=
secondary
.
currentStation
.
canDispose
)
break
# for all the components that have the same parent Order as the activeEntity
activeEntity
.
order
.
componentsReadyForAssembly
=
1
...
...
dream/simulation/NonStarvingEntry.py
View file @
ecb52198
...
...
@@ -81,7 +81,5 @@ class NonStarvingEntry(Queue):
G
.
numberOfEntities
+=
1
if
not
self
.
canDispose
.
triggered
:
if
self
.
expectedSignals
[
'canDispose'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
canDispose
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'canDispose'
]
=
0
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
canDispose
)
\ No newline at end of file
dream/simulation/ObjectInterruption.py
View file @
ecb52198
...
...
@@ -96,8 +96,7 @@ class ObjectInterruption(ManPyObject):
def
invoke
(
self
):
if
self
.
expectedSignals
[
'isCalled'
]:
succeedTuple
=
(
self
.
victim
,
self
.
env
.
now
)
self
.
isCalled
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'isCalled'
]
=
0
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
isCalled
,
succeedTuple
=
succeedTuple
)
#===========================================================================
# returns the internal queue of the victim
...
...
@@ -120,9 +119,9 @@ class ObjectInterruption(ManPyObject):
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
if
self
.
victim
.
expectedSignals
[
'interruptionStart'
]:
self
.
victim
.
interruptedBy
=
self
.
type
s
ucceedTuple
=
(
self
,
self
.
env
.
now
)
self
.
victim
.
interruptionStart
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'interruption
Start'
]
=
0
s
elf
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
interruptionStart
)
# ToDo following is needed for synching, check why
self
.
victim
.
expectedSignals
[
'interruption
End'
]
=
1
# if the machines are operated by dedicated operators
if
self
.
victim
.
dedicatedOperator
:
# request allocation
...
...
@@ -133,9 +132,7 @@ class ObjectInterruption(ManPyObject):
#===========================================================================
def
reactivateVictim
(
self
):
if
self
.
victim
.
expectedSignals
[
'interruptionEnd'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
victim
.
interruptionEnd
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'interruptionEnd'
]
=
0
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
interruptionEnd
)
#reset the interruptionStart event of the victim
self
.
victim
.
interruptionStart
=
self
.
env
.
event
()
# TODO: reconsider what happens when failure and ShiftScheduler (e.g.) signal simultaneously
...
...
dream/simulation/OperatedPoolBroker.py
View file @
ecb52198
...
...
@@ -100,10 +100,8 @@ class Broker(ObjectInterruption):
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
G
.
Router
.
isCalled
)
G
.
Router
.
invoked
=
True
succeedTuple
=
(
self
,
self
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
...
...
@@ -156,9 +154,7 @@ class Broker(ObjectInterruption):
self
.
victim
.
currentOperator
.
timeLastOperationStarted
=
self
.
env
.
now
#()
# signal the machine that an operator is reserved
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
victim
.
brokerIsSet
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]
=
0
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
brokerIsSet
)
# update the schedule of the operator
self
.
victim
.
currentOperator
.
schedule
.
append
([
self
.
victim
,
self
.
env
.
now
])
...
...
@@ -184,9 +180,7 @@ class Broker(ObjectInterruption):
if
not
G
.
Router
.
invoked
and
G
.
Router
.
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
G
.
Router
.
invoked
=
True
succeedTuple
=
(
self
,
self
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
self
.
sendSignal
(
receiver
=
G
.
Router
,
signal
=
G
.
Router
.
isCalled
)
# 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
# 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):
pass
# return the control to the victim
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
victim
.
brokerIsSet
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]
=
0
self
.
sendSignal
(
receiver
=
self
.
victim
,
signal
=
self
.
victim
.
brokerIsSet
)
dream/simulation/OperatorRouter.py
View file @
ecb52198
...
...
@@ -245,19 +245,15 @@ class Router(ObjectInterruption):
elif
station
.
broker
.
waitForOperator
:
# signal this station's broker that the resource is available
if
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]:
self
.
sendSignal
(
receiver
=
station
.
broker
,
signal
=
station
.
broker
.
resourceAvailable
)
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
:
# signal the queue proceeding the station
if
station
.
canAccept
()
\
and
any
(
type
==
'Load'
for
type
in
station
.
multOperationTypeList
):
if
station
.
expectedSignals
[
'loadOperatorAvailable'
]:
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
loadOperatorAvailable
)
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
...
...
dream/simulation/OperatorRouterManaged.py
View file @
ecb52198
...
...
@@ -200,9 +200,7 @@ class RouterManaged(Router):
# signal this station's broker that the resource is available
self
.
printTrace
(
'router'
,
'signalling broker of'
+
' '
*
50
+
operator
.
isAssignedTo
().
id
)
if
operator
.
isAssignedTo
().
broker
.
expectedSignals
[
'resourceAvailable'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
operator
.
isAssignedTo
().
broker
.
resourceAvailable
.
succeed
(
succeedTuple
)
operator
.
isAssignedTo
().
broker
.
expectedSignals
[
'resourceAvailable'
]
=
0
self
.
sendSignal
(
receiver
=
operator
.
isAssignedTo
().
broker
,
signal
=
operator
.
isAssignedTo
().
broker
.
resourceAvailable
)
elif
(
not
station
in
self
.
pendingMachines
)
or
(
not
station
in
self
.
toBeSignalled
):
# signal the queue proceeding the station
assert
operator
.
candidateEntity
.
currentStation
in
self
.
toBeSignalled
,
'the candidateEntity currentStation is not picked by the Router'
...
...
@@ -213,9 +211,7 @@ class RouterManaged(Router):
if
not
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
.
triggered
:
self
.
printTrace
(
'router'
,
'signalling queue'
+
' '
*
50
+
operator
.
candidateEntity
.
currentStation
.
id
)
if
operator
.
candidateEntity
.
currentStation
.
expectedSignals
[
'loadOperatorAvailable'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
.
succeed
(
succeedTuple
)
operator
.
candidateEntity
.
currentStation
.
expectedSignals
[
'loadOperatorAvailable'
]
=
0
self
.
sendSignal
(
receiver
=
operator
.
candidateEntity
.
currentStation
,
signal
=
operator
.
candidateEntity
.
currentStation
.
loadOperatorAvailable
)
#===========================================================================
# clear the pending lists of the router
...
...
dream/simulation/ShiftScheduler.py
View file @
ecb52198
...
...
@@ -99,9 +99,7 @@ class ShiftScheduler(ObjectInterruption):
for
oi
in
self
.
victim
.
objectInterruptions
:
if
oi
.
isWaitingForVictimOnShift
:
if
oi
.
expectedSignals
[
'victimOnShift'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimOnShift
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimOnShift'
]
=
0
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimOnShift
)
else
:
timeToEndShift
=
float
(
self
.
remainingShiftPattern
[
0
][
1
]
-
self
.
env
.
now
)
yield
self
.
env
.
timeout
(
timeToEndShift
-
self
.
receiveBeforeEndThreshold
)
# wait until the entry threshold
...
...
@@ -129,19 +127,15 @@ class ShiftScheduler(ObjectInterruption):
# signal to the station that the operator has to leave
station
=
self
.
victim
.
workingStation
if
station
:
if
not
self
.
endUnfinished
and
station
.
isProcessing
:
station
.
processOperatorUnavailable
.
succeed
(
self
.
env
.
now
)
station
.
expectedSignals
[
'processOperatorUnavailable'
]
=
0
if
not
self
.
endUnfinished
and
station
.
expectedSignals
[
'processOperatorUnavailable'
]:
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
processOperatorUnavailable
)
self
.
requestAllocation
()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
for
oi
in
self
.
victim
.
objectInterruptions
:
if
oi
.
isWaitingForVictimOffShift
:
if
oi
.
expectedSignals
[
'victimOffShift'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimOffShift
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimOnShift'
]
=
0
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimOffShift
)
self
.
victim
.
onShift
=
False
# get the victim off-shift
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
...
...
dream/simulation/SkilledOperatorRouter.py
View file @
ecb52198
...
...
@@ -254,19 +254,15 @@ class SkilledRouter(Router):
if
station
.
broker
.
waitForOperator
:
# signal this station's broker that the resource is available
if
station
.
broker
.
expectedSignals
[
'resourceAvailable'
]:
self
.
sendSignal
(
receiver
=
station
.
broker
,
signal
=
station
.
broker
.
resourceAvailable
)
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
:
# signal the queue proceeding the station
if
station
.
canAccept
()
\
and
any
(
type
==
'Load'
for
type
in
station
.
multOperationTypeList
):
if
station
.
expectedSignals
[
'loadOperatorAvailable'
]:
self
.
sendSignal
(
receiver
=
station
,
signal
=
station
.
loadOperatorAvailable
)
self
.
printTrace
(
'router'
,
'signalling'
+
' '
*
50
+
station
.
id
)
succeedTuple
=
(
self
,
self
.
env
.
now
)
station
.
loadOperatorAvailable
.
succeed
(
succeedTuple
)
station
.
expectedSignals
[
'loadOperatorAvailable'
]
=
0
#===================================================================
# default behaviour
...
...
dream/simulation/Source.py
View file @
ecb52198
...
...
@@ -207,7 +207,5 @@ class Source(CoreObject):
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
# run the default method
if
len
(
self
.
getActiveObjectQueue
())
==
1
:
if
self
.
expectedSignals
[
'entityCreated'
]:
succeedTuple
=
(
newEntity
,
self
.
env
.
now
)
self
.
entityCreated
.
succeed
(
succeedTuple
)
self
.
expectedSignals
[
'entityCreated'
]
=
0
self
.
sendSignal
(
receiver
=
self
,
signal
=
self
.
entityCreated
)
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