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
5ca6debd
Commit
5ca6debd
authored
May 29, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BatchScrapMachine and EventGenerator updated
parent
b1478fcf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
dream/simulation/BatchScrapMachine.py
dream/simulation/BatchScrapMachine.py
+3
-2
dream/simulation/EventGenerator.py
dream/simulation/EventGenerator.py
+6
-5
No files found.
dream/simulation/BatchScrapMachine.py
View file @
5ca6debd
...
...
@@ -26,8 +26,9 @@ Models a machine that processes a (Sub)Batch and can scrap a number of units in
depends on the number of units of the (Sub)Batch
'''
from
SimPy.Simulation
import
Process
,
Resource
from
SimPy.Simulation
import
activate
,
passivate
,
waituntil
,
now
,
hold
# from SimPy.Simulation import Process, Resource
# from SimPy.Simulation import activate, passivate, waituntil, now, hold
import
simpy
from
RandomNumberGenerator
import
RandomNumberGenerator
from
Machine
import
Machine
...
...
dream/simulation/EventGenerator.py
View file @
5ca6debd
...
...
@@ -26,7 +26,8 @@ Created on 4 Dec 2013
models a generator that runs a method at specified intervals
'''
from
SimPy.Simulation
import
now
,
hold
,
Process
# from SimPy.Simulation import now, hold, Process
import
simpy
from
ObjectInterruption
import
ObjectInterruption
class
EventGenerator
(
ObjectInterruption
):
...
...
@@ -43,15 +44,15 @@ class EventGenerator(ObjectInterruption):
self
.
argumentDict
=
argumentDict
#the arguments of the method given in a dict
def
run
(
self
):
yield
hold
,
self
,
self
.
start
#wait until the start time
yield
self
.
env
.
timeout
(
self
.
start
)
#wait until the start time
#loop until the end of the simulation
while
1
:
#if the stop time is exceeded then break the loop
if
self
.
stop
:
if
now
()
>
self
.
stop
:
if
self
.
env
.
now
>
self
.
stop
:
break
self
.
method
(
self
.
argumentDict
)
#call the method
yield
hold
,
self
,
self
.
interval
#wait for the predetermined interval
yield
self
.
env
.
timeout
(
self
.
interval
)
#wait for the predetermined interval
...
...
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