Open YanceyYq opened 1 month ago
Hi YanceyYq,
this is not about PyFMI, this is a general feature/limitation of Co-simulation. If you haven't yet, I recommend to read https://fmi-standard.org/docs/3.0/#fmi-for-co-simulation (even though this is FMI3, the concepts are the same; or read the corresponding FMI2 parts). If you want a more direct coupling and your models allow it, you might want to consider using ME FMUs instead.
/Peter
Thank you for your response
environment ubuntu22.04 python=3.9.19 pyfmi=2.13.0 CoSimulation model fmiVersion=2 issue
model_sub1 = FMUModelCS2("./Sin.fmu") model_sub2 = FMUModelCS2("./Sin2.fmu")
models = [model_sub1, model_sub2]
connections = [(model_sub1, "o1", model_sub2, "int_in")]
master = Master(models, connections)
opts = master.simulate_options()
opts["step_size"] = 1.0 total_duration = 5.0 # 5秒
res = master.simulate(options=opts, final_time=total_duration)
y1_values = res[0]['o1'] y3_values = res[1]['int_out'] y2_values = res[1]['int_in'] times = res[0]['time']
In the above implementation, the extracted results y1-values are consistent with y2-values, but y3-values will be delayed by 1 second compared to y1-values. Is this the mechanism of pyfmi?