This post won’t be for everyone, but if you’re into using Python there’s a lot you can do to make EnergyPlus input files easier understand and analyse.

I’m slowly putting together a few useful functions to help with analysing models I and others have built, and one of the basic building blocks is a way of measuring the surface area of each building element. For anyone not interested in EnergyPlus, it’s also a set of Python functions for getting the area of any polygon in 3D space.

This is basically the VBA function for polygon area in a 2D coordinate system, translated into Python and extended to a 3D coordinate system.

To use the function you pass it a set of vertices as a list of lists in the form [[x1,y1,z1],[x2,y2,z2],...,[xn,yn,zn]].

If you’re not using EnergyPlus then that’s all you need to know. If you are, how you get that list depends on which version of EnergyPlus you’re using. If you’re using version 5.x then the vertices listed in lines with the form:

And in version 6.x they are:

The functions to extract the vertices for a building surface are:

The parameter surface refers to either a BuildingSurface:Detailed object or a FenestrationSurface:Detailed object. To get these, open your .idf or .imf as read only, and whenever you reach a line which contains “Surface:Detailed” call the get_surface() function on your open file:

Here’s some test code you can try out. Without a bit of additional work, all it does it print a list of surface areas to the console but keep your eyes open for more options here in the future. If you’re using version 5 then just swap out gv_6(surface) for gv_5(surface):

Hope it helps.

Jamie Bull |

Related Posts

IntroThis tutorial is intended as a walk-through for complete beginners to geomeppy. geomeppy is a python project built on top of eppy, and as the name implies, it adds much more geometry editing capabilities.At the end of the tutorial, you will have created and run an EnergyPlus model without once having to manually edit an […]

WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December […]

Just a quick post to point out a couple of really useful tools.The first is a web-based tool for finding weather files for a location of interest. It’s similar to the Excel EPW finder tool we created a few years back, but much more modern looking. It is however missing a few of the useful […]

Leave a Reply

Your email address will not be published. Required fields are marked *