include "primitives.alh" include "services.alh" include "modelling.alh" include "object_operations.alh" include "utils.alh" include "io.alh" Boolean function main(model : Element): String port String the_input String devs_model port = comm_connect("pypdevs_simulator") log("(PDEVS) task name = " + get_taskname()) log("(PDEVS) Sending model...") comm_set(port, read_attribute(model, set_pop(allInstances(model, "MyString/MyString")), "value")) log("(PDEVS) " + port) while (True): if (comm_hasInput(port)): log(cast_value(has_input())) the_input = comm_get(port) log("(PDEVS) Got input from simulator!") log("(PDEVS) " + the_input) output(the_input) if (has_input()): the_input = input() log("(PDEVS) Got input from console/ps simulator!") log("(PDEVS) " + cast_value(the_input)) if (is_physical_string(the_input)): comm_set(port, the_input) else: comm_set(port, cast_value(the_input)) sleep(0.05)