1

I am trying to simulate my FMU created from TRNSYS using pyFMI. When I try to simulate it, it prompts the following message:

"forrtl severe(193):Run-time Check Failure. The variable \'TRNSYSFUNCTIONS_mp_GETOUTPUT VALUE$GETOUTPUT VALUE\' is being used without being initiated"

My code looks like this:

    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

Can anybody predict the reason for an error. It seems like there is an initialization error.

Nauman
  • 11
  • 2
  • 1
    The location it is giving you is in the Fortran code. – Vladimir F Героям слава Mar 19 '17 at 17:54
  • 1
    The message comes from the option to do run-time detection of uninitialized variables. I think in this case that you have a function called GETOUTPUT_VALUE (which you don't show) where the function return value is referenced before it is defined. I'm also wondering exactly what the code is that you have posted, as the "from...import" lines aren't Fortran. You need to look at the actual Fortran code - the error message is accompanied by a traceback that should give you the exact source and line of the uninitialized reference. – Steve Lionel Mar 19 '17 at 21:19
  • Hi @Steve Lionel The code is written in python and pyfmi module is being used for simulating trnsys fmu. Simulating TRNSYS FMU uses C and fortran compilers. There doesn't seem to be a problem with compilers as this code works on another FMU. In the above code, there can be a problem with using the following get command which gets the output values of FMU LR.append(float(trnsys.get('DG_BU_Shading'))) – Nauman Mar 20 '17 at 08:50
  • 1
    It is not a problem with compilers, it is a **Run-time Check Failure**. And it happens inside the Fortran code. In module `TRNSYSFUNCTIONS` in function `GETOUTPUT VALUE`. It might be cause by the way you are calling it but it is in the Fortran code. I am not sure if TRNSYS is commercial or the source code is available. If it is commercial, contact the technical support of TRNSYS. – Vladimir F Героям слава Mar 20 '17 at 10:11
  • Thank you for your suggestions. The problem was with the creation of FMU. It works fine now# – Nauman Mar 20 '17 at 16:36

0 Answers0