|
14 | 14 |
|
15 | 15 | u = concore.initval(init_simtime_u) |
16 | 16 | ym = concore2.initval(init_simtime_ym) |
17 | | -while(concore2.simtime<concore.maxtime): |
18 | | - while concore.unchanged(): |
19 | | - u = concore.read(concore.iport['U'],"u",init_simtime_u) |
20 | | - print(u) |
21 | | - #concore.write(concore.oport['U1'],"u",u) |
22 | | - #old2 = concore2.simtime |
23 | | - #while concore2.unchanged() or concore2.simtime <= old2: |
24 | | - # ym = concore2.read(concore.iport['Y1'],"ym",init_simtime_ym) |
25 | | - paired_transmitter = PairedTransmitter( |
26 | | - remote_host="localhost", exposed_commands=[], |
27 | | - remote_port=2345, listen_port=2346,) |
28 | | - paired_transmitter.start_background_sync() |
29 | | - ym = paired_transmitter.request_with_immediate_reply( |
30 | | - "fun", timeout=10.0, params={"u": [concore.simtime]+u}) |
31 | | - concore2.simtime = ym[0] |
32 | | - ym = ym[1:] |
| 17 | +paired_transmitter = PairedTransmitter( |
| 18 | + remote_host="localhost", exposed_commands=[], |
| 19 | + remote_port=2345, listen_port=2346,) |
| 20 | +paired_transmitter.start_background_sync() |
| 21 | +try: |
| 22 | + while(concore2.simtime<concore.maxtime): |
| 23 | + while concore.unchanged(): |
| 24 | + u = concore.read(concore.iport['U'],"u",init_simtime_u) |
| 25 | + print(u) |
| 26 | + #concore.write(concore.oport['U1'],"u",u) |
| 27 | + #old2 = concore2.simtime |
| 28 | + #while concore2.unchanged() or concore2.simtime <= old2: |
| 29 | + # ym = concore2.read(concore.iport['Y1'],"ym",init_simtime_ym) |
| 30 | + ym = paired_transmitter.request_with_immediate_reply( |
| 31 | + "fun", timeout=10.0, params={"u": [concore.simtime]+u}) |
| 32 | + concore2.simtime = ym[0] |
| 33 | + ym = ym[1:] |
| 34 | + #print(ym) |
| 35 | + concore2.write(concore.oport['Y'],"ym",ym) |
| 36 | + print("funcall 0mq u="+str(u)+" ym="+str(ym)+" time="+str(concore2.simtime)) |
| 37 | +finally: |
33 | 38 | paired_transmitter.stop_background_sync() |
34 | | - #print(ym) |
35 | | - concore2.write(concore.oport['Y'],"ym",ym) |
36 | | - print("funcall 0mq u="+str(u)+" ym="+str(ym)+" time="+str(concore2.simtime)) |
37 | 39 | print("retry="+str(concore.retrycount)) |
0 commit comments