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
a4b1cf0e
Commit
a4b1cf0e
authored
Sep 08, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more methods moved to ManPyObject
parent
b7d78ef7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
81 deletions
+49
-81
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+1
-19
dream/simulation/Failure.py
dream/simulation/Failure.py
+3
-3
dream/simulation/ManPyObject.py
dream/simulation/ManPyObject.py
+37
-0
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+2
-30
dream/simulation/ObjectResource.py
dream/simulation/ObjectResource.py
+1
-24
dream/simulation/ScheduledMaintenance.py
dream/simulation/ScheduledMaintenance.py
+2
-2
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+3
-3
No files found.
dream/simulation/CoreObject.py
View file @
a4b1cf0e
...
...
@@ -612,25 +612,7 @@ class CoreObject(ManPyObject):
activeObject
.
Loading
.
append
(
100
*
self
.
totalLoadTime
/
MaxSimtime
)
activeObject
.
SettingUp
.
append
(
100
*
self
.
totalSetupTime
/
MaxSimtime
)
activeObject
.
OffShift
.
append
(
100
*
self
.
totalOffShiftTime
/
MaxSimtime
)
# =======================================================================
# outputs message to the trace.xls
# =======================================================================
#outputs message to the trace.xls. Format is (Simulation Time | Entity or Frame Name | message)
def
outputTrace
(
self
,
entityName
,
message
):
from
Globals
import
G
if
(
G
.
trace
==
"Yes"
):
#output only if the user has selected to
#handle the 3 columns
G
.
traceSheet
.
write
(
G
.
traceIndex
,
0
,
str
(
self
.
env
.
now
))
G
.
traceSheet
.
write
(
G
.
traceIndex
,
1
,
entityName
)
G
.
traceSheet
.
write
(
G
.
traceIndex
,
2
,
message
)
G
.
traceIndex
+=
1
#increment the row
#if we reach row 65536 we need to create a new sheet (excel limitation)
if
(
G
.
traceIndex
==
65536
):
G
.
traceIndex
=
0
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
# =======================================================================
# outputs data to "output.xls"
...
...
dream/simulation/Failure.py
View file @
a4b1cf0e
...
...
@@ -152,7 +152,7 @@ class Failure(ObjectInterruption):
self
.
victim
.
Up
=
False
self
.
victim
.
timeLastFailure
=
self
.
env
.
now
self
.
outputTrace
(
"is down"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is down"
)
# update the failure time
failTime
=
self
.
env
.
now
if
(
self
.
repairman
and
self
.
repairman
!=
"None"
):
# if the failure needs a resource to be fixed,
...
...
@@ -169,7 +169,7 @@ class Failure(ObjectInterruption):
self
.
victim
.
totalFailureTime
+=
self
.
env
.
now
-
failTime
self
.
reactivateVictim
()
# since repairing is over, the Machine is reactivated
self
.
victim
.
Up
=
True
self
.
outputTrace
(
"is up"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is up"
)
self
.
repairman
.
totalWorkingTime
+=
self
.
env
.
now
-
timeOperationStarted
continue
...
...
@@ -194,4 +194,4 @@ class Failure(ObjectInterruption):
self
.
victim
.
totalFailureTime
+=
self
.
env
.
now
-
failTime
self
.
reactivateVictim
()
# since repairing is over, the Machine is reactivated
self
.
victim
.
Up
=
True
self
.
outputTrace
(
"is up"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is up"
)
dream/simulation/ManPyObject.py
View file @
a4b1cf0e
...
...
@@ -113,3 +113,40 @@ class ManPyObject(object):
print
phrase
,
arg
,
suffix
else
:
print
phrase
,
arg
# =======================================================================
# outputs message to the trace.xls
# outputs message to the trace.xls. Format is (Simulation Time | Entity or Frame Name | message)
# =======================================================================
@
staticmethod
def
outputTrace
(
entityName
,
message
):
from
Globals
import
G
if
(
G
.
trace
==
"Yes"
):
#output only if the user has selected to
#handle the 3 columns
G
.
traceSheet
.
write
(
G
.
traceIndex
,
0
,
str
(
G
.
env
.
now
))
G
.
traceSheet
.
write
(
G
.
traceIndex
,
1
,
entityName
)
G
.
traceSheet
.
write
(
G
.
traceIndex
,
2
,
message
)
G
.
traceIndex
+=
1
#increment the row
#if we reach row 65536 we need to create a new sheet (excel limitation)
if
(
G
.
traceIndex
==
65536
):
G
.
traceIndex
=
0
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#===========================================================================
# actions to be performed after the end of the simulation
#===========================================================================
def
postProcessing
(
self
):
pass
# =======================================================================
# outputs data to "output.xls"
# =======================================================================
def
outputResultsXL
(
self
,
MaxSimtime
=
None
):
pass
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
pass
\ No newline at end of file
dream/simulation/ObjectInterruption.py
View file @
a4b1cf0e
...
...
@@ -74,12 +74,6 @@ class ObjectInterruption(ManPyObject):
def
invoke
(
self
):
self
.
isCalled
.
succeed
(
self
.
env
.
now
)
#===========================================================================
# outputs data to "output.xls"
#===========================================================================
def
outputTrace
(
self
,
message
):
pass
#===========================================================================
# returns the internal queue of the victim
#===========================================================================
...
...
@@ -92,12 +86,7 @@ class ObjectInterruption(ManPyObject):
def
victimQueueIsEmpty
(
self
):
return
len
(
self
.
getVictimQueue
())
==
0
#===========================================================================
# actions to be performed after the end of the simulation
#===========================================================================
def
postProcessing
(
self
):
pass
#===========================================================================
# interrupts the victim
#===========================================================================
...
...
@@ -124,24 +113,7 @@ class ObjectInterruption(ManPyObject):
if
self
.
victim
.
dedicatedOperator
:
# request allocation
self
.
victim
.
requestAllocation
()
#===========================================================================
# outputs message to the trace.xls. Format is (Simulation Time | Victim Name | message)
#===========================================================================
def
outputTrace
(
self
,
message
):
from
Globals
import
G
if
(
G
.
trace
==
"Yes"
):
#output only if the user has selected to
#handle the 3 columns
G
.
traceSheet
.
write
(
G
.
traceIndex
,
0
,
str
(
self
.
env
.
now
))
G
.
traceSheet
.
write
(
G
.
traceIndex
,
1
,
self
.
victim
.
objName
)
G
.
traceSheet
.
write
(
G
.
traceIndex
,
2
,
message
)
G
.
traceIndex
+=
1
#increment the row
#if we reach row 65536 we need to create a new sheet (excel limitation)
if
(
G
.
traceIndex
==
65536
):
G
.
traceIndex
=
0
G
.
sheetIndex
+=
1
G
.
traceSheet
=
G
.
traceFile
.
add_sheet
(
'sheet '
+
str
(
G
.
sheetIndex
),
cell_overwrite_ok
=
True
)
#===========================================================================
# prints message to the console
#===========================================================================
...
...
dream/simulation/ObjectResource.py
View file @
a4b1cf0e
...
...
@@ -65,30 +65,7 @@ class ObjectResource(ManPyObject):
def
checkIfResourceIsAvailable
(
self
,
callerObject
=
None
):
return
len
(
self
.
Res
.
users
)
<
self
.
capacity
# =======================================================================
# actions to be taken after the simulation ends
# =======================================================================
def
postProcessing
(
self
,
MaxSimtime
=
None
):
pass
# =======================================================================
# outputs message to the trace.xls
# =======================================================================
def
outputTrace
(
self
,
message
):
pass
# =======================================================================
# outputs data to "output.xls"
# =======================================================================
def
outputResultsXL
(
self
,
MaxSimtime
=
None
):
pass
# =======================================================================
# outputs results to JSON File
# =======================================================================
def
outputResultsJSON
(
self
):
pass
# =======================================================================
# returns the resource
# =======================================================================
...
...
dream/simulation/ScheduledMaintenance.py
View file @
a4b1cf0e
...
...
@@ -99,7 +99,7 @@ class ScheduledMaintenance(ObjectInterruption):
self
.
interruptVictim
()
self
.
victim
.
Up
=
False
self
.
victim
.
timeLastFailure
=
self
.
env
.
now
self
.
outputTrace
(
"is down"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is down"
)
except
AttributeError
:
print
"AttributeError1"
...
...
@@ -110,7 +110,7 @@ class ScheduledMaintenance(ObjectInterruption):
if
(
len
(
self
.
getVictimQueue
())
>
0
):
self
.
reactivateVictim
()
# since the maintenance is over, the victim is reactivated
self
.
victim
.
Up
=
True
self
.
outputTrace
(
"is up"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is up"
)
except
AttributeError
:
print
"AttributeError2"
...
...
dream/simulation/ShiftScheduler.py
View file @
a4b1cf0e
...
...
@@ -68,7 +68,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
victim
.
onShift
=
False
self
.
interruptVictim
()
# interrupt processing operations if any
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
self
.
outputTrace
(
"is off shift"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is off shift"
)
while
1
:
if
not
self
.
victim
.
onShift
:
...
...
@@ -83,7 +83,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
victim
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
victim
.
timeLastShiftEnded
self
.
victim
.
onShift
=
True
self
.
victim
.
timeLastShiftStarted
=
self
.
env
.
now
self
.
outputTrace
(
"is on shift"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is on shift"
)
startShift
=
self
.
env
.
now
else
:
timeToEndShift
=
float
(
self
.
remainingShiftPattern
[
0
][
1
]
-
self
.
env
.
now
)
...
...
@@ -109,7 +109,7 @@ class ShiftScheduler(ObjectInterruption):
self
.
interruptVictim
()
# interrupt the victim
self
.
victim
.
onShift
=
False
# get the victim off-shift
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
self
.
outputTrace
(
"is off shift"
)
self
.
outputTrace
(
self
.
victim
.
name
,
"is off shift"
)
self
.
remainingShiftPattern
.
pop
(
0
)
if
len
(
self
.
remainingShiftPattern
)
==
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