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
68e334e6
Commit
68e334e6
authored
Dec 20, 2013
by
Georgios Dagkakis
Committed by
Jérome Perrin
Jan 20, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine/QueuePreemptive added and also LineGenerationJSON updated so that it can read them
parent
9a458a97
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
0 deletions
+147
-0
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+46
-0
dream/simulation/MachinePreemptive.py
dream/simulation/MachinePreemptive.py
+51
-0
dream/simulation/QueuePreemptive.py
dream/simulation/QueuePreemptive.py
+50
-0
No files found.
dream/simulation/LineGenerationJSON.py
View file @
68e334e6
...
...
@@ -85,6 +85,7 @@ from OperatedMachine import OperatedMachine
from
BatchDecompositionStartTime
import
BatchDecompositionStartTime
from
M3
import
M3
import
ExcelHandler
import
time
import
json
...
...
@@ -155,6 +156,8 @@ def createObjects():
G
.
BrokersList
=
[]
G
.
OperatedMachineList
=
[]
G
.
BatchScrapMachineList
=
[]
G
.
MachinePreemptiveList
=
[]
G
.
QueuePreemptiveList
=
[]
# -----------------------------------------------------------------------
# loop through all the model resources
...
...
@@ -360,6 +363,36 @@ def createObjects():
G
.
MachineJobShopList
.
append
(
M
)
G
.
MachineList
.
append
(
M
)
G
.
ObjList
.
append
(
M
)
elif
objClass
==
'Dream.MachinePreemptive'
:
from
MachinePreemptive
import
MachinePreemptive
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
processingTime
=
element
.
get
(
'processingTime'
,{})
distributionType
=
processingTime
.
get
(
'distributionType'
,
'not found'
)
mean
=
float
(
processingTime
.
get
(
'mean'
,
'0'
))
stdev
=
float
(
processingTime
.
get
(
'stdev'
,
'0'
))
min
=
float
(
processingTime
.
get
(
'min'
,
'0'
))
max
=
float
(
processingTime
.
get
(
'max'
,
'0'
))
failures
=
element
.
get
(
'failures'
,
{})
failureDistribution
=
failures
.
get
(
'failureDistribution'
,
'not found'
)
MTTF
=
float
(
failures
.
get
(
'MTTF'
,
'0'
))
MTTR
=
float
(
failures
.
get
(
'MTTR'
,
'0'
))
availability
=
float
(
failures
.
get
(
'availability'
,
'0'
))
resetOnPreemption
=
bool
(
int
(
element
.
get
(
'resetOnPreemption'
,
'0'
)))
r
=
'None'
for
repairman
in
G
.
RepairmanList
:
# check which repairman in the G.RepairmanList
if
(
id
in
repairman
.
coreObjectIds
):
# (if any) is assigned to repair
r
=
repairman
# the machine with ID equal to id
M
=
MachinePreemptive
(
id
,
name
,
1
,
distribution
=
distributionType
,
failureDistribution
=
failureDistribution
,
MTTF
=
MTTF
,
MTTR
=
MTTR
,
availability
=
availability
,
repairman
=
r
,
mean
=
mean
,
stdev
=
stdev
,
min
=
min
,
max
=
max
,
resetOnPreemption
=
resetOnPreemption
)
M
.
nextIds
=
getSuccessorList
(
id
)
# update the nextIDs list of the machine
G
.
MachinePreemptiveList
.
append
(
M
)
# add machine to global MachinePreemptiveList
G
.
MachineList
.
append
(
M
)
# add machine to global MachineList
G
.
ObjList
.
append
(
M
)
# add machine to ObjList
elif
objClass
==
'Dream.Exit'
:
id
=
element
.
get
(
'id'
,
'not found'
)
...
...
@@ -399,6 +432,19 @@ def createObjects():
G
.
QueueJobShopList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.QueuePreemptive'
:
from
QueuePreemptive
import
QueuePreemptive
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
capacity
=
int
(
element
.
get
(
'capacity'
,
'1'
))
isDummy
=
bool
(
int
(
element
.
get
(
'isDummy'
,
'0'
)))
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
Q
=
QueuePreemptive
(
id
,
name
,
capacity
,
isDummy
,
schedulingRule
=
schedulingRule
)
Q
.
nextIds
=
getSuccessorList
(
id
)
G
.
QueueList
.
append
(
Q
)
G
.
QueuePreemptiveList
.
append
(
Q
)
G
.
ObjList
.
append
(
Q
)
elif
objClass
==
'Dream.QueueLIFO'
:
id
=
element
.
get
(
'id'
,
'not found'
)
name
=
element
.
get
(
'name'
,
'not found'
)
...
...
dream/simulation/MachinePreemptive.py
0 → 100644
View file @
68e334e6
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 20 Dec 2012
@author: George
'''
'''
inherits from MachineJobShop it can preempt the currently processed Entity if need be
'''
from
MachinePreemptive
import
MachinePreemptive
#the MachineJobShop object
class
MachinePreemptive
(
MachineJobShop
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
distribution
=
'Fixed'
,
mean
=
1
,
stdev
=
0
,
min
=
0
,
max
=
10
,
\
failureDistribution
=
'No'
,
MTTF
=
0
,
MTTR
=
0
,
availability
=
0
,
repairman
=
'None'
,
resetOnPreemption
=
True
):
MachineJobShop
.
__init__
(
self
,
id
,
name
,
capacity
,
distribution
,
mean
,
stdev
,
min
,
max
,
\
failureDistribution
,
MTTF
,
MTTR
,
availability
,
repairman
)
self
.
shouldPreempt
=
False
#flag that shows that the machine should preempt or not
self
.
resetOnPreemption
=
resetOnPreemption
#flag that shows if the processing time should be reset or not
def
initilize
(
self
):
MachineJobShop
.
initialize
(
self
)
self
.
shouldPreempt
=
False
#when interrupted call the preempt method
def
interruptionAction
(
self
):
self
.
preempt
()
#method to execute the preemption
def
preempt
(
self
):
print
'in'
dream/simulation/QueuePreemptive.py
0 → 100644
View file @
68e334e6
# ===========================================================================
# Copyright 2013 University of Limerick
#
# This file is part of DREAM.
#
# DREAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DREAM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with DREAM. If not, see <http://www.gnu.org/licenses/>.
# ===========================================================================
'''
Created on 20 Dec 2012
@author: George
'''
'''
Inherits from QueueJobShop. If it gets an isCritical Entity it can interrupt the destination station
'''
from
QueueJobShop
import
QueueJobShop
#the QueuePreemptive object
class
QueuePreemptive
(
QueueJobShop
):
#extend he default so that it can interrupt the receiver if need be
def
getEntity
(
self
):
activeEntity
=
QueueJobShop
.
getEntity
(
self
)
#execute default behaviour
#if the obtained Entity is critical
if
activeEntity
.
isCritical
:
#if the receiver is not empty
if
len
(
receiver
.
getActiveObjectQueue
())
>
0
:
#if the receiver does not hold an Entity that is also critical
if
not
receiver
.
getActiveObjectQueue
()[
0
].
isCritical
:
receiver
.
shouldPreempt
=
True
receiver
.
interrupt
()
#interrupt the receiver
#for future use
def
sortEntities
(
self
):
QueueJobShop
.
sortEntities
(
self
)
\ No newline at end of file
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