openergy / opyplus

A package to work with EnergyPlus in python
Mozilla Public License 2.0
38 stars 13 forks source link

Field length limit #67

Closed ThibaultMarzullo closed 1 year ago

ThibaultMarzullo commented 1 year ago

Hello, I am using opyplus in a workflow that uses IDFs generated automatically using OpenStudio. Until now, I have been using opyplus with "human-made" IDFs and it always parsed just fine. Trouble started when I included OpenStudio in the workflow, because some fields are too long for opyplus. I could force a limit on name lengths, but this will break the rest of my workflow.

Describe the bug When loading an IDF using op.Epm().load(), if field names are longer than 100 characters the program crashes. Fields can be >100 characters long when names are automatically generated, such as when using an OpenStudio Measure.

To Reproduce Steps to reproduce the behavior:

  1. Modify an IDF to have a field that is longer than 100 characters or
  2. Generate an IDF using an OpenStudio Measure such as "create DOE prototype building" and a "primary school" type of building (EMS programs and some component names get very long in that model)
  3. Load the IDF using op.Epm().load()

Expected behavior The IDF loads correctly.

Screenshots image

Misc

I tried raising this limit to >100, but the program crashes elsewhere because of an out of bounds index error. The screenshot shows what happens when the program is run in a Docker container based on Ubuntu 18.04, but the same result happens on a local install.

Thank you

thomascerbelaud commented 1 year ago

Hi @ThibaultMarzullo, Thanks for reporting this! It is true that opyplus defaults to checking field length when loading an EPM using op.Epm.load. However you could use the optional keyword argument check_length to prevent raising the error about field length:

epm = op.Epm.load(epm_path, check_length=False)

I think this should solve your problem. About the other error when you bring the limit above 100, I am not sure this is an opyplus issue. Maybe try this fix and see if the error still shows?

ThibaultMarzullo commented 1 year ago

Hi @thomascerbelaud , Thank you for your quick reply! Strangely enough, I have already tried the check_length option on both the initialization of the Epm class and also the Epm.load function and it did not work. I have been going back and forth with this for about two weeks with no success. However, following your advice I tried that again and it worked. Sorry for opening an issue for something that turned out to be trivial! I just had an error about a missing IDD for EP v22.2.0, so I manually added the IDD in the opyplus/idd/resources folder and now all works well. Thank you!

thomascerbelaud commented 1 year ago

No problem! About the IDD issue, I think it was fixed in #65 so a new version should come up soon that supports EnergyPlus v22.2.0 ;)