update HTML + changes made to queueing example during tutorial
This commit is contained in:
parent
94b3b47e87
commit
7230fcf584
4 changed files with 37 additions and 24 deletions
|
|
@ -29,20 +29,6 @@ class Queue(AtomicDEVS):
|
|||
self.in_event = self.addInPort("in_event")
|
||||
self.in_finish = self.addInPort("in_finish")
|
||||
|
||||
def intTransition(self):
|
||||
# Is only called when we are outputting an event
|
||||
# Pop the first idle processor and clear processing event
|
||||
self.state.idle_procs.pop(0)
|
||||
if self.state.queue and self.state.idle_procs:
|
||||
# There are still queued elements, so continue
|
||||
self.state.processing = self.state.queue.pop(0)
|
||||
self.state.remaining_time = self.processing_time
|
||||
else:
|
||||
# No events left to process, so become idle
|
||||
self.state.processing = None
|
||||
self.state.remaining_time = float("inf")
|
||||
return self.state
|
||||
|
||||
def extTransition(self, inputs):
|
||||
# Update the remaining time of this job
|
||||
self.state.remaining_time -= self.elapsed
|
||||
|
|
@ -73,3 +59,17 @@ class Queue(AtomicDEVS):
|
|||
# Output the event to the processor
|
||||
port = self.out_proc[self.state.idle_procs[0]]
|
||||
return {port: self.state.processing}
|
||||
|
||||
def intTransition(self):
|
||||
# Is only called when we are outputting an event
|
||||
# Pop the first idle processor and clear processing event
|
||||
self.state.idle_procs.pop(0)
|
||||
if self.state.queue and self.state.idle_procs:
|
||||
# There are still queued elements, so continue
|
||||
self.state.processing = self.state.queue.pop(0)
|
||||
self.state.remaining_time = self.processing_time
|
||||
else:
|
||||
# No events left to process, so become idle
|
||||
self.state.processing = None
|
||||
self.state.remaining_time = float("inf")
|
||||
return self.state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue