1

我正在尝试使用 pyFMI 模拟从 TRNSYS 创建的 FMU。当我尝试模拟它时,它会提示以下消息:

“forrtl 严重(193):运行时检查失败。变量 \'TRNSYSFUNCTIONS_mp_GETOUTPUT VALUE$GETOUTPUT VALUE\' 正在使用而未启动”

我的代码如下所示:

    from pyfmi import load_fmu
    import os
    from collections import defaultdict
    import time

    model = 'ZUB_FMU2.fmu'
    model_dir ='C:\\Trnsys17\MyProjects\\TEST_ZUB_13_FMU_check'
    trnsys = load_fmu(fmu=model, path=model_dir)
    os.chdir(model_dir)
    import numpy as np
    t_start = 3624*3600
    t_end = 6552*3600
    h_step = 1*3600
    t_array = np.arange(t_start, t_end, h_step)
    cool = 26
    heat = 19
    tim = 0
    LR = []
    # Initialize FMU
    start_time = time.time()
    trnsys.initialize(t_start, t_end)
    while tim <= len(t_array)-1:
          try:
              trnsys.set('setCool', cool)
              trnsys.set('setHeat', heat)
              res = trnsys.do_step(current_t= t_array[tim],step_size=h_step, new_step=True)
              if res != 0:
              print "Failed to do step", t_array[tim]
              LR.append(float(trnsys.get('DG_BU_Shading')))
              tim += 1
          except ValueError:
              raw_input("Error...")
    print "Time for simulating an FMU is:"
    del trnsys
    print 'LR is given as: ', LR

任何人都可以预测错误的原因。好像有初始化错误。

4

0 回答 0