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
61301df0
Commit
61301df0
authored
Apr 17, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preemption enabled for unoperated MachineJobShops
parent
e2e10cac
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
86 deletions
+73
-86
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+0
-6
dream/simulation/Machine.py
dream/simulation/Machine.py
+33
-47
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+40
-33
No files found.
dream/simulation/CoreObject.py
View file @
61301df0
...
...
@@ -566,12 +566,6 @@ class CoreObject(Process):
def
unAssignExit
(
self
):
self
.
exitAssignedToReceiver
=
None
# # =======================================================================
# # actions to be carried whenever the object is preemptied
# # =======================================================================
# def preempt(self):
# pass
# =======================================================================
# actions to be carried whenever the object is interrupted
# (failure, break, preemption, etc)
...
...
dream/simulation/Machine.py
View file @
61301df0
This diff is collapsed.
Click to expand it.
dream/simulation/MachineJobShop.py
View file @
61301df0
...
...
@@ -86,12 +86,16 @@ class MachineJobShop(Machine):
if
not
activeObject
.
onShift
:
activeObject
.
timeLastShiftEnded
=
now
()
# update the total working time # the total processing time for this entity is what the distribution initially gave
activeObject
.
totalWorkingTime
+=
activeObject
.
totalProcessingTimeInCurrentEntity
if
not
self
.
shouldPreempt
:
activeObject
.
totalWorkingTime
+=
activeObject
.
totalProcessingTimeInCurrentEntity
else
:
activeObject
.
totalWorkingTime
+=
now
()
-
(
self
.
timeLastEntityEntered
)
# update the variables keeping track of Entity related attributes of the machine
activeObject
.
timeLastEntityEnded
=
now
()
# this holds the time that the last entity ended processing in Machine
activeObject
.
nameLastEntityEnded
=
activeObject
.
currentEntity
.
name
# this holds the name of the last entity that ended processing in Machine
activeObject
.
completedJobs
+=
1
# Machine completed one more Job
# reseting the preemption flag
self
.
shouldPreempt
=
False
# TODO: collapse that to Machine
...
...
@@ -214,37 +218,40 @@ class MachineJobShop(Machine):
and
(
thecaller
in
activeObject
.
next
)
\
and
thecaller
.
isInRoute
(
activeObject
)
# # =======================================================================
# # method to execute preemption
# # =======================================================================
# def preempt(self):
# activeObject=self.getActiveObject()
# activeEntity=self.getActiveObjectQueue()[0] #get the active Entity
# #calculate the remaining processing time
# #if it is reset then set it as the original processing time
# if self.resetOnPreemption:
# remainingProcessingTime=self.procTime
# #else subtract the time that passed since the entity entered
# #(may need also failure time if there was. TO BE MELIORATED)
# else:
# remainingProcessingTime=self.procTime-(now()-self.timeLastEntityEntered)
# #update the remaining route of activeEntity
# activeEntity.remainingRoute.insert(0, {'stationIdsList':[str(self.id)],\
# 'processingTime':\
# {'distributionType':'Fixed',\
# 'mean':str(remainingProcessingTime)}})
# # activeEntity.remainingRoute.insert(0, [self.id, remainingProcessingTime])
# activeEntity.remainingRoute.insert(0, {'stationIdsList':[str(self.lastGiver.id)],\
# 'processingTime':\
# {'distributionType':'Fixed',\
# 'mean':'0'}})
# # activeEntity.remainingRoute.insert(0, [self.lastGiver.id, 0])
# #set the receiver as the object where the active entity was preempted from
# self.receiver=self.lastGiver
# self.next=[self.receiver]
# self.waitToDispose=True #set that I have to dispose
# self.receiver.timeLastEntityEnded=now() #required to count blockage correctly in the preemptied station
# reactivate(self)
# =======================================================================
# method to execute preemption
# =======================================================================
def
preempt
(
self
):
activeObject
=
self
.
getActiveObject
()
activeEntity
=
self
.
getActiveObjectQueue
()[
0
]
#get the active Entity
#calculate the remaining processing time
#if it is reset then set it as the original processing time
if
self
.
resetOnPreemption
:
remainingProcessingTime
=
self
.
procTime
#else subtract the time that passed since the entity entered
#(may need also failure time if there was. TO BE MELIORATED)
else
:
remainingProcessingTime
=
self
.
procTime
-
(
now
()
-
self
.
timeLastEntityEntered
)
#update the remaining route of activeEntity
activeEntity
.
remainingRoute
.
insert
(
0
,
{
'stationIdsList'
:[
str
(
self
.
id
)],
\
'processingTime'
:
\
{
'distributionType'
:
'Fixed'
,
\
'mean'
:
str
(
remainingProcessingTime
)}})
# activeEntity.remainingRoute.insert(0, [self.id, remainingProcessingTime])
activeEntity
.
remainingRoute
.
insert
(
0
,
{
'stationIdsList'
:[
str
(
self
.
lastGiver
.
id
)],
\
'processingTime'
:
\
{
'distributionType'
:
'Fixed'
,
\
'mean'
:
'0'
}})
# activeEntity.remainingRoute.insert(0, [self.lastGiver.id, 0])
#set the receiver as the object where the active entity was preempted from
self
.
receiver
=
self
.
lastGiver
self
.
next
=
[
self
.
receiver
]
self
.
waitToDispose
=
True
#set that I have to dispose
self
.
receiver
.
timeLastEntityEnded
=
now
()
#required to count blockage correctly in the preemptied station
# TODO: use a signal and wait for it, reactivation is not recognised as interruption
reactivate
(
self
)
# 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.
#===========================================================================
# extend the default behaviour to check if whether the station
...
...
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