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
ff79aaa1
Commit
ff79aaa1
authored
Dec 05, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Dec 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor changes to Machine.py, coreObjects list with operated Objects added to Repairman
parent
066c5fca
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
dream/simulation/Machine.py
dream/simulation/Machine.py
+10
-8
dream/simulation/Repairman.py
dream/simulation/Repairman.py
+3
-1
No files found.
dream/simulation/Machine.py
View file @
ff79aaa1
...
...
@@ -102,9 +102,9 @@ class Machine(CoreObject):
# canAcceptAndIsRequested is invoked to check when the machine requested to receive an entity
yield
waituntil
,
self
,
self
.
canAcceptAndIsRequested
# get the entity from the predecessor
self
.
getEntity
()
self
.
currentEntity
=
self
.
getEntity
()
# set the currentEntity as the Entity just received and initialize the timer timeLastEntityEntered
self
.
currentEntity
=
self
.
getActiveObjectQueue
()[
0
]
# entity is the current entity processed in Machine
#
self.currentEntity=self.getActiveObjectQueue()[0] # entity is the current entity processed in 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
# variables dedicated to hold the processing times, the time when the Entity entered,
...
...
@@ -229,7 +229,7 @@ class Machine(CoreObject):
# this is done to achieve better (cpu) processing time
# then we can also use it as a filter for a yield method
if
(
len
(
activeObject
.
previous
)
==
1
or
callerObject
==
None
):
return
activeObject
.
Up
and
len
(
activeObjectQueue
)
==
0
return
activeObject
.
Up
and
len
(
activeObjectQueue
)
<
activeObject
.
capacity
thecaller
=
callerObject
# return True ONLY if the length of the activeOjbectQue is smaller than
...
...
@@ -352,7 +352,9 @@ class Machine(CoreObject):
# we have to add this blockage to the percentage of blockage in Machine
# we should exclude the failure time in current entity though!
# if (len(self.Res.activeQ)>0) and (len(self.next[0].Res.activeQ)>0) and ((self.nameLastEntityEntered == self.nameLastEntityEnded)):
if
(
len
(
activeObjectQueue
)
>
0
)
and
(
mightBeBlocked
)
and
((
activeObject
.
nameLastEntityEntered
==
activeObject
.
nameLastEntityEnded
)):
if
(
len
(
activeObjectQueue
)
>
0
)
and
(
mightBeBlocked
)
\
and
((
activeObject
.
nameLastEntityEntered
==
activeObject
.
nameLastEntityEnded
)):
# be carefull here, might have to reconsider
activeObject
.
totalBlockageTime
+=
now
()
-
(
activeObject
.
timeLastEntityEnded
+
activeObject
.
downTimeInTryingToReleaseCurrentEntity
)
if
activeObject
.
Up
==
False
:
activeObject
.
totalBlockageTime
-=
now
()
-
activeObject
.
timeLastFailure
...
...
@@ -365,7 +367,7 @@ class Machine(CoreObject):
# if(len(activeObjectQueue)>0) and (self.Up==False):
activeObject
.
downTimeProcessingCurrentEntity
+=
now
()
-
activeObject
.
timeLastFailure
activeObject
.
totalWorkingTime
+=
now
()
-
activeObject
.
timeLastEntityEntered
-
activeObject
.
downTimeProcessingCurrentEntity
# if Machine is down we have to add this failure time to its total failure time
# we also need to add the last blocking time to total blockage time
if
(
activeObject
.
Up
==
False
):
...
...
@@ -374,16 +376,16 @@ class Machine(CoreObject):
#if((len(self.next[0].Res.activeQ)>0) and (self.nameLastEntityEnded==self.nameLastEntityEntered) and (not alreadyAdded)):
if
((
mightBeBlocked
)
and
(
activeObject
.
nameLastEntityEnded
==
activeObject
.
nameLastEntityEntered
)
and
(
not
alreadyAdded
)):
activeObject
.
totalBlockageTime
+=
(
now
()
-
activeObject
.
timeLastEntityEnded
)
-
(
now
()
-
activeObject
.
timeLastFailure
)
-
activeObject
.
downTimeInTryingToReleaseCurrentEntity
#Machine was idle when it was not in any other state
activeObject
.
totalWaitingTime
=
MaxSimtime
-
activeObject
.
totalWorkingTime
-
activeObject
.
totalBlockageTime
-
activeObject
.
totalFailureTime
if
activeObject
.
totalBlockageTime
<
0
and
activeObject
.
totalBlockageTime
>-
0.00001
:
#to avoid some effects of getting negative cause of rounding precision
self
.
totalBlockageTime
=
0
if
activeObject
.
totalWaitingTime
<
0
and
activeObject
.
totalWaitingTime
>-
0.00001
:
#to avoid some effects of getting negative cause of rounding precision
self
.
totalWaitingTime
=
0
activeObject
.
Failure
.
append
(
100
*
self
.
totalFailureTime
/
MaxSimtime
)
activeObject
.
Blockage
.
append
(
100
*
self
.
totalBlockageTime
/
MaxSimtime
)
activeObject
.
Waiting
.
append
(
100
*
self
.
totalWaitingTime
/
MaxSimtime
)
...
...
dream/simulation/Repairman.py
View file @
ff79aaa1
...
...
@@ -45,8 +45,10 @@ class Repairman(ObjectResource):
# lists to hold statistics of multiple runs
self
.
Waiting
=
[]
# holds the percentage of waiting time
self
.
Working
=
[]
# holds the percentage of working time
# list with the coreObjects that the repairman repairs
# list with the coreObjects
IDs
that the repairman repairs
self
.
coreObjectIds
=
[]
# list with the coreObjects that the repairman repairs
self
.
coreObjects
=
[]
# =======================================================================
# actions to be taken after the simulation ends
...
...
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