Why Automate Your LCA Calculations

At Below280, we use openLCA’s IPC server extensively in our LCA work. It lets us run large models with many scenarios from scripts, which saves time and reduces errors. openLCA’s scripting capabilities are significant but under-used within the LCA community, so we’ve put together this series of guides and example code to help practitioners get started.

Why would you want to do this?

Running one calculation in the openLCA GUI is straightforward. Running many gets tedious quickly. If you need to test multiple scenarios, each with different parameter values, it will gradually drive you mad in whatever LCA software you use. There is a much more efficient way to do this, though using code. Additionally, by coding it, you have a record of all the values you used, and everything you did, making error checking much easier.

How it works

openLCA includes a built-in IPC (Inter-Process Communication) server. You can start this by going to Tools->Developer Tools->IPC Server. Python is the most common choice because GreenDelta provides an official client library, but anything that can send HTTP requests works: R, MATLAB, Julia, JavaScript…. whatever you want to try. Remember, openLCA is open-source, so there’s no limit to what you can do.

The IPC server supports JSON-RPC by default, with two other protocols available for different use cases:

  • JSON-RPC over HTTP is the simplest. It works from any language and runs on localhost. The examples in this series use it via the olca-ipc Python package.
  • gRPC is a higher-performance protocol. GreenDelta publishes the .proto definition files on GitHub, so you can generate client code for languages like C++, Java, Go, and Kotlin.
  • REST API is designed for web application integration, where you need openLCA’s calculation engine behind a web service.

What’s in this series

Within this Knowledge Base, we include information on how to use IPC, and then move onto example code. We will gradually increase this whenever we have time. The code examples will be linked to our Github, where you can download them.

If you need help with openLCA automation on your projects, or you’re interested in our LCA training, get in touch.