This is the official repository of LCA as Code language.
LCA as Code is a domain-specific language (DSL) for life-cycle analysis experts. Its declarative approach allows to define parametrized and reusable LCA models. See our book to learn more about the language.
From the source
git checkout v1.7.10
./gradlew :cli:installDist
alias lcaac=$GIT_ROOT/cli/build/install/lcaac/bin/lcaac
lcaac version
From Homebrew
brew tap kleis-technology/lcaac
brew install lcaac-cli
lcaac version
Check the sample file in $GIT_ROOT/cli/samples/main.lca
.
process electricity_mix {
params {
from_fossil = 40 percent
from_nuclear = 20 percent
from_hydro = 40 percent
}
products {
1 kWh electricity
}
inputs {
from_fossil * 1 kWh electricity from fossil
from_nuclear * 1 kWh electricity from nuclear
from_hydro * 1 kWh electricity from hydro
}
}
// rest of the file omitted
Now you can assess the process electricity_mix
.
cd $GIT_ROOT/cli/samples
lcaac assess "electricity_mix"
The result is printed on the standard output in CSV format.
product,amount,reference unit,co2,co2_unit
electricity,1.0,kWh,5.4,kg
You can also run multiple assessments with an external data csv file providing values for the process parameters.
lcaac assess "electricity_mix" --file params.csv
The language allows to define tests as well. See the file $GIT_ROOT/cli/samples/test.lca
.
test should_pass {
given {
1 kWh electricity from electricity_mix
}
assert {
co2 between 0 kg and 10 kg
}
}
// rest of the file omitted
Run the tests using
lcaac test --show-success
This repository contains the core libraries to handle LCAAC code.
The package core
contains:
- the language's abstract syntax tree (AST)
- the evaluator
- analysis programs, namely, contribution analysis, and local sensitivity analysis
The package grammar
contains:
- a concrete ANTLR-based grammar
- utilities to parse and load LCAAC files.
The package cli
contains the code for the command-line interface.
For users
For developers
- Core concepts [coming soon]
- Contribution guide [coming soon]
Cloud Assess is an open-source tool to automate the assessment of the environmental impacts of cloud services. It aims at defining a trusted library of LCA models, written in the LCAAC language, which can be easily consulted via a REST API.
An integrated-development environment (IDE) is available. This editor provides facilities to develop and interact with LCAAC models. E.g.
- Automatic unit consistency check with syntax highlighting.
- Integrated analysis and visualization.
- Support for collaboration and code review.
This work is dual licensed:
- For commercial use: commercial license. Reach out to
contact@kleis.ch
for more information. - For non-commercial use: AGPL v3. See
LICENSE-AGPL.txt
.
We are Kleis Technology. Software craftsmen, thirsty for knowledge, with experience in complex subjects, we solve challenges in a pragmatic manner. Backed by our core values of trust, commitment and continuous improvement, we love to make and create.