Search in sources :

Example 11 with SystemCalculator

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);
}
Also used : DQResult(org.openlca.core.math.data_quality.DQResult) SystemCalculator(org.openlca.core.math.SystemCalculator)

Aggregations

SystemCalculator (org.openlca.core.math.SystemCalculator)11 Test (org.junit.Test)5 File (java.io.File)2 Derby (org.openlca.core.database.Derby)2 Process (org.openlca.core.model.Process)2 ArrayList (java.util.ArrayList)1 SingularMatrixException (org.apache.commons.math3.linear.SingularMatrixException)1 IDatabase (org.openlca.core.database.IDatabase)1 ImpactMethodDao (org.openlca.core.database.ImpactMethodDao)1 ProcessDao (org.openlca.core.database.ProcessDao)1 LibTechIndex (org.openlca.core.library.LibTechIndex)1 LibraryDir (org.openlca.core.library.LibraryDir)1 DQResult (org.openlca.core.math.data_quality.DQResult)1 ProductSystemBuilder (org.openlca.core.matrix.ProductSystemBuilder)1 MatrixCache (org.openlca.core.matrix.cache.MatrixCache)1 EnviFlow (org.openlca.core.matrix.index.EnviFlow)1 TechIndex (org.openlca.core.matrix.index.TechIndex)1 LinkingConfig (org.openlca.core.matrix.linking.LinkingConfig)1 JavaSolver (org.openlca.core.matrix.solvers.JavaSolver)1 ImpactDescriptor (org.openlca.core.model.descriptors.ImpactDescriptor)1