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
12103620
Commit
12103620
authored
Sep 03, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change the imports in LineGenerationJSON.py
parent
11d13686
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
19 deletions
+18
-19
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+18
-19
No files found.
dream/simulation/LineGenerationJSON.py
View file @
12103620
...
...
@@ -38,18 +38,18 @@ logger = logging.getLogger("dream.platform")
import
numpy
numpy
.
seterr
(
all
=
'raise'
)
import
simpy
from
Globals
import
G
from
Order
import
Order
from
OrderDesign
import
OrderDesign
from
Mould
import
Mould
import
PrintRoute
import
ExcelHandler
from
dream.simulation.
Globals
import
G
from
dream.simulation.
Order
import
Order
from
dream.simulation.
OrderDesign
import
OrderDesign
from
dream.simulation.
Mould
import
Mould
import
dream.simulation.PrintRoute
as
PrintRoute
import
dream.simulation.ExcelHandler
as
ExcelHandler
import
time
import
json
from
random
import
Random
import
sys
import
os.path
import
Globals
import
dream.simulation.Globals
as
Globals
import
ast
import
cProfile
...
...
@@ -149,7 +149,7 @@ def createObjectResourcesAndCoreObjects():
resourceClass
=
element
.
pop
(
'_class'
)
# get the class type of the element
objectType
=
Globals
.
getClassFromName
(
resourceClass
)
from
ObjectResource
import
ObjectResource
# operator pools to be created later since they use operators
from
dream.simulation.
ObjectResource
import
ObjectResource
# operator pools to be created later since they use operators
# ToDo maybe it is semantically diferent object
if
issubclass
(
objectType
,
ObjectResource
)
and
not
resourceClass
==
'Dream.OperatorPool'
:
inputDict
=
dict
(
element
)
...
...
@@ -162,7 +162,7 @@ def createObjectResourcesAndCoreObjects():
search for operatorPools in order to create them
read the data and create them
'''
from
OperatorPool
import
OperatorPool
from
dream.simulation.
OperatorPool
import
OperatorPool
for
(
element_id
,
element
)
in
nodes
.
iteritems
():
# use an iterator to go through all the nodes
# the key is the element_id and the second is the
# element itself
...
...
@@ -202,8 +202,9 @@ def createObjectResourcesAndCoreObjects():
for
k
in
(
'element_id'
,
'top'
,
'left'
):
element
.
pop
(
k
,
None
)
objClass
=
element
.
pop
(
'_class'
)
objectType
=
Globals
.
getClassFromName
(
objClass
)
from
CoreObject
import
CoreObject
objectType
=
Globals
.
getClassFromName
(
objClass
)
from
dream.simulation.CoreObject
import
CoreObject
if
issubclass
(
objectType
,
CoreObject
):
# remove data that has to do with wip or object interruption. CoreObjects do not need it
inputDict
=
dict
(
element
)
...
...
@@ -255,8 +256,7 @@ def createObjectInterruptions():
element
[
'id'
]
=
element_id
# create a new entry for the element (dictionary)
# with key 'id' and value the the element_id
objClass
=
element
.
get
(
'_class'
,
'not found'
)
# get the class type of the element
from
ObjectInterruption
import
ObjectInterruption
import
Globals
from
dream.simulation.ObjectInterruption
import
ObjectInterruption
objClass
=
element
.
pop
(
'_class'
)
objectType
=
Globals
.
getClassFromName
(
objClass
)
# from CoreObject import CoreObject
...
...
@@ -272,9 +272,9 @@ def createObjectInterruptions():
# ToDo this will be cleaned a lot if we update the JSON notation:
# define ObjectInterruption echelon inside node
# define interruptions' distribution better
from
ScheduledMaintenance
import
ScheduledMaintenance
from
Failure
import
Failure
from
ShiftScheduler
import
ShiftScheduler
from
dream.simulation.
ScheduledMaintenance
import
ScheduledMaintenance
from
dream.simulation.
Failure
import
Failure
from
dream.simulation.
ShiftScheduler
import
ShiftScheduler
for
(
element_id
,
element
)
in
nodes
.
iteritems
():
element
[
'id'
]
=
element_id
scheduledMaintenance
=
element
.
get
(
'scheduledMaintenance'
,
{})
...
...
@@ -344,21 +344,20 @@ def createWIP():
# entities that just finished processing in a station
# and have to enter the next machine
G
.
pendingEntities
=
[]
import
Globals
json_data
=
G
.
JSONData
#Read the json data
nodes
=
json_data
[
'nodes'
]
# read from the dictionary the dicts with key 'nodes'
for
(
element_id
,
element
)
in
nodes
.
iteritems
():
element
[
'id'
]
=
element_id
wip
=
element
.
get
(
'wip'
,
[])
from
OrderDesign
import
OrderDesign
from
dream.simulation.
OrderDesign
import
OrderDesign
from
Order
import
Order
for
entity
in
wip
:
entityClass
=
entity
.
get
(
'_class'
,
None
)
entityType
=
Globals
.
getClassFromName
(
entityClass
)
inputDict
=
dict
(
entity
)
inputDict
.
pop
(
'_class'
)
from
Entity
import
Entity
from
dream.simulation.
Entity
import
Entity
if
issubclass
(
entityType
,
Entity
)
and
(
not
entityClass
==
'Dream.Order'
):
entity
=
entityType
(
**
inputDict
)
G
.
EntityList
.
append
(
entity
)
...
...
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