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
6d6129a4
Commit
6d6129a4
authored
Mar 20, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
breaks may be suspended if near the end of the shift
parent
44f488c8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
dream/simulation/Break.py
dream/simulation/Break.py
+14
-2
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+3
-2
No files found.
dream/simulation/Break.py
View file @
6d6129a4
...
...
@@ -35,12 +35,13 @@ from ObjectInterruption import ObjectInterruption
class
Break
(
ObjectInterruption
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
distribution
=
{},
deteriorationType
=
'constant'
,
endUnfinished
=
True
,
**
kw
):
endUnfinished
=
True
,
offShiftAnticipation
=
0
,
**
kw
):
ObjectInterruption
.
__init__
(
self
,
id
,
name
,
victim
=
victim
)
self
.
rngTTB
=
RandomNumberGenerator
(
self
,
distribution
.
get
(
'TTB'
,{
'Fixed'
:{
'mean'
:
100
}}))
self
.
rngTTR
=
RandomNumberGenerator
(
self
,
distribution
.
get
(
'TTR'
,{
'Fixed'
:{
'mean'
:
10
}}))
self
.
type
=
"Break"
self
.
endUnfinished
=
endUnfinished
self
.
offShiftAnticipation
=
offShiftAnticipation
def
initialize
(
self
):
ObjectInterruption
.
initialize
(
self
)
...
...
@@ -79,6 +80,17 @@ class Break(ObjectInterruption):
self
.
victimOffShift
=
self
.
env
.
event
()
continue
# check if we are close to the end of the shift. If yes then the break may be suspended
# (depending on offShiftAnticipation)
timeToNextOfShift
=
None
for
oi
in
self
.
victim
.
objectInterruptions
:
if
oi
.
type
==
'ShiftScheduler'
:
if
oi
.
remainingShiftPattern
:
timeToNextOfShift
=
oi
.
remainingShiftPattern
[
0
][
1
]
if
timeToNextOfShift
:
if
self
.
offShiftAnticipation
>=
timeToNextOfShift
-
self
.
env
.
now
:
continue
# interrupt the victim
# if the victim is station
if
issubclass
(
self
.
victim
.
__class__
,
CoreObject
):
...
...
dream/simulation/LineGenerationJSON.py
View file @
6d6129a4
...
...
@@ -349,8 +349,9 @@ def createObjectInterruptions():
victim
=
Globals
.
findObjectById
(
element
[
'id'
])
endUnfinished
=
bool
(
int
(
br
.
get
(
'endUnfinished'
,
1
)))
deteriorationType
=
br
.
get
(
'deteriorationType'
,
'constant'
)
BR
=
Break
(
victim
=
victim
,
distribution
=
br
,
endUnfinished
=
endUnfinished
,
deteriorationType
=
deteriorationType
)
offShiftAnticipation
=
br
.
get
(
'offShiftAnticipation'
,
0
)
BR
=
Break
(
victim
=
victim
,
distribution
=
br
,
endUnfinished
=
endUnfinished
,
deteriorationType
=
deteriorationType
,
offShiftAnticipation
=
offShiftAnticipation
)
G
.
ObjectInterruptionList
.
append
(
BR
)
G
.
FailureList
.
append
(
BR
)
...
...
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