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
f38258e6
Commit
f38258e6
authored
Aug 14, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Operator to count and output off-shift time
parent
7471841a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
8 deletions
+23
-8
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+0
-4
dream/simulation/Operator.py
dream/simulation/Operator.py
+23
-4
No files found.
dream/simulation/ObjectResource.py
View file @
f38258e6
...
@@ -48,8 +48,6 @@ class ObjectResource(ManPyObject):
...
@@ -48,8 +48,6 @@ class ObjectResource(ManPyObject):
def
initialize
(
self
):
def
initialize
(
self
):
from
Globals
import
G
from
Globals
import
G
self
.
env
=
G
.
env
self
.
env
=
G
.
env
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
timeLastOperationStarted
=
0
#holds the time that the last repair was started
self
.
timeLastOperationStarted
=
0
#holds the time that the last repair was started
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
capacity
=
self
.
capacity
)
self
.
Res
=
simpy
.
Resource
(
self
.
env
,
capacity
=
self
.
capacity
)
# variable that checks whether the resource is already initialized
# variable that checks whether the resource is already initialized
...
@@ -58,8 +56,6 @@ class ObjectResource(ManPyObject):
...
@@ -58,8 +56,6 @@ class ObjectResource(ManPyObject):
self
.
coreObjectIds
=
[]
self
.
coreObjectIds
=
[]
# list with the coreObjects that the resource services
# list with the coreObjects that the resource services
self
.
coreObjects
=
[]
self
.
coreObjects
=
[]
# flag that shows if the resourse is on shift
self
.
onShift
=
True
# =======================================================================
# =======================================================================
# checks if the worker is available
# checks if the worker is available
...
...
dream/simulation/Operator.py
View file @
f38258e6
...
@@ -46,6 +46,8 @@ class Operator(ObjectResource):
...
@@ -46,6 +46,8 @@ class Operator(ObjectResource):
# lists to hold statistics of multiple runs
# lists to hold statistics of multiple runs
self
.
Waiting
=
[]
# holds the percentage of waiting time
self
.
Waiting
=
[]
# holds the percentage of waiting time
self
.
Working
=
[]
# holds the percentage of working time
self
.
Working
=
[]
# holds the percentage of working time
self
.
OffShift
=
[]
# holds the percentage of working time
# the following attributes are not used by the Repairman
# the following attributes are not used by the Repairman
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
self
.
schedulingRule
=
schedulingRule
#the scheduling rule that the Queue follows
...
@@ -81,6 +83,16 @@ class Operator(ObjectResource):
...
@@ -81,6 +83,16 @@ class Operator(ObjectResource):
from
Globals
import
G
from
Globals
import
G
G
.
OperatorsList
.
append
(
self
)
G
.
OperatorsList
.
append
(
self
)
def
initialize
(
self
):
ObjectResource
.
initialize
(
self
)
# flag that shows if the resource is on shift
self
.
onShift
=
True
self
.
totalWorkingTime
=
0
#holds the total working time
self
.
totalWaitingTime
=
0
#holds the total waiting time
self
.
totalOffShiftTime
=
0
#holds the total off-shift time
self
.
timeLastShiftStarted
=
0
#holds the time that the last shift of the object started
self
.
timeLastShiftEnded
=
0
#holds the time that the last shift of the object ended
@
staticmethod
@
staticmethod
def
getSupportedSchedulingRules
():
def
getSupportedSchedulingRules
():
return
(
"FIFO"
,
"Priority"
,
"WT"
,
"EDD"
,
"EOD"
,
return
(
"FIFO"
,
"Priority"
,
"WT"
,
"EDD"
,
"EOD"
,
...
@@ -304,13 +316,16 @@ class Operator(ObjectResource):
...
@@ -304,13 +316,16 @@ class Operator(ObjectResource):
if
MaxSimtime
==
None
:
if
MaxSimtime
==
None
:
from
Globals
import
G
from
Globals
import
G
MaxSimtime
=
G
.
maxSimTime
MaxSimtime
=
G
.
maxSimTime
# if the repairman is currently working we have to count the time of this work
# if the Operator is currently working we have to count the time of this work
# if len(self.getResourceQueue())>0:
if
len
(
self
.
getResourceQueue
())
>
0
:
if
not
self
.
checkIfResourceIsAvailable
():
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLastOperationStarted
self
.
totalWorkingTime
+=
self
.
env
.
now
-
self
.
timeLastOperationStarted
# if the Operator is currently off-shift we have to count the time of this work
if
not
self
.
onShift
:
self
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
timeLastShiftEnded
# Repairman was idle when he was not in any other state
# Repairman was idle when he was not in any other state
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
self
.
totalWaitingTime
=
MaxSimtime
-
self
.
totalWorkingTime
-
self
.
totalOffShiftTime
# update the waiting/working time percentages lists
# update the waiting/working time percentages lists
self
.
Waiting
.
append
(
100
*
self
.
totalWaitingTime
/
MaxSimtime
)
self
.
Waiting
.
append
(
100
*
self
.
totalWaitingTime
/
MaxSimtime
)
self
.
Working
.
append
(
100
*
self
.
totalWorkingTime
/
MaxSimtime
)
self
.
Working
.
append
(
100
*
self
.
totalWorkingTime
/
MaxSimtime
)
...
@@ -371,9 +386,13 @@ class Operator(ObjectResource):
...
@@ -371,9 +386,13 @@ class Operator(ObjectResource):
if
(
G
.
numberOfReplications
==
1
):
if
(
G
.
numberOfReplications
==
1
):
json
[
'results'
][
'working_ratio'
]
=
100
*
self
.
totalWorkingTime
/
G
.
maxSimTime
json
[
'results'
][
'working_ratio'
]
=
100
*
self
.
totalWorkingTime
/
G
.
maxSimTime
json
[
'results'
][
'waiting_ratio'
]
=
100
*
self
.
totalWaitingTime
/
G
.
maxSimTime
json
[
'results'
][
'waiting_ratio'
]
=
100
*
self
.
totalWaitingTime
/
G
.
maxSimTime
#output the off-shift time only if there is any
if
self
.
totalOffShiftTime
:
json
[
'results'
][
'off_shift_ratio'
]
=
100
*
self
.
totalOffShiftTime
/
G
.
maxSimTime
else
:
else
:
json
[
'results'
][
'working_ratio'
]
=
getConfidenceIntervals
(
self
.
Working
)
json
[
'results'
][
'working_ratio'
]
=
getConfidenceIntervals
(
self
.
Working
)
json
[
'results'
][
'waiting_ratio'
]
=
getConfidenceIntervals
(
self
.
Waiting
)
json
[
'results'
][
'waiting_ratio'
]
=
getConfidenceIntervals
(
self
.
Waiting
)
json
[
'results'
][
'off_shift_ratio'
]
=
getConfidenceIntervals
(
self
.
OffShift
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
G
.
outputJSON
[
'elementList'
].
append
(
json
)
#===========================================================================
#===========================================================================
...
...
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