INNER CODE UNIT · Python

current_command

Fortiphyd/GRFICSv2 · simulation_vm/simulation/remote_io/modbus/feed1.py:49

    current_command = context[slave_id].getValues(16, 1, 1)[0] / 65535.0*100.0

    s.send('{"request":"write","data":{"inputs":{"f1_valve_sp":'+repr(current_command)+'}}}\n')

    # import pdb; pdb.set_trace()
    #s.send('{"request":"read"}')
    data = json.loads(s.recv(1500))
    valve_pos = int(data["state"]["f1_valve_pos"]/100.0*65535)
    flow = int(data["outputs"]["f1_flow"]/500.0*65535)
    print data
    if valve_pos > 65535:
        valve_pos = 65535
    elif valve_pos < 0:
        valve_pos = 0
    if flow > 65535:
        flow = 65535
    elif flow < 0:
        flow = 0

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…