@@ -125,13 +125,15 @@ def safe_literal_eval(filename, defaultValue):
125125inpath = "./in" #must be rel path for local
126126outpath = "./out"
127127simtime = 0
128+ concore_params_file = os .path .join (inpath , "1" , "concore.params" )
129+ concore_maxtime_file = os .path .join (inpath , "1" , "concore.maxtime" )
128130
129131#9/21/22
130132# ===================================================================
131133# Parameter Parsing
132134# ===================================================================
133135try :
134- sparams_path = os . path . join ( inpath + "1" , "concore.params" )
136+ sparams_path = concore_params_file
135137 if os .path .exists (sparams_path ):
136138 with open (sparams_path , "r" ) as f :
137139 sparams = f .read ()
@@ -171,8 +173,7 @@ def tryparam(n, i):
171173def default_maxtime (default ):
172174 """Read maximum simulation time from file or use default."""
173175 global maxtime
174- maxtime_path = os .path .join (inpath + "1" , "concore.maxtime" )
175- maxtime = safe_literal_eval (maxtime_path , default )
176+ maxtime = safe_literal_eval (concore_maxtime_file , default )
176177
177178default_maxtime (100 )
178179
@@ -220,7 +221,7 @@ def read(port_identifier, name, initstr_val):
220221 return default_return_val
221222
222223 time .sleep (delay )
223- file_path = os .path .join (inpath + str (file_port_num ), name )
224+ file_path = os .path .join (inpath , str (file_port_num ), name )
224225 ins = ""
225226
226227 try :
@@ -283,14 +284,12 @@ def write(port_identifier, name, val, delta=0):
283284 print (f"ZMQ write error on port { port_identifier } (name: { name } ): { e } " )
284285 except Exception as e :
285286 print (f"Unexpected error during ZMQ write on port { port_identifier } (name: { name } ): { e } " )
287+ return
286288
287289 # Case 2: File-based port
288290 try :
289- if isinstance (port_identifier , str ) and port_identifier in zmq_ports :
290- file_path = os .path .join ("../" + port_identifier , name )
291- else :
292- file_port_num = int (port_identifier )
293- file_path = os .path .join (outpath + str (file_port_num ), name )
291+ file_port_num = int (port_identifier )
292+ file_path = os .path .join (outpath , str (file_port_num ), name )
294293 except ValueError :
295294 print (f"Error: Invalid port identifier '{ port_identifier } ' for file operation. Must be integer or ZMQ name." )
296295 return
0 commit comments