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
fee23319
Commit
fee23319
authored
Dec 18, 2013
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jan 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CoreObjects updated so that blockage is calculated in removeEntity
parent
178576c6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
35 deletions
+73
-35
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+5
-3
dream/simulation/BatchDecomposition.py
dream/simulation/BatchDecomposition.py
+2
-1
dream/simulation/Conveyer.py
dream/simulation/Conveyer.py
+6
-0
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+21
-0
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+13
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+12
-13
dream/simulation/OperatedMachine.py
dream/simulation/OperatedMachine.py
+14
-15
No files found.
dream/simulation/Assembly.py
View file @
fee23319
...
@@ -120,8 +120,9 @@ class Assembly(CoreObject):
...
@@ -120,8 +120,9 @@ class Assembly(CoreObject):
self
.
timeLastFrameWasFull
=
now
()
self
.
timeLastFrameWasFull
=
now
()
self
.
nameLastFrameWasFull
=
self
.
getActiveObjectQueue
()[
0
].
name
self
.
nameLastFrameWasFull
=
self
.
getActiveObjectQueue
()[
0
].
name
startWorkingTime
=
now
()
startWorkingTime
=
now
()
yield
hold
,
self
,
self
.
rng
.
generateNumber
()
#hold for the time the assembly operation is carried
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
yield
hold
,
self
,
self
.
totalProcessingTimeInCurrentEntity
#hold for the time the assembly operation is carried
self
.
totalWorkingTime
+=
now
()
-
startWorkingTime
self
.
totalWorkingTime
+=
now
()
-
startWorkingTime
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"ended processing in "
+
self
.
objName
)
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"ended processing in "
+
self
.
objName
)
...
@@ -136,7 +137,7 @@ class Assembly(CoreObject):
...
@@ -136,7 +137,7 @@ class Assembly(CoreObject):
if
self
.
next
[
0
].
getGiverObject
()
==
self
:
#if the free object can accept from this Assembly
if
self
.
next
[
0
].
getGiverObject
()
==
self
:
#if the free object can accept from this Assembly
#break. Else continue
#break. Else continue
break
break
self
.
totalBlockageTime
+=
now
()
-
startBlockageTime
#add the blockage time
#
self.totalBlockageTime+=now()-startBlockageTime #add the blockage time
#checks if the Assembly can accept an entity
#checks if the Assembly can accept an entity
...
@@ -208,6 +209,7 @@ class Assembly(CoreObject):
...
@@ -208,6 +209,7 @@ class Assembly(CoreObject):
#actions to be taken after the simulation ends
#actions to be taken after the simulation ends
def
postProcessing
(
self
,
MaxSimtime
=
None
):
def
postProcessing
(
self
,
MaxSimtime
=
None
):
if
MaxSimtime
==
None
:
if
MaxSimtime
==
None
:
from
Globals
import
G
from
Globals
import
G
MaxSimtime
=
G
.
maxSimTime
MaxSimtime
=
G
.
maxSimTime
...
...
dream/simulation/BatchDecomposition.py
View file @
fee23319
...
@@ -96,7 +96,8 @@ class BatchDecomposition(CoreObject):
...
@@ -96,7 +96,8 @@ class BatchDecomposition(CoreObject):
self
.
nameLastEntityEntered
=
self
.
currentEntity
.
name
# this holds the name of the last entity that got into Machine
self
.
nameLastEntityEntered
=
self
.
currentEntity
.
name
# this holds the name of the last entity that got into Machine
self
.
timeLastEntityEntered
=
now
()
#this holds the last time that an entity got into Machine
self
.
timeLastEntityEntered
=
now
()
#this holds the last time that an entity got into Machine
yield
hold
,
self
,
self
.
calculateProcessingTime
()
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
yield
hold
,
self
,
self
.
totalProcessingTimeInCurrentEntity
self
.
decompose
()
self
.
decompose
()
...
...
dream/simulation/Conveyer.py
View file @
fee23319
...
@@ -228,6 +228,12 @@ class Conveyer(CoreObject):
...
@@ -228,6 +228,12 @@ class Conveyer(CoreObject):
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
self
.
position
.
pop
(
0
)
self
.
position
.
pop
(
0
)
#revert the blockage calculation
#conveyer needs its customcalculation
blockage
=
now
()
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
)
self
.
totalBlockageTime
-=
blockage
self
.
waitToDispose
=
False
self
.
waitToDispose
=
False
#if the conveyer was full, it means that it also was blocked
#if the conveyer was full, it means that it also was blocked
#we count this blockage time
#we count this blockage time
...
...
dream/simulation/CoreObject.py
View file @
fee23319
...
@@ -82,6 +82,15 @@ class CoreObject(Process):
...
@@ -82,6 +82,15 @@ class CoreObject(Process):
# then the giverObjects have to be blocked for the time
# then the giverObjects have to be blocked for the time
# that the machine is being loaded
# that the machine is being loaded
# ============================== lists to hold statistics of multiple runs =====================
# ============================== lists to hold statistics of multiple runs =====================
self
.
totalTimeWaitingForOperator
=
0
self
.
operatorWaitTimeCurrentEntity
=
0
self
.
totalTimeInCurrentEntity
=
0
self
.
operatorWaitTimeCurrentEntity
=
0
self
.
totalProcessingTimeInCurrentEntity
=
0
self
.
failureTimeInCurrentEntity
=
0
self
.
setupTimeCurrentEntity
=
0
self
.
Failure
=
[]
self
.
Failure
=
[]
self
.
Working
=
[]
self
.
Working
=
[]
self
.
Blockage
=
[]
self
.
Blockage
=
[]
...
@@ -99,9 +108,21 @@ class CoreObject(Process):
...
@@ -99,9 +108,21 @@ class CoreObject(Process):
# ================================== removes an entity from the Object ==========================
# ================================== removes an entity from the Object ==========================
def
removeEntity
(
self
):
def
removeEntity
(
self
):
self
.
totalTimeInCurrentEntity
=
now
()
-
self
.
timeLastEntityEntered
self
.
totalTimeWaitingForOperator
+=
self
.
operatorWaitTimeCurrentEntity
#blockage=self.totalTimeInCurrentEntity-(self.totalProcessingTimeInCurrentEntity\
# +self.failureTimeInCurrentEntity\
# +self.operatorWaitTimeCurrentEntity\
# +self.setupTimeCurrentEntity)
blockage
=
now
()
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
)
self
.
totalBlockageTime
+=
blockage
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeEntity
=
activeObjectQueue
[
0
]
activeEntity
=
activeObjectQueue
[
0
]
activeObjectQueue
.
pop
(
0
)
#remove the Entity from the queue
activeObjectQueue
.
pop
(
0
)
#remove the Entity from the queue
self
.
failureTimeInCurrentEntity
=
0
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
self
.
timeLastEntityLeft
=
now
()
self
.
timeLastEntityLeft
=
now
()
try
:
try
:
self
.
outputTrace
(
activeEntity
.
name
,
"released "
+
self
.
objName
)
self
.
outputTrace
(
activeEntity
.
name
,
"released "
+
self
.
objName
)
...
...
dream/simulation/Dismantle.py
View file @
fee23319
...
@@ -117,7 +117,10 @@ class Dismantle(CoreObject):
...
@@ -117,7 +117,10 @@ class Dismantle(CoreObject):
self
.
timeLastEntityEntered
=
now
()
self
.
timeLastEntityEntered
=
now
()
startWorkingTime
=
now
()
startWorkingTime
=
now
()
yield
hold
,
self
,
self
.
rng
.
generateNumber
()
#hold for the time the dismantle operation is carried
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
yield
hold
,
self
,
self
.
totalProcessingTimeInCurrentEntity
#hold for the time the assembly operation is carried
self
.
totalWorkingTime
+=
now
()
-
startWorkingTime
self
.
totalWorkingTime
+=
now
()
-
startWorkingTime
self
.
timeLastEntityEnded
=
now
()
self
.
timeLastEntityEnded
=
now
()
...
@@ -131,7 +134,7 @@ class Dismantle(CoreObject):
...
@@ -131,7 +134,7 @@ class Dismantle(CoreObject):
self
.
completedJobs
+=
1
#Dismantle completed a job
self
.
completedJobs
+=
1
#Dismantle completed a job
self
.
waitToDisposeFrame
=
False
#the Dismantle has no Frame to dispose now
self
.
waitToDisposeFrame
=
False
#the Dismantle has no Frame to dispose now
self
.
totalBlockageTime
+=
now
()
-
startBlockageTime
#add the blockage time
#
self.totalBlockageTime+=now()-startBlockageTime #add the blockage time
#checks if the Dismantle can accept an entity and there is a Frame waiting for it
#checks if the Dismantle can accept an entity and there is a Frame waiting for it
...
@@ -189,7 +192,14 @@ class Dismantle(CoreObject):
...
@@ -189,7 +192,14 @@ class Dismantle(CoreObject):
#removes an entity from the Dismantle
#removes an entity from the Dismantle
def
removeEntity
(
self
):
def
removeEntity
(
self
):
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
)
#run the default method
#we want the blockagetobeadded only if we disposed a frame!
#if a part was disposed rever
if
activeEntity
.
type
==
'Part'
:
blockage
=
now
()
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
)
self
.
totalBlockageTime
-=
blockage
#update the flags
#update the flags
if
(
len
(
activeObjectQueue
)
==
0
):
if
(
len
(
activeObjectQueue
)
==
0
):
self
.
waitToDisposeFrame
=
False
self
.
waitToDisposeFrame
=
False
...
...
dream/simulation/Machine.py
View file @
fee23319
...
@@ -99,15 +99,15 @@ class Machine(CoreObject):
...
@@ -99,15 +99,15 @@ class Machine(CoreObject):
# variables dedicated to hold the processing times, the time when the Entity entered,
# variables dedicated to hold the processing times, the time when the Entity entered,
# and the processing time left
# and the processing time left
timeEntered
=
now
()
# timeEntered dummy Timer that holds the time the last Entity Entered
timeEntered
=
now
()
# timeEntered dummy Timer that holds the time the last Entity Entered
tinMStart
=
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
tinM
=
tinMStart
# timer to hold the processing time left
tinM
=
self
.
totalProcessingTimeInCurrentEntity
# timer to hold the processing time left
self
.
processingTimeOfCurrentEntity
=
tinMStart
# processing time of the machine
#self.processingTimeOfCurrentEntity=self.totalProcessingTimeInCurrentEntity
# processing time of the machine
# variables used to flag any interruptions and the end of the processing
# variables used to flag any interruptions and the end of the processing
interruption
=
False
interruption
=
False
processingEndedFlag
=
True
processingEndedFlag
=
True
# timers to follow up the failure time of the machine while on current Entity
# timers to follow up the failure time of the machine while on current Entity
failureTime
=
0
# dummy variable keeping track of the failure time
#self.failureTimeInCurrentEntity
=0 # dummy variable keeping track of the failure time
# might be feasible to avoid it
# might be feasible to avoid it
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
#object was down while holding current entity
#object was down while holding current entity
...
@@ -141,7 +141,7 @@ class Machine(CoreObject):
...
@@ -141,7 +141,7 @@ class Machine(CoreObject):
self
.
downTimeProcessingCurrentEntity
+=
now
()
-
breakTime
# count the time that Machine is down while processing this Entity
self
.
downTimeProcessingCurrentEntity
+=
now
()
-
breakTime
# count the time that Machine is down while processing this Entity
self
.
downTimeInCurrentEntity
+=
now
()
-
breakTime
# count the time that Machine is down while on currentEntity
self
.
downTimeInCurrentEntity
+=
now
()
-
breakTime
# count the time that Machine is down while on currentEntity
self
.
timeLastFailureEnded
=
now
()
# set the timeLastFailureEnded
self
.
timeLastFailureEnded
=
now
()
# set the timeLastFailureEnded
failureTime
+=
now
()
-
breakTime
# dummy variable keeping track of the failure time
self
.
failureTimeInCurrentEntity
+=
now
()
-
breakTime
# dummy variable keeping track of the failure time
# output to trace that the Machine self.objName was passivated for the current failure time
# output to trace that the Machine self.objName was passivated for the current failure time
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"passivated in "
+
self
.
objName
+
" for "
+
str
(
now
()
-
breakTime
))
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"passivated in "
+
self
.
objName
+
" for "
+
str
(
now
()
-
breakTime
))
# if no interruption occurred the processing in M1 is ended
# if no interruption occurred the processing in M1 is ended
...
@@ -152,7 +152,7 @@ class Machine(CoreObject):
...
@@ -152,7 +152,7 @@ class Machine(CoreObject):
# set the variable that flags an Entity is ready to be disposed
# set the variable that flags an Entity is ready to be disposed
self
.
waitToDispose
=
True
self
.
waitToDispose
=
True
# update the total working time
# update the total working time
self
.
totalWorkingTime
+=
tinMStart
# the total processing time for this entity
self
.
totalWorkingTime
+=
self
.
totalProcessingTimeInCurrentEntity
# the total processing time for this entity
# is what the distribution initially gave
# is what the distribution initially gave
# update the variables keeping track of Entity related attributes of the machine
# update the variables keeping track of Entity related attributes of the machine
...
@@ -167,7 +167,7 @@ class Machine(CoreObject):
...
@@ -167,7 +167,7 @@ class Machine(CoreObject):
reqTime
=
now
()
# entity has ended processing in Machine and requests for the next object
reqTime
=
now
()
# entity has ended processing in Machine and requests for the next object
# initialize the timer downTimeInTryingToReleaseCurrentEntity, we have to count how much time
# initialize the timer downTimeInTryingToReleaseCurrentEntity, we have to count how much time
# the Entity will wait for the next successor to be able to accept (canAccept)
# the Entity will wait for the next successor to be able to accept (canAccept)
self
.
downTimeInTryingToReleaseCurrentEntity
=
0
#
self.downTimeInTryingToReleaseCurrentEntity=0
while
1
:
while
1
:
# wait until the next Object is available or machine has failure
# wait until the next Object is available or machine has failure
...
@@ -181,7 +181,7 @@ class Machine(CoreObject):
...
@@ -181,7 +181,7 @@ class Machine(CoreObject):
failTime
=
now
()
# dummy variable holding the time failure happened
failTime
=
now
()
# dummy variable holding the time failure happened
# passivate until machine is up
# passivate until machine is up
yield
waituntil
,
self
,
self
.
checkIfMachineIsUp
yield
waituntil
,
self
,
self
.
checkIfMachineIsUp
failureTime
+=
now
()
-
failTime
# count the failure while on current entity time with failureTime variable
self
.
failureTimeInCurrentEntity
+=
now
()
-
failTime
# count the failure while on current entity time with failureTime variable
# calculate the time the Machine was down while trying to dispose the current Entity,
# calculate the time the Machine was down while trying to dispose the current Entity,
# and the total down time while on current Entity
# and the total down time while on current Entity
self
.
downTimeInTryingToReleaseCurrentEntity
+=
now
()
-
failTime
self
.
downTimeInTryingToReleaseCurrentEntity
+=
now
()
-
failTime
...
@@ -189,12 +189,12 @@ class Machine(CoreObject):
...
@@ -189,12 +189,12 @@ class Machine(CoreObject):
# update the timeLastFailureEnded
# update the timeLastFailureEnded
self
.
timeLastFailureEnded
=
now
()
self
.
timeLastFailureEnded
=
now
()
totalTime
=
now
()
-
timeEntered
# dummy variable holding the total time the Entity spent in the Machine
#self.totalTimeInCurrentEntity
=now()-timeEntered # dummy variable holding the total time the Entity spent in the Machine
blockageTime
=
totalTime
-
(
tinMStart
+
failureTime
)
# count the time the Machine was blocked subtracting the failureTime
#
blockageTime=totalTime-(tinMStart+failureTime) # count the time the Machine was blocked subtracting the failureTime
# and the processing time from the totalTime spent in the Machine
# and the processing time from the totalTime spent in the Machine
# might be possible to avoid using blockageTime
# might be possible to avoid using blockageTime
# self.totalBlockageTime+=blockageTime
# self.totalBlockageTime+=blockageTime
self
.
totalBlockageTime
+=
totalTime
-
(
tinMStart
+
failureTime
)
#the time of blockage is derived from
#self.totalBlockageTime+=totalTime-(tinMStart+self.failureTimeInCurrentEntity
) #the time of blockage is derived from
#the whole time in the machine
#the whole time in the machine
#minus the processing time and the failure time
#minus the processing time and the failure time
# =======================================================================
# =======================================================================
...
@@ -305,7 +305,6 @@ class Machine(CoreObject):
...
@@ -305,7 +305,6 @@ class Machine(CoreObject):
# give the entity to the successor that is waiting for the most time.
# give the entity to the successor that is waiting for the most time.
# (plant simulation does not do this in every occasion!)
# (plant simulation does not do this in every occasion!)
maxTimeWaiting
=
0
# dummy variable counting the time a successor is waiting
maxTimeWaiting
=
0
# dummy variable counting the time a successor is waiting
i
=
0
# index used to set the successorIndex to the giver waiting the most
for
object
in
activeObject
.
next
:
for
object
in
activeObject
.
next
:
if
(
object
.
canAccept
(
activeObject
)):
# if a successor can accept an object
if
(
object
.
canAccept
(
activeObject
)):
# if a successor can accept an object
timeWaiting
=
now
()
-
object
.
timeLastEntityLeft
# the time it has been waiting is updated and stored in dummy variable timeWaiting
timeWaiting
=
now
()
-
object
.
timeLastEntityLeft
# the time it has been waiting is updated and stored in dummy variable timeWaiting
...
@@ -314,7 +313,7 @@ class Machine(CoreObject):
...
@@ -314,7 +313,7 @@ class Machine(CoreObject):
activeObject
.
receiver
=
object
# set the receiver as the longest waiting possible receiver
activeObject
.
receiver
=
object
# set the receiver as the longest waiting possible receiver
# in the next loops, check the other successors in the previous list
# in the next loops, check the other successors in the previous list
return
len
(
activeObjectQueue
)
>
0
and
activeObject
.
waitToDispose
\
return
len
(
activeObjectQueue
)
>
0
and
activeObject
.
waitToDispose
\
and
activeObject
.
Up
and
(
thecaller
is
receiverObject
)
and
activeObject
.
Up
and
(
thecaller
is
self
.
receiver
)
# =======================================================================
# =======================================================================
# actions to be taken after the simulation ends
# actions to be taken after the simulation ends
...
...
dream/simulation/OperatedMachine.py
View file @
fee23319
...
@@ -226,9 +226,9 @@ class OperatedMachine(Machine):
...
@@ -226,9 +226,9 @@ class OperatedMachine(Machine):
# print self.objName, 'operator assigned', now()
# print self.objName, 'operator assigned', now()
tinMStart
=
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
tinM
=
tinMStart
# timer to hold the processing time left
tinM
=
self
.
totalProcessingTimeInCurrentEntity
# timer to hold the processing time left
self
.
processingTimeOfCurrentEntity
=
tinMStart
# processing time of the machine
#
self.processingTimeOfCurrentEntity=tinMStart # processing time of the machine
# ======= setup the machine if the Setup is defined as one of the Operators' operation types
# ======= setup the machine if the Setup is defined as one of the Operators' operation types
# in plantSim the setup is performed when the machine has to process a new type of Entity and only once
# in plantSim the setup is performed when the machine has to process a new type of Entity and only once
...
@@ -336,7 +336,7 @@ class OperatedMachine(Machine):
...
@@ -336,7 +336,7 @@ class OperatedMachine(Machine):
# set the variable that flags an Entity is ready to be disposed
# set the variable that flags an Entity is ready to be disposed
self
.
waitToDispose
=
True
self
.
waitToDispose
=
True
# update the total working time
# update the total working time
self
.
totalWorkingTime
+=
tinMStart
# the total processing time for this entity
self
.
totalWorkingTime
+=
self
.
totalProcessingTimeInCurrentEntity
# the total processing time for this entity
# is what the distribution initially gave
# is what the distribution initially gave
# update the variables keeping track of Entity related attributes of the machine
# update the variables keeping track of Entity related attributes of the machine
...
@@ -377,16 +377,16 @@ class OperatedMachine(Machine):
...
@@ -377,16 +377,16 @@ class OperatedMachine(Machine):
# dummy variable holding the total time the Entity spent in the Machine
# dummy variable holding the total time the Entity spent in the Machine
# count the time the Machine was blocked subtracting the failureTime
# count the time the Machine was blocked subtracting the failureTime
# and the processing time from the totalTime spent in the Machine
# and the processing time from the totalTime spent in the Machine
totalTime
=
now
()
-
timeEntered
self
.
totalTimeInCurrentEntity
=
now
()
-
timeEntered
# update the total time waiting for the operator of the machine
# update the total time waiting for the operator of the machine
self
.
totalTimeWaitingForOperator
+=
self
.
operatorWaitTimeCurrentEntity
#
self.totalTimeWaitingForOperator += self.operatorWaitTimeCurrentEntity
blockageTime
=
totalTime
-
(
tinMStart
\
#
blockageTime=totalTime-(tinMStart\
+
failureTime
\
#
+failureTime\
+
self
.
operatorWaitTimeCurrentEntity
\
#
+self.operatorWaitTimeCurrentEntity\
+
self
.
setupTimeCurrentEntity
)
#
+self.setupTimeCurrentEntity)
# might be possible to avoid using blockageTime
# might be possible to avoid using blockageTime
self
.
totalBlockageTime
+=
blockageTime
# the time of blockage is derived from
# the time of blockage is derived from
# the whole time in the machine minus the processing time and the failure time
# the whole time in the machine minus the processing time and the failure time
# self.totalBlockageTime+=totalTime-(tinMStart\
# self.totalBlockageTime+=totalTime-(tinMStart\
...
@@ -426,6 +426,7 @@ class OperatedMachine(Machine):
...
@@ -426,6 +426,7 @@ class OperatedMachine(Machine):
thecaller
=
callerObject
thecaller
=
callerObject
# return True ONLY if the length of the activeOjbectQue is smaller than
# return True ONLY if the length of the activeOjbectQue is smaller than
# the object capacity, and the callerObject is not None but the giverObject
# the object capacity, and the callerObject is not None but the giverObject
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
)):
return
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
return
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
and
activeObject
.
Up
\
and
activeObject
.
Up
\
...
@@ -496,7 +497,7 @@ class OperatedMachine(Machine):
...
@@ -496,7 +497,7 @@ class OperatedMachine(Machine):
if
(
timeWaiting
>=
maxTimeWaiting
):
if
(
timeWaiting
>=
maxTimeWaiting
):
activeObject
.
giver
=
object
# set the giver
activeObject
.
giver
=
object
# set the giver
maxTimeWaiting
=
timeWaiting
maxTimeWaiting
=
timeWaiting
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
)):
if
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
if
activeObject
.
operatorPool
.
checkIfResourceIsAvailable
()
\
and
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
and
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
\
...
@@ -600,8 +601,6 @@ class OperatedMachine(Machine):
...
@@ -600,8 +601,6 @@ class OperatedMachine(Machine):
def
requestSetup
(
self
):
def
requestSetup
(
self
):
self
.
setUp
=
False
self
.
setUp
=
False
# =======================================================================
# =======================================================================
# actions to be taken after the simulation ends
# actions to be taken after the simulation ends
# =======================================================================
# =======================================================================
...
@@ -681,8 +680,8 @@ class OperatedMachine(Machine):
...
@@ -681,8 +680,8 @@ class OperatedMachine(Machine):
activeObject
.
totalBlockageTime
+=
(
now
()
-
activeObject
.
timeLastEntityEnded
)
-
(
now
()
-
activeObject
.
timeLastFailure
)
-
activeObject
.
downTimeInTryingToReleaseCurrentEntity
activeObject
.
totalBlockageTime
+=
(
now
()
-
activeObject
.
timeLastEntityEnded
)
-
(
now
()
-
activeObject
.
timeLastFailure
)
-
activeObject
.
downTimeInTryingToReleaseCurrentEntity
# print activeObject.objName,'total Block time:',activeObject.totalBlockageTime#/G.maxSimTime
# print activeObject.objName,'total Block time:',activeObject.totalBlockageTime#/G.maxSimTime
#Machine was idle when it was not in any other state
#Machine was idle when it was not in any other state
activeObject
.
totalWaitingTime
=
MaxSimtime
-
activeObject
.
totalWorkingTime
-
activeObject
.
totalBlockageTime
-
activeObject
.
totalFailureTime
activeObject
.
totalWaitingTime
=
MaxSimtime
-
activeObject
.
totalWorkingTime
-
activeObject
.
totalBlockageTime
-
activeObject
.
totalFailureTime
# print activeObject.objName,'total waiting time:',activeObject.totalWaitingTime#/G.maxSimTime
if
activeObject
.
totalBlockageTime
<
0
and
activeObject
.
totalBlockageTime
>-
0.00001
:
#to avoid some effects of getting negative cause of rounding precision
if
activeObject
.
totalBlockageTime
<
0
and
activeObject
.
totalBlockageTime
>-
0.00001
:
#to avoid some effects of getting negative cause of rounding precision
self
.
totalBlockageTime
=
0
self
.
totalBlockageTime
=
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