Internal gains missing from IDF

Hi everyone

I’m having some issues figuring out why some gains aren’t being translated from my honeybee model to an IDF.

Below are two simple HBJSONs, one of which seems to pull everything across (Office), but the other (Exhibition) doesn’t include Lighting, Electric Equipment and People in the resulting OSM and IDF files … but I can’t determine why.

Both have valid programs and don’t show any errors in the translation logs. I’ve also included a rough script I’ve been using to test a few different files.

Does anyone have any idea why this might be happening?

Exhibition.hbjson (489.3 KB)
Office.hbjson (394.7 KB)

from pathlib import Path
from honeybee.model import Model
from honeybee_energy.run import run_osw, to_openstudio_osw

test_dir = Path(r"C:\test")  # contains two files, Exhibition.hbjson and Office.hbjson

for hbjson in test_dir.glob("*.hbjson"):
    # prep the working directory
    wd = (test_dir / hbjson.stem)
    wd.mkdir(parents=True, exist_ok=True)

    # show the gains
    prog = Model.from_hbjson(hbjson_file=hbjson).properties.energy.program_types[0]
    print(prog.lighting)
    print(prog.people)
    
    # write the stuff
    osw = to_openstudio_osw(
        osw_directory=wd.as_posix(),
        model_path=hbjson.as_posix()
    )
    osm, idf = run_osw(osw, silent=False)

    # find the gains ... if they exist!
    with open(idf, "r") as fp:
        idf_str = fp.readlines()
        for n, i in enumerate(idf_str):
            if i.startswith("Lights,"):
                print("".join(idf_str[n:n+13]))
            if i.startswith("People,"):
                print("".join(idf_str[n:n+11]))
    print()

I think I’ve solved my problem, though not in the way I expected.

The Exhibition.hbjson was created using a ProgramType built up entirely by me using a custom mix of predefined Honeybee programs, and then using ProgramType.average to create the resultant program to assign.

Office.hbjson used the predefined ProgramType returned by program_type_by_identifier("MediumOffice").

I found that if I used a predefined program (from program_type_by_identifier) as a very small proportion of my custom building mix (~0.0001) then the IDF was generated with all the required gains pulled through.

It’s probably me missing something important within the assigned ProgramType that’s built into the predefined ones, but just wanted to post my solution here in case someone else encounters the same problem.