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
63d2f0c2
Commit
63d2f0c2
authored
Sep 12, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Nov 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
signalling in operation process corrected
parent
a13b5330
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
dream/simulation/Machine.py
dream/simulation/Machine.py
+17
-20
No files found.
dream/simulation/Machine.py
View file @
63d2f0c2
...
@@ -659,9 +659,8 @@ class Machine(CoreObject):
...
@@ -659,9 +659,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
.
waitinSignal
=
False
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'
:
...
@@ -845,11 +844,11 @@ class Machine(CoreObject):
...
@@ -845,11 +844,11 @@ class Machine(CoreObject):
# and the processing time left
# and the processing time left
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
# get the processing time, tinMStarts holds the processing time of the machine
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
# get the processing time, tinMStarts holds the processing time of the machine
self
.
tinM
=
self
.
totalProcessingTimeInCurrentEntity
# timer to hold the processing time left
self
.
tinM
=
self
.
totalProcessingTimeInCurrentEntity
# timer to hold the processing time left
# variables used to flag any interruptions and the end of the processing
# variables used to flag any interruptions and the end of the processing
self
.
interruption
=
False
self
.
interruption
=
False
processingNotFinished
=
True
processingNotFinished
=
True
# if there is a failure that depends on the working time of the Machine
# if there is a failure that depends on the working time of the Machine
# send it the victimStartsProcess signal
# send it the victimStartsProcess signal
for
oi
in
self
.
objectInterruptions
:
for
oi
in
self
.
objectInterruptions
:
...
@@ -857,11 +856,11 @@ class Machine(CoreObject):
...
@@ -857,11 +856,11 @@ class Machine(CoreObject):
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
expectedSignals
[
'victimStartsProcess'
]:
if
oi
.
expectedSignals
[
'victimStartsProcess'
]:
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimStartsProcess
)
self
.
sendSignal
(
receiver
=
oi
,
signal
=
oi
.
victimStartsProcess
)
# 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
while
processingNotFinished
:
while
processingNotFinished
:
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'interruptionStart'
]
=
1
self
.
expectedSignals
[
'preemptQueue'
]
=
1
self
.
expectedSignals
[
'preemptQueue'
]
=
1
...
@@ -883,28 +882,28 @@ class Machine(CoreObject):
...
@@ -883,28 +882,28 @@ class Machine(CoreObject):
assert
eventTime
==
self
.
env
.
now
,
'the interruption has not been processed on the time of activation'
assert
eventTime
==
self
.
env
.
now
,
'the interruption has not been processed on the time of activation'
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
interruptionStart
=
self
.
env
.
event
()
self
.
interruptionActions
()
# execute interruption actions
self
.
interruptionActions
()
# execute interruption actions
#===========================================================
#===========================================================
# # release the operator if there is interruption
# # release the operator if there is interruption
#===========================================================
#===========================================================
if
self
.
shouldYield
(
operationTypes
=
{
"Processing"
:
1
},
methods
=
{
'isOperated'
:
1
}):
if
self
.
shouldYield
(
operationTypes
=
{
"Processing"
:
1
},
methods
=
{
'isOperated'
:
1
}):
yield
self
.
env
.
process
(
self
.
release
())
yield
self
.
env
.
process
(
self
.
release
())
# loop until we reach at a state that there is no interruption
# loop until we reach at a state that there is no interruption
while
1
:
while
1
:
self
.
expectedSignals
[
'interruptionEnd'
]
=
1
self
.
expectedSignals
[
'interruptionEnd'
]
=
1
yield
self
.
interruptionEnd
# interruptionEnd to be triggered by ObjectInterruption
yield
self
.
interruptionEnd
# interruptionEnd to be triggered by ObjectInterruption
transmitter
,
eventTime
=
self
.
interruptionEnd
.
value
transmitter
,
eventTime
=
self
.
interruptionEnd
.
value
assert
eventTime
==
self
.
env
.
now
,
'the interruptionEnd was received later than anticipated'
assert
eventTime
==
self
.
env
.
now
,
'the interruptionEnd was received later than anticipated'
self
.
interruptionEnd
=
self
.
env
.
event
()
self
.
interruptionEnd
=
self
.
env
.
event
()
if
self
.
Up
and
self
.
onShift
:
if
self
.
Up
and
self
.
onShift
:
break
break
self
.
postInterruptionActions
()
self
.
postInterruptionActions
()
#===========================================================
#===========================================================
# # request a resource after the repair
# # request a resource after the repair
#===========================================================
#===========================================================
...
@@ -944,22 +943,20 @@ class Machine(CoreObject):
...
@@ -944,22 +943,20 @@ class Machine(CoreObject):
assert
eventTime
==
self
.
env
.
now
,
'the preemption must be performed on the time of request'
assert
eventTime
==
self
.
env
.
now
,
'the preemption must be performed on the time of request'
self
.
preemptQueue
=
self
.
env
.
event
()
self
.
preemptQueue
=
self
.
env
.
event
()
self
.
interruptionActions
()
# execute interruption actions
self
.
interruptionActions
()
# execute interruption actions
#===========================================================
#===========================================================
# # release the operator if there is interruption
# # release the operator if there is interruption
#===========================================================
#===========================================================
if
self
.
shouldYield
(
operationTypes
=
{
"Processing"
:
1
},
methods
=
{
'isOperated'
:
1
}):
if
self
.
shouldYield
(
operationTypes
=
{
"Processing"
:
1
},
methods
=
{
'isOperated'
:
1
}):
yield
self
.
env
.
process
(
self
.
release
())
yield
self
.
env
.
process
(
self
.
release
())
self
.
postInterruptionActions
()
self
.
postInterruptionActions
()
break
break
# if no interruption occurred the processing in M1 is ended
# if no interruption occurred the processing in M1 is ended
else
:
else
:
processingNotFinished
=
False
processingNotFinished
=
False
# carry on actions that have to take place when an Entity ends its processing
# carry on actions that have to take place when an Entity ends its processing
self
.
endProcessingActions
()
self
.
endProcessingActions
()
#===================================================================
#===================================================================
...
...
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