modelon-community / PyFMI

PyFMI is a package for loading and interacting with Functional Mock-Up Units (FMUs) both for Model Exchange and Co-Simulation, which are compiled dynamic models compliant with the Functional Mock-Up Interface (FMI)
http://jmodelica.org/pyfmi
GNU Lesser General Public License v3.0
165 stars 38 forks source link

log position #266

Closed YanceyYq closed 1 month ago

YanceyYq commented 2 months ago

script:

model_sub1 = FMUModelCS2(fmu_path1, log_level=7)
model_sub2 = FMUModelCS2(fmu_path2, log_level=7)
models = [model_sub1, model_sub2]
connections = [(model_sub1, out_par, model_sub2, in_par)]
master = Master(models, connections)
opts = master.simulate_options()
opts["step_size"] = 1.0
opts["logging"] = True
res = master.simulate(options=opts, final_time=total_duration)

error:

 res = master.simulate(options=opts, final_time=total_duration)
Elapsed initialization time: 2.6243388 seconds.
Traceback (most recent call last):
  File "F:\LHFZ\work\Qtfiles\Testtestcon.py", line 30, in <module>
    res = master.simulate(options=opts, final_time=total_duration)
  File "src\\pyfmi\\master.pyx", line 1511, in pyfmi.master.Master.simulate
  File "src\\pyfmi\\master.pyx", line 1311, in pyfmi.master.Master.jacobi_algorithm
  File "src\\pyfmi\\master.pyx", line 55, in pyfmi.master.perform_do_step
  File "src\\pyfmi\\master.pyx", line 72, in pyfmi.master.perform_do_step_serial
pyfmi.fmi.FMUException: The step failed for model SimpleController at time 0.000000. See the log for more information. Return flag 2.

I didn't find the location of the log that records detailed information. Where is its location usually?

PeterMeisrimelModelon commented 1 month ago

FMUModelCS2 has the optional argument log_file_name (default = ""; current location; where your Python script is located) that you can use to specify name and location of the .txt log.

/Peter

YanceyYq commented 1 month ago

Thank you for your help.