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
09cf6663
Commit
09cf6663
authored
May 14, 2014
by
Georgios Dagkakis
Committed by
Ioannis Papagiannopoulos
May 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parallel server examples updated in order to work with the new approach
parent
ba85e941
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
20 deletions
+14
-20
dream/simulation/Examples/ParallelServers2.py
dream/simulation/Examples/ParallelServers2.py
+7
-10
dream/simulation/Examples/ParallelServers3.py
dream/simulation/Examples/ParallelServers3.py
+7
-10
No files found.
dream/simulation/Examples/ParallelServers2.py
View file @
09cf6663
...
@@ -3,16 +3,13 @@ from dream.simulation.imports import simulate, activate, initialize, infinity
...
@@ -3,16 +3,13 @@ from dream.simulation.imports import simulate, activate, initialize, infinity
#the custom queue
#the custom queue
class
SelectiveQueue
(
Queue
):
class
SelectiveQueue
(
Queue
):
def
haveToDispose
(
self
,
callerObject
=
None
):
# override so that it first chooses M1 and then M2
caller
=
callerObject
def
selectReceiver
(
self
,
possibleReceivers
=
[]):
# if the caller is M1 then return true if there is an Entity to give
if
M1
.
canAccept
():
if
caller
.
id
==
'M1'
:
return
M1
return
len
(
self
.
getActiveObjectQueue
())
>
0
elif
M2
.
canAccept
():
# else return true only if M1 cannot accept the Entity
return
M2
if
caller
.
id
==
'M2'
:
return
None
# find M1
M1
=
Globals
.
findObjectById
(
'M1'
)
# global method to obtain an object from the id
return
len
(
self
.
getActiveObjectQueue
())
>
0
and
(
not
(
M1
.
canAccept
()))
#define the objects of the model
#define the objects of the model
S
=
Source
(
'S'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
S
=
Source
(
'S'
,
'Source'
,
interarrivalTime
=
{
'distributionType'
:
'Fixed'
,
'mean'
:
0.5
},
entity
=
'Dream.Part'
)
...
...
dream/simulation/Examples/ParallelServers3.py
View file @
09cf6663
...
@@ -3,16 +3,13 @@ from dream.simulation.imports import simulate, activate, initialize, infinity
...
@@ -3,16 +3,13 @@ from dream.simulation.imports import simulate, activate, initialize, infinity
#the custom queue
#the custom queue
class
SelectiveQueue
(
Queue
):
class
SelectiveQueue
(
Queue
):
def
haveToDispose
(
self
,
callerObject
=
None
):
# override so that it first chooses M1 and then M2
caller
=
callerObject
def
selectReceiver
(
self
,
possibleReceivers
=
[]):
# if the caller is M1 then return true if there is an Entity to give
if
M1
.
canAccept
():
if
caller
.
id
==
'M1'
:
return
M1
return
len
(
self
.
getActiveObjectQueue
())
>
0
elif
M2
.
canAccept
():
# else return true only if M1 cannot accept the Entity
return
M2
if
caller
.
id
==
'M2'
:
return
None
# find M1
M1
=
Globals
.
findObjectById
(
'M1'
)
# global method to obtain an object from the id
return
len
(
self
.
getActiveObjectQueue
())
>
0
and
(
not
(
M1
.
canAccept
()))
#the custom machine
#the custom machine
class
Milling
(
Machine
):
class
Milling
(
Machine
):
...
...
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