Search in sources :

Example 16 with Parameter

use of org.openlca.core.model.Parameter in project olca-modules by GreenDelta.

the class Parameters method create.

static Parameter create(InputParameterRow row, ParameterScope scope) {
    Parameter p = new Parameter();
    p.refId = UUID.randomUUID().toString();
    p.name = row.name();
    p.isInputParameter = true;
    p.scope = scope;
    p.value = row.value();
    p.description = row.comment();
    p.uncertainty = Uncertainties.of(row.value(), row.uncertainty());
    return p;
}
Also used : Parameter(org.openlca.core.model.Parameter)

Example 17 with Parameter

use of org.openlca.core.model.Parameter in project olca-modules by GreenDelta.

the class Parameters method fetchFromProperties.

private static void fetchFromProperties(List<Property> properties, List<Parameter> parameters, ImportConfig config) {
    for (Property property : properties) {
        if (!canCreate(property.variableName, parameters))
            continue;
        Parameter olcaParam = new Parameter();
        olcaParam.name = property.variableName;
        olcaParam.scope = ParameterScope.PROCESS;
        olcaParam.value = property.amount;
        olcaParam.description = property.unit;
        String formula = property.mathematicalRelation;
        if (config.withParameterFormulas && isValid(formula, config)) {
            olcaParam.formula = formula.trim();
            olcaParam.isInputParameter = false;
        } else
            olcaParam.isInputParameter = true;
        parameters.add(olcaParam);
    }
}
Also used : Parameter(org.openlca.core.model.Parameter) Property(spold2.Property)

Example 18 with Parameter

use of org.openlca.core.model.Parameter in project olca-modules by GreenDelta.

the class Parameters method fetchProcessParameters.

private static void fetchProcessParameters(DataSet ds, List<Parameter> parameters, ImportConfig config) {
    for (spold2.Parameter param : Spold2.getParameters(ds)) {
        if (!canCreate(param.variableName, parameters))
            continue;
        Parameter olcaParam = new Parameter();
        parameters.add(olcaParam);
        olcaParam.description = param.unitName;
        olcaParam.name = param.variableName;
        setScope(param, olcaParam);
        olcaParam.value = param.amount;
        olcaParam.uncertainty = UncertaintyConverter.toOpenLCA(param.uncertainty, 1);
        String formula = param.mathematicalRelation;
        if (config.withParameterFormulas && isValid(formula, config)) {
            olcaParam.formula = formula.trim();
            olcaParam.isInputParameter = false;
        } else {
            olcaParam.isInputParameter = true;
        }
    }
}
Also used : Parameter(org.openlca.core.model.Parameter)

Example 19 with Parameter

use of org.openlca.core.model.Parameter in project olca-modules by GreenDelta.

the class Parameters method fetchFromExchange.

private static void fetchFromExchange(Exchange exchange, List<Parameter> params, ImportConfig config) {
    if (!canCreate(exchange.variableName, params))
        return;
    Parameter olcaParam = new Parameter();
    olcaParam.name = exchange.variableName;
    olcaParam.scope = ParameterScope.PROCESS;
    olcaParam.value = exchange.amount;
    olcaParam.description = exchange.unit;
    String formula = exchange.mathematicalRelation;
    if (config.withParameterFormulas && isValid(formula, config)) {
        olcaParam.formula = formula.trim();
        olcaParam.isInputParameter = false;
    } else
        olcaParam.isInputParameter = true;
    params.add(olcaParam);
}
Also used : Parameter(org.openlca.core.model.Parameter)

Example 20 with Parameter

use of org.openlca.core.model.Parameter in project olca-modules by GreenDelta.

the class Parameters method fetchFromProductionVolume.

private static void fetchFromProductionVolume(IntermediateExchange exchange, List<Parameter> params, ImportConfig config) {
    String varName = exchange.productionVolumeVariableName;
    Double amount = exchange.productionVolumeAmount;
    String formula = exchange.productionVolumeMathematicalRelation;
    if (!canCreate(exchange.productionVolumeVariableName, params))
        return;
    Parameter param = new Parameter();
    param.name = varName;
    param.scope = ParameterScope.PROCESS;
    param.value = amount == null ? 0d : amount;
    if (config.withParameterFormulas && isValid(formula, config)) {
        param.formula = formula.trim();
        param.isInputParameter = false;
    } else
        param.isInputParameter = true;
    params.add(param);
}
Also used : Parameter(org.openlca.core.model.Parameter)

Aggregations

Parameter (org.openlca.core.model.Parameter)74 Test (org.junit.Test)17 AbstractZipTest (org.openlca.jsonld.AbstractZipTest)14 Process (org.openlca.core.model.Process)12 ParameterDao (org.openlca.core.database.ParameterDao)11 Uncertainty (org.openlca.core.model.Uncertainty)8 ArrayList (java.util.ArrayList)7 Category (org.openlca.core.model.Category)6 ImpactCategory (org.openlca.core.model.ImpactCategory)6 ParameterRedef (org.openlca.core.model.ParameterRedef)6 Exchange (org.openlca.core.model.Exchange)5 ImpactFactor (org.openlca.core.model.ImpactFactor)5 ProductSystem (org.openlca.core.model.ProductSystem)5 Before (org.junit.Before)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 ImpactMethod (org.openlca.core.model.ImpactMethod)3 ProcessDao (org.openlca.core.database.ProcessDao)2 DQSystem (org.openlca.core.model.DQSystem)2 Flow (org.openlca.core.model.Flow)2