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
1b82966b
Commit
1b82966b
authored
Aug 15, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dismantle to work with state variables
parent
7abdc079
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
26 deletions
+31
-26
dream/simulation/Assembly.py
dream/simulation/Assembly.py
+4
-4
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+7
-5
dream/simulation/Dismantle.py
dream/simulation/Dismantle.py
+20
-17
No files found.
dream/simulation/Assembly.py
View file @
1b82966b
...
@@ -150,10 +150,10 @@ class Assembly(CoreObject):
...
@@ -150,10 +150,10 @@ class Assembly(CoreObject):
self
.
timeLastFrameWasFull
=
self
.
env
.
now
self
.
timeLastFrameWasFull
=
self
.
env
.
now
self
.
nameLastFrameWasFull
=
self
.
getActiveObjectQueue
()[
0
].
name
self
.
nameLastFrameWasFull
=
self
.
getActiveObjectQueue
()[
0
].
name
s
tartWorkingTime
=
self
.
env
.
now
s
elf
.
timeLastProcessingStarted
=
self
.
env
.
now
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
yield
self
.
env
.
timeout
(
self
.
totalProcessingTimeInCurrentEntity
)
#hold for the time the assembly operation is carried
yield
self
.
env
.
timeout
(
self
.
totalProcessingTimeInCurrentEntity
)
#hold for the time the assembly operation is carried
self
.
totalWorkingTime
+=
self
.
env
.
now
-
s
tartWorkingTime
self
.
totalWorkingTime
+=
self
.
env
.
now
-
s
elf
.
timeLastProcessingStarted
self
.
isProcessing
=
False
self
.
isProcessing
=
False
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"ended processing in "
+
self
.
objName
)
self
.
outputTrace
(
self
.
getActiveObjectQueue
()[
0
].
name
,
"ended processing in "
+
self
.
objName
)
...
@@ -319,11 +319,11 @@ class Assembly(CoreObject):
...
@@ -319,11 +319,11 @@ class Assembly(CoreObject):
# if the object is blocked add the blockage time
# if the object is blocked add the blockage time
if
self
.
isBlocked
:
if
self
.
isBlocked
:
self
.
totalBlockageTime
+=
self
.
env
.
now
-
self
.
timeLast
EntityEnd
ed
self
.
totalBlockageTime
+=
self
.
env
.
now
-
self
.
timeLast
BlockageStart
ed
# if the object is processing add the working time
# if the object is processing add the working time
if
self
.
isProcessing
:
if
self
.
isProcessing
:
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLast
FrameWasFull
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLast
ProcessingStarted
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
-
self
.
totalBlockageTime
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
-
self
.
totalBlockageTime
...
...
dream/simulation/CoreObject.py
View file @
1b82966b
...
@@ -200,10 +200,12 @@ class CoreObject(object):
...
@@ -200,10 +200,12 @@ class CoreObject(object):
# removes an Entity from the Object the Entity to be removed is passed
# removes an Entity from the Object the Entity to be removed is passed
# as argument by getEntity of the receiver
# as argument by getEntity of the receiver
# =======================================================================
# =======================================================================
def
removeEntity
(
self
,
entity
=
None
):
def
removeEntity
(
self
,
entity
=
None
,
resetFlags
=
True
,
addBlockage
=
True
):
# reset flags
# reset flags
if
resetFlags
:
self
.
isBlocked
=
False
self
.
isBlocked
=
False
self
.
isProcessing
=
False
self
.
isProcessing
=
False
if
addBlockage
:
# add the blocking time
# add the blocking time
self
.
addBlockage
()
self
.
addBlockage
()
...
...
dream/simulation/Dismantle.py
View file @
1b82966b
...
@@ -134,12 +134,17 @@ class Dismantle(CoreObject):
...
@@ -134,12 +134,17 @@ class Dismantle(CoreObject):
self
.
getEntity
()
#get the Frame with the parts
self
.
getEntity
()
#get the Frame with the parts
self
.
timeLastEntityEntered
=
self
.
env
.
now
self
.
timeLastEntityEntered
=
self
.
env
.
now
startWorkingTime
=
self
.
env
.
now
startWorkingTime
=
self
.
env
.
now
self
.
isProcessing
=
True
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
self
.
totalProcessingTimeInCurrentEntity
=
self
.
calculateProcessingTime
()
#hold for the time the assembly operation is carried
#hold for the time the assembly operation is carried
yield
self
.
env
.
timeout
(
self
.
totalProcessingTimeInCurrentEntity
)
yield
self
.
env
.
timeout
(
self
.
totalProcessingTimeInCurrentEntity
)
self
.
isProcessing
=
False
self
.
totalWorkingTime
+=
self
.
env
.
now
-
startWorkingTime
self
.
totalWorkingTime
+=
self
.
env
.
now
-
startWorkingTime
self
.
timeLastEntityEnded
=
self
.
env
.
now
self
.
timeLastEntityEnded
=
self
.
env
.
now
startBlockageTime
=
self
.
env
.
now
self
.
timeLastBlockageStarted
=
self
.
env
.
now
self
.
isBlocked
=
True
self
.
completedJobs
+=
1
#Assembly completed a job
self
.
waitToDispose
=
True
self
.
waitToDispose
=
True
self
.
waitToDisposePart
=
True
#Dismantle is in state to dispose a part
self
.
waitToDisposePart
=
True
#Dismantle is in state to dispose a part
...
@@ -159,14 +164,12 @@ class Dismantle(CoreObject):
...
@@ -159,14 +164,12 @@ class Dismantle(CoreObject):
yield
self
.
entityRemoved
yield
self
.
entityRemoved
self
.
waitEntityRemoval
=
False
self
.
waitEntityRemoval
=
False
self
.
entityRemoved
=
self
.
env
.
event
()
self
.
entityRemoved
=
self
.
env
.
event
()
# yield self.env.timeout(0)#(0.000000000000005)
if
self
.
frameIsEmpty
()
and
not
self
.
waitToDisposeFrame
:
if
self
.
frameIsEmpty
()
and
not
self
.
waitToDisposeFrame
:
self
.
waitToDisposePart
=
False
self
.
waitToDisposePart
=
False
self
.
waitToDisposeFrame
=
True
self
.
waitToDisposeFrame
=
True
# if the internal queue is empty then update the corresponding flags and proceed with getting a new entity
# if the internal queue is empty then update the corresponding flags and proceed with getting a new entity
if
self
.
isEmpty
():
if
self
.
isEmpty
():
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
break
break
...
@@ -277,10 +280,13 @@ class Dismantle(CoreObject):
...
@@ -277,10 +280,13 @@ class Dismantle(CoreObject):
activeObject
=
self
.
getActiveObject
()
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
activeObjectQueue
=
activeObject
.
getActiveObjectQueue
()
#run the default method
#run the default method
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
)
activeEntity
=
CoreObject
.
removeEntity
(
self
,
entity
,
resetFlags
=
False
,
addBlockage
=
False
)
#update the flags
#update the flags
if
(
len
(
activeObjectQueue
)
==
0
):
if
(
len
(
activeObjectQueue
)
==
0
):
activeObject
.
waitToDisposeFrame
=
False
activeObject
.
waitToDisposeFrame
=
False
self
.
isBlocked
=
False
self
.
isProcessing
=
False
self
.
addBlockage
()
else
:
else
:
if
(
len
(
activeObjectQueue
)
==
1
):
if
(
len
(
activeObjectQueue
)
==
1
):
activeObject
.
waitToDisposePart
=
False
activeObject
.
waitToDisposePart
=
False
...
@@ -290,15 +296,12 @@ class Dismantle(CoreObject):
...
@@ -290,15 +296,12 @@ class Dismantle(CoreObject):
activeObject
.
signalGiver
()
activeObject
.
signalGiver
()
return
activeEntity
return
activeEntity
#===========================================================================
# =======================================================================
# add the blockage only if the very last Entity (Frame) is to depart
# adds the blockage time to totalBlockageTime
#===========================================================================
# each time an Entity is removed
# =======================================================================
def
addBlockage
(
self
):
def
addBlockage
(
self
):
if
len
(
self
.
getActiveObjectQueue
())
==
1
:
self
.
totalBlockageTime
+=
self
.
env
.
now
-
self
.
timeLastBlockageStarted
self
.
totalTimeInCurrentEntity
=
self
.
env
.
now
-
self
.
timeLastEntityEntered
self
.
totalTimeWaitingForOperator
+=
self
.
operatorWaitTimeCurrentEntity
blockage
=
self
.
env
.
now
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
)
self
.
totalBlockageTime
+=
blockage
#===========================================================================
#===========================================================================
# actions to be taken after the simulation ends
# actions to be taken after the simulation ends
...
@@ -311,12 +314,12 @@ class Dismantle(CoreObject):
...
@@ -311,12 +314,12 @@ class Dismantle(CoreObject):
#if there is an entity that finished processing in Dismantle but did not get to reach
#if there is an entity that finished processing in Dismantle but did not get to reach
#the following Object
#the following Object
#till the end of simulation, we have to add this blockage to the percentage of blockage in Dismantle
#till the end of simulation, we have to add this blockage to the percentage of blockage in Dismantle
if
(
len
(
self
.
Res
.
users
)
>
0
)
and
(
self
.
waitToDisposeFrame
)
or
(
self
.
waitToDisposePart
)
:
if
self
.
isBlocked
:
self
.
totalBlockageTime
+=
self
.
env
.
now
-
self
.
timeLast
EntityEnded
self
.
totalBlockageTime
+=
self
.
env
.
now
-
self
.
timeLast
BlockageStarted
#if Dismantle is currently processing an entity we should count this working time
#if Dismantle is currently processing an entity we should count this working time
if
(
len
(
self
.
Res
.
users
)
>
0
)
and
(
not
((
self
.
waitToDisposeFrame
)
or
(
self
.
waitToDisposePart
)))
:
if
self
.
isProcessing
:
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLast
EntityEnter
ed
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLast
ProcessingStart
ed
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
-
self
.
totalBlockageTime
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
-
self
.
totalBlockageTime
...
...
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