Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
2

Translation issues

asked 2023-10-19 14:03:24 -0600

clima337's avatar

updated 2023-10-20 07:28:52 -0600

My goal is to load .osm files and run energy plus simulations, all using the Python bindings. I've found it quite hard due to the lack of Python documentation, the divergence from typical python open source standards etc, but I think there's good potential here. I was able to locally install the openstudio and pyenergyplus packages for Mac Arm64. As far as I can see, the only way to run an energyplus simulation is to use a .idf file - if there's another way with a Workspace object or something, please let me know.

While trying to translate an object from openstudio to energyplus, I am running into issues. `

p1 = 'models_nrel/bldg0000007-up18.osm'
p2 = 'models_eplus/bldg0000007-up18.idf'
building = os.model.Model.load(p1).get()
v = translator.translateModel(os.osversion.VersionTranslator().loadModel(os.path(p1)).get())

` This gives an error like:

[utilities.idf.WorkspaceObject] <0> Object of type 'Schedule:Constant' and named 'Always On Continuous', points to an object named Fractional 1 from field 1, but that object cannot be located.

This doesn't break the script though. A file is created at path p2, so I tried api.runtime.run_energyplus(state, [ '-w', weather, '-d', 'out', p2, ] ) Then I run into a breaking error:

**FATAL:Errors occurred on processing input file. Preceding condition(s) cause termination.

I tried to look through the building schedules like this: `

schedules = building.getSchedules()
[(i, s.name().get()) for i, s in enumerate(schedules)]

`

Doing this, I don't even see a schedule with the name "Always On Continuous". I have no idea how to fix this in order to run the simulation, or even if the schedule issue is the reason the energy plus run fails. Any help would be greatly appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2023-10-20 08:03:15 -0600

This is indeed how you load and translate a model. Here's the proper code with all necessary imports for clarity.

import openstudio

# Load an existing model
vt = osversion.VersionTranslator()
m_ = vt.loadModel("mymodel.osm")
assert m_.is_initialized, "Not a valid model"
m = m_.get()

# Translate it to IDF
ft = openstudio.energyplus.ForwardTranslator()
workspace = ft.translateModel(m)
workspace.save("mymodel.idf")

I also have a repo with a demo: https://github.com/jmarrec/OpenStudio...

Anyways, regarding your issue:

This can be disregarded

[utilities.idf.WorkspaceObject] <0> Object of type 'Schedule:Constant' and named 'Always On Continuous', points to an object named Fractional 1 from field 1, but that object cannot be located.

This is energyplus telling you there's a problem with your IDF.

**FATAL:Errors occurred on processing input file. Preceding condition(s) cause termination.

Open eplusout.err and see what the issue actually is.

edit flag offensive delete link more

Comments

Thanks this is helpful. When I run my simulation code, an eplusout.err file isn't created - no output files are. Separately I can open the osm file in openstudio, run simulate, and it does successfully run an energy model. The eplusout.err file created with this simulation does not have any real errors, just a ton of warnings. I'm going to try to simulate using a different version of openstudio and pyenergyplus.

clima337's avatar clima337  ( 2023-10-20 15:36:15 -0600 )edit
0

answered 2023-10-20 19:11:29 -0600

clima337's avatar

I think I've solved most of this. I was using energyplus 23.2, and the compatibility matrix at https://github.com/NREL/OpenStudio/wi... shows that openstudio v.3.6.1 is only compatible with 23.1. Downgrading to 23.1 has allowed me to run simulations.

edit flag offensive delete link more

Comments

@clima337 how did you "downgrade" from v23.2 to v23.1? Downgrading IDFs must be a manual process that carefully considers changes between each version's IDD files. See more in a similar post here.

Aaron Boranian's avatar Aaron Boranian  ( 2023-10-21 20:44:05 -0600 )edit

All I did was download Energyplus 23.1 and locally import that instead of 23.2.

sys.path.append('/Applications/EnergyPlus-23-1-0/')
from pyenergyplus.api import EnergyPlusAP

The idf file was being created by code like the way Julien described above. Pyenergyplus couldn't properly open them when i was using 23.2 but they could when it was 23.1.

clima337's avatar clima337  ( 2023-10-23 16:26:13 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2023-10-19 14:01:55 -0600

Seen: 123 times

Last updated: Oct 20 '23