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
fb3c7870
Commit
fb3c7870
authored
Oct 29, 2013
by
Ioannis Papagiannopoulos
Committed by
Sebastien Robin
Nov 06, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Batch.py and SubBatch.py updated
parent
0d1b0971
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
dream/simulation/Batch.py
dream/simulation/Batch.py
+26
-26
dream/simulation/SubBatch.py
dream/simulation/SubBatch.py
+1
-1
No files found.
dream/simulation/Batch.py
View file @
fb3c7870
...
...
@@ -33,35 +33,35 @@ class Batch(Entity):
type
=
"Batch"
def
__init__
(
self
,
id
,
name
,
numberOfUnits
=
1
):
Entity
.
__init__
(
self
,
name
)
Entity
.
__init__
(
self
,
name
=
name
)
self
.
id
=
id
self
.
numberOfUnits
=
numberOfUnits
self
.
numberOfSubBatches
=
1
#integer that shows in how many sub batches is the batch broken
self
.
subBatchList
=
[]
#list that contains the sub-batches that this batch has been broken into
self
.
numberOfSubBatches
=
1
#integer that shows in how many sub batches is the batch broken
self
.
subBatchList
=
[]
#list that contains the sub-batches that this batch has been broken into
#breaks the Batch to a number of SubBatches
def
breakToSubBatches
(
self
,
numberOfSubBatches
=
2
):
numberOfSubBatchUnits
=
self
.
numberOfUnits
/
numberOfSubBatches
#for now it considers that the division gives an integer
#(E.g. 100 units to be divided to 4 sub-batches)
activeObjectQueue
=
self
.
currentStation
.
getActiveObjectQueue
()
#get the internal queue of the active core object
activeObjectQueue
.
remove
(
self
)
#the Batch is non-existent in this active Queue now (since it is broken)
for
i
in
range
(
numberOfSubBatches
):
subBatch
=
SubBatch
(
str
(
self
.
id
)
+
'_'
+
str
(
i
),
self
.
name
+
"_SB_"
+
str
(
i
),
self
.
id
,
numberOfUnits
=
numberOfSubBatchUnits
)
#create the sub-batch
activeObjectQueue
.
append
(
subBatch
)
#append the sub-batch to the active object Queue
self
.
subBatchList
.
append
(
subBatch
)
self
.
numberOfSubBatches
=
numberOfSubBatches
#re-assembles a batch that was broken into sub-batches
def
reAssembleBatch
(
self
):
self
.
numberOfUnits
=
0
activeObjectQueue
=
self
.
subBatchList
[
0
].
currentStation
.
getActiveObjectQueue
()
#get the internal queue of the active core object
#it should be the same for all the sub-batches
for
subBatch
in
self
.
subBatchList
:
self
.
numberOfUnits
+=
subBatch
.
numberOfUnits
#maybe there are units lost (scrapped), so it has to be re-calculated
#the sub-batch no longer exists
activeObjectQueue
.
remove
(
subBatch
)
del
subBatch
#
#breaks the Batch to a number of SubBatches
#
def breakToSubBatches(self, numberOfSubBatches=2):
#
numberOfSubBatchUnits=self.numberOfUnits/numberOfSubBatches #for now it considers that the division gives an integer
#
#(E.g. 100 units to be divided to 4 sub-batches)
#
activeObjectQueue=self.currentStation.getActiveObjectQueue() #get the internal queue of the active core object
#
activeObjectQueue.remove(self) #the Batch is non-existent in this active Queue now (since it is broken)
#
for i in range(numberOfSubBatches):
#
subBatch=SubBatch(str(self.id)+'_'+str(i), self.name+"_SB_"
#
+str(i), self.id, numberOfUnits=numberOfSubBatchUnits) #create the sub-batch
#
activeObjectQueue.append(subBatch) #append the sub-batch to the active object Queue
#
self.subBatchList.append(subBatch)
#
self.numberOfSubBatches=numberOfSubBatches
#
#
#re-assembles a batch that was broken into sub-batches
#
def reAssembleBatch(self):
#
self.numberOfUnits=0
#
activeObjectQueue=self.subBatchList[0].currentStation.getActiveObjectQueue() #get the internal queue of the active core object
#
#it should be the same for all the sub-batches
#
for subBatch in self.subBatchList:
#
self.numberOfUnits+=subBatch.numberOfUnits #maybe there are units lost (scrapped), so it has to be re-calculated
#
#the sub-batch no longer exists
#
activeObjectQueue.remove(subBatch)
#
del subBatch
dream/simulation/SubBatch.py
View file @
fb3c7870
...
...
@@ -32,7 +32,7 @@ class SubBatch(Entity):
type
=
"SubBatch"
def
__init__
(
self
,
id
,
name
,
batchId
,
numberOfUnits
=
1
):
Entity
.
__init__
(
self
,
name
)
Entity
.
__init__
(
self
,
name
=
name
)
self
.
id
=
id
self
.
numberOfUnits
=
numberOfUnits
self
.
batchId
=
batchId
...
...
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