Dependent Parameter in openLCA

Dependent parameters in openLCA are useful for dynamically adjusting LCI data based on specific scenarios. They allow users to create complex models where results update automatically as input parameters change. Users can use the constants, operators and functions listed below to create formulas for dependent parameters. This is particularly useful when users wish to connect openLCA to external tools where input parameters may be initialised by or dependent upon user inputs.

Function/Operator/ConstantDescriptionExamples with valuesUsage in a Dependent Formula
piRatio of circumference to diameterpi = 3.141592653589793circle_area = pi - radius^2
eBase of natural logarithme = 2.718281828459045exponential_growth = e^growth_rate
+Addition1 + 2 = 3total_cost = material_cost + labor_cost
-Subtraction5 - 3 = 2net_income = revenue - expenses
-Multiplication2 - 3 = 6total_energy = energy_per_unit - units_produced
/Division6 / 2 = 3average_cost = total_cost / quantity
^Exponentiation2^3 = 8compound_interest = principal - (1 + rate)^time
divInteger division7 div 2 = 3batches = total_units div batch_size
modModulus (remainder)7 mod 2 = 1remaining_units = total_units mod batch_size
=Equal to1 = 1 = trueis_equal = value1 = value2
<> or !=Not equal to1 <> 2 = true or 1 != 2 = trueis_not_equal = value1 <> value2
<Less than2 < 3 = trueis_less = temperature < setpoint
<=Less than or equal to2 <= 2 = trueis_in_range = value <= limit
>Greater than3 > 2 = trueis_greater = pressure > threshold
>=Greater than or equal to3 >= 3 = trueis_above_min = score >= passing_score
and or &&Logical ANDtrue() && false() = falsein_range = temperature >= low && temperature <= high
or orLogical OR
abs(x)Absolute value of xabs(-1) = 1magnitude = abs(change)
sqrt(x)Square root of xsqrt(4) = 2side_length = sqrt(area)
ln(x)Natural logarithm of xln(7.389) = 2decay_rate = ln(remaining_amount)
sin(x)Sine of x (in radians)sin(pi/2) = 1wave_height = amplitude - sin(angle)
cos(x)Cosine of x (in radians)cos(0) = 1horizontal_force = total_force - cos(angle)
tan(x)Tangent of x (in radians)tan(pi/4) = 1slope = rise / tan(angle)
round(x)Rounds x to the nearest integerround(2.5) = 3rounded_value = round(exact_value)
floor(x)Largest integer not greater than xfloor(2.7) = 2full_batches = floor(total_units / batch_size)
ceil(x)Smallest integer not less than xceil(2.2) = 3full_containers = ceil(total_volume / container_volume)
if(b;x;y)Returns x if b is trueif(1 > 2; 1; 2) = 2result = if(condition; value_if_true; value_if_false)
min(x1;x2;...;xN)Returns the minimum of x1min(1;2;3) = 1minimum_value = min(value1; value2; value3)
max(x1;x2;...;xN)Returns the maximum of x1max(1;2;3) = 3maximum_value = max(value1; value2; value3)
exp(x)Euler's number e raised to power xexp(2) = 7.389growth_factor = exp(rate - time)

Extending the formula field character allowance

Note: Often the length of the formula field allowed by the software (150 characters) is insufficient for the formulas users wish to enter. The length of the formulas can be extended using the SQL command below in the SQL query browser of openLCA, which can be found under (select the green icon), users may save this formula under Tools>developer tools>SQL. You may save the script under the ‘scripts’ database elements folder in order to apply it in each new database they work with on openLCA.

ALTER TABLE tbl_exchanges
ALTER COLUMN resulting_amount_formula
SET DATA TYPE VARCHAR(15000);
ALTER TABLE tbl_parameters
ALTER COLUMN formula
SET DATA TYPE VARCHAR(15000);

Below are some examples using global parameters that users can try out. In each of these examples, the input parameters are created first as described in the parameter section, so that they can be used in the dependent parameters where the formulas are added. Dependent parameter formulas can also use other dependent parameters.

Example 1: The amount of concrete required depends on both the area and the height of the building.

Input Parameters:

  • building_area (m²)
  • building_height (m)

Dependent Parameter:

  • concrete_amount (m³)

Formula on openLCA

concrete_amount= if(and(building_area<=100;building_height<=10);150;if(and(building_area<=100;building_height>10;building_height<=20);200;if(and(building_area<=100;building_height>20);250;if(and(building_area>100;building_area<=200;building_height<=10);300;if(and(building_area>100;building_area<=200;building_height>10;building_height<=20);400;if(and(building_area>100;building_area<=200;building_height>20);500;if(and(building_area>200;building_height<=10);600;if(and(building_area>200;building_height>10;building_height<=20);800;1000))))))))

Note: openLCA requires precise syntax. If there is any mistake in the syntax—such as incorrect usage of operators, missing parentheses, or improper logical conditions—the software will return an error and the calculation will not proceed. In the example below the bracket was removed before the first ‘if(and’ from the concrete amount formula.*

Example 2: Determining the flow regime in a pipe (laminar, transitional, or turbulent) based on the Reynolds number to decide on a pipe for an experiment

Input Parameters:

  • density = 1000 (kg/m³) - Fluid density
  • velocity = 2 (m/s) - Flow velocity
  • diameter = 0.05 (m) - Pipe diameter
  • viscosity = 0.001 (Pa·s) - Fluid viscosity

Dependent Parameters:

  • reynolds_number (dimensionless)
  • flow_regime (numeric code)

Formula:

reynolds_number = (density*velocity*diameter)/viscosity

flow_regime = if(reynolds_number<2000;1;if(reynolds_number<=4000;2;3))

Please note the opening and closing brackets in the if-else statements.

where,

  • flow_regime = 1 indicates laminar flow and uses pipe material design 1
  • flow_regime = 2 indicates transitional flow uses pipe material design 2
  • flow_regime = 3 indicates turbulent flow pipe material design 3

Example 3: Calculation of total cost considering production volume and wastage of a material. (using and() and if())

Input Parameters:

production_cost_per_unit = 10 ($/unit)

production_volume = 1000 (units)

wastage = 50 (units)

Dependent Parameters:

total_cost ($)

Formula:

total_cost = if(and(production_volume>500;wastage>30); (production_cost_per_unit- (production_volume+wastage));production_cost_per_unit*production_volume)