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
b62c4203
Commit
b62c4203
authored
Oct 24, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine.py comments corrections
parent
3b194d7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
dream/simulation/Machine.py
dream/simulation/Machine.py
+16
-15
No files found.
dream/simulation/Machine.py
View file @
b62c4203
...
...
@@ -89,7 +89,7 @@ class Machine(CoreObject):
MFailure
=
Failure
(
self
,
self
.
failureDistType
,
self
.
MTTF
,
self
.
MTTR
,
self
.
availability
,
self
.
id
,
self
.
repairman
)
activate
(
MFailure
,
MFailure
.
run
())
# initialize the Queue (type Resource) of the Machine
# initialize the
internal
Queue (type Resource) of the Machine
self
.
Res
=
Resource
(
self
.
capacity
)
# =======================================================================
...
...
@@ -121,7 +121,7 @@ class Machine(CoreObject):
processingEndedFlag
=
True
# timers to follow up the failure time of the machine while on current Entity
failureTime
=
0
# dummy variable keeping track of the failure time
#
(why not avoid using it?)
#
might be feasible to avoid it
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
#object was down while holding current entity
# this loop is repeated until the processing time is expired with no failure
...
...
@@ -205,7 +205,7 @@ class Machine(CoreObject):
totalTime
=
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
# and the processing time from the totalTime spent in the Machine
#
??? is the next equivalent to:
#
might be possible to avoid using blockageTime
# self.totalBlockageTime+=blockageTime
self
.
totalBlockageTime
+=
totalTime
-
(
tinMStart
+
failureTime
)
#the time of blockage is derived from
#the whole time in the machine
...
...
@@ -290,7 +290,7 @@ class Machine(CoreObject):
# checks if the machine down or it can dispose the object
# =======================================================================
def
ifCanDisposeOrHaveFailure
(
self
):
# the last part is added so that it is not removed and stack gotta think of it again
??????????
# the last part is added so that it is not removed and stack gotta think of it again
return
self
.
Up
==
False
or
self
.
next
[
0
].
canAccept
(
self
)
or
len
(
self
.
Res
.
activeQ
)
==
0
# =======================================================================
...
...
@@ -350,19 +350,19 @@ class Machine(CoreObject):
activeObject
=
self
.
getActiveObject
()
activeObjectQueue
=
self
.
getActiveObjectQueue
()
alreadyAdded
=
False
#
a flag that shows if the blockage time has already been added
alreadyAdded
=
False
#
a flag that shows if the blockage time has already been added
#checks all the successors. If no one can accept an Entity then the machine might be blocked
#
checks all the successors. If no one can accept an Entity then the machine might be blocked
mightBeBlocked
=
True
for
nextObject
in
self
.
next
:
if
nextObject
.
canAccept
():
mightBeBlocked
=
False
#if there is an entity that finished processing in a Machine but did not get to reach
#
the following Object
#
till the end of simulation,
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 there is an entity that finished processing in a Machine but did not get to reach
#
the following Object till the end of simulation,
# 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
)):
activeObject
.
totalBlockageTime
+=
now
()
-
(
activeObject
.
timeLastEntityEnded
+
activeObject
.
downTimeInTryingToReleaseCurrentEntity
)
if
activeObject
.
Up
==
False
:
...
...
@@ -372,15 +372,16 @@ class Machine(CoreObject):
#if Machine is currently processing an entity we should count this working time
if
(
len
(
activeObject
.
Res
.
activeQ
)
>
0
)
and
(
not
(
activeObject
.
nameLastEntityEnded
==
activeObject
.
nameLastEntityEntered
)):
#if Machine is down we should add this last failure time to the time that it has been down in current entity
if
(
len
(
activeObjectQueue
)
>
0
)
and
(
self
.
Up
==
False
):
if
self
.
Up
==
False
:
# 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 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
):
activeObject
.
totalFailureTime
+=
now
()
-
activeObject
.
timeLastFailure
#we add the value only if it hasn't already been added
#
we add the value only if it hasn't already been added
#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
...
...
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