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
1bd4eeef
Commit
1bd4eeef
authored
Mar 02, 2014
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display change in station status
parent
5022baef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
4 deletions
+36
-4
dream/platform/static/src/dream_launcher.js
dream/platform/static/src/dream_launcher.js
+17
-3
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+9
-1
dream/simulation/Machine.py
dream/simulation/Machine.py
+10
-0
No files found.
dream/platform/static/src/dream_launcher.js
View file @
1bd4eeef
...
...
@@ -356,11 +356,17 @@
displayEntities
(
destination
,
message
.
destination
);
}
})()
}
}
function
changeStatus
(
message
,
queue
)
{
var
obj
=
dream_instance
.
getElementId
(
message
.
object
);
dream_instance
.
updateElementData
(
message
.
object
,
{
status
:
message
.
status
})
$
(
"
#now
"
).
text
(
message
.
time
.
toFixed
(
2
));
$
(
queue
).
dequeue
()
}
function
notifyEndSimulation
(
message
){
function
notifyEndSimulation
(
message
,
queue
){
$
(
"
#json_result
"
).
val
(
JSON
.
stringify
(
message
[
'
success
'
],
undefined
,
"
"
));
$
(
"
#loading_spinner
"
).
hide
();
...
...
@@ -381,17 +387,25 @@
);
});
dream_instance
.
displayResult
(
0
);
$
(
queue
).
dequeue
()
}
function
onWebSocketMessage
(
e
)
{
var
message
=
JSON
.
parse
(
e
.
data
)
// XXX queue process message ?
if
(
message
.
action
===
"
move_entity
"
){
$
(
"
#main
"
).
queue
(
function
()
{
moveEntity
(
message
,
this
);
})
}
if
(
message
.
action
===
"
status_change
"
){
$
(
"
#main
"
).
queue
(
function
()
{
changeStatus
(
message
,
this
);
})
}
if
(
message
[
'
success
'
])
{
$
(
"
#main
"
).
queue
(
function
()
{
notifyEndSimulation
(
message
,
this
);
...
...
dream/simulation/CoreObject.py
View file @
1bd4eeef
...
...
@@ -181,7 +181,15 @@ class CoreObject(Process):
self
.
offShiftTimeTryingToReleaseCurrentEntity
=
self
.
timeLastShiftStarted
-
self
.
timeLastShiftEnded
blockage
=
now
()
-
(
self
.
timeLastEntityEnded
+
self
.
downTimeInTryingToReleaseCurrentEntity
+
self
.
offShiftTimeTryingToReleaseCurrentEntity
)
self
.
totalBlockageTime
+=
blockage
def
changeStatus
(
self
,
new_status
):
self
.
status
=
new_status
from
Globals
import
send
send
({
"action"
:
"status_change"
,
"object"
:
self
.
id
,
"status"
:
new_status
,
"time"
:
now
()})
# =======================================================================
# gets an entity from the giver
# =======================================================================
...
...
dream/simulation/Machine.py
View file @
1bd4eeef
...
...
@@ -86,6 +86,10 @@ class Machine(CoreObject):
self
.
MTTF
=
MTTF
self
.
MTTR
=
MTTR
self
.
availability
=
availability
self
.
changeStatus
(
'waiting'
)
# Can be 'failure', 'working', 'waiting',
# 'blocked' or 'offshift'
''' sets the operator resource of the Machine
check if the operatorPool is a List or a OperatorPool type Object
if it is a list then initiate a OperatorPool type object containing
...
...
@@ -143,6 +147,7 @@ class Machine(CoreObject):
def
initialize
(
self
):
# using the Process __init__ and not the CoreObject __init__
CoreObject
.
initialize
(
self
)
self
.
changeStatus
(
'waiting'
)
# initialize the internal Queue (type Resource) of the Machine
self
.
Res
=
Resource
(
self
.
capacity
)
# initiate the Broker responsible to control the request/release
...
...
@@ -199,6 +204,7 @@ class Machine(CoreObject):
def
run
(
self
):
# execute all through simulation time
while
1
:
self
.
changeStatus
(
'waiting'
)
# wait until the machine can accept an entity and one predecessor requests it
# canAcceptAndIsRequested is invoked to check when the machine requested to receive an entity
yield
waituntil
,
self
,
self
.
canAcceptAndIsRequested
...
...
@@ -297,6 +303,7 @@ class Machine(CoreObject):
# in plantSim the setup is performed when the machine has to process a new type of Entity and only once
if
any
(
type
==
"Setup"
for
type
in
self
.
multOperationTypeList
)
and
self
.
isOperated
():
self
.
timeSetupStarted
=
now
()
self
.
changeStatus
(
'working'
)
yield
hold
,
self
,
self
.
calculateSetupTime
()
# if self.interrupted(): There is the issue of failure during the setup
self
.
timeSetupEnded
=
now
()
...
...
@@ -323,6 +330,7 @@ class Machine(CoreObject):
self
.
downTimeInCurrentEntity
=
0
#holds the total time that the
#object was down while holding current entity
self
.
changeStatus
(
'working'
)
# this loop is repeated until the processing time is expired with no failure
# check when the processingEndedFlag switched to false
while
processingNotFinished
:
...
...
@@ -360,6 +368,7 @@ class Machine(CoreObject):
self
.
releaseOperator
()
yield
waituntil
,
self
,
self
.
broker
.
brokerIsSet
self
.
changeStatus
(
'failure'
)
# if there is a failure in the machine it is passivated
yield
passivate
,
self
# use the timers to count the time that Machine is down and related
...
...
@@ -425,6 +434,7 @@ class Machine(CoreObject):
self
.
timeLastEntityEnded
=
now
()
# this holds the time that the last entity ended processing in Machine
self
.
nameLastEntityEnded
=
self
.
currentEntity
.
name
# this holds the name of the last entity that ended processing in Machine
self
.
completedJobs
+=
1
# Machine completed one more Job
self
.
changeStatus
(
'blocked'
)
# =============== release resource after the end of processing
...
...
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