[BEM, Topologic] BIM Energy Modeling
Starting a new dedicated topic following our discussions :
quotes from Safely split an IFC
@Cyril I just realised you mentioned energy model. I have a very hastily written half-baked completely incomplete Blender->gbXML exporter code here. Maybe it is useful to you. Maybe you can help write a fully featured one? You no doubt have much more experience in energy models and I have zero experience :)
Once we have a reliable gbXML workflow (by the way, gbXML spaces have an attribute that relate back to IFC spaces), that would be a huge benefit as people can then use Blender as an authoring tool for energy models.
@Moult I think I could use your gbXML exporter quite easily in FreeCAD... Would you be interested in trying to make it Blender-independent? I'm thinking in FreeCAD it could be fed with a list of Arch Space objects. There is quite a lot that is geometry-dependant, but maybe we could isolate that as much as possible into separate methods, then in FreeCAD I can derive a new class from yours and reimplement the geometry-related functions
@yorik Sure thing :) I haven't touched the code in a while and it currently is quite low on the to-do list, but gbXML expects a closed mesh polygon to represent a space (and from memory, only supports that, not like IFC which has 200 options :) ). Each face of the polygon represents a "surface". This is very simple in Blender and is isolated to the
create_spacefunction. As spaces are almost always very simple boxes / box-like closed shapes, this should also be very simple in FreeCAD :) Feel free to use it and please let us know when you do :)
Note on gbXML vs IFC (IfcRelSpaceBoundary)
IfcRelSpaceBoundaries have some advantages over gbXML. See also specialized IfcRelSpaceBoundary2ndLevel. gbXML is kind of the old way supported by almost any energy analysis software. Geometric generation process is almost the same for gbXML and IfcRelSpaceBoundaries. Adapt to local standard is hard with gbXML as it contains limited building information.
Current personnal progress
I am currently working on the other part of the process which is :
- Read an Ifc which contains IfcRelSpaceBoundary exported from any software (eg. Revit, ArchiCAD currently)
- Adapt or generate geometries for local standards. (which could become IfcRelSpaceBoundary level n in future according to discussions on building smart forum)
- Output information in simple and consistent manner for use in the energy analysis software
I'll give more detail soon.
I will be happy to work on gbXML/IfcRelSpaceBoundary generation as a team because I am not a geometry or algorithm master so I will need some help to avoid spending decades on this or get awful performances.
- I know that there is already energy analysis tools in Blender but I don't know how it works and if it is able to generate gbXML already. Cf. An Arch project showcase on FreeCAD forum
- I know that LadyBug Tools already have tools related to gbXML and energy analysis. Investigate a little here is required to avoid reinventing wheel.
- There is many scientific publication related to IfcRelSpaceBoundaries generation. I will post links on wiki for the ones publicly readable on web.
Here an Energy Workbench for FreeCAD
@Cyril that sounds fun! If I understand correctly, you are building an IFC to gbXML converter? Or are you building some way that software like EnergyPlus can read IFC with its benefits like
IfcRelSpaceBoundary? If it is the latter, how does that work?
I think investigating LadyBug tools is a very good idea - somehow bringing data from IFC into a format which could be plugged into LadyBug means that you could then use their entire suite of tools. Unfortunately I've never used their libraries :(
Are you aware of any FOSS tool which currently can output an IFC capable for energy modeling now? If not, perhaps that's where @yorik and I can help?
@Moult I'd be interested in seeing if Homemaker IFC files could have this energy modelling info. What would it normally consist-of?
Linking walls and spaces with
IfcRelSpaceBoundaryis fairly obvious, what about internal walls, floors and roofs? Ground floor slabs? I assume that thermal properties of walls, windows and doors can be set with a single U or R value? Or is this a property of the materials?
That is super interesting! I wasn't aware of the energy freecad workbench... indeed it seems an ifc file could contain everything a gbxml file needs:
The main issue i think would be how to know which face of the space relates to which boundary wall? I think that info is necessary, no?
You don't need reinvent the wheel, search IFC2Modelica
Thanks @ReD_CoDE ! From a bit of searching it seems that the original IFC2Modelica was never released open-source. However, another research paper did create an open source thing called BIM2Modelica which seems to do the same thing - here's the Github repo. @Cyril - you're the man qualified for energy analysis, does it look relevant and useful? If so, we can integrate it into Blender/FreeCAD.
@Moult yes, IFC2Modelica is a private academic repo
If you research after a while will find a lot of interesting resources related to IFC/Ifc to Modelica and some important articles about accuracy challenges about spaces and zones
For instance: https://pdfs.semanticscholar.org/6cd9/39a6ca65ff03c5267c9d916eb3a01b7a25a9.pdf
IFC to a custom xml but not gbXML. As I said gbXML has some unwanted restrictions and complications.
EnergyPlus don't read IFC directly. Another software translate IFC or gbXML to IDF to feed EnergyPlus.
Yes and no…
You have Space Boundary Tool which is supposed to generate IfcRelSpaceBoundaries from an IFC but license is weird. It has a github fork.
As I said in my previous post someone has presented a House project and energy analysis with FreeCad, Blender 3D and VI Suite on FreeCAD forum. VI Suite is an open source addon for Blender. Repository seems to be here.
Internal wall, virtual boundary (eg. no wall between kitchen and living room). Many things are not obvious if you try to do it for real. :-D
Materials handle λ values (thermal conductivity) etc… in Pset_MaterialThermal
I don't know any local standards which is certified with Modelica. So any Modelica only based workflow is not a valid solution. We need pragmatic solutions which can be adapted to feed local energy software certified for local standards.
I have created an Energy Modeling wiki page referencing many scientific articles or conference papers including some algorithm comparison for boundaries generation (graph, ray, polyhedron etc…).
Side note : I don't know where to reference this wiki page on main page. Also I noticed many spam pages in wiki history but only admin and sysop user can delete it.
Wow, VI Suite with a "White-Sky" theme ;)
Modelica opens some new doors to the future and also cause "parallel" simulation which was a wish for years
@Cyril I would like to help on that.
BIM2SIM (next to BIM2BEM)
I have just published source code of the BIMxBEM project I have been working on at CNPA. It is released under LGPL3.0. We should definitely have a talk. I am very interested to share our mutual experiences.
@agonzalezesteve I also think it's a great idea to allow BlenderBIM to bring in IFCs, enrich them (e.g by cleaning up or adding
IfcRelSpaceBoundary), and then output to different engines. One example would be to output to gbXML for OpenStudio, and another would be to output to Honeybee-JSON for Ladybug Tools / Pollination. I've heard that Honeybee-JSON addresses many of the shortcomings of gbXML, so @Cyril would you like to investigate that instead of inventing a new XML type? I still think supporting gbXML is useful as a base case.
Here's a utility I've started playing with, not sure what it will evolve into, which takes IfcSpaces which have wall thickness gaps between them, and offsets the space surfaces as necessary to the midpoint of the wall thickness: https://github.com/IfcOpenShell/IfcOpenShell/commit/eb0f2de197c94e18d6eed83e56351e1c189e07ed
After cleanup tool:
I've created a page https://wiki.osarch.org/index.php?title=Learn_about_environmental_analysis as part of a category of 'Analysis & Simulation'. So anything useful people can add to that category or improve in those pages would be great. https://wiki.osarch.org/index.php?title=Category:Analysis_and_Simulation
I've checked gbXML and Honeybee schemas and I think that the gbXML has more information available for HVAC. But for only geometry they're really similar, so the same exporter could be used.
Honeybee uses the OpenStudio translator, that is the only software verified, and its SDK is my everyday tool.
From this resources I conclude that the problem consists in the following steps:
Once the space boundaries are set, there are some scripts available to translate it to an energy model:
@Moult I'll take a look it. In my case, I did just the opposite, substracting wall thickness in an energy model for computing the air volume properly.
No worry. Idea was not to reinvent the wheel. The produced xml is very close to IFC specifications and represent a very tiny part of the code. We easily can output to a different format easily. Honeybee schema might works. Also keep in mind that every national standard has its own requirements so output requires some adjustments. From my talk with some energy simulation software developers gbXML is implemented in various manner depending on which software produce it and all required data cannot be stored in it without extending the schema and no authoring software would handle it.
I had a look too. With honeybee schema you can extend data for some object which is very useful for local standards specific data. Example with space boundaries. Definition in gbXML (SpaceBoundary) is not extensible but Honeybee schema definition is (Face) which is better for Switzerland requirement as we need geometry for both internal and external faces.
I would like to talk about this too. Are these tools are certified for your national standards (Spain I assume as you are from Barcelona) ?
Clipper is apparently for 2D only. From my understanding of publications polyhedron approach is the most promising approach (CBIP revised). CGAL might have some interesting algorithm in this regard.
One of my colleague wondered if Topologic could not help too. Seeing HomeMaker at july meetup I also wondered if @brunopostle work could not help too.
Where do you see reference to this ? I have found CGAL in dependencies but no mention to Geometry Simplification Tool. All mention to
simplificationin source code seems to reference CGAL.
@Cyril what about the Surface object?
SG Save uses OpenStudio and it's certified here in Spain.
It's true, but since OpenStudio works with polyhedron, surfaces are always polygons and 2D clipping algorithms are enough.
Here you have some references:
It would be great if some of this information could be added to https://wiki.osarch.org/index.php?title=Energy_Modeling
Yes Topologic (and Homemaker/Topologise too, I added ifcrelspaceboundary to all IFC output, but don't have any way to test it) is perfectly suited to generating this simplified geometry of spaces and boundaries, but only if you are using it to generate the building elements in the first place. The hard problem is taking a collection of random building elements (a typical IFC file) and assembling them into logical spaces and boundaries.
How about the collision detection features? Having a virtual-robot going through the building (raytrace like) and making a graph from the ifc space informations? It has to go through door which are always adjacent to another Space.. all the space having to be within the overall building envelope. Out of an IFC file , have a AI/ML that would build the topology of the building. Having this Tree/Graph/Topologiy of the IFC, it would be easy to build new simplified spaces.. One new generated Building would be used for the Static Engineer, the next one for Energy analysis, the next one for the light-designer and so on ... each simulation could have its own simplified IFC-basis. At some point this ML/AI would be good enough to even name the room functions (detect whether it is a bathroom or a floor..). This would also help to convert one ifc to another , like a compatibility filter between ArchiCAD/Revit or Dialux/DDS-CAD or whatever.. a dream..
The tools that translate IFC to gbXML or creates 2n level space boundaries require that spaces should be generated in the authoring BIM tool.
An algorithm to generate space boundaries for building energy simulation references Dimensional reduction of 3D building models using graph theory and its application in building energy simulation
for creating IfcSpace based on building elements and is used for CFD.
A litterature review.. but no solution :-)
download link for the 3D-Building/graph article above: http://www.cie.bgu.tum.de/publications/paper/2006_08.pdf
The hard problem is taking a collection of random building elements (a typical IFC file) and assembling them into logical spaces and boundaries.
I don't think so. What if we take the polygons of IfcWalls, IfcSlabs and IfcRoofs and intersect them? The intersection doesn't belong to a 1st level space boundary. Then, if we do XOR of all polygons, two polygons that share and edge belong to the same IfcSpace. What do you think?
The problem is that an extra IfcSpace with the building envelope will be created but is easy to remove because it is the one with the biggest volume.
Should I extract the geometry using the bpy or ifcopenshell library? Once I have the polygons vertices we could use the pyclipper library.
@agonzalezesteve I'm thinking of the building models that I encounter, where you can't rely on elements fitting perfectly without gaps between them, I've rarely seen an airtight 3d model.
Also, these Boolean operations are very unreliable even when you take care to align objects, you would have to draw everything overlapping, whereas ifc models tend to be drawn with zero overlap - exactly the sort of geometry that causes problems for Boolean operations.
If models are drawn with zero overlap, they can be drawn without gaps too, isn't it? In the worst case two IfcSpace will be merged.
I attach a script that does that in txt, because I cannot upload a py file, and a test file in ifc with an IfcWall an two IfcSlabs. It's not perfect but it seems to work.
If we decide to follow this worklow, I would need help to define IfcSpace and IfcRelSpaceBoundary.
I share with you a script that's able to find the geometry of 1st level IfcRelSpaceBoundary and group them by the IfcSpace they should belong to. I've done it in a geometric/abstract way and it's time to create the ifc objects but I don't know how to do it. Some help @Cyril @Moult?
I ended up using the pyclipper library because gives less errors than CGAL.
Nice. We can meet to figure this out. pm me your availabilities or join chat and mention me to make sure I see notification.
@agonzalezesteve I checked IFC documentation further about IfcSpace. It propose a 2D geometry representation and 3 possible 3D geometry representation. It would be great to have generate both 2D and 3D representation. 2D representation would allow to compute area and it would also be great to be able to choose at which height it has to be computed as it varies from a country to another.
I discussed with @Moult about 3D representation. Considering you are generating faces the Body Brep Geometry is probably the best way to go. He said that in IFC4 IfcPolygonalFaceSet is better (I think this is because definition is simpler and has a smaller size) but it doesn't exist in IFC2X3 so in this case IfcFacetedBrep should be used.
There is an example of how to generate both in BlenderBIM addon source code :
may be too late..because you are on your way to succeed.. from London and Creta
Has anyone used Open BIM Analytical Model from CYPE?