12345678910111213141516171819202122232425262728293031 |
- import sys
- sys.path.append("wrappers")
- from modelverse import *
- init()
- login("admin", "admin")
- model_add("formalisms/ParallelDEVS", "formalisms/SimpleClassDiagrams", open("models/ParallelDEVS/metamodels/PDEVS.mvc", 'r').read())
- model_add("models/produce_consume_pdevs", "formalisms/ParallelDEVS", open("models/ParallelDEVS/models/produce_consume.mvc", 'r').read())
- transformation_add_AL({"ParallelDEVS": "formalisms/ParallelDEVS"}, {}, "models/paralleldevs_simulator", open("models/ParallelDEVS/transformations/simulate_interactive.alc", "r").read())
- import poll_print
- ctrl = poll_print.Controller(keep_running=False)
- thrd = threading.Thread(target=ctrl.start)
- thrd.daemon = True
- thrd.start()
- def input_thread():
- import select
- while thrd.is_alive():
- if select.select([sys.stdin], [], [], 0.1)[0]:
- ctrl.addInput(Event("raw_inp", "user_inp", [sys.stdin.readline().strip()]))
- thrd2 = threading.Thread(target=input_thread)
- thrd2.daemon = True
- thrd2.start()
- transformation_execute_AL("models/paralleldevs_simulator", {"ParallelDEVS": "models/produce_consume_pdevs"}, {}, statechart=(ctrl, "inp", "outp"))
|