Online Model Translation from HBjson to Openstudio

Hi,

I was trying to find out the way to generate and run an OpenStuido model online, so that I don’t have to open the openstudio application locally every time.

I noticed there seems a function to translate hbjson input file into an os model (as below)


And I looked through the Github repos (under “pollination-dsl” and “honeybee-energy”) but I was not able to locate the code that does the translation work.

Currently I’m using C# (in Visual Studio) to read data from pre-defined object (similar to hb-object) and create openstudio components (e.g. surfaces, schedules, HVAC cmoponents, etc,.) and create an openstudio model on local drive.

If anyone can provide some clues or examples about how to create an os model online (either through C# or python), that would be really helpful and much appreciated. Could be command or something else.

Thanks.

Hi @kunyuluo, Welcome to the forum! :wave:

I’m a bit confused here. Do you have an OSM file? Or do you create an HBJSON file and are looking for a translator to OSM?

In either case, you can use the custom-energy-simulation recipe to run the energy simulation using an HBJSON file or an OSM or an IDF file.

Hi @mostapha

Thanks for the info.

I have an HBJSON file and I understand that the recipe I should use is what you point out above.

What I would like to know is: how to translate a hjson file into an openstudio model and run it ONLINE.

I looked into the Github repos. Under “honeybee-energy/pollination/Honeybee-energy/simulate.py” it looks like these two functions might be relevant to the model translation and generation.

image
image

If you could provides more details on this that would be really helpful and appreciated.

That’s exactly what the recipe does. It uses the function that you shared above as part of the process.

You have two options for running the model on Pollination. You can either use the UI or use the API to submit your simulations.

In either case, the process is similar:

  1. Create a project
  2. Add the custom-energy-simulation recipe to the project
  3. Create a new study
  4. Submit the study to Pollination

Here is a recording that shows the process:

You can see the command that is used to translate the model and run the simulation.

Here is a sample code that shows how to use the API to submit them:

Thanks for the sample! That’s very enlightening.

Apart from that, I would like to see the code that realizes the model translation and simulation. I’m thinking there should be a python file, and I should be able to see command like “import openstudio” or something at the begining.

Currently I can only find this wrapped-up function that tells me “simulate a model in EP+” and shows a few input arguments, but I don’t find the code that actually build an osm or idf model.

image

Could you point me to the python files for those parts?

Thanks!

This is helpful. See here. The translation code is written in ruby.

This is the measure that is called from the Python side for translating the model into OSM. The best place to see the process is the mode_to_osm function that is called from the command line.

Awesome! That’s really helpful.

It looks like the opentuido model is simulated by calling the CLI, which can run silently behind the scene.
like this:

image

I was trying to run an osm file in CLI through subprocess, but something seems to be wrong:

image

Do you have any sample code of running an os model through CLI? Thanks!

Hey Chris! You can help with this much faster than I could. Thank you.

Hey @kunyuluo ,

If you want to know about OpenStudio CLI, you’re kinda leaving the Pollination/Ladybug Tools side of things and you’re entering the realm of the simulation engines. Instead of looking at the Pollination/Ladybug Tools documentation, you should probably be looking through the OpenStudio documentation like the docs here on the OpenStudio CLI:

https://nrel.github.io/OpenStudio-user-documentation/reference/command_line_interface/

Those will show you how you can format inputs for the OpenStudio CLI, which does not take an OSM as input and instead needs a special type of JSON called an OpenStudio Workflow (OSW).

Also, if you have questions about the OpenStudio CLI, you should ask them on the UnmetHours forum where the OpenStudio developers answer questions:

Thanks! I’ll look into that.

Btw, should I use Ruby to create an OSW or python is also okay for that?

OSW is a JSON file. It doesn’t matter what programming language do you use to create the file as long as it’s a valid JSON file.

1 Like

I see. I’ve figured out the CLI staff. Thank you for the instructions.

Another question: where do you store all the output files generated from a simulation? I noticed there seems an specific folder for these, which is created by another class. Is that an online location or somewhere on the local drive?

image

If you run the command locally, then this is a local path. If you run it on the cloud then it will be on the cloud or as you call it an online location.

1 Like

Hey @kunyuluo,
Long time no talk:> are you trying to integrate the Pollination with your platform?

Yeah it’s been a long time :smiley:

No. I’m just trying to create a workflow using openstudio-sdk to automate the energy modeling process without having to use the OpenStudioApp locally.