Skip to content

Commit

Permalink
Merge pull request #8 from GreenDelta/October-update
Browse files Browse the repository at this point in the history
October update
  • Loading branch information
JonciH authored Oct 8, 2024
2 parents 5e693bd + 2ebf004 commit 014e1f2
Show file tree
Hide file tree
Showing 60 changed files with 513 additions and 177 deletions.
75 changes: 0 additions & 75 deletions src/LCC_old.md

This file was deleted.

13 changes: 9 additions & 4 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
- [Creating a new empty database](databases/create_database.md)
- [Restoring a database](databases/restore_database.md)
- [Database update](databases/database_update.md)
- [Importing and combining databases](databases/importing_and_combining_databases.md)
- [Importing data and combining databases](databases/importing_and_combining_databases.md)
- [Using mapping files and validate databases](databases/mapping_validation.md)
- [Exporting databases](databases/exporting_databases.md)
- [Flows](flows/README.md)
Expand Down Expand Up @@ -73,11 +73,11 @@
# The advanced knowledge base
- [Advanced Topics](advanced_top/README.md)
- [Regionalized LCA](advanced_top/regionalized.md)
- [Monte Carlo simulation](advanced_top/monte_carlo.md)
- [Life Cycle Costing](advanced_top/LCC.md)
- [Data Quality](advanced_top/data_quality.md)
- [Social aspects](advanced_top/social_aspects.md)
- [Constants, operators and functions for formulas in openLCA](advanced_top/formulas_in_openlca.md)
- [Data Quality](advanced_top/data_quality.md)
- [Monte Carlo simulation](advanced_top/monte_carlo.md)
- [Dependent parameters](advanced_top/dependent_parameter.md)
- [Environmental Product Declarations (EPDs)](epds/README.md)
- [Creating new processes for target products](epds/create_processes_for_target_products.md)
- [Create product systems from your processes](epds/create_product_systems_from_processess.md)
Expand All @@ -88,12 +88,17 @@
- [Get EPDs from EC3](epds/ec3.md)
- [Using results of EPDs in life cycle models](epds/life_cycle_models.md)
- [Using soda4LCA](epds/soda4lca.md)
- [Libraries](libraries/README.md)
- [Adding a library to a database](libraries/adding_library_database.md)
- [Exporting a database as a library](libraries/exporting_database_as_library.md)
- [Library file system](libraries/file_system.md)
- [Collaboration in Teams](collaboserver.md)
- [openLCA cheat sheet](cheat/README.md)
- [Usage](cheat/usage.md)
- [Direct impact calculations in processes](cheat/direct.md)
- [openLCA and Excel](cheat/import_export.md)
- [Tags](cheat/tags.md)
- [Constants, operators and functions for formulas in openLCA](cheat/formulas_in_openlca.md)

-----------
-----------
Expand Down
1 change: 1 addition & 0 deletions src/advanced_top/data_quality.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ You can access existing data quality system in the folder "Data quality system"
![](../media/quality_score.png)
_Data quality systems, indicators and scores_

As visualized above, adding uncertainty values allows to perform "[Monte Carlo Simulations](../advanced_top/monte_carlo.md)" in openLCA.

### Setup

Expand Down
131 changes: 131 additions & 0 deletions src/advanced_top/dependent_parameter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Dependent Parameter in openLCA

<div style='text-align: justify;'>

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 ](../cheat/formulas_in_openlca.md) 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/Constant** | **Description** | **Examples with values** | **Usage in a Dependent Formula** |
|---------------------------------|---------------------------------------|-----------------------------------------|---------------------------------|
| pi | Ratio of circumference to diameter | `pi = 3.141592653589793` | `circle_area = pi - radius^2` |
| e | Base of natural logarithm | `e = 2.718281828459045` | `exponential_growth = e^growth_rate` |
| + | Addition | `1 + 2 = 3` | `total_cost = material_cost + labor_cost` |
| - | Subtraction | `5 - 3 = 2` | `net_income = revenue - expenses` |
| - | Multiplication | `2 - 3 = 6` | `total_energy = energy_per_unit - units_produced` |
| / | Division | `6 / 2 = 3` | `average_cost = total_cost / quantity` |
| ^ | Exponentiation | `2^3 = 8` | `compound_interest = principal - (1 + rate)^time` |
| div | Integer division | `7 div 2 = 3` | `batches = total_units div batch_size` |
| mod | Modulus (remainder) | `7 mod 2 = 1` | `remaining_units = total_units mod batch_size` |
| = | Equal to | `1 = 1 = true` | `is_equal = value1 = value2` |
| <> or != | Not equal to | `1 <> 2 = true` or `1 != 2 = true` | `is_not_equal = value1 <> value2` |
| < | Less than | `2 < 3 = true` | `is_less = temperature < setpoint` |
| <= | Less than or equal to | `2 <= 2 = true` | `is_in_range = value <= limit` |
| > | Greater than | `3 > 2 = true` | `is_greater = pressure > threshold` |
| >= | Greater than or equal to | `3 >= 3 = true` | `is_above_min = score >= passing_score` |
| and or && | Logical AND | `true() && false() = false` | `in_range = temperature >= low && temperature <= high` |
| or or || | Logical OR | `true() || false() = true` | `requires_attention = temperature < low || temperature > high` |
| abs(x) | Absolute value of x | `abs(-1) = 1` | `magnitude = abs(change)` |
| sqrt(x) | Square root of x | `sqrt(4) = 2` | `side_length = sqrt(area)` |
| ln(x) | Natural logarithm of x | `ln(7.389) = 2` | `decay_rate = ln(remaining_amount)` |
| sin(x) | Sine of x (in radians) | `sin(pi/2) = 1` | `wave_height = amplitude - sin(angle)` |
| cos(x) | Cosine of x (in radians) | `cos(0) = 1` | `horizontal_force = total_force - cos(angle)` |
| tan(x) | Tangent of x (in radians) | `tan(pi/4) = 1` | `slope = rise / tan(angle)` |
| round(x) | Rounds x to the nearest integer | `round(2.5) = 3` | `rounded_value = round(exact_value)` |
| floor(x) | Largest integer not greater than x | `floor(2.7) = 2` | `full_batches = floor(total_units / batch_size)` |
| ceil(x) | Smallest integer not less than x | `ceil(2.2) = 3` | `full_containers = ceil(total_volume / container_volume)` |
| if(b;x;y) | Returns x if b is true | `if(1 > 2; 1; 2) = 2` | `result = if(condition; value_if_true; value_if_false)` |
| min(x1;x2;...;xN) | Returns the minimum of x1 | `min(1;2;3) = 1` | `minimum_value = min(value1; value2; value3)` |
| max(x1;x2;...;xN) | Returns the maximum of x1 | `max(1;2;3) = 3` | `maximum_value = max(value1; value2; value3)` |
| exp(x) | Euler's number e raised to power x | `exp(2) = 7.389` | `growth_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);
```

![](../media/SQL_para.png)

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](../parameters/parameters.md) 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)


![](../media/dependent_para_1.png)

### 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))))))))

![](../media/dependent_para_2.png)

**_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.*

![](../media/dependent_para_3.png)

## 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)


</div>
22 changes: 0 additions & 22 deletions src/advanced_top/mac_memory.md

This file was deleted.

Loading

0 comments on commit 014e1f2

Please sign in to comment.