use of org.openlca.core.math.SystemCalculator in project olca-app by GreenDelta.
the class CalculationWizard method runCalculation.
private void runCalculation() {
// for MC simulations, just open the simulation editor
if (setup.hasType(CalculationType.MONTE_CARLO_SIMULATION)) {
SimulationEditor.open(setup.calcSetup);
return;
}
boolean upstream = setup.hasType(CalculationType.UPSTREAM_ANALYSIS);
// run the calculation
log.trace("run calculation");
var calc = new SystemCalculator(Database.get());
var result = upstream ? calc.calculateFull(setup.calcSetup) : calc.calculateContributions(setup.calcSetup);
// check storage and DQ calculation
DQResult dqResult = null;
if (setup.withDataQuality) {
log.trace("calculate data quality result");
dqResult = DQResult.of(Database.get(), setup.dqSetup, result);
}
// sort and open the editor
log.trace("sort result items");
Sort.sort(result);
log.trace("calculation done; open editor");
ResultEditor.open(setup.calcSetup, result, dqResult);
}
Aggregations