Integration with other software

Hi, I would like to know what is the recommended approach for integrating Radiance with other software. In other words, how would one use Radiance as a library, in a programmatic way?

I could come up with two alternatives:

  • List item By invoking the shell and executing radiance commands. Some examples like bifacial_radiance work this way.
  • List item By compiling Radiance into a dynamic library (eg, dll or so) and directly calling the native C functions.

For some context, I am looking into ways to run Radiance calculations as part of a larger calculation model, which is written in Java.

Many thanks in advance for your help!

There are many examples of the former, beyond Bifacial Radiance; I will show my age here but even the old “Desktop Radiance” project from LBNL used this approach, there is SPOT, and like a half dozen others out there that use this approach too, in various states of integration with a GUI, and I’d argue most of the regulars here have developed their own tools that operate this way.

OpenStudio attempted to offer something more like a library of functions that could be called from Ruby, and the insanely vast Ladybug Tools ecosystem has a proper Radiance functions (and model) library based on Python. Also somewhere on here very recently @Taoning_Wang1 announced a python-based Radiance library that was developed right at LBNL, didn’t he?

More low-level library functionality like you are probably wanting to do is above my pay grade, but I am sure that’s what the ClimateStudio folks have done.

Hi Felix,

I wrote craytraverse: GitHub - stephanwaz/craytraverse: c/c++ libraries for raytraverse, including radiance based render classes., which might not work for your case, but could offer some helpful pointers. craytraverse makes c++ bindings of rtrace and rcontrib callable from within python. Compilation is a bit tricky, but I provide linux and mac binaries, none of this will work with windows radiance. This allows a radiance instance to be maintained throughout runtime, but enables successive trace calls without reloading the scene. Rtrace can also change sources and settings on the fly. The big challenge is all of the global variables, so these render instances must be maintained as singletons. They come with a reset() function though for when you want to load a new scene.

Hi @Rob_Guglielmetti and @Stephen_Wasilewski , many thanks for your answers!! It is very helpful to get such detailed responses.

I think that the approach I will follow is to do the “traditional” implementation using shell invocation. For an initial version this seems fine. I will look into other alternatives, such as the ones you proposed, if I run into problems.