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
9e78f168
Commit
9e78f168
authored
Aug 14, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
isProcessing flag added to Machine
parent
59b20ed5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
23 deletions
+27
-23
dream/simulation/Machine.py
dream/simulation/Machine.py
+26
-23
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+1
-0
No files found.
dream/simulation/Machine.py
View file @
9e78f168
...
@@ -173,7 +173,7 @@ class Machine(CoreObject):
...
@@ -173,7 +173,7 @@ class Machine(CoreObject):
self
.
requestingEntity
=
None
self
.
requestingEntity
=
None
# variables used for interruptions
# variables used for interruptions
self
.
tinM
=
0
self
.
tinM
=
0
self
.
time
RestartingProcessing
=
0
self
.
time
LastProcessingStarted
=
0
self
.
interruption
=
False
self
.
interruption
=
False
self
.
breakTime
=
0
self
.
breakTime
=
0
# flag notifying that there is operator assigned to the actievObject
# flag notifying that there is operator assigned to the actievObject
...
@@ -189,7 +189,10 @@ class Machine(CoreObject):
...
@@ -189,7 +189,10 @@ class Machine(CoreObject):
self
.
preemptQueue
=
self
.
env
.
event
()
self
.
preemptQueue
=
self
.
env
.
event
()
# signal used for informing objectInterruption objects that the current entity processed has finished processnig
# signal used for informing objectInterruption objects that the current entity processed has finished processnig
self
.
endedLastProcessing
=
self
.
env
.
event
()
self
.
endedLastProcessing
=
self
.
env
.
event
()
# flag that shows if the Machine is processing state at any given time
self
.
isProcessing
=
False
#===========================================================================
#===========================================================================
# create an operatorPool if needed
# create an operatorPool if needed
#===========================================================================
#===========================================================================
...
@@ -458,13 +461,14 @@ class Machine(CoreObject):
...
@@ -458,13 +461,14 @@ class Machine(CoreObject):
if
oi
.
type
==
'Failure'
:
if
oi
.
type
==
'Failure'
:
if
oi
.
deteriorationType
==
'working'
:
if
oi
.
deteriorationType
==
'working'
:
oi
.
victimStartsProcess
.
succeed
(
self
.
env
.
now
)
oi
.
victimStartsProcess
.
succeed
(
self
.
env
.
now
)
# 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
:
# time
RestartingProcessing
: dummy variable to keep track of the time that the processing starts after
# time
LastProcessingStarted
: dummy variable to keep track of the time that the processing starts after
# every interruption
# every interruption
self
.
timeRestartingProcessing
=
self
.
env
.
now
self
.
timeLastProcessingStarted
=
self
.
env
.
now
self
.
isProcessing
=
True
# wait for the processing time left tinM, if no interruption occurs then change the processingEndedFlag and exit loop,
# wait for the processing time left tinM, if no interruption occurs then change the processingEndedFlag and exit loop,
# else (if interrupted()) set interruption flag to true (only if tinM==0),
# else (if interrupted()) set interruption flag to true (only if tinM==0),
# and recalculate the processing time left tinM, passivate while waiting for repair.
# and recalculate the processing time left tinM, passivate while waiting for repair.
...
@@ -587,11 +591,13 @@ class Machine(CoreObject):
...
@@ -587,11 +591,13 @@ class Machine(CoreObject):
# actions to be carried out when the processing of an Entity ends
# actions to be carried out when the processing of an Entity ends
# =======================================================================
# =======================================================================
def
endProcessingActions
(
self
):
def
endProcessingActions
(
self
):
self
.
isProcessing
=
False
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLastProcessingStarted
activeObjectQueue
=
self
.
Res
.
users
activeObjectQueue
=
self
.
Res
.
users
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
self
.
printTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
processEnd
=
self
.
objName
)
self
.
printTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
processEnd
=
self
.
objName
)
# reset the variables used to handle the interruptions timing
# reset the variables used to handle the interruptions timing
self
.
timeRestartingProcessing
=
0
# self.timeLastProcessingStarted
=0
self
.
breakTime
=
0
self
.
breakTime
=
0
# output to trace that the processing in the Machine self.objName ended
# output to trace that the processing in the Machine self.objName ended
try
:
try
:
...
@@ -618,11 +624,11 @@ class Machine(CoreObject):
...
@@ -618,11 +624,11 @@ class Machine(CoreObject):
self
.
waitToDispose
=
True
self
.
waitToDispose
=
True
# update the total working time
# update the total working time
# the total processing time for this entity is what the distribution initially gave
# the total processing time for this entity is what the distribution initially gave
if
not
self
.
shouldPreempt
:
#
if not self.shouldPreempt:
self
.
totalWorkingTime
+=
self
.
totalProcessingTimeInCurrentEntity
#
self.totalWorkingTime+=self.totalProcessingTimeInCurrentEntity
# if the station was preemptied for a critical order then calculate the total working time accordingly
#
# if the station was preemptied for a critical order then calculate the total working time accordingly
else
:
#
else:
self
.
totalWorkingTime
+=
self
.
env
.
now
-
(
self
.
timeLastEntityEntered
)
# self.totalWorkingTime+=self.env.now-self.timeLastProcessingStarted
# update the variables keeping track of Entity related attributes of the machine
# update the variables keeping track of Entity related attributes of the machine
self
.
timeLastEntityEnded
=
self
.
env
.
now
# this holds the time that the last entity ended processing in Machine
self
.
timeLastEntityEnded
=
self
.
env
.
now
# this holds the time that the last entity ended processing in Machine
self
.
nameLastEntityEnded
=
self
.
currentEntity
.
name
# this holds the name of the last entity that ended processing in Machine
self
.
nameLastEntityEnded
=
self
.
currentEntity
.
name
# this holds the name of the last entity that ended processing in Machine
...
@@ -657,6 +663,9 @@ class Machine(CoreObject):
...
@@ -657,6 +663,9 @@ class Machine(CoreObject):
# actions to be carried out when the processing of an Entity ends
# actions to be carried out when the processing of an Entity ends
# =======================================================================
# =======================================================================
def
interruptionActions
(
self
):
def
interruptionActions
(
self
):
if
self
.
isProcessing
and
not
self
.
shouldPreempt
:
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLastProcessingStarted
self
.
isProcessing
=
False
activeObjectQueue
=
self
.
Res
.
users
activeObjectQueue
=
self
.
Res
.
users
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
self
.
printTrace
(
activeEntity
.
name
,
interrupted
=
self
.
objName
)
self
.
printTrace
(
activeEntity
.
name
,
interrupted
=
self
.
objName
)
...
@@ -668,7 +677,7 @@ class Machine(CoreObject):
...
@@ -668,7 +677,7 @@ class Machine(CoreObject):
except
IndexError
:
except
IndexError
:
pass
pass
# recalculate the processing time left tinM
# recalculate the processing time left tinM
self
.
tinM
=
self
.
tinM
-
(
self
.
env
.
now
-
self
.
time
RestartingProcessing
)
self
.
tinM
=
self
.
tinM
-
(
self
.
env
.
now
-
self
.
time
LastProcessingStarted
)
if
(
self
.
tinM
==
0
):
# sometimes the failure may happen exactly at the time that the processing would finish
if
(
self
.
tinM
==
0
):
# sometimes the failure may happen exactly at the time that the processing would finish
# this may produce disagreement with the simul8 because in both SimPy and Simul8
# this may produce disagreement with the simul8 because in both SimPy and Simul8
# it seems to be random which happens 1st
# it seems to be random which happens 1st
...
@@ -957,18 +966,12 @@ class Machine(CoreObject):
...
@@ -957,18 +966,12 @@ class Machine(CoreObject):
alreadyAdded
=
True
alreadyAdded
=
True
#if Machine is currently processing an entity we should count this working time
#if Machine is currently processing an entity we should count this working time
if
(
len
(
activeObject
.
getActiveObjectQueue
())
>
0
)
\
if
(
self
.
isProcessing
):
and
(
not
(
activeObject
.
nameLastEntityEnded
==
activeObject
.
nameLastEntityEntered
))
\
and
(
not
(
activeObject
.
operationType
==
'Processing'
and
(
activeObject
.
currentOperator
==
None
))):
#if Machine is down we should add this last failure time to the time that it has been down in current entity
#if Machine is down we should add this last failure time to the time that it has been down in current entity
if
self
.
Up
==
False
:
# if self.Up==False:
# if(len(activeObjectQueue)>0) and (self.Up==False):
# # if(len(activeObjectQueue)>0) and (self.Up==False):
activeObject
.
downTimeProcessingCurrentEntity
+=
self
.
env
.
now
-
activeObject
.
timeLastFailure
# activeObject.downTimeProcessingCurrentEntity+=self.env.now-activeObject.timeLastFailure
activeObject
.
totalWorkingTime
+=
self
.
env
.
now
-
activeObject
.
timeLastEntityEntered
\
activeObject
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLastProcessingStarted
-
activeObject
.
downTimeProcessingCurrentEntity
\
-
activeObject
.
operatorWaitTimeCurrentEntity
\
-
activeObject
.
setupTimeCurrentEntity
\
-
offShiftTimeInCurrentEntity
activeObject
.
totalTimeWaitingForOperator
+=
activeObject
.
operatorWaitTimeCurrentEntity
activeObject
.
totalTimeWaitingForOperator
+=
activeObject
.
operatorWaitTimeCurrentEntity
elif
(
len
(
activeObject
.
getActiveObjectQueue
())
>
0
)
\
elif
(
len
(
activeObject
.
getActiveObjectQueue
())
>
0
)
\
...
...
dream/simulation/MachineJobShop.py
View file @
9e78f168
...
@@ -44,6 +44,7 @@ class MachineJobShop(Machine):
...
@@ -44,6 +44,7 @@ class MachineJobShop(Machine):
# actions to be carried out when the processing of an Entity ends
# actions to be carried out when the processing of an Entity ends
# =======================================================================
# =======================================================================
def
endProcessingActions
(
self
):
def
endProcessingActions
(
self
):
self
.
isProcessing
=
False
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
Res
.
users
activeObjectQueue
=
activeObject
.
Res
.
users
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
...
...
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