Create a Modelica district network from URBANopt simulation created with Dragonfly

Hi All,
I’m trying to create heat networks with the URBANopt District Energy System workflow. I’ve performed the URBANopt simulation using Dragonfly, but although the weather file is included when launching the simulation, the “weather” folder does not appear in the project folder, and the climate file is not included in the geojson file. When I try to create the Modelica model using “uo_des build-sys-param”, I get the following error: KeyError: ‘weather_filename’. I’ve tried creating the “weather” folder in the project and including “weather_filename”: “ESP_Gerona.081840_SWEC.epw” in the geojson, but I get the following error: Exception: Returned non 200 status code trying to download weather file: 403. It seems that the .epw file is not being detected, and it’s trying to download it from the internet but failing.
How can I include the weather file when creating the geojson from DragonFly? Or if someone knows how to solve the problem directly from the console. Regards.

Hello @chris , now with the new update, the new components of DES can be correctly implemented in Modelica, or what is specifically calculated by applying the new components to the UrbanOpt simulation?

Hey @Batiste ,

Sorry for the late response. I know that the URBANopt docs describe the DES workflow but it really is not available at the moment since it has been undergoing several major refactors over the last 2 years. And, while I know that the error message makes it seem like the only issue is a weather file specification, trust me that you’re not going to be able to simulate it now no matter how hard you try.

Nate at NREL just told me yesterday that they finally updated their DES workflows with a new Docker image that is capable of simulating DES systems with OpenModelica. So, as long as you’re trying to run your simulation on your own machine (and not for a company that might have to pay for Docker Desktop), you should be able to finally simulate DES systems from Dragonfly around the next stable LBT plugin release (probably in September).

Hello @chris ,

I understand that the new Modelica Buildings Library 10.0 update is related to the capabilities of URBANopt to run 5th generation DES. I understand that it is not yet available in either URBANopt or Dragonfly since it was released yesterday.
Very eager to try it.

Hi @Batiste ,

Yea, I noticed that release yesterday as well, though I didn’t know it was related to 5th Generation DES. I’m hoping to get to the point next week where I have a component that will at least write out the Modelica files for 4th and 5th generation systems, though I’m waiting on a few bug fixes to be merged in some URBANopt packages like this one. But we’re hopefully pretty close.

Just so I know when to reach out to you about testing, do you perchance have a Dymola license such that you’d be able to work with the DES Modelica files directly? Or would you need the whole end-to-end workflow with the OpenModelica docker image to be working in order to make use of a Modelica 5th generation DES?

I ask because NREL has told me that they have gotten things working with OpenModelica and they released a docker image with it a couple of months ago but I sense that there may be a few more bugs to fix there such that we’ll have the capability to just write the Modelica files in place before we have the whole simulation working end-to-end.

1 Like

Wow, it would be incredible to see those models in Modelica in the coming weeks.

Yes, one of the parts of the update is related to new objects for 5G networks, including some examples.

In my case, I don’t have a Dymola license, unfortunately. The last time I tried was in June with some examples they had for geojson to Modelica, and it was possible to create the project in OpenModelica, but it didn’t make any sense; everything was incorrect and impossible to run the simulation. I also don’t have much experience using Docker and OpenModelica, but I believe at that time it wasn’t functional.

I Will try this docker image. I also don’t have much experience using Docker and OpenModelica, but I believe at that time it wasn’t functional.

Hi @Batiste ,

I’m showing my naiveté here but I actually did not realize that OpenModelica had a graphical UI. Does this mean, if you had a set of Modelica files that’s compatible with OpenModelica, you would have what you need to run the model and build the FMU?

If so, I will let you know as soon as I have a set of components that are capable of writing out the Modelica files. Right now, I have something that correctly writes the Modelica files for 4th generation systems but it’s going to take some time to get the 5G network working.

I should also clarify, is the type of 5G network you are trying to simulate one that makes use of a ground heat exchanger? These types of GHE systems are what I am currently working on.

Hi @chris,

I understand that if the ‘DF Run URBANpot’ can create the .mo file with all the folders, etc. It will be capable to open it in OM and run it. But the thing is: Will The lastest URBANOPT version integrate the necessary uploads ( Modelica Buildings Library 10.0) to be able to correctly create the Open Modelica files correctly?

The Docker stuff I understand that was a UO-CLI solution to run the simulation directly from de comsol they have to use the Docket image

I can try ,if it is possible, with the 4th generation system if it works with Open Modelica. I think that for implementing the GHE system and the DES components in Grasshopper is what right now i have no idea how to configure it. Would it be necesary to create the network geoemtry and in which way?

Yes, it use a ground heat exchanger and network pipes without insulation.

I have a question regarding the GHE component. How do you determine whether it’s a 4th or 5th generation network? In other words, how do you specify whether the thermal connectors are insulated or not, their thermal properties, and what type of heat pump is used (in 5G, it would be in each building, and in 4th generation, it’s centralized)? Also, my understanding of 4th and 5th generation might be different.

I assume that if you want to simulate a different network technology like 3rd generation or lower, or a network with air-source heat pumps, for example, it wouldn’t be possible, am I correct?

Hi @chris, I have tested and I understand that the second one is the one you mentioned that still doesn’t work. I managed to launch the FMU, but I had to create both the system_params.json and the Modelica folder from the URBANopt CLI. However, I encountered an error when running uo_des run-model (I believe it’s now a problem with the Docker image or with GTM or MBL).

With the system_params.json that is created with Run_URBANopt, I encountered issues where the weather path is missing, and when I manually include it, I get errors about unexpected properties like “max_electrucal_load.” When I remove that property manually, it tells me that the path to the Modelica loads doesn’t exist.

I understand that this system_params should be created after running the simulation with Run URBANOpt using the Run DES component (but in my case, this component doesn’t work because when it starts downloading the GMT libraries, I encounter issues with the Python version installed within Ladybug Tools, which is version 3.7, and the required version is 3.8.

I understand that you are in the midst of development, but if it can be of any help, I have captured the errors that I encountered, and I can share them with you. Regarding the Docker part, I suppose I should contact NREL, but I’m not sure if they have a dedicated forum or how to reach them.

Hi @Batiste ,

Sorry that I was unresponsive for a couple of weeks. I have a long response drafted for you that answers all of the questions but I’m just waiting on us to post an updated release with everything you’ll need to run things correctly.

For now, I’ll say I have been able to get to the point where you can write out a full set of Modelica files for both a standard 4th generation system (with a heating and cooling plant) and a 5th generation system (with an ambient loop and at least one ground heat exchanger). I was not able to get the docker-based workflow to run from Grasshopper, which is meant to simulate the Modelica files using OpenModlica in the background. It seems that this workflow is currently not set up to run on Windows and I’ll need some more changes from NREL to fully expose it (perhaps within a few months). However, I am confident that, if you have a Dymola license, the Modelica files we are currently writing should simulate and, if you know enough about OpenModelica, you should be able to simulate the files in the OpenModelica UI. Granted, I personally don’t know enough about OpenModelica but I only get one error when I run the “Check All” functionality on the current models and it just says “Too many open files”, which makes me think it’s a setting that I need to change in the UI.

Give me until the end of today and I’ll post the full instructions for you to test.

1 Like

Hi @Batiste ,

Below you can find the full set of instructions for the basic DES workflow from Dragonfly, along with some files for you to test.

But, first, just so you know where we have gotten to, you can see what the heating/cooling plants of the 4th generation system look like here in OpenModelica:

Cooling Plant

Heating Plant

… and you can see what the ground heat exchanger of the 5th generation system looks like here:


5th Gen DES

In order replicate the test on your end, you have to do the following:

  1. Uninstall your current version of Ladybug Tools / Pollination and download the latest single-click installer from the Pollination website. You need to do this because, like you said, the Python libraries that NREL has written to produce the Modelica files are intended to work best in Python 3.10 and we just updated our Pollination installers to use Python 3.10 today.

  2. I would start by running the samples that I have already put together for DES simulation before trying to run your own. It sounds like you’ve been trying to use these already but I would re-download the latest ones since I have been updating them over the last few days. Here is a sample Grasshopper file for a 4th Gen DES and Here is a sample Grasshopper file for a 5th Gen DES. You’ll see in the latest version of Dragonfly that, when you plug in a des_loop to the GeoJSON export component, the weather_filename is automatically included in the GeoJSON, we automatically translate the EPW to an .mos file so that it can be used with Modelica simulation, and we also write out a basic system_params.json with any properties of the DES that you set in Grasshopper.

  3. When you get to the “Run DES” component in the samples, note that the first time you run the component, it will download 3 different dependencies to your machine - the geojson-modelica-translator, the ThermalNetwork package for sizing ground heat exchangers, and the correct version of the Modelica Buildings Library. Each of the dependencies will ask you for admin privileges to install. So it will take a while the first time but, once you get these dependencies installed, this won’t happen the next time the component runs.

  4. Also note that, if you are running the 5th generation system, there is a whole long routine that runs prior to writing the Modelica files, which will size the ground heat exchanger. This process can eat up a lot of memory when you start getting to district-size exchangers with thousands of boreholes. So I recommend running on a machine with at least 32 GBs of RAM.

  5. If the “Run DES” component executes successfully, it will output a folder where all of the Modelica files are written. You can open this in OpenModelica with the caveat that these files Only work with MBL version 9.1.0 right now. I know that they did the later releases of the MBL for better compatibility with 5th Gen systems but the geojson-modelica-translator is not yet updated to work with the new conventions. So you will have to use MBL 9.1.0 in the OpenModelica UI if you want to be able to open the files without serious errors. If the 9.1.0 package is being used correctly, you should see this in the OpenModelica UI:


I hope that’s enough to get you started testing and let us know how it goes. I can answer any questions related to the NREL packages or Dragonfly but, as I said, OpenModelica is a bit beyond my expertise at the moment.

1 Like

Hi @chris , I was already finishing my workday, and your message makes it unlikely that I’ll sleep tonight. I need to try out this move. Thank you very much, I’ll keep you updated with the results.

1 Like

Thanks, @Batiste . I realize our time zones are a bit mismatched since I just woke up here on the west coast of the US. Take your time with it if you can as there’s no rush and the workflow is only going to get better from here.


Hi @chris, I have tried the 4th Gen DES and I see the Scripting Notification Message that you have put it in the previous message. When I “Check All” the model I have no errors. But when I Run the simulation ( with a > 32 GB ram computer) the simulation stops at second 600s with this error:

I will put a message in the Open Modelica Github discussion.

And another thing is that in OM, I can not visualize the district as you have shown in the previous messages ( I’m using the OM 1.21)

Hi @Batiste ,

I’m not sure what that error code means but let me know if you end up finding out more. I remember Nate from NREL told me that the OpenModelica simulation requires a really large amount of resources in order to run. So it may be worth running a test with a district that has just 1-3 buildings to see if it can complete.

Those images from OMEdit come from navigating through the tree menu and double-clicking on specific parts of the DES. For example, you can see the cooling plant under Plants > Central Cooling Plant:

I am also using OM 1.21.0.

Hi @chris,

Thank you for your reply.
For solving some problems of OM, in the github forum they have suggested to use the 1.22 -dev version:

We have achieved to reduce some problems due to the notation of the folders (change "" to “/”). The original one

I have tried what you said, but now I am facing this problem when I run the DF Run URBANopt:

Error running command: ‘C:/URBANopt-cli-0.10.0/OpenStudio/bin/openstudio.exe --bundle ‘C:/Users/Batiste/simulation/Buffalo_Development_DES_2/Gemfile’ --bundle_path ‘C:/Users/Batiste/simulation/Buffalo_Development_DES_2/.bundle/install/’ run -w ‘C:/Users/Batiste/simulation/Buffalo_Development_DES_2/run/honeybee_scenario/Residential4/in.osw’ 2>&1 > “C:/Users/Batiste/simulation/Buffalo_Development_DES_2/run/honeybee_scenario/Residential4/in.osw.log”’
stderr: El proceso no tiene acceso al archivo porque est� siendo utilizado por otro proceso.
DONE, result = false

The translation to english: stderr: The process does not have access to the file because it is being used by another process.

The only thing that I modify is to syncronize the Grasshopper file with LB Sync Grasshopper File.

Thank you so much in advance.

Hi @Batiste ,

The error message seems pretty clear that it’s having trouble overwriting the older results because they’re open in another program. I would try either manually deleting the project folder before you rerun the simulation, which will give you an indication of which files are open, or you could just run the simulation in a different project folder altogether by changing either the Dragonfly Model _name_ or _folder_ into which the GeoJSON is written.

Hi @chris ,

We are currently working on the basic DES (5G) workflow for Dragonfly using the “ghe_example” sample file. Everything is progressing well until we reach the “Generate DES Modelica Files” step, at which point the process appears to freeze.

I’ve conducted a test using only one floor per building in order to reduce simulation time, but the issue persists during the “Generate DES Modelica Files” step (the simulation appears to halt).

Just to provide additional context, we are using Rhino 7 and Pollination 1.40.5.

If you have any insights or suggestions on how to resolve this issue, it would be greatly appreciated. And thank you very much for all your work!

Hi @jordibrunet

In response to this:

What is it that convinces you the process is “frozen” vs. it’s just taking a while to run? The component generally takes a long time to run, especially the first time that you run it and it has to download a bunch of extra dependencies. How long are you waiting and do any of the batch windows pop up?