Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
490a619
fix: replace deprecated concore2 imports with concore (Issue #287)
GaneshPatil7517 Feb 14, 2026
ba08829
Update 0mq/funcall_zmq2.py
GaneshPatil7517 Feb 14, 2026
79a7e31
Update 0mq/funbody.py
GaneshPatil7517 Feb 14, 2026
5ebcfc0
Update 0mq/comm_node.py
GaneshPatil7517 Feb 14, 2026
1559a30
Update testsou/powermetermax.py
GaneshPatil7517 Feb 14, 2026
0563c1c
Update testsou/funcall.py
GaneshPatil7517 Feb 14, 2026
ab214a0
Update ratc/learn3.py
GaneshPatil7517 Feb 14, 2026
d34f485
Update 0mq/funbody.py
GaneshPatil7517 Feb 14, 2026
b1d1d23
Update testsou/powermetermax.py
GaneshPatil7517 Feb 14, 2026
6c0fce9
Update ratc/learn3.py
GaneshPatil7517 Feb 14, 2026
fa1aa26
Update 0mq/funcall2.py
GaneshPatil7517 Feb 14, 2026
36a0c9e
Update 0mq/funcall_distributed.py
GaneshPatil7517 Feb 14, 2026
efee0e8
Update 0mq/funcall_zmq2.py
GaneshPatil7517 Feb 14, 2026
33820fd
Update measurements/comm_node_test.py
GaneshPatil7517 Feb 14, 2026
6847bc1
Update 0mq/funbody_zmq.py
GaneshPatil7517 Feb 14, 2026
d682891
Update 0mq/funbody_zmq.py
GaneshPatil7517 Feb 14, 2026
ab956e0
Update 0mq/funbody_distributed.py
GaneshPatil7517 Feb 14, 2026
b6f87cd
Update 0mq/funbody2.py
GaneshPatil7517 Feb 14, 2026
3e6c958
Update testsou/funcall.py
GaneshPatil7517 Feb 14, 2026
aaebd5d
Update 0mq/funcall2.py
GaneshPatil7517 Feb 14, 2026
9b886d0
Update measurements/Latency/funcall_distributed.py
GaneshPatil7517 Feb 14, 2026
bda776f
Update 0mq/funbody_zmq2.py
GaneshPatil7517 Feb 14, 2026
e980a81
Update 0mq/funbody2.py
GaneshPatil7517 Feb 14, 2026
4f1382f
Update 0mq/comm_node.py
GaneshPatil7517 Feb 14, 2026
f8869e9
Update testsou/funbody.py
GaneshPatil7517 Feb 14, 2026
58915e3
refactor: address remaining Copilot review suggestions
GaneshPatil7517 Feb 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions 0mq/comm_node.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import concore
import concore2

concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u = "[0.0, 0.0, 0.0]"
init_simtime_ym = "[0.0, 0.0, 0.0]"

u = concore.initval(init_simtime_u)
ym = concore2.initval(init_simtime_ym)
while(concore2.simtime<concore.maxtime):
ym = concore.initval(init_simtime_ym)
while(concore.simtime<concore.maxtime):
while concore.unchanged():
u = concore.read(concore.iport['U'],"u",init_simtime_u)
concore.write(concore.oport['U1'],"u",u)
print(u)
old2 = concore2.simtime
while concore2.unchanged() or concore2.simtime <= old2:
ym = concore2.read(concore.iport['Y1'],"ym",init_simtime_ym)
concore2.write(concore.oport['Y'],"ym",ym)
print("funbody u="+str(u)+" ym="+str(ym)+" time="+str(concore2.simtime))
old2 = float(concore.simtime)
while concore.unchanged() or concore.simtime <= old2:
ym = concore.read(concore.iport['Y1'],"ym",init_simtime_ym)
concore.write(concore.oport['Y'],"ym",ym)
print("funbody u="+str(u)+" ym="+str(ym)+" time="+str(concore.simtime))
print("retry="+str(concore.retrycount))
22 changes: 9 additions & 13 deletions 0mq/funbody.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import concore
import concore2
import time
from osparc_control import CommandManifest
from osparc_control import CommandParameter
Expand Down Expand Up @@ -27,17 +26,14 @@
paired_transmitter.start_background_sync()

concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u = "[0.0, 0.0, 0.0]"
init_simtime_ym = "[0.0, 0.0, 0.0]"

u = concore.initval(init_simtime_u)
ym = concore2.initval(init_simtime_ym)
while(concore2.simtime<concore.maxtime):
ym = concore.initval(init_simtime_ym)
while(concore.simtime<concore.maxtime):
#while concore.unchanged():
# u = concore.read(concore.iport['U1'],"u",init_simtime_u)
command_list = paired_transmitter.get_incoming_requests()
Expand All @@ -53,17 +49,17 @@
u = u[1:]
concore.write(concore.oport['U2'],"u",u)
print(u)
old2 = concore2.simtime
while concore2.unchanged() or concore2.simtime <= old2:
ym = concore2.read(concore.iport['Y2'],"ym",init_simtime_ym)
ym = [concore2.simtime]+ym
old2 = float(concore.simtime)
while concore.unchanged() or concore.simtime <= old2:
ym = concore.read(concore.iport['Y2'],"ym",init_simtime_ym)
ym = [concore.simtime]+ym
print(f"Replying to {command.action} with {ym}")
paired_transmitter.reply_to_command(
request_id=command.request_id, payload=ym)
else:
print("undefined action"+str(command.action))
quit()
#concore2.write(concore.oport['Y1'],"ym",ym)
print("funbody u="+str(u)+" ym="+str(ym)+" time="+str(concore2.simtime))
#concore.write(concore.oport['Y1'],"ym",ym)
print("funbody u="+str(u)+" ym="+str(ym)+" time="+str(concore.simtime))
paired_transmitter.stop_background_sync()
print("retry="+str(concore.retrycount))
22 changes: 9 additions & 13 deletions 0mq/funbody2.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import concore
import concore2
import time
from osparc_control import CommandManifest
from osparc_control import CommandParameter
Expand Down Expand Up @@ -27,17 +26,14 @@
paired_transmitter.start_background_sync()

concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u = "[0.0, 0.0, 0.0]"
init_simtime_ym = "[0.0, 0.0, 0.0]"

u = concore.initval(init_simtime_u)
ym = concore2.initval(init_simtime_ym)
while(concore2.simtime<concore.maxtime):
ym = concore.initval(init_simtime_ym)
while(concore.simtime<concore.maxtime):
#while concore.unchanged():
# u = concore.read(concore.iport['U1'],"u",init_simtime_u)
command_list = paired_transmitter.get_incoming_requests()
Expand All @@ -53,17 +49,17 @@
u = u[1:]
concore.write(concore.oport['U2'],"u",u)
print(u)
old2 = concore2.simtime
while concore2.unchanged() or concore2.simtime <= old2:
ym = concore2.read(concore.iport['Y2'],"ym",init_simtime_ym)
ym = [concore2.simtime]+ym
old2 = float(concore.simtime)
while concore.simtime <= old2:
ym = concore.read(concore.iport['Y2'],"ym",init_simtime_ym)
ym = [concore.simtime]+ym
print(f"Replying to {command.action} with {ym}")
paired_transmitter.reply_to_command(
request_id=command.request_id, payload=ym)
else:
print("undefined action"+str(command.action))
quit()
#concore2.write(concore.oport['Y1'],"ym",ym)
print("funbody u="+str(u)+" ym="+str(ym)+" time="+str(concore2.simtime))
#concore.write(concore.oport['Y1'],"ym",ym)
print("funbody u="+str(u)+" ym="+str(ym)+" time="+str(concore.simtime))
paired_transmitter.stop_background_sync()
print("retry="+str(concore.retrycount))
22 changes: 9 additions & 13 deletions 0mq/funbody_distributed.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# funbody2_zmq.py
import time
import concore
import concore2

print("funbody using ZMQ via concore")

Expand All @@ -16,21 +15,18 @@

# Standard concore initializations
concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u_str = "[0.0, 0.0, 0.0]"
init_simtime_ym_str = "[0.0, 0.0, 0.0]"

u_data_values = concore.initval(init_simtime_u_str)
ym_data_values = concore2.initval(init_simtime_ym_str)
ym_data_values = concore.initval(init_simtime_ym_str)

print(f"Initial u_data_values: {u_data_values}, ym_data_values: {ym_data_values}")
print(f"Max time: {concore.maxtime}")

while concore2.simtime < concore.maxtime:
while concore.simtime < concore.maxtime:
received_u_data = concore.read(PORT_NAME_F2_OUT, "u_signal", init_simtime_u_str)

if not (isinstance(received_u_data, list) and len(received_u_data) > 0):
Expand All @@ -50,17 +46,17 @@
if 'U2' in concore.oport:
concore.write(concore.oport['U2'], "u", u_data_values)

old_concore2_simtime = concore2.simtime
while concore2.unchanged() or concore2.simtime <= old_concore2_simtime:
old_concore_simtime = float(concore.simtime)
while concore.unchanged() or concore.simtime <= old_concore_simtime:
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential logic issue: This code pattern may create an infinite loop. The variable old_concore_simtime now references the same concore.simtime that is checked in the loop condition, whereas the original code tracked two separate simulation times.

Suggested change
while concore.unchanged() or concore.simtime <= old_concore_simtime:
while concore.unchanged() and concore.simtime <= old_concore_simtime:

Copilot uses AI. Check for mistakes.
# Assuming concore.iport['Y2'] is a file port (e.g., from pmpymax.py)
ym_data_values = concore2.read(concore.iport['Y2'], "ym", init_simtime_ym_str)
# time.sleep(concore2.delay) # Optional delay
ym_data_values = concore.read(concore.iport['Y2'], "ym", init_simtime_ym_str)
# time.sleep(concore.delay) # Optional delay

ym_full_to_send = [concore2.simtime] + ym_data_values
ym_full_to_send = [concore.simtime] + ym_data_values

concore.write(PORT_NAME_F2_OUT, "ym_signal", ym_full_to_send)

print(f"funbody u={u_data_values} ym={ym_data_values} time={concore2.simtime}")
print(f"funbody u={u_data_values} ym={ym_data_values} time={concore.simtime}")

print("funbody retry=" + str(concore.retrycount))

Expand Down
24 changes: 11 additions & 13 deletions 0mq/funbody_zmq.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# funbody2_zmq.py
import time
import concore
import concore2

print("funbody using ZMQ via concore")

Expand All @@ -15,21 +14,18 @@

# Standard concore initializations
concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u_str = "[0.0, 0.0, 0.0]"
init_simtime_ym_str = "[0.0, 0.0, 0.0]"

u_data_values = concore.initval(init_simtime_u_str)
ym_data_values = concore2.initval(init_simtime_ym_str)
ym_data_values = concore.initval(init_simtime_ym_str)

print(f"Initial u_data_values: {u_data_values}, ym_data_values: {ym_data_values}")
print(f"Max time: {concore.maxtime}")

while concore2.simtime < concore.maxtime:
while concore.simtime < concore.maxtime:
received_u_data = concore.read(PORT_NAME_F2_F1, "u_signal", init_simtime_u_str)

if not (isinstance(received_u_data, list) and len(received_u_data) > 0):
Expand All @@ -49,17 +45,19 @@
if 'U2' in concore.oport:
concore.write(concore.oport['U2'], "u", u_data_values)

old_concore2_simtime = concore2.simtime
while concore2.unchanged() or concore2.simtime <= old_concore2_simtime:
# Take a numeric snapshot of the current simulation time to avoid
# inadvertently sharing a reference with concore.simtime.
old_concore_simtime = float(concore.simtime)
while concore.unchanged() or concore.simtime <= old_concore_simtime:
# Assuming concore.iport['Y2'] is a file port (e.g., from pmpymax.py)
ym_data_values = concore2.read(concore.iport['Y2'], "ym", init_simtime_ym_str)
# time.sleep(concore2.delay) # Optional delay
ym_data_values = concore.read(concore.iport['Y2'], "ym", init_simtime_ym_str)
# time.sleep(concore.delay) # Optional delay

ym_full_to_send = [concore2.simtime] + ym_data_values
ym_full_to_send = [concore.simtime] + ym_data_values

concore.write(PORT_NAME_F2_F1, "ym_signal", ym_full_to_send)

print(f"funbody u={u_data_values} ym={ym_data_values} time={concore2.simtime}")
print(f"funbody u={u_data_values} ym={ym_data_values} time={concore.simtime}")

print("funbody retry=" + str(concore.retrycount))

Expand Down
22 changes: 9 additions & 13 deletions 0mq/funbody_zmq2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# funbody2_zmq.py
import time
import concore
import concore2

print("funbody using ZMQ via concore")

Expand All @@ -15,21 +14,18 @@

# Standard concore initializations
concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u_str = "[0.0, 0.0, 0.0]"
init_simtime_ym_str = "[0.0, 0.0, 0.0]"

u_data_values = concore.initval(init_simtime_u_str)
ym_data_values = concore2.initval(init_simtime_ym_str)
ym_data_values = concore.initval(init_simtime_ym_str)

print(f"Initial u_data_values: {u_data_values}, ym_data_values: {ym_data_values}")
print(f"Max time: {concore.maxtime}")

while concore2.simtime < concore.maxtime:
while concore.simtime < concore.maxtime:
received_u_data = concore.read(PORT_NAME_F2_OUT, "u_signal", init_simtime_u_str)

if not (isinstance(received_u_data, list) and len(received_u_data) > 0):
Expand All @@ -49,17 +45,17 @@
if 'U2' in concore.oport:
concore.write(concore.oport['U2'], "u", u_data_values)

old_concore2_simtime = concore2.simtime
while concore2.unchanged() or concore2.simtime <= old_concore2_simtime:
old_concore_simtime = float(concore.simtime)
while concore.unchanged() or concore.simtime <= old_concore_simtime:
# Assuming concore.iport['Y2'] is a file port (e.g., from pmpymax.py)
ym_data_values = concore2.read(concore.iport['Y2'], "ym", init_simtime_ym_str)
# time.sleep(concore2.delay) # Optional delay
ym_data_values = concore.read(concore.iport['Y2'], "ym", init_simtime_ym_str)
# time.sleep(concore.delay) # Optional delay

ym_full_to_send = [concore2.simtime] + ym_data_values
ym_full_to_send = [concore.simtime] + ym_data_values

concore.write(PORT_NAME_F2_OUT, "ym_signal", ym_full_to_send)

print(f"funbody u={u_data_values} ym={ym_data_values} time={concore2.simtime}")
print(f"funbody u={u_data_values} ym={ym_data_values} time={concore.simtime}")

print("funbody retry=" + str(concore.retrycount))

Expand Down
22 changes: 9 additions & 13 deletions 0mq/funcall.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
import concore
import concore2
from osparc_control import PairedTransmitter
print("funcall 0mq")

concore.delay = 0.07
concore2.delay = 0.07
concore2.inpath = concore.inpath
concore2.outpath = concore.outpath
concore2.simtime = 0
concore.simtime = 0
concore.default_maxtime(100)
init_simtime_u = "[0.0, 0.0, 0.0]"
init_simtime_ym = "[0.0, 0.0, 0.0]"

u = concore.initval(init_simtime_u)
ym = concore2.initval(init_simtime_ym)
ym = concore.initval(init_simtime_ym)
paired_transmitter = PairedTransmitter(
remote_host="localhost", exposed_commands=[],
remote_port=2345, listen_port=2346,)
paired_transmitter.start_background_sync()
try:
while(concore2.simtime<concore.maxtime):
while(concore.simtime<concore.maxtime):
while concore.unchanged():
u = concore.read(concore.iport['U'],"u",init_simtime_u)
print(u)
#concore.write(concore.oport['U1'],"u",u)
#old2 = concore2.simtime
#while concore2.unchanged() or concore2.simtime <= old2:
# ym = concore2.read(concore.iport['Y1'],"ym",init_simtime_ym)
#old2 = concore.simtime
#while concore.unchanged() or concore.simtime <= old2:
# ym = concore.read(concore.iport['Y1'],"ym",init_simtime_ym)
ym = paired_transmitter.request_with_immediate_reply(
"fun", timeout=10.0, params={"u": [concore.simtime]+u})
concore2.simtime = ym[0]
concore.simtime = ym[0]
ym = ym[1:]
#print(ym)
concore2.write(concore.oport['Y'],"ym",ym)
print("funcall 0mq u="+str(u)+" ym="+str(ym)+" time="+str(concore2.simtime))
concore.write(concore.oport['Y'],"ym",ym)
print("funcall 0mq u="+str(u)+" ym="+str(ym)+" time="+str(concore.simtime))
finally:
paired_transmitter.stop_background_sync()
print("retry="+str(concore.retrycount))
Loading