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
90b37ff5
Commit
90b37ff5
authored
Apr 19, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jobshop machines also check if their entryIsAssigned before returning True from canAccept
parent
0ebf00f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
92 deletions
+60
-92
dream/simulation/MachineJobShop.py
dream/simulation/MachineJobShop.py
+10
-4
dream/simulation/MachineManagedJob.py
dream/simulation/MachineManagedJob.py
+50
-88
No files found.
dream/simulation/MachineJobShop.py
View file @
90b37ff5
...
@@ -49,6 +49,10 @@ class MachineJobShop(Machine):
...
@@ -49,6 +49,10 @@ class MachineJobShop(Machine):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
#=======================================================================
# # TESTING
# print activeObject.getActiveObjectQueue()[0].name,"ended processing in "+activeObject.objName
#=======================================================================
# reset the variables used to handle the interruptions timing
# reset the variables used to handle the interruptions timing
self
.
timeRestartingProcessing
=
0
self
.
timeRestartingProcessing
=
0
self
.
breakTime
=
0
self
.
breakTime
=
0
...
@@ -165,11 +169,13 @@ class MachineJobShop(Machine):
...
@@ -165,11 +169,13 @@ class MachineJobShop(Machine):
return
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
return
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
and
len
(
activeObject
.
getActiveObjectQueue
())
<
activeObject
.
capacity
\
and
len
(
activeObject
.
getActiveObjectQueue
())
<
activeObject
.
capacity
\
and
activeObject
.
checkIfMachineIsUp
()
\
and
activeObject
.
checkIfMachineIsUp
()
\
and
activeObject
.
isInRoute
(
thecaller
)
and
activeObject
.
isInRoute
(
thecaller
)
\
and
not
activeObject
.
entryIsAssignedTo
()
else
:
else
:
return
len
(
activeObject
.
getActiveObjectQueue
())
<
activeObject
.
capacity
\
return
len
(
activeObject
.
getActiveObjectQueue
())
<
activeObject
.
capacity
\
and
activeObject
.
checkIfMachineIsUp
()
\
and
activeObject
.
checkIfMachineIsUp
()
\
and
activeObject
.
isInRoute
(
thecaller
)
and
activeObject
.
isInRoute
(
thecaller
)
\
and
not
activeObject
.
entryIsAssignedTo
()
#===========================================================================
#===========================================================================
# method used to check whether the station is in the entity-to-be-received route
# method used to check whether the station is in the entity-to-be-received route
...
@@ -209,12 +215,12 @@ class MachineJobShop(Machine):
...
@@ -209,12 +215,12 @@ class MachineJobShop(Machine):
if
(
callerObject
==
None
):
if
(
callerObject
==
None
):
return
len
(
activeObjectQueue
)
>
0
\
return
len
(
activeObjectQueue
)
>
0
\
and
activeObject
.
waitToDispose
\
and
activeObject
.
waitToDispose
\
and
activeObject
.
checkIf
MachineIsUp
()
\
and
activeObject
.
checkIf
Active
()
\
#return True if the Machine in the state of disposing and the caller is the receiver
#return True if the Machine in the state of disposing and the caller is the receiver
return
len
(
activeObjectQueue
)
>
0
\
return
len
(
activeObjectQueue
)
>
0
\
and
activeObject
.
waitToDispose
\
and
activeObject
.
waitToDispose
\
and
activeObject
.
checkIf
MachineIsUp
()
\
and
activeObject
.
checkIf
Active
()
\
and
(
thecaller
in
activeObject
.
next
)
\
and
(
thecaller
in
activeObject
.
next
)
\
and
thecaller
.
isInRoute
(
activeObject
)
and
thecaller
.
isInRoute
(
activeObject
)
...
...
dream/simulation/MachineManagedJob.py
View file @
90b37ff5
...
@@ -68,24 +68,16 @@ class MachineManagedJob(MachineJobShop):
...
@@ -68,24 +68,16 @@ class MachineManagedJob(MachineJobShop):
# =======================================================================
# =======================================================================
# checks if the Queue can accept an entity
# checks if the Queue can accept an entity
#
it checks also the next station of the Entity
#
TODO: cannot check here if the station in the route of the entity that will be received (if any)
# a
nd returns true only if the active object is the next station
# a
s the giver (QueueManagedJob) will be sorted from giver.haveToDispose in self.canAcceptAndIsRequested method
# =======================================================================
# =======================================================================
def
canAccept
(
self
,
callerObject
=
None
):
def
canAccept
(
self
,
callerObject
=
None
):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
thecaller
=
callerObject
#return according to the state of the Queue
if
(
thecaller
!=
None
):
return
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
#check it the caller object holds an Entity that requests for current object
and
activeObject
.
checkIfMachineIsUp
()
\
if
len
(
thecaller
.
getActiveObjectQueue
())
>
0
:
and
not
activeObject
.
entryIsAssignedTo
()
# TODO: make sure that the first entity of the callerObject is to be disposed
activeEntity
=
thecaller
.
getActiveObjectQueue
()[
0
]
# if the machine's Id is in the list of the entity's next stations
if
activeObject
.
id
in
activeEntity
.
remainingRoute
[
0
].
get
(
'stationIdsList'
,[]):
#return according to the state of the Queue
return
len
(
activeObject
.
getActiveObjectQueue
())
<
activeObject
.
capacity
\
and
activeObject
.
Up
return
False
# =======================================================================
# =======================================================================
# checks if the Queue can accept an specific Entity
# checks if the Queue can accept an specific Entity
...
@@ -113,74 +105,50 @@ class MachineManagedJob(MachineJobShop):
...
@@ -113,74 +105,50 @@ class MachineManagedJob(MachineJobShop):
# get active and giver objects
# get active and giver objects
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
giverObject
=
self
.
getGiverObject
()
giverObject
=
activeObject
.
getGiverObject
()
giverObjectQueue
=
giverObject
.
getActiveObjectQueue
()
# dummy variables that help prioritise the objects requesting to give objects to the Machine (activeObject)
isRequested
=
False
# is requested is dummyVariable checking if it is requested to accept an item
maxTimeWaiting
=
0
# dummy variable counting the time a predecessor is blocked
# loop through the possible givers to see which have to dispose and which is the one blocked for longer
for
object
in
activeObject
.
previous
:
if
(
object
.
haveToDispose
(
activeObject
)
and
object
.
receiver
==
self
):
# and not object.exitIsAssigned()):
isRequested
=
True
# if the possible giver has entities to dispose of
if
(
object
.
downTimeInTryingToReleaseCurrentEntity
>
0
):
# and the possible giver has been down while trying to give away the Entity
timeWaiting
=
now
()
-
object
.
timeLastFailureEnded
# the timeWaiting dummy variable counts the time end of the last failure of the giver object
else
:
timeWaiting
=
now
()
-
object
.
timeLastEntityEnded
# in any other case, it holds the time since the end of the Entity processing
#if more than one possible givers have to dispose take the part from the one that is blocked longer
if
(
timeWaiting
>=
maxTimeWaiting
):
activeObject
.
giver
=
object
# set the giver
maxTimeWaiting
=
timeWaiting
# if the multOperationTypeList of the machine contains Load or Setup
# if the multOperationTypeList of the machine contains Load or Setup
if
(
activeObject
.
operatorPool
!=
'None'
and
(
any
(
type
==
'Load'
for
type
in
activeObject
.
multOperationTypeList
)
\
if
(
activeObject
.
operatorPool
!=
'None'
and
(
any
(
type
==
'Load'
for
type
in
activeObject
.
multOperationTypeList
)
\
or
any
(
type
==
'Setup'
for
type
in
activeObject
.
multOperationTypeList
))):
or
any
(
type
==
'Setup'
for
type
in
activeObject
.
multOperationTypeList
))):
if
isRequested
:
if
giverObject
.
haveToDispose
(
activeObject
):
# TODO: check whether this entity is the one to be hand in
#===============================================================
# to be used in operatorPreemptive
# # TODO: check whether this entity is the one to be hand in
activeObject
.
requestingEntity
=
activeObject
.
giver
.
getActiveObjectQueue
()[
0
]
# # to be used in operatorPreemptive
# TODO: update the object requesting the operator
# activeObject.requestingEntity=activeObject.giver.getActiveObjectQueue()[0]
activeObject
.
operatorPool
.
requestingObject
=
activeObject
.
giver
# # TODO: update the object requesting the operator
# TODO: update the last object calling the operatorPool
# activeObject.operatorPool.requestingObject=activeObject.giver
activeObject
.
operatorPool
.
receivingObject
=
activeObject
# # TODO: update the last object calling the operatorPool
# activeObject.operatorPool.receivingObject=activeObject
if
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
#===============================================================
and
self
.
checkOperator
()
\
if
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
and
not
activeObject
.
giver
.
exitIsAssigned
():
and
activeObject
.
checkOperator
()
\
activeObject
.
giver
.
assignExit
()
and
not
giverObject
.
exitIsAssigned
():
giverObject
.
assignExit
()
# if the activeObject is not in manager's activeCallersList of the entityToGet
# if the activeObject is not in manager's activeCallersList of the entityToGet
if
self
not
in
activeObject
.
giver
.
getActiveObjectQueue
()
[
0
].
manager
.
activeCallersList
:
if
activeObject
not
in
giverObjectQueue
[
0
].
manager
.
activeCallersList
:
# append it to the activeCallerList of the manager of the entity to be received
# append it to the activeCallerList of the manager of the entity to be received
activeObject
.
giver
.
getActiveObjectQueue
()
[
0
].
manager
.
activeCallersList
.
append
(
self
)
giverObjectQueue
[
0
].
manager
.
activeCallersList
.
append
(
self
)
# update entityToGet
# update entityToGet
self
.
entityToGet
=
activeObject
.
giver
.
getActiveObjectQueue
()
[
0
]
activeObject
.
entityToGet
=
giverObjectQueue
[
0
]
#make the operators List so that it holds only the manager of the current order
#make the operators List so that it holds only the manager of the current order
activeObject
.
operatorPool
.
operators
=
[
activeObject
.
giver
.
getActiveObjectQueue
()
[
0
].
manager
]
activeObject
.
operatorPool
.
operators
=
[
giverObjectQueue
[
0
].
manager
]
# read the load time of the machine
# read the load time of the machine
self
.
readLoadTime
()
activeObject
.
readLoadTime
()
return
True
return
True
# if activeObject.Up and len(activeObjectQueue)<activeObject.capacity:
# if not activeObject.giver.exitIsAssigned():
# for entity in activeObject.giver.getActiveObjectQueue():
# if activeObject.checkOperator(entity):
# if self not in entity.manager.activeCallersList:
# entity.manager.activeCallersList.append(self)
# if entity not in self.entitiesToGet:
# self.entitiesToGet.append(entity)
# # activeObject.giver.assignExit()
# return True
else
:
else
:
return
False
return
False
# if the multOperationTypeList contains only Processing
# if the multOperationTypeList contains only Processing
elif
(
activeObject
.
operatorPool
!=
'None'
and
any
(
type
==
'Processing'
for
type
in
activeObject
.
multOperationTypeList
)):
elif
(
activeObject
.
operatorPool
!=
'None'
and
any
(
type
==
'Processing'
for
type
in
activeObject
.
multOperationTypeList
)):
if
isRequested
:
if
giverObject
.
haveToDispose
(
activeObject
):
# TODO: check whether this entity is the one to be hand in
#===============================================================
# to be used in operatorPreemptive
# # TODO: check whether this entity is the one to be hand in
activeObject
.
requestingEntity
=
activeObject
.
giver
.
getActiveObjectQueue
()[
0
]
# # to be used in operatorPreemptive
# TODO: update the object requesting the operator
# activeObject.requestingEntity=activeObject.giver.getActiveObjectQueue()[0]
activeObject
.
operatorPool
.
requestingObject
=
activeObject
.
giver
# # TODO: update the object requesting the operator
# TODO: update the last object calling the operatorPool
# activeObject.operatorPool.requestingObject=activeObject.giver
activeObject
.
operatorPool
.
receivingObject
=
activeObject
# # TODO: update the last object calling the operatorPool
# activeObject.operatorPool.receivingObject=activeObject
#===============================================================
# TODO: the operator must not be available for the object to receive the entity
# TODO: the operator must not be available for the object to receive the entity
# the exit of the giver should not be assigned
# the exit of the giver should not be assigned
...
@@ -189,7 +157,7 @@ class MachineManagedJob(MachineJobShop):
...
@@ -189,7 +157,7 @@ class MachineManagedJob(MachineJobShop):
# there may be a problem with the activeCallersList as the Router may assign
# there may be a problem with the activeCallersList as the Router may assign
# the operator to the machine while he is not needed for receiving the entity
# the operator to the machine while he is not needed for receiving the entity
# the entityToGet should be updated
# the entityToGet should be updated
if
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
:
#\
if
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
:
#\
# and self.checkOperator()\
# and self.checkOperator()\
# and not activeObject.giver.exitIsAssigned():
# and not activeObject.giver.exitIsAssigned():
# activeObject.giver.assignExit()
# activeObject.giver.assignExit()
...
@@ -199,38 +167,32 @@ class MachineManagedJob(MachineJobShop):
...
@@ -199,38 +167,32 @@ class MachineManagedJob(MachineJobShop):
# activeObject.giver.getActiveObjectQueue()[0].manager.activeCallersList.append(self)
# activeObject.giver.getActiveObjectQueue()[0].manager.activeCallersList.append(self)
# # update entityToGet
# # update entityToGet
# self.entityToGet=activeObject.giver.getActiveObjectQueue()[0]
# self.entityToGet=activeObject.giver.getActiveObjectQueue()[0]
self
.
entityToGet
=
activeObject
.
giver
.
getActiveObjectQueue
()
[
0
]
activeObject
.
entityToGet
=
giverObjectQueue
[
0
]
#make the operators List so that it holds only the manager of the current order
#make the operators List so that it holds only the manager of the current order
activeObject
.
operatorPool
.
operators
=
[
activeObject
.
giver
.
getActiveObjectQueue
()
[
0
].
manager
]
activeObject
.
operatorPool
.
operators
=
[
giverObjectQueue
[
0
].
manager
]
# read the load time of the machine
# read the load time of the machine
self
.
readLoadTime
()
activeObject
.
readLoadTime
()
return
True
return
True
# if activeObject.Up and len(activeObjectQueue)<activeObject.capacity:
# if not activeObject.giver.exitIsAssigned():
# for entity in activeObject.giver.getActiveObjectQueue():
# if activeObject.checkOperator(entity):
# if self not in entity.manager.activeCallersList:
# entity.manager.activeCallersList.append(self)
# if entity not in self.entitiesToGet:
# self.entitiesToGet.append(entity)
# # activeObject.giver.assignExit()
# return True
else
:
else
:
return
False
return
False
else
:
else
:
# the operator doesn't have to be present for the loading of the machine as the load operation
# the operator doesn't have to be present for the loading of the machine as the load operation
# is not assigned to operators
# is not assigned to operators
if
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
isRequested
:
if
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
giverObject
.
haveToDispose
(
activeObject
)
:
# update entityToGet
# update entityToGet
self
.
entityToGet
=
self
.
giver
.
getActiveObjectQueue
()[
0
]
activeObject
.
entityToGet
=
self
.
giver
.
getActiveObjectQueue
()[
0
]
return
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
isRequested
activeObject
.
readLoadTime
()
return
activeObject
.
checkIfActive
()
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
and
giverObject
.
haveToDispose
(
activeObject
)
# =======================================================================
# =======================================================================
# to be called by canAcceptAndIsRequested and check for the operator
# to be called by canAcceptAndIsRequested and check for the operator
# =======================================================================
# =======================================================================
def
checkOperator
(
self
):
#, candidateEntity=None):
def
checkOperator
(
self
):
#, candidateEntity=None):
if
self
.
giver
.
getActiveObjectQueue
()[
0
].
manager
:
activeObject
=
self
.
getActiveObject
()
manager
=
self
.
giver
.
getActiveObjectQueue
()[
0
].
manager
giverObject
=
activeObject
.
getGiverObject
()
giverObjectQueue
=
giverObject
.
getActiveObjectQueue
()
if
giverObjectQueue
[
0
].
manager
:
manager
=
giverObjectQueue
[
0
].
manager
# print ''
# print ''
# print 'Entity',self.giver.getActiveObjectQueue()[0].id
# print 'Entity',self.giver.getActiveObjectQueue()[0].id
# print 'manager',manager.id
# print 'manager',manager.id
...
...
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