我做了世界上最简单的 simulink 模型,它将两个常数相加并将结果发送到输出端口。我将它导出到 fmu 模型并尝试在 pyfmi 中运行它。
我收到 FMUException 错误:模拟失败。有关更多信息,请参阅日志。返回标志 3
日志显示 ['FMIL: module = FMILIB, log level = 5: Allocating FMIL context', 'FMIL: module = FMILIB, log level = 5: Parsing model description XML', 'FMIL: module = FMI2XML, log level = 5 : 解析 XML 元素 fmiModelDescription', 'FMIL: module = FMI2XML, log level = 5: Parsing XML element CoSimulation', 'FMIL: module = FMI2XML, log level = 5: Parsing XML element VendorAnnotations', 'FMIL: module = FMI2XML, log level = 5: Parsing XML element ModelVariables', 'FMIL: module = FMI2XML, log level = 4: [Line:31] Detected during parsing:', 'FMIL: module = FMI2XML, log level = 2: start attribute is required对于这种因果关系、可变性和初始组合','FMIL:模块 = FMI2XML,日志级别 = 5:建筑别名索引','FMIL:模块 = FMI2XML,日志级别 = 5:解析 XML 元素 ModelStructure', 'FMIL: module = FMI2XML, log level = 5: Parsing XML element Outputs', 'FMIL: module = FMI2XML, log level = 5: Parsing XML element InitialUnknowns', 'FMIL: module = FMILIB, log level = 5: 解析成功完成', "FMIL: module = FMILIB, log level = 4: Loading 'linux64' binary with 'default' platform types", 'FMIL: module = FMICAPI, log level = 5: Loaded FMU binary from /tmp/bruce/JModelica.org/jm_tmp9uvk5t3l/binaries/linux64/simple_sum2const.so', 'FMIL: module = FMICAPI, log level = 5: Loading functions for the co-simulation interface', 'FMIL: module = FMILIB, log level = 5: 成功加载所有接口函数', 'FMIL: module = FMI2XML, log level = 3: fmi2_xml_get_default_experiment_tolerance:返回默认值,因为在 modelDescription 中未定义任何属性', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2SetupExperiment', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2EnterInitializationMode', 'FMIL: module = FMICAPI, 日志级别 = 5: 调用 fmi2ExitInitializationMode', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:0, value:5.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:1, value:0.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] CommunicationStepSize=0.02, LocalSolverStepSize= 0.2', 'FMIL: module = Model, log level = 2: [error][FMU status:Error] Stepsize 必须是非负数并且可以被 0.2 整除', 'FMIL: module = Model, log level = 4: [info ][FMU状态:OK] CommunicationStepSize=1, LocalSolverStepSize=0.2', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] Local Solver will do 5 step from t = 0.', 'FMIL: module = FMI2XML,日志级别 = 3:fmi2_xml_get_default_experiment_tolerance:返回默认值,因为没有在 modelDescription 中定义属性','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2SetupExperiment','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2EnterInitializationMode', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2ExitInitializationMode', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:0, value:5.000000' , 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:1, value:0.000000', 'FMIL: module = Model, log level = 4: [info][FMU status :OK] CommunicationStepSize=0.02, LocalSolverStepSize=0.2', 'FMIL: module = Model, log level = 2: [error][FMU status:Error] Stepsize 必须是非负数且可被 0.2 整除', 'FMIL: module = FMICAPI , 日志级别 = 5: 调用 fmi2SetupExperiment', 'FMIL: 模块 = FMI2XML, 日志级别 = 3: fmi2_xml_get_default_experiment_tolerance: 返回默认值,因为模型描述中没有定义属性', 'FMIL: 模块 = FMICAPI, 日志级别 = 5: 调用fmi2SetupExperiment', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2EnterInitializationMode', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2ExitInitializationMode', 'FMIL: module = Model, log level = 4: [info] [FMU status:OK] getReal vr:0, value:5.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:1,value:0.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] CommunicationStepSize=0.02, LocalSolverStepSize=0.2', 'FMIL: module = Model, log level = 2: [error] [FMU 状态:错误] 步长必须为非负且可被 0.2 整除','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2EnterInitializationMode','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2ExitInitializationMode', 'FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2EnterInitializationMode','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2ExitInitializationMode','FMIL:模块 = FMI2XML,日志级别 = 3:fmi2_xml_get_default_experiment_tolerance:返回默认值,因为没有在 modelDescription 中定义属性','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2SetupExperiment','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2EnterInitializationMode','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2ExitInitializationMode','FMIL:模块 = 模型,日志级别 = 4:[信息][FMU 状态:OK] getReal vr:0, value:5.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:1, value:0.000000', 'FMIL: module = Model , 日志级别 = 4: [info][FMU status:OK] CommunicationStepSize=0.02, LocalSolverStepSize=0.2', 'FMIL: module = Model, log level = 2: [error][FMU status:Error] Stepsize 必须是非负数且可被 0.2 整除','FMIL:模块 = FMI2XML,日志级别 = 3:fmi2_xml_get_default_experiment_tolerance:返回默认值,因为模型描述中没有定义属性','FMIL:模块 = FMICAPI,日志级别 = 5:调用 fmi2SetupExperiment', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2EnterInitializationMode', 'FMIL: module = FMICAPI, log level = 5: Calling fmi2ExitInitializationMode', 'FMIL: module = Model, log level = 4: [info ][FMU status:OK] getReal vr:0, value:5.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] getReal vr:1, value:0.000000', 'FMIL :模块 = 模型,日志级别 = 4:[信息][FMU 状态:OK] CommunicationStepSize=0.004,LocalSolverStepSize=0.2','FMIL:模块 = 模型,日志级别 = 2:[错误][FMU 状态:错误]步长必须是非负数且可被 0.2' 整除]日志级别 = 4:[信息][FMU 状态:OK] getReal vr:0,值:5.000000','FMIL:模块 = 型号,日志级别 = 4:[信息][FMU 状态:OK] getReal vr:1, value:0.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] CommunicationStepSize=0.004, LocalSolverStepSize=0.2', 'FMIL: module = Model, log level = 2: [error] [FMU status:Error] Stepsize 必须是非负数且可被 0.2' 整除]日志级别 = 4:[信息][FMU 状态:OK] getReal vr:0,值:5.000000','FMIL:模块 = 型号,日志级别 = 4:[信息][FMU 状态:OK] getReal vr:1, value:0.000000', 'FMIL: module = Model, log level = 4: [info][FMU status:OK] CommunicationStepSize=0.004, LocalSolverStepSize=0.2', 'FMIL: module = Model, log level = 2: [error] [FMU status:Error] Stepsize 必须是非负数且可被 0.2' 整除]
我找不到有关如何设置步长或应该是什么的任何信息。我试过 model.do_step(0, 1.0) model.initialize(0, 0.1, True)
model.simulate_options() 显示 {'ncp': 500, 'initialize': True, 'stop_time_defined': False, 'write_scaled_result': False, 'result_file_name': '', 'result_handling': 'binary', 'result_handler':无,'result_store_variable_description':真,'return_result':真,'time_limit':无,'过滤器':无,'silent_mode':假}
我怎样才能让这个简单的演示工作?