|
@@ -432,7 +432,6 @@ class ModelverseInterface(AtomicDEVS):
|
|
|
print("Adding 3 empty lists")
|
|
|
self.state.operations.insert(0, None)
|
|
|
self.state.operations.insert(0, None)
|
|
|
- self.state.operations.insert(0, None)
|
|
|
elif prev_output.startswith("Finished task: "):
|
|
|
self.state.blocked = True
|
|
|
elif " : " in prev_output:
|
|
@@ -444,7 +443,10 @@ class ModelverseInterface(AtomicDEVS):
|
|
|
# NOTE We now know that there is something to do on an other task, so we just wait for that event to come in
|
|
|
self.state.operations.insert(0, None)
|
|
|
self.state.operations.insert(0, None)
|
|
|
- self.state.operations.insert(0, None)
|
|
|
+ elif prev_output == "Success":
|
|
|
+ print("Remaining operations: " + str(self.state.operations))
|
|
|
+ self.state.operations.pop(0)
|
|
|
+ self.state.blocked = False
|
|
|
else:
|
|
|
print("UNKNOWN: " + str(prev_output))
|
|
|
|
|
@@ -526,7 +528,7 @@ class Network(AtomicDEVS):
|
|
|
def intTransition(self):
|
|
|
self.state.processing.pop(0)
|
|
|
if self.state.processing:
|
|
|
- self.state.timer = (len(self.state.processing[0]) * 8 / float(self.bandwidth) + self.latency)
|
|
|
+ self.state.timer = (len(json.dumps(self.state.processing[0])) * 8 / float(self.bandwidth) + self.latency)
|
|
|
else:
|
|
|
self.state.timer = float("inf")
|
|
|
return self.state
|
|
@@ -536,14 +538,14 @@ class Network(AtomicDEVS):
|
|
|
if self.state.timer == float("inf"):
|
|
|
self.state.timer = 0
|
|
|
for v in inputs[self.input_port]:
|
|
|
- self.state.processing.append(json.dumps(v))
|
|
|
+ self.state.processing.append(v)
|
|
|
# NOTE data is in bytes, while bandwidth is in bits, so multiply by 8
|
|
|
if len(self.state.processing) > 0:
|
|
|
- self.state.timer = (len(self.state.processing[0]) * 8 / float(self.bandwidth) + self.latency)
|
|
|
+ self.state.timer = (len(json.dumps(self.state.processing[0])) * 8 / float(self.bandwidth) + self.latency)
|
|
|
return self.state
|
|
|
|
|
|
def outputFnc(self):
|
|
|
- return {self.output_port: [json.loads(self.state.processing[0])]}
|
|
|
+ return {self.output_port: [self.state.processing[0]]}
|
|
|
|
|
|
def timeAdvance(self):
|
|
|
#print("Timer: " + str(self.state.timer))
|