From e8d4b341003db3dc5331894150705c3913d2c6e5 Mon Sep 17 00:00:00 2001
From: Frode Helgetun Krogh <70878501+frodehk@users.noreply.github.com>
Date: Fri, 14 Jun 2024 09:39:32 +0200
Subject: [PATCH] docs: update advanced model (#522)
* docs: update advanced model
ECALC-531
---
.../advanced_invalid_timesteps.mdx | 305 +++++++
.../base_profile.csv | 23 +
.../compressor_chart.csv | 12 +
.../compressor_sampled.csv | 5 +
.../genset.csv | 8 +
.../model.yaml | 210 +++++
.../pump_chart.csv | 10 +
.../about/modelling/course_material/index.md | 11 +
.../simple_invalid_timesteps.mdx | 244 ++++++
.../compressor_sampled.csv | 17 +
.../compressor_sampled_with_turbine.csv | 7 +
.../simple_with_invalid_timesteps/genset.csv | 8 +
.../simple_with_invalid_timesteps/model.yaml | 104 +++
.../production_data.csv | 14 +
.../pump_chart.csv | 7 +
.../pump_sampled.csv | 9 +
.../docs/about/modelling/examples/advanced.md | 779 ------------------
.../about/modelling/examples/advanced.mdx | 320 +++++++
.../examples/advanced/base_profile.csv | 23 +
.../examples/advanced/compressor_chart.csv | 12 +
.../examples/advanced/compressor_sampled.csv | 5 +
.../modelling/examples/advanced/genset.csv | 8 +
.../modelling/examples/advanced/model.yaml | 269 ++++++
.../examples/advanced/pump_chart.csv | 10 +
docs/docs/about/modelling/examples/index.md | 2 +-
25 files changed, 1642 insertions(+), 780 deletions(-)
create mode 100644 docs/docs/about/modelling/course_material/advanced_invalid_timesteps.mdx
create mode 100644 docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/base_profile.csv
create mode 100644 docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_chart.csv
create mode 100644 docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_sampled.csv
create mode 100644 docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/genset.csv
create mode 100644 docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/model.yaml
create mode 100644 docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/pump_chart.csv
create mode 100644 docs/docs/about/modelling/course_material/index.md
create mode 100644 docs/docs/about/modelling/course_material/simple_invalid_timesteps.mdx
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled.csv
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled_with_turbine.csv
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/genset.csv
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/model.yaml
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/production_data.csv
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_chart.csv
create mode 100644 docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_sampled.csv
delete mode 100644 docs/docs/about/modelling/examples/advanced.md
create mode 100644 docs/docs/about/modelling/examples/advanced.mdx
create mode 100644 docs/docs/about/modelling/examples/advanced/base_profile.csv
create mode 100644 docs/docs/about/modelling/examples/advanced/compressor_chart.csv
create mode 100644 docs/docs/about/modelling/examples/advanced/compressor_sampled.csv
create mode 100644 docs/docs/about/modelling/examples/advanced/genset.csv
create mode 100644 docs/docs/about/modelling/examples/advanced/model.yaml
create mode 100644 docs/docs/about/modelling/examples/advanced/pump_chart.csv
diff --git a/docs/docs/about/modelling/course_material/advanced_invalid_timesteps.mdx b/docs/docs/about/modelling/course_material/advanced_invalid_timesteps.mdx
new file mode 100644
index 0000000000..cb3506e417
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_invalid_timesteps.mdx
@@ -0,0 +1,305 @@
+import CodeLinesFromFile from "../../../../src/components/CodeLinesFromFile";
+import CodeBlock from '@theme/CodeBlock';
+import compressorChartCsv from '!!raw-loader!./advanced_with_invalid_timesteps/compressor_chart.csv';
+import compressorSampledCsv from '!!raw-loader!./advanced_with_invalid_timesteps/compressor_sampled.csv';
+import genset from '!!raw-loader!./advanced_with_invalid_timesteps/genset.csv';
+import pumpChart from '!!raw-loader!./advanced_with_invalid_timesteps/pump_chart.csv';
+import baseProfile from '!!raw-loader!./advanced_with_invalid_timesteps/base_profile.csv';
+import yamlModel from '!!raw-loader!./advanced_with_invalid_timesteps/model.yaml';
+
+# Advanced model example with invalid timesteps
+This is a model very similar to [Simple example](/about/modelling/examples/simple.mdx). The main difference is the use of more advanced
+energy usage models and consumer systems, and the addition of a second installation.
+
+Both installations exports oil (`OIL_PROD`) and gas (`GAS_PROD`).
+The installations emit CO2 and CH4.
+
+The following is an example with one installation called `Installation A` and `Installation B`.
+
+```mermaid
+graph TD;
+ Asset(Asset) --> A(Installation A);
+ A(Installation A) --> AA(Flare A);
+ A --> AD(Generator set A);
+ AD --> AE(Base production load A);
+ AD --> AF(Gas export compressor A);
+ AD --> AG(Produced water reinjection pump A);
+ AD --> AH(Sea water injection pump A);
+
+ Asset --> B(Installation B);
+ B --> BA(Generator set B);
+ B --> BD(Gas export compressor B);
+ BA --> BC(Base production load B);
+ B --> BB(Flare B);
+ style A stroke:red;
+ style B stroke:red;
+ style BC stroke:blue;
+ style AE stroke:blue;
+ style AF stroke:blue;
+ style AG stroke:blue;
+ style AH stroke:blue;
+```
+
+The results of a performed characterization of the equipment are listed below:
+
+| Consumer |Type | Description |
+|-------------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Generator set A |Generator set | Variable fuel consumer with electricity to fuel function |
+| Base production load A |Power consumer | Production base load varying depending on a binary condition |
+| Gas export compressor A |Power consumer | Variable consumption depending on gas sales rate |
+| Produced water reinjection pump A |Power consumer | Variable consumption depending on water production rate and water injection rate. The pump suction pressure is 10 bar and discharge pressure is 200 bar. |
+| Sea water injection pump A |Power consumer | Variable consumption depending on a complex combination on water injection rate and water production rate |
+| Flare A |Direct fuel consumer| Flare A |
+| Generator set B |Generator set | Variable fuel consumption with electricity to fuel function |
+| Base production load B |Power consumer| Production base load at 7.6 MW |
+| Gas export compressor B |Direct fuel consumer| Variable fuel consumption depending on gas sales rate |
+| Flare B |Direct fuel consumer| Flare B |
+
+## YAML model overview
+The YAML model consist of these main components:
+- Time series inputs - [TIME_SERIES](/about/references/keywords/TIME_SERIES.md)
+- Facility characterization input - [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md)
+- Fuel input - [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md)
+- Model specifications - [MODELS](/about/references/keywords/MODELS.md)
+- Model variables - [VARIABLES](/about/references/keywords/VARIABLES.md)
+- Installation topology - [INSTALLATIONS](/about/references/keywords/INSTALLATIONS.md)
+
+The YAML setup file looks like this:
+
+~~~~~~~~yaml title="model.yaml"
+TIME_SERIES:
+
+FACILITY_INPUTS:
+
+FUEL_TYPES:
+
+VARIABLES:
+
+INSTALLATIONS:
+
+~~~~~~~~
+
+We will now replace the placeholders for each of the main keywords above.
+
+## TIME_SERIES
+The reservoir variables, in this case, are found in a CSV (Comma separated file) `production_data.csv`.
+We give the time-series data a name that can be referenced as variables elsewhere in the form `:`.
+See [TIME_SERIES](/about/references/keywords/TIME_SERIES.md) for further details.
+
+{yamlModel}
+
+## FACILITY_INPUTS
+We specify CSV input data for processing equipment using FACILITY_INPUTS. This is used for generatorsets,
+tabulated/sampled models and pump charts. See [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md) for further details.
+
+Here we define a tabulated genset, a sampled compressor, and a single speed pump chart.
+Note that more complicated energy models are defined under the [MODELS](/about/references/keywords/MODELS.md)-keyword.
+
+{yamlModel}
+
+## FUEL_TYPES
+In this example there are two [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md) - `fuel_gas` and `bad_fuel_gas`.
+These are used for Installation A and Installation B respectively.
+Here we also define emissions in CO2 and CH4:
+
+{yamlModel}
+
+## MODELS
+
+This advanced example requires some energy usage models to be defined under the model section. See [MODELS](/about/references/keywords/MODELS.md) for details.
+
+Here we specify:
+- Compressor chart based on design points
+- Compressor chart based on chart data
+- Medium density fluid
+- Gas turbine
+- Simplified compressor train model
+
+{yamlModel}
+
+See [MODELS](/about/references/keywords/MODELS.md) for further details.
+
+## VARIABLES
+To run the model it is recommended to specify [VARIABLES](/about/references/keywords/VARIABLES.md),
+instead of hard coding values in difference places. This makes it easier to develop, maintain and understand the model
+by allowing descriptive variable names and avoid duplications.
+
+For our model, we specify the following variables:
+
+{yamlModel}
+
+We reference the [TIME_SERIES](#time_series) `SIM` using the column names from the CSV file.
+
+:::tip
+You can use boolean condition such as shown in base_production_load_mw and time varying variables such as shown in
+flare_a_fuel_rate_sm3_day and flare_b_fuel_rate_sm3_day to write simpler models with less duplicated code.
+
+The base_production_load_mw adds another 4.1 MW when the gas lift injection rate is positive.
+
+The flare rate changes in year 2030.
+:::
+
+## INSTALLATIONS
+
+An installation is composed of hydrocarbon export, a default fuel for that installation and consumers in the form
+of generatorsets (with electric sub-consumers), and direct fuel consumers.
+
+We specify:
+- `NAME`: the installation name
+- `HCEXPORT`: Hydrocarbon export in Sm3/day by referring to the variable $var.hydrocarbon_export_sm3_per_day specified under [VARIABLES](#variables) above.
+- `FUEl`: Default fuel specified in [FUEL_TYPES](#fuel_types) above. Note the different fuels used by the two installations.
+- `CATEGORY`: FIXED (installation) category is used to group result data for reporting. See [CATEGORY](/about/references/keywords/CATEGORY.md) for details.
+
+~~~~~~~~yaml
+INSTALLATIONS:
+ - NAME: Installation A
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: fuel_gas
+ CATEGORY: FIXED
+ GENERATORSETS:
+
+ FUELCONSUMERS:
+
+ - NAME: Installation B
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: bad_fuel_gas
+ CATEGORY: FIXED
+ GENERATORSETS:
+
+ FUELCONSUMERS:
+
+~~~~~~~~
+
+### Installation A
+There is one generator set, `Generator set A`. This has a power to fuel function defined in
+[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumers getting
+power from the generator set are *Base production load*, *Gas injection compressor*, *Produced water reinjection pump*
+and *Sea-water injection pump*.
+
+The direct fuel consumers are **Flare**.
+
+The setup for `Installation A` thus becomes:
+
+~~~~~~~~yaml
+ - NAME: Installation A
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: fuel_gas
+ CATEGORY: FIXED
+ GENERATORSETS:
+ - NAME: Generator set A
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads A
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+ - NAME: Gas export compressors system A
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+ - NAME: Water injection pump system A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ - NAME: Single pump A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ FUELCONSUMERS:
+ - NAME: Flare A
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+~~~~~~~~
+
+### Installation B
+There is one generator set, `Generator set B`. This has a power to fuel function defined in
+[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumer getting
+power from the generator set is *Base production load*.
+
+The direct fuel consumers are **Flare** and **Gas export compressor**.
+
+The setup for `Installation B` thus becomes:
+
+~~~~~~~~yaml
+ - NAME: Installation B
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: bad_fuel_gas
+ CATEGORY: FIXED
+ GENERATORSETS:
+ - NAME: Generator set B
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads B
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+ FUELCONSUMERS:
+ - NAME: Flare B
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+ - NAME: Gas export compressors B
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+~~~~~~~~
+
+## ENERGY_USAGE_MODEL
+We will now fill in the final placeholders with detailed [ENERGY_USAGE_MODEL](/about/references/keywords/ENERGY_USAGE_MODEL.md)s.
+
+`Base production loads A` has a load of 7.6 MW with additional 4.1 MW when the field gas injection rate is positive:
+
+{yamlModel}
+
+`Gas export compressor system A` is represented by a consumer system of two simplified compressor train models.
+The system has defined the variable [gas_export_rate_sm3_per_day](#variables) and will run two different
+rate distributions between these two compressor trains. It will first send all rate to the first compressor train
+and nothing to the second `RATE_FRACTIONS: [1.0, 0.0]` and then it will run the same input while distributing equal
+rates to the two compressor trains `RATE_FRACTIONS: [0.5, 0.5]`. The final result will be composed of the first
+setting that returns a valid result for the compressors.
+See [COMPRESSOR_SYSTEM](/about/modelling/setup/installations/compressor_models_in_calculations/compressor_system.md) for further details.
+
+The model compressor model is defined:
+{yamlModel}
+
+`Water injection pump system A` is variable and its energy function is dependent on the field's water
+injection rate (`WATER_INJ`) that is set in the variable [water_injection_rate](#variables) as `SIM;WATER_INJ`.
+The pump only runs when the variables [water_injection_condition](#variables) evaluates to true as `SIM;WATER_PROD > 0`.
+This is when the water injection rate is positive. Fluid density, suction pressure and discharge pressure
+is also defined.
+
+This PUMP_SYSTEM behaves much the same as the COMPRESSOR_SYSTEM above.
+See [PUMP_SYSTEM](/about/modelling/setup/installations/pump_models_in_calculations.md#pump_system-energy-usage-model) for further details.
+{yamlModel}
+
+`Single pump A` has an energy function that is dependent on the seawater injection rate, same as the system above.
+It uses the pump_chart defined in [FACILITY_INPUTS](#facility_inputs) above.
+
+The pump model is then defined:
+{yamlModel}
+
+The `Flare A` is changing on the 1st of July 2020 and 1st of January 2030. Therefore, we need to use a different constant
+fuel consumption value before and after this date. This is done using the variable [flare_a_fuel_rate_sm3_day](#variables).
+
+The model becomes:
+{yamlModel}
+
+`Base production loads B` has a load of 7.6 :
+{yamlModel}
+
+The `Flare B` is changing on the 1st of July 2020 and 1st of January 2030. Therefore, we need to use a different constant
+fuel consumption value before and after this date. This is done using the variable [flare_a_fuel_rate_sm3_day](#variables).
+
+The model becomes:
+{yamlModel}
+
+The `Gas export compressors B` is a variable fuel consumer whose energy function depends on the field gas production rate (`GAS_PROD`) defined
+in the variable [gas_export_rate_sm3_per_day](#variables) as `SIM;GAS_PROD`, and put to the condition [gas_export_condition](#variables) as `SIM;GAS_PROD > 0`
+
+The model is specified:
+{yamlModel}
+
+## Full eCalc YAML model
+{yamlModel}
+
+### Input files
+{compressorChartCsv}
+{compressorSampledCsv}
+{genset}
+{pumpChart}
+{baseProfile}
diff --git a/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/base_profile.csv b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/base_profile.csv
new file mode 100644
index 0000000000..a97ba579de
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/base_profile.csv
@@ -0,0 +1,23 @@
+DATE, OIL_PROD, WATER_PROD, GAS_PROD, WATER_INJ, GAS_LIFT
+01.01.2020, 1000, 20000, 4000000, 30000, 1200000
+01.01.2021, 1000, 20000, 4000000, 30000, 1200000
+01.01.2022, 1000, 20000, 4000000, 30000, 1200000
+01.01.2023, 2500, 21000, 4000000, 30000, 1200000
+01.01.2024, 3000, 22000, 4500000, 28000, 1300000
+01.01.2025, 3500, 23000, 5000000, 26000, 1350000
+01.01.2026, 4000, 24000, 5500000, 25000, 1400000
+01.01.2027, 4000, 25000, 6000000, 24000, 1400000
+01.01.2028, 4000, 20000, 6000000, 23000, 1400000
+01.01.2029, 5000, 20000, 5500000, 22000, 1350000
+01.01.2030, 9000, 20000, 5000000, 21000, 1300000
+01.01.2031, 5000, 20000, 3000000, 22000, 1300000
+01.01.2032, 4000, 22100, 3000000, 23000, 2000000
+01.01.2033, 4000, 22100, 3000000, 23000, 2000000
+01.01.2034, 1200, 25000, 1000000, 21000, 2000000
+01.01.2035, 1100, 25000, 1000000, 20000, 1500000
+01.01.2036, 1000, 22000, 500000, 18000, 1400000
+01.01.2037, 900, 20000, 500000, 17000, 1400000
+01.01.2038, 800, 18000, 500000, 17000, 1400000
+01.01.2039, 700, 18000, 200000, 17000, 1400000
+01.01.2040, 600, 10000, 200000, 15000, 1400000
+01.01.2041, 0, 0, 0, 0, 0
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_chart.csv b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_chart.csv
new file mode 100644
index 0000000000..0fcd7d9c09
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_chart.csv
@@ -0,0 +1,12 @@
+RATE, HEAD, EFFICIENCY, SPEED
+# [m3/h], [m], [frac], [rpm]
+3000, 8500, 0.72, 7500
+3500, 8000, 0.75, 7500
+4000, 7500, 0.74, 7500
+4500, 6500, 0.70, 7500
+4100, 16500, 0.72, 10500
+4600, 16000, 0.73, 10500
+5000, 15500, 0.74, 10500
+5500, 14500, 0.74, 10500
+6000, 13500, 0.72, 10500
+6500, 12000, 0.70, 10500
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_sampled.csv b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_sampled.csv
new file mode 100644
index 0000000000..3d21a6c1ba
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/compressor_sampled.csv
@@ -0,0 +1,5 @@
+RATE, FUEL
+0, 0
+0.01, 100
+10, 500
+20, 1200
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/genset.csv b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/genset.csv
new file mode 100644
index 0000000000..8b389f4147
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/genset.csv
@@ -0,0 +1,8 @@
+POWER, FUEL
+# [MW], [Sm3/d]
+0, 0
+0.1, 75000
+10, 80000
+20, 100000
+50, 500000
+100, 1000000
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/model.yaml b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/model.yaml
new file mode 100644
index 0000000000..548bd10b20
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/model.yaml
@@ -0,0 +1,210 @@
+TIME_SERIES:
+ - NAME: SIM
+ TYPE: DEFAULT
+ FILE: base_profile.csv
+
+FACILITY_INPUTS:
+ - NAME: genset
+ FILE: genset.csv
+ TYPE: ELECTRICITY2FUEL
+ - NAME: gasexp
+ FILE: compressor_sampled.csv
+ TYPE: COMPRESSOR_TABULAR
+ - NAME: pump_chart
+ FILE: pump_chart.csv
+ TYPE: PUMP_CHART_SINGLE_SPEED
+ UNITS:
+ RATE: AM3_PER_HOUR
+ HEAD: M
+ EFFICIENCY: PERCENTAGE
+
+FUEL_TYPES:
+ - NAME: fuel_gas
+ CATEGORY: FUEL-GAS
+ EMISSIONS:
+ - NAME: CO2
+ FACTOR: 2.20 #kg/Sm3
+ - NAME: CH4
+ FACTOR: 0.01 #kg/Sm3
+ - NAME: bad_fuel_gas
+ CATEGORY: FUEL-GAS
+ EMISSIONS:
+ - NAME: CO2
+ FACTOR: 5.0 #kg/Sm3
+ - NAME: CH4
+ FACTOR: 0.01 #kg/Sm3
+
+MODELS:
+ - NAME: generic_from_design_point_compressor_chart
+ TYPE: COMPRESSOR_CHART
+ CHART_TYPE: GENERIC_FROM_DESIGN_POINT
+ POLYTROPIC_EFFICIENCY: 0.75
+ DESIGN_RATE: 10000
+ DESIGN_HEAD: 80
+ UNITS:
+ RATE: AM3_PER_HOUR
+ HEAD: KJ_PER_KG
+ EFFICIENCY: FRACTION
+ - NAME: predefined_variable_speed_compressor_chart
+ TYPE: COMPRESSOR_CHART
+ CHART_TYPE: VARIABLE_SPEED
+ UNITS:
+ RATE: AM3_PER_HOUR
+ HEAD: M # M or KJ_PER_KG
+ EFFICIENCY: FRACTION
+ CURVES:
+ FILE: compressor_chart.csv
+ - NAME: medium_fluid
+ TYPE: FLUID
+ FLUID_MODEL_TYPE: PREDEFINED
+ EOS_MODEL: SRK
+ GAS_TYPE: MEDIUM
+ - NAME: turbine
+ TYPE: TURBINE
+ LOWER_HEATING_VALUE: 38 # MJ/Sm3
+ TURBINE_LOADS: [0, 2.352, 4.589, 6.853, 9.125, 11.399, 13.673, 15.947, 18.223, 20.496, 22.767] # MW
+ TURBINE_EFFICIENCIES: [0, 0.138, 0.210, 0.255, 0.286, 0.310, 0.328, 0.342, 0.353, 0.360, 0.362]
+ - NAME: simplified_compressor_train_model
+ TYPE: SIMPLIFIED_VARIABLE_SPEED_COMPRESSOR_TRAIN
+ FLUID_MODEL: medium_fluid
+ COMPRESSOR_TRAIN:
+ STAGES:
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: generic_from_design_point_compressor_chart
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: generic_from_design_point_compressor_chart
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: predefined_variable_speed_compressor_chart
+
+VARIABLES:
+ hydrocarbon_export_sm3_per_day:
+ VALUE: SIM;OIL_PROD {+} SIM;GAS_PROD {/} 1000
+ gas_export_rate_sm3_per_day:
+ VALUE: SIM;GAS_PROD
+ water_injection_rate:
+ VALUE: SIM;WATER_INJ
+ gas_export_condition:
+ VALUE: SIM;GAS_PROD > 0
+ base_production_load_mw:
+ VALUE: 7.6 {+} 4.1 {*} (SIM;GAS_LIFT > 0)
+ water_injection_condition:
+ VALUE: SIM;WATER_PROD >0
+ flare_a_fuel_rate_sm3_day:
+ 2020-06-01:
+ VALUE: 5000
+ 2030-01-01:
+ VALUE: 2000
+ flare_b_fuel_rate_sm3_day:
+ 2020-06-01:
+ VALUE: 10000
+ 2030-01-01:
+ VALUE: 7000
+
+INSTALLATIONS:
+ - NAME: Installation A
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: fuel_gas
+ CATEGORY: FIXED
+ GENERATORSETS:
+ - NAME: Generator set A
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads A
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ LOAD: $var.base_production_load_mw
+ - NAME: Gas export compressors system A
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+ TYPE: COMPRESSOR_SYSTEM
+ COMPRESSORS:
+ - NAME: train1_A
+ COMPRESSOR_MODEL: simplified_compressor_train_model
+ - NAME: train2_A
+ COMPRESSOR_MODEL: simplified_compressor_train_model
+ TOTAL_SYSTEM_RATE: $var.gas_export_rate_sm3_per_day
+ OPERATIONAL_SETTINGS:
+ - RATE_FRACTIONS: [1.0, 0.0]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 120
+ - RATE_FRACTIONS: [0.5, 0.5]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 120
+ - NAME: Water injection pump system A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ TYPE: PUMP_SYSTEM
+ PUMPS:
+ - NAME: pump1
+ CHART: pump_chart
+ - NAME: pump2
+ CHART: pump_chart
+ - NAME: pump3
+ CHART: pump_chart
+ - NAME: pump4
+ CHART: pump_chart
+ FLUID_DENSITY: 1026
+ TOTAL_SYSTEM_RATE: $var.water_injection_rate
+ CONDITION: $var.water_injection_condition
+ OPERATIONAL_SETTINGS:
+ - RATE_FRACTIONS: [1, 0, 0, 0]
+ SUCTION_PRESSURES: [3, 3, 3, 3]
+ DISCHARGE_PRESSURES: [200, 200, 200, 200]
+ CROSSOVER: [2, 0, 0, 0]
+ - RATE_FRACTIONS: [0.5, 0.5, 0, 0]
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.33, 0.33, 0.34, 0]
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.25, 0.25, 0.25, 0.25]
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ - NAME: Single pump A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ TYPE: PUMP
+ CONDITION: $var.water_injection_condition
+ ENERGYFUNCTION: pump_chart
+ RATE: 5000
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ FLUID_DENSITY: 1026
+ FUELCONSUMERS:
+ - NAME: Flare A
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ FUELRATE: $var.flare_a_fuel_rate_sm3_day
+
+ - NAME: Installation B
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: bad_fuel_gas
+ CATEGORY: FIXED
+ GENERATORSETS:
+ - NAME: Generator set B
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads B
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ LOAD: 7.6
+ FUELCONSUMERS:
+ - NAME: Flare B
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ FUELRATE: $var.flare_b_fuel_rate_sm3_day
+ - NAME: Gas export compressors B
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+ TYPE: COMPRESSOR
+ ENERGYFUNCTION: gasexp
+ CONDITION: $var.gas_export_condition
+ RATE: $var.gas_export_rate_sm3_per_day
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 200
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/pump_chart.csv b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/pump_chart.csv
new file mode 100644
index 0000000000..8b8f3e01c8
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/advanced_with_invalid_timesteps/pump_chart.csv
@@ -0,0 +1,10 @@
+RATE, HEAD, EFFICIENCY, SPEED
+# [m3/h], [m], [%], [rpm]
+250, 2350, 50, 10000
+300, 2300, 55, 10000
+350, 2250, 60, 10000
+400, 2200, 70, 10000
+450, 2150, 75, 10000
+500, 2100, 80, 10000
+550, 2050, 75, 10000
+600, 2000, 70, 10000
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/index.md b/docs/docs/about/modelling/course_material/index.md
new file mode 100644
index 0000000000..031d5a63ae
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/index.md
@@ -0,0 +1,11 @@
+---
+sidebar_position: 8
+description: Examples of eCalc usage
+---
+# Course material
+Here you find modelling course material.
+
+- [Simple model example with invalid timesteps](/about/modelling/course_material/simple_invalid_timesteps.mdx)
+- [Advanced model example with invalid timesteps](/about/modelling/course_material/advanced_invalid_timesteps.mdx)
+
+The models are also available in the Python library under the libecalc.examples module.
diff --git a/docs/docs/about/modelling/course_material/simple_invalid_timesteps.mdx b/docs/docs/about/modelling/course_material/simple_invalid_timesteps.mdx
new file mode 100644
index 0000000000..d1ebbe49a6
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_invalid_timesteps.mdx
@@ -0,0 +1,244 @@
+import CodeLinesFromFile from "../../../../src/components/CodeLinesFromFile";
+import CodeBlock from '@theme/CodeBlock';
+import compressorSampledCsv from '!!raw-loader!./simple_with_invalid_timesteps/compressor_sampled.csv';
+import compressorSampledWithTurbineCsv from '!!raw-loader!./simple_with_invalid_timesteps/compressor_sampled_with_turbine.csv';
+import genset from '!!raw-loader!./simple_with_invalid_timesteps/genset.csv';
+import productionData from '!!raw-loader!./simple_with_invalid_timesteps/production_data.csv';
+import pumpChart from '!!raw-loader!./simple_with_invalid_timesteps/pump_chart.csv';
+import pumpSampled from '!!raw-loader!./simple_with_invalid_timesteps/pump_sampled.csv';
+import yamlModel from '!!raw-loader!./simple_with_invalid_timesteps/model.yaml';
+
+# Simple model example with invalid timesteps
+The following is an example with one installation called `Installation A` that exports oil (`OIL_PROD`) and gas (`GAS_PROD`).
+The installation emits CO2.
+
+On this installation, the following components are identified:
+
+```mermaid
+graph TD;
+ A(Installation A) --> B(Flare);
+ A --> C(Gas export compressor);
+ A --> D(Generator set A);
+ D --> E(Base production load);
+ D --> F(Gas injection compressor);
+ D --> G(Produced water reinjection pump);
+ D --> H(Sea water injection pump);
+ style A stroke:red;
+ style E stroke:blue;
+ style F stroke:blue;
+ style G stroke:blue;
+ style H stroke:blue;
+```
+
+The results of a performed characterization of the equipment are listed below:
+
+| Consumer |Type | Description |
+|----------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Generator set A |Generator set | Variable fuel consumer with electricity to fuel function |
+| Base production load |Power consumer | Constant load 11.8 MW |
+| Gas injection compressor |Power consumer | Variable consumption depending on gas injection rate and lift gas rate |
+| Produced water reinjection pump |Power consumer | Variable consumption depending on water production rate and water injection rate. The pump suction pressure is 10 bar and discharge pressure is 200 bar. |
+| Sea water injection pump |Power consumer | Variable consumption depending on a complex combination on water injection rate and water production rate |
+| Flare |Direct fuel consumer| Before 1.1.2005: Constant fuel rate 10000 Sm3/day, From 1.1.2005: Constant fuel rate 7000 Sm3/day |
+| Gas export compressor |Direct fuel consumer| Variable fuel consumer depending on gas sales rate |
+
+## YAML model overview
+The YAML model consist of these main components:
+- Time series inputs - [TIME_SERIES](/about/references/keywords/TIME_SERIES.md)
+- Facility characterization input - [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md)
+- Fuel input - [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md)
+- Model variables - [VARIABLES](/about/references/keywords/VARIABLES.md)
+- Installation topology - [INSTALLATIONS](/about/references/keywords/INSTALLATIONS.md)
+
+The YAML setup file looks like this:
+
+~~~~~~~~yaml title="model.yaml"
+TIME_SERIES:
+
+FACILITY_INPUTS:
+
+FUEL_TYPES:
+
+VARIABLES:
+
+INSTALLATIONS:
+
+~~~~~~~~
+
+We will now replace the placeholders for each of the main keywords above.
+
+## TIME_SERIES
+The reservoir variables, in this case, are found in a CSV (Comma separated file) `production_data.csv`.
+We give the time-series data a name that can be referenced as variables elsewhere in the form `:`.
+See [TIME_SERIES](/about/references/keywords/TIME_SERIES.md) for further details.
+
+{yamlModel}
+
+## FACILITY_INPUTS
+We specify CSV input data for processing equipment using FACILITY_INPUTS. This is used for generatorsets,
+tabulated/sampled models and pump charts.
+See [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md) for further details.
+
+Here we define a tabulated genset, a sampled compressor, a sampled compressor driven by a turbine, a sampled pump,
+and a single speed pump chart. These will be used in the final model for illustration.
+Note that more complicated energy models are defined under the [MODELS-keyword](/about/references/keywords/MODELS.md).
+
+See the input data further down to understand the input formats.
+
+{yamlModel}
+
+## FUEL_TYPES
+In this example there is only one [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md) - `fuel_gas`. The emissions we model with the fuel is CO2. The CO2 factor
+is 2.19 kg CO2 per Sm3 fuel gas burned.
+
+{yamlModel}
+
+## VARIABLES
+To run the model it is recommended to specify [VARIABLES](/about/references/keywords/VARIABLES.md),
+instead of hard coding values in difference places. This makes it easier to develop, maintain and understand the model
+by allowing descriptive variable names and avoid duplications.
+
+For our model, we specify the following variables:
+
+{yamlModel}
+
+We reference the [TIME_SERIES](#time_series) `SIM` using the column names from the CSV file. Here we use for example
+`SIM:OIL_PROD` (Field Oil Production Rate) `SIM:GAS_PROD` (Field Gas Sales Rate).
+
+:::tip
+It is possible to specify if-else conditions by multiplying with boolean values.
+This has been done in the $var.sea_water_injection_rate_m3_per_day variable example above.
+:::
+
+## INSTALLATION
+
+An installation is composed of hydrocarbon export, a default fuel for that installation and consumers in the form
+of generatorsets (with electric sub-consumers), and direct fuel consumers.
+
+We specify:
+- `NAME`: the installation name
+- `HCEXPORT`: Hydrocarbon export in Sm3/day by referring to the variable specified under [VARIABLES](#variables) above.
+- `FUEl`: Default fuel specified in [FUEL_TYPES](#fuel_types) above.
+
+~~~~~~~~yaml
+INSTALLATIONS:
+ - NAME: Installation A
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: fuel_gas
+ GENERATORSETS:
+
+ FUELCONSUMERS:
+
+~~~~~~~~
+
+### GENERATORSETS
+There is one generator set, `Generator set A`. This has a power to fuel function defined in
+[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumers getting
+power from the generator set are *Base production load*, *Gas injection compressor*, *Produced water re-injection pump*
+and *Sea-water injection pump*. The setup for `Generator set A` thus becomes:
+
+~~~~~~~~yaml
+ GENERATORSETS:
+ - NAME: Generator set A
+ ELECTRICITY2FUEL: genset
+ CATEGORY: TURBINE-GENERATOR
+ CONSUMERS:
+ - NAME: Base production load
+ CATEGORY: BASE-LOAD
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Gas injection compressor
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Produced water reinjection pump
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Sea water injection pump
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+
+~~~~~~~~
+
+### FUELCONSUMERS
+The direct fuel consumers are **Flare** and **Gas export compressor**.
+~~~~~~~~yaml title="model.yaml"
+ FUELCONSUMERS:
+ - NAME: Flare
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Gas export compressor
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+
+~~~~~~~~
+
+## ENERGY_USAGE_MODEL
+We will now fill in the final placeholders with detailed [ENERGY_USAGE_MODEL](/about/references/keywords/ENERGY_USAGE_MODEL.md)s.
+
+
+`Base production load` has a constant load of 11.8 MW:
+
+{yamlModel}
+
+`Gas injection compressor` is represented by a tabulated (sampled) energy usage model defining the relationship
+between the gas injection rate [Sm3/day] and the corresponding power requirement. The gas rate is already defined
+in the variable [gas_injection_rate_sm3_per_day](#variables) as `SIM;GAS_INJ {+} SIM;GAS_LIFT`:
+
+{yamlModel}
+
+`Produced water reinjection pump` is variable and its energy function is dependent on the field's water
+production rate (`WATER_PROD`) that is set in the variable [produced_water_reinjection_condition](#variables) as `SIM;WATER_PROD`.
+The pump only runs when the variables [produced_water_reinjection_condition](#variables) evaluates to true as `SIM;WATER_PROD > 1500`.
+This is when the water production is above 1500 Sm3/day. Fluid density, suction pressure and discharge pressure
+is also defined:
+
+{yamlModel}
+
+`Sea water injection pump` has an energy function that is dependent on the seawater injection rate.
+This rate is not modeled explicitly in the reservoir input source, but it may be computed
+from the injection (`WATER_INJ`) and production (`WATER_PROD`) rate by the following rules:
+
+- In general, the seawater injection rate (`SEAWATER_INJ`), is the difference between injected and
+ produced water: `SEAWATER_INJ = WATER_INJ - WATER_PROD`.
+
+- When the produced water rate is below 1500 SM3/day, this goes directly to sea, such that
+ `SEAWATER_INJ = WATER_INJ` when `WATER_PROD < 1500`.
+
+- When the produced water rate is between 17000 and 18500 SM3/day, everything above 17000 SM3/day
+ goes directly to the sea, thus `SEAWATER_INJ = WATER_INJ - 17000` when `17000 < WATER_PROD < 18500`.
+
+This is specified as the variable [sea_water_injection_rate_m3_per_day](#variables) above and is defined as:
+
+The model is specified:
+
+{yamlModel}
+
+The flare is changing on the 1st of January 2005. Therefore, we need to use a different constant
+fuel consumption value before and after this date. This is done using the variable [flare_fuel_rate_sm3_day](#variables)
+above.
+
+The model is specified:
+
+{yamlModel}
+
+Gasexport is a variable fuel consumer whose energy function depends on the field gas sales rate (`GAS_PROD`) defined
+in the variable [gas_export_rate_sm3_per_day](#variables) as `SIM;GAS_PROD`. Even though it is not used in the eCalc model, suction and discharge pressure needs to be specified in order for the model to run.
+
+The model is specified:
+
+{yamlModel}
+
+## Full eCalc YAML model
+
+{yamlModel}
+
+## Input files
+{compressorSampledCsv}
+{compressorSampledWithTurbineCsv}
+{genset}
+{pumpChart}
+{pumpSampled}
+{productionData}
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled.csv b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled.csv
new file mode 100644
index 0000000000..9372cef0bb
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled.csv
@@ -0,0 +1,17 @@
+RATE,POWER
+#[Sm3/day],[MW]
+0,0
+1,4.1
+100000000,4.1
+200000000,4.1
+210000000,4.1
+220000000,4.4
+230000000,4.8
+240000000,5.1
+250000000,5.4
+260000000,5.8
+270000000,6.1
+280000000,6.4
+290000000,6.8
+300000000,7.1
+500000000,14.2
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled_with_turbine.csv b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled_with_turbine.csv
new file mode 100644
index 0000000000..befc4bc6a8
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/compressor_sampled_with_turbine.csv
@@ -0,0 +1,7 @@
+RATE,FUEL
+#[Sm3/day],[Sm3/day]
+0,0
+0.1,50000
+3000000,50000
+3500000,130000
+7000000,170000
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/genset.csv b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/genset.csv
new file mode 100644
index 0000000000..5b758dcf03
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/genset.csv
@@ -0,0 +1,8 @@
+POWER,FUEL
+#[MW],[Sm3/day]
+0, 0
+0.1, 65000
+10.0, 75000
+20.0, 126000
+40.0, 250000
+100.0, 750000
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/model.yaml b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/model.yaml
new file mode 100644
index 0000000000..489e833b9b
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/model.yaml
@@ -0,0 +1,104 @@
+TIME_SERIES:
+ - NAME: SIM
+ FILE: production_data.csv
+ TYPE: DEFAULT
+FACILITY_INPUTS:
+ - NAME: genset
+ FILE: genset.csv
+ TYPE: ELECTRICITY2FUEL
+ - NAME: compressor_sampled
+ FILE: compressor_sampled.csv
+ TYPE: COMPRESSOR_TABULAR
+ - NAME: compressor_with_turbine_sampled
+ FILE: compressor_sampled_with_turbine.csv
+ TYPE: COMPRESSOR_TABULAR
+ - NAME: pump_sampled
+ FILE: pump_sampled.csv
+ TYPE: TABULAR
+ - NAME: pump_chart
+ FILE: pump_chart.csv
+ TYPE: PUMP_CHART_SINGLE_SPEED
+ UNITS:
+ HEAD: M
+ RATE: AM3_PER_HOUR
+ EFFICIENCY: PERCENTAGE
+
+FUEL_TYPES:
+ - NAME: fuel_gas
+ EMISSIONS:
+ - NAME: CO2
+ FACTOR: 2.19 # CO2/Sm3 fuel gas burned
+
+VARIABLES:
+ hydrocarbon_export_sm3_per_day:
+ VALUE: SIM;OIL_PROD {+} SIM;GAS_PROD {/} 1000 # divide the gas rate by 1000 to get oil equivalent
+ sea_water_injection_rate_m3_per_day:
+ VALUE: SIM;WATER_INJ {-} SIM;WATER_PROD {+} SIM;WATER_PROD {*} (SIM;WATER_PROD < 1500) {+} (SIM;WATER_PROD {-} 17000) {*} (SIM;WATER_PROD > 17000) {*} (SIM;WATER_PROD < 18500)
+ gas_export_rate_sm3_per_day:
+ VALUE: SIM;GAS_PROD
+ gas_injection_rate_sm3_per_day:
+ VALUE: SIM;GAS_INJ {+} SIM;GAS_LIFT
+ produced_water_reinjection_condition:
+ VALUE: SIM;WATER_PROD > 1500
+ produced_water_reinjection_total_system_rate_m3_per_day:
+ VALUE: SIM;WATER_PROD
+ flare_fuel_rate_sm3_day:
+ 1995-10-01:
+ VALUE: 10000
+ 2005-01-01:
+ VALUE: 7000
+
+INSTALLATIONS:
+ - NAME: Installation A
+ HCEXPORT: $var.hydrocarbon_export_sm3_per_day
+ FUEL: fuel_gas
+ GENERATORSETS:
+ - NAME: Generator set A
+ ELECTRICITY2FUEL: genset
+ CATEGORY: TURBINE-GENERATOR
+ CONSUMERS:
+ - NAME: Base production load
+ CATEGORY: BASE-LOAD
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ LOAD: 11.8 # MW
+ - NAME: Gas injection compressor
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+ TYPE: COMPRESSOR
+ ENERGYFUNCTION: compressor_sampled
+ RATE: $var.gas_injection_rate_sm3_per_day
+ SUCTION_PRESSURE: 50 #not used but a number is needed for eCalc
+ DISCHARGE_PRESSURE: 200 #not used but a number is needed for eCalc
+ - NAME: Produced water reinjection pump
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ TYPE: PUMP
+ CONDITION: $var.produced_water_reinjection_condition
+ ENERGYFUNCTION: pump_chart
+ RATE: $var.produced_water_reinjection_total_system_rate_m3_per_day
+ FLUID_DENSITY: 1010
+ SUCTION_PRESSURE: 10 # bara
+ DISCHARGE_PRESSURE: 200 # bara
+ - NAME: Sea water injection pump
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ TYPE: TABULATED
+ ENERGYFUNCTION: pump_sampled
+ VARIABLES:
+ - NAME: RATE
+ EXPRESSION: $var.sea_water_injection_rate_m3_per_day
+ FUELCONSUMERS:
+ - NAME: Flare
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ FUELRATE: $var.flare_fuel_rate_sm3_day
+ - NAME: Gas export compressor
+ CATEGORY: GAS-DRIVEN-COMPRESSOR
+ ENERGY_USAGE_MODEL:
+ TYPE: COMPRESSOR
+ ENERGYFUNCTION: compressor_with_turbine_sampled
+ RATE: $var.gas_export_rate_sm3_per_day
+ SUCTION_PRESSURE: 50 #not used but a number is needed for eCalc
+ DISCHARGE_PRESSURE: 200 #not used but a number is needed for eCalc
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/production_data.csv b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/production_data.csv
new file mode 100644
index 0000000000..fdca18ae62
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/production_data.csv
@@ -0,0 +1,14 @@
+Dates, OIL_PROD, GAS_PROD, WATER_PROD, WATER_INJ, GAS_INJ, GAS_LIFT
+#, Sm3/d, Sm3/d, m3/d, m3/d, Sm3/d, Sm3/d
+2020-01-01 00:00:00, 9000, 3500000, 18000, 34000, 2200000, 130000
+2021-01-01 00:00:00, 8000, 3600000, 19000, 33000, 2200000, 170000
+2022-01-01 00:00:00, 7000, 3700000, 15000, 30000, 2200000, 210000
+2023-01-01 00:00:00, 6000, 3800000, 16000, 33000, 2300000, 240000
+2024-01-01 00:00:00, 6000, 3900000, 14000, 35000, 2300000, 280000
+2024-12-01 00:00:00, 6000, 4000000, 15000, 36000, 2400000, 310000
+2026-01-01 00:00:00, 7000, 4100000, 18000, 36000, 2400000, 350000
+2027-01-01 00:00:00, 6000, 4500000, 15000, 38000, 2400000, 390000
+2028-01-01 00:00:00, 6000, 3500000, 12000, 33000, 2400000, 430000
+2029-01-01 00:00:00, 5000, 2500000, 14000, 36000, 2400000, 460000
+2030-01-01 00:00:00, 6000, 2000000, 16000, 35000, 2400000, 500000
+2031-01-01 00:00:00, 4000, 3000000, 14000, 33000, 2400000, 530000
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_chart.csv b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_chart.csv
new file mode 100644
index 0000000000..ef30bd7a44
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_chart.csv
@@ -0,0 +1,7 @@
+SPEED,RATE,HEAD,EFFICIENCY
+3250,250,2640,59
+3250,360,2490,68
+3250,500,2342,77
+3250,600,2210,80
+3250,667,2068,78
+3250,735,1870,74
\ No newline at end of file
diff --git a/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_sampled.csv b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_sampled.csv
new file mode 100644
index 0000000000..e5ad7f7682
--- /dev/null
+++ b/docs/docs/about/modelling/course_material/simple_with_invalid_timesteps/pump_sampled.csv
@@ -0,0 +1,9 @@
+RATE,POWER
+#[Sm3/day],[MW]
+0,0
+1,3
+8500,4
+9000,4
+17000,6
+17500,9
+36000,13
\ No newline at end of file
diff --git a/docs/docs/about/modelling/examples/advanced.md b/docs/docs/about/modelling/examples/advanced.md
deleted file mode 100644
index 2f22375b4d..0000000000
--- a/docs/docs/about/modelling/examples/advanced.md
+++ /dev/null
@@ -1,779 +0,0 @@
----
-sidebar_position: 2
-title: Advanced model
-description: An advanced model using consumer systems and two installations
----
-# Advanced model example
-This is a model very similar to [Simple example](/about/modelling/examples/simple.mdx). The main difference is the use of more advanced
-energy usage models and consumer systems, and the addition of a second installation.
-
-Both installations exports oil (`OIL_PROD`) and gas (`GAS_PROD`).
-The installations emits CO2 and CH4.
-
-The following is an example with one installation called `Installation A` and `Installation B`.
-
-```mermaid
-graph TD;
- Asset(Asset) --> A(Installation A);
- A(Installation A) --> AA(Flare A);
- A --> AD(Generator set A);
- AD --> AE(Base production load A);
- AD --> AF(Gas export compressor A);
- AD --> AG(Produced water reinjection pump A);
- AD --> AH(Sea water injection pump A);
-
- Asset --> B(Installation B);
- B --> BA(Generator set B);
- B --> BD(Gas export compressor B);
- BA --> BC(Base production load B);
- B --> BB(Flare B);
- style A stroke:red;
- style B stroke:red;
- style BC stroke:blue;
- style AE stroke:blue;
- style AF stroke:blue;
- style AG stroke:blue;
- style AH stroke:blue;
-```
-
-The results of a performed characterization of the equipment are listed below:
-
-| Consumer |Type | Description |
-|-------------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
-| Generator set A |Generator set | Variable fuel consumer with electricity to fuel function |
-| Base production load A |Power consumer | Production base load varying depending on a binary condition |
-| Gas export compressor A |Power consumer | Variable consumption depending on gas sales rate |
-| Produced water reinjection pump A |Power consumer | Variable consumption depending on water production rate and water injection rate. The pump suction pressure is 10 bar and discharge pressure is 200 bar. |
-| Sea water injection pump A |Power consumer | Variable consumption depending on a complex combination on water injection rate and water production rate |
-| Flare A |Direct fuel consumer| Flare A |
-| Generator set B |Generator set | Variable fuel consumption with electricity to fuel function |
-| Base production load B |Power consumer| Production base load at 7.6 MW |
-| Gas export compressor B |Direct fuel consumer| Variable fuel consumption depending on gas sales rate |
-| Flare B |Direct fuel consumer| Flare B |
-
-## YAML model overview
-The YAML model consist of these main components:
-- Time series inputs - [TIME_SERIES](/about/references/keywords/TIME_SERIES.md)
-- Facility characterization input - [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md)
-- Fuel input - [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md)
-- Model specifications - [MODELS](/about/references/keywords/MODELS.md)
-- Model variables - [VARIABLES](/about/references/keywords/VARIABLES.md)
-- Installation topology - [INSTALLATIONS](/about/references/keywords/INSTALLATIONS.md)
-
-The YAML setup file looks like this:
-
-~~~~~~~~yaml title="model.yaml"
-TIME_SERIES:
-
-FACILITY_INPUTS:
-
-FUEL_TYPES:
-
-VARIABLES:
-
-INSTALLATIONS:
-
-~~~~~~~~
-
-We will now replace the placeholders for each of the main keywords above.
-
-## TIME_SERIES
-The reservoir variables, in this case, are found in a CSV (Comma separated file) `production_data.csv`.
-We give the time-series data a name that can be referenced as variables elsewhere in the form `:`.
-See [TIME_SERIES](/about/references/keywords/TIME_SERIES.md) for further details.
-
-~~~~~~~~yaml title="model.yaml"
-TIME_SERIES:
- - NAME: SIM
- TYPE: DEFAULT
- FILE: base_profile.csv
-~~~~~~~~
-
-## FACILITY_INPUTS
-We specify CSV input data for processing equipment using FACILITY_INPUTS. This is used for generatorsets,
-tabulated/sampled models and pump charts. See [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md) for further details.
-
-Here we define a tabulated genset, a sampled compressor, and a single speed pump chart.
-Note that more complicated energy models are defined under the [MODELS](/about/references/keywords/MODELS.md)-keyword.
-
-~~~~~~~~yaml title="model.yaml"
-FACILITY_INPUTS:
- - NAME: genset
- FILE: genset.csv
- TYPE: ELECTRICITY2FUEL
- - NAME: gasexp
- FILE: compressor_sampled.csv
- TYPE: COMPRESSOR_TABULAR
- - NAME: pump_chart
- FILE: pump_chart.csv
- TYPE: PUMP_CHART_SINGLE_SPEED
- UNITS:
- RATE: AM3_PER_HOUR
- HEAD: M
- EFFICIENCY: PERCENTAGE
-~~~~~~~~
-
-## FUEL_TYPES
-In this example there are two [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md) - `fuel_gas` and `bad_fuel_gas`.
-These are used for Installation A and Installation B respectively.
-Here we also define emissions in CO2 and CH4:
-
-~~~~~~~~yaml title="model.yaml"
-FUEL_TYPES:
- - NAME: fuel_gas
- CATEGORY: FUEL-GAS
- EMISSIONS:
- - NAME: CO2
- FACTOR: 2.20 #kg/Sm3
- - NAME: CH4
- FACTOR: 0.01 #kg/Sm3
- - NAME: bad_fuel_gas
- CATEGORY: FUEL-GAS
- EMISSIONS:
- - NAME: CO2
- FACTOR: 5.0 #kg/Sm3
- - NAME: CH4
- FACTOR: 0.01 #kg/Sm3
-~~~~~~~~
-
-## MODELS
-
-This advanced example requires some energy usage models to be defined under the model section. See [MODELS](/about/references/keywords/MODELS.md) for details.
-
-Here we specify:
-- Compressor chart based on design points
-- Compressor chart based on chart data
-- Medium density fluid
-- Gas turbine
-- Simplified compressor train model
-
-~~~~~~~~yaml title="model.yaml"
-MODELS:
- - NAME: generic_from_design_point_compressor_chart
- TYPE: COMPRESSOR_CHART
- CHART_TYPE: GENERIC_FROM_DESIGN_POINT
- POLYTROPIC_EFFICIENCY: 0.75
- DESIGN_RATE: 10000
- DESIGN_HEAD: 80
- UNITS:
- RATE: AM3_PER_HOUR
- HEAD: KJ_PER_KG
- EFFICIENCY: FRACTION
- - NAME: predefined_variable_speed_compressor_chart
- TYPE: COMPRESSOR_CHART
- CHART_TYPE: VARIABLE_SPEED
- UNITS:
- RATE: AM3_PER_HOUR
- HEAD: M # M or KJ_PER_KG
- EFFICIENCY: FRACTION
- CURVES:
- FILE: compressor_chart.csv
- - NAME: medium_fluid
- TYPE: FLUID
- FLUID_MODEL_TYPE: PREDEFINED
- EOS_MODEL: SRK
- GAS_TYPE: MEDIUM
- - NAME: turbine
- TYPE: TURBINE
- LOWER_HEATING_VALUE: 38 # [MJ/Sm3]
- TURBINE_LOADS: [0, 2.352, 4.589, 6.853, 9.125, 11.399, 13.673, 15.947, 18.223, 20.496, 22.767] # MW
- TURBINE_EFFICIENCIES: [0, 0.138, 0.210, 0.255, 0.286, 0.310, 0.328, 0.342, 0.353, 0.360, 0.362]
- - NAME: simplified_compressor_train_model
- TYPE: SIMPLIFIED_VARIABLE_SPEED_COMPRESSOR_TRAIN
- FLUID_MODEL: medium_fluid
- COMPRESSOR_TRAIN:
- STAGES:
- - INLET_TEMPERATURE: 30
- COMPRESSOR_CHART: generic_from_design_point_compressor_chart
- - INLET_TEMPERATURE: 30
- COMPRESSOR_CHART: generic_from_design_point_compressor_chart
- - INLET_TEMPERATURE: 30
- COMPRESSOR_CHART: predefined_variable_speed_compressor_chart
-~~~~~~~~
-
-See [MODELS](/about/references/keywords/MODELS.md) for further details.
-
-## VARIABLES
-To run the model it is recommended to specify [VARIABLES](/about/references/keywords/VARIABLES.md),
-instead of hard coding values in difference places. This makes it easier to develop, maintain and understand the model
-by allowing descriptive variable names and avoid duplications.
-
-For our model, we specify the following variables:
-
-~~~~~~~~yaml title="model.yaml"
-VARIABLES:
- hydrocarbon_export_sm3_per_day:
- VALUE: SIM;OIL_PROD {+} SIM;GAS_PROD {/} 1000
- gas_export_rate_sm3_per_day:
- VALUE: SIM;GAS_PROD
- water_injection_rate:
- VALUE: SIM;WATER_INJ
- gas_export_condition:
- VALUE: SIM;GAS_PROD > 0
- base_production_load_mw:
- VALUE: 7.6 {+} 4.1 {*} (SIM;GAS_LIFT > 0)
- water_injection_condition:
- VALUE: SIM;WATER_PROD >0
- flare_a_fuel_rate_sm3_day:
- 2020-06-01:
- VALUE: 5000
- 2030-01-01:
- VALUE: 2000
- flare_b_fuel_rate_sm3_day:
- 2020-06-01:
- VALUE: 10000
- 2030-01-01:
- VALUE: 7000
-~~~~~~~~
-
-We reference the [TIME_SERIES](#time_series) `SIM` using the column names from the CSV file.
-
-:::tip
-You can use boolean condition such as shown in base_production_load_mw and time varying variables such as shown in
-flare_a_fuel_rate_sm3_day and flare_b_fuel_rate_sm3_day to write simpler models with less duplicated code.
-
-The base_production_load_mw adds another 4.1 MW when the gas lift injection rate is positive.
-
-The flare rate changes in year 2030.
-:::
-
-## INSTALLATIONS
-
-An installation is composed of hydrocarbon export, a default fuel for that installation and consumers in the form
-of generatorsets (with electric sub-consumers), and direct fuel consumers.
-
-We specify:
-- `NAME`: the installation name
-- `HCEXPORT`: Hydrocarbon export in Sm3/day by referring to the variable $var.hydrocarbon_export_sm3_per_day specified under [VARIABLES](#variables) above.
-- `FUEl`: Default fuel specified in [FUEL_TYPES](#fuel_types) above. Note the different fuels used by the two installations.
-- `CATEGORY`: FIXED (installation) category is used to group result data for reporting. See [CATEGORY](/about/references/keywords/CATEGORY.md) for details.
-
-~~~~~~~~yaml
-INSTALLATIONS:
- - NAME: Installation A
- HCEXPORT: $var.hydrocarbon_export_sm3_per_day
- FUEL: fuel_gas
- CATEGORY: FIXED
- GENERATORSETS:
-
- FUELCONSUMERS:
-
- - NAME: Installation B
- HCEXPORT: $var.hydrocarbon_export_sm3_per_day
- FUEL: bad_fuel_gas
- CATEGORY: FIXED
- GENERATORSETS:
-
- FUELCONSUMERS:
-
-~~~~~~~~
-
-### Installation A
-There is one generator set, `Generator set A`. This has a power to fuel function defined in
-[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumers getting
-power from the generator set are *Base production load*, *Gas injection compressor*, *Produced water reinjection pump*
-and *Sea-water injection pump*.
-
-The direct fuel consumers are **Flare**.
-
-The setup for `Installation A` thus becomes:
-
-~~~~~~~~yaml
- - NAME: Installation A
- HCEXPORT: $var.hydrocarbon_export_sm3_per_day
- FUEL: fuel_gas
- CATEGORY: FIXED
- GENERATORSETS:
- - NAME: Generator set A
- CATEGORY: TURBINE-GENERATOR
- ELECTRICITY2FUEL: genset
- CONSUMERS:
- - NAME: Fixed production loads A
- CATEGORY: FIXED-PRODUCTION-LOAD
- ENERGY_USAGE_MODEL:
- - NAME: Gas export compressors system A
- CATEGORY: COMPRESSOR
- ENERGY_USAGE_MODEL:
- - NAME: Water injection pump system A
- CATEGORY: PUMP
- ENERGY_USAGE_MODEL:
- - NAME: Single pump A
- CATEGORY: PUMP
- ENERGY_USAGE_MODEL:
- FUELCONSUMERS:
- - NAME: Flare A
- CATEGORY: FLARE
- ENERGY_USAGE_MODEL:
-~~~~~~~~
-
-### Installation B
-There is one generator set, `Generator set B`. This has a power to fuel function defined in
-[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumer getting
-power from the generator set is *Base production load*.
-
-The direct fuel consumers are **Flare** and **Gas export compressor**.
-
-The setup for `Installation B` thus becomes:
-
-~~~~~~~~yaml
- - NAME: Installation B
- HCEXPORT: $var.hydrocarbon_export_sm3_per_day
- FUEL: bad_fuel_gas
- CATEGORY: FIXED
- GENERATORSETS:
- - NAME: Generator set B
- CATEGORY: TURBINE-GENERATOR
- ELECTRICITY2FUEL: genset
- CONSUMERS:
- - NAME: Fixed production loads B
- CATEGORY: FIXED-PRODUCTION-LOAD
- ENERGY_USAGE_MODEL:
- FUELCONSUMERS:
- - NAME: Flare B
- CATEGORY: FLARE
- ENERGY_USAGE_MODEL:
- - NAME: Gas export compressors B
- CATEGORY: COMPRESSOR
- ENERGY_USAGE_MODEL:
-~~~~~~~~
-
-## ENERGY_USAGE_MODEL
-We will now fill in the final placeholders with detailed [ENERGY_USAGE_MODEL](/about/references/keywords/ENERGY_USAGE_MODEL.md)s.
-
-`Base production loads A` has a load of 7.6 MW with additional 4.1 MW when the field gas injection rate is positive:
-
-~~~~~~~~yaml
- - NAME: Fixed production loads A
- CATEGORY: FIXED-PRODUCTION-LOAD
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- LOAD: $var.base_production_load_mw
-~~~~~~~~
-
-`Gas export compressor system A` is represented by a consumer system of two simplified compressor train models.
-The system has defined the variable [gas_export_rate_sm3_per_day](#variables) and will run two different
-rate distributions between these two compressor trains. It will first send all rate to the first compressor train
-and nothing to the second `RATE_FRACTIONS: [1.0, 0.0]` and then it will run the same input while distributing equal
-rates to the two compressor trains `RATE_FRACTIONS: [0.5, 0.5]`. The final result will be composed of the first
-setting that returns a valid result for the compressors.
-See [COMPRESSOR_SYSTEM](/about/modelling/setup/installations/compressor_models_in_calculations/compressor_system.md) for further details.
-
-The model compressor model is defined:
-~~~~~~~~yaml
- - NAME: Gas export compressors system A
- CATEGORY: COMPRESSOR
- ENERGY_USAGE_MODEL:
- TYPE: COMPRESSOR_SYSTEM
- COMPRESSORS:
- - NAME: train1_A
- COMPRESSOR_MODEL: simplified_compressor_train_model
- - NAME: train2_A
- COMPRESSOR_MODEL: simplified_compressor_train_model
- TOTAL_SYSTEM_RATE: $var.gas_export_rate_sm3_per_day
- OPERATIONAL_SETTINGS:
- - RATE_FRACTIONS: [1.0, 0.0]
- SUCTION_PRESSURE: 20
- DISCHARGE_PRESSURE: 120
- - RATE_FRACTIONS: [0.5, 0.5]
- SUCTION_PRESSURE: 20
- DISCHARGE_PRESSURE: 120
-~~~~~~~~
-
-`Water injection pump system A` is variable and its energy function is dependent on the field's water
-injection rate (`WATER_INJ`) that is set in the variable [water_injection_rate](#variables) as `SIM;WATER_INJ`.
-The pump only runs when the variables [water_injection_condition](#variables) evaluates to true as `SIM;WATER_PROD > 0`.
-This is when the water injection rate is positive. Fluid density, suction pressure and discharge pressure
-is also defined.
-
-This PUMP_SYSTEM behaves much the same as the COMPRESSOR_SYSTEM above.
-See [PUMP_SYSTEM](/about/modelling/setup/installations/pump_models_in_calculations.md#pump_system-energy-usage-model) for further details.
-
-~~~~~~~~yaml
- - NAME: Water injection pump system A
- CATEGORY: PUMP
- ENERGY_USAGE_MODEL:
- TYPE: PUMP_SYSTEM
- PUMPS:
- - NAME: pump1
- CHART: pump_chart
- - NAME: pump2
- CHART: pump_chart
- - NAME: pump3
- CHART: pump_chart
- - NAME: pump4
- CHART: pump_chart
- FLUID_DENSITY: 1026
- TOTAL_SYSTEM_RATE: $var.water_injection_rate
- CONDITION: $var.water_injection_condition
- OPERATIONAL_SETTINGS:
- - RATE_FRACTIONS: [1, 0, 0, 0]
- SUCTION_PRESSURES: [3, 3, 3, 3]
- DISCHARGE_PRESSURES: [200, 200, 200, 200]
- CROSSOVER: [2, 0, 0, 0]
- - RATE_FRACTIONS: [0.5, 0.5, 0, 0]
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- - RATE_FRACTIONS: [0.33, 0.33, 0.34, 0]
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- - RATE_FRACTIONS: [0.25, 0.25, 0.25, 0.25]
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
-~~~~~~~~
-
-`Single pump A` has an energy function that is dependent on the seawater injection rate, same as the system above.
-It uses the pump_chart defined in [FACILITY_INPUTS](#facility_inputs) above.
-
-The pump model is then defined:
-~~~~~~~~yaml
- - NAME: Single pump A
- CATEGORY: PUMP
- ENERGY_USAGE_MODEL:
- TYPE: PUMP
- CONDITION: $var.water_injection_condition
- ENERGYFUNCTION: pump_chart
- RATE: 5000
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- FLUID_DENSITY: 1026
-~~~~~~~~
-
-The `Flare A` is changing on the 1st of July 2020 and 1st of January 2030. Therefore, we need to use a different constant
-fuel consumption value before and after this date. This is done using the variable [flare_a_fuel_rate_sm3_day](#variables).
-
-The model becomes:
-~~~~~~~~yaml
- - NAME: Flare A
- CATEGORY: FLARE
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- FUELRATE: $var.flare_a_fuel_rate_sm3_day
-~~~~~~~~
-
-
-`Base production loads B` has a load of 7.6 :
-
-~~~~~~~~yaml
- - NAME: Fixed production loads B
- CATEGORY: FIXED-PRODUCTION-LOAD
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- LOAD: 7.6
-~~~~~~~~
-
-The `Flare B` is changing on the 1st of July 2020 and 1st of January 2030. Therefore, we need to use a different constant
-fuel consumption value before and after this date. This is done using the variable [flare_a_fuel_rate_sm3_day](#variables).
-
-The model becomes:
-~~~~~~~~yaml
- - NAME: Flare B
- CATEGORY: FLARE
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- FUELRATE: $var.flare_b_fuel_rate_sm3_day
-~~~~~~~~
-
-The `Gas export compressors B` is a variable fuel consumer whose energy function depends on the field gas production rate (`GAS_PROD`) defined
-in the variable [gas_export_rate_sm3_per_day](#variables) as `SIM;GAS_PROD`, and put to the condition [gas_export_condition](#variables) as `SIM;GAS_PROD > 0`
-
-The model is specified:
-~~~~~~~~yaml
- - NAME: Gas export compressors B
- CATEGORY: COMPRESSOR
- ENERGY_USAGE_MODEL:
- TYPE: COMPRESSOR
- ENERGYFUNCTION: gasexp
- CONDITION: $var.gas_export_condition
- RATE: $var.gas_export_rate_sm3_per_day
- SUCTION_PRESSURE: 20
- DISCHARGE_PRESSURE: 200
-~~~~~~~~
-
-## Full eCalc YAML model
-~~~~~~~~yaml title="model.yaml"
-TIME_SERIES:
- - NAME: SIM
- TYPE: DEFAULT
- FILE: base_profile.csv
-
-FACILITY_INPUTS:
- - NAME: genset
- FILE: genset.csv
- TYPE: ELECTRICITY2FUEL
- - NAME: gasexp
- FILE: compressor_sampled.csv
- TYPE: COMPRESSOR_TABULAR
- - NAME: pump_chart
- FILE: pump_chart.csv
- TYPE: PUMP_CHART_SINGLE_SPEED
- UNITS:
- RATE: AM3_PER_HOUR
- HEAD: M
- EFFICIENCY: PERCENTAGE
-
-FUEL_TYPES:
- - NAME: fuel_gas
- CATEGORY: FUEL-GAS
- EMISSIONS:
- - NAME: CO2
- FACTOR: 2.20 #kg/Sm3
- - NAME: CH4
- FACTOR: 0.01 #kg/Sm3
- - NAME: bad_fuel_gas
- CATEGORY: FUEL-GAS
- EMISSIONS:
- - NAME: CO2
- FACTOR: 5.0 #kg/Sm3
- - NAME: CH4
- FACTOR: 0.01 #kg/Sm3
-
-MODELS:
- - NAME: generic_from_design_point_compressor_chart
- TYPE: COMPRESSOR_CHART
- CHART_TYPE: GENERIC_FROM_DESIGN_POINT
- POLYTROPIC_EFFICIENCY: 0.75
- DESIGN_RATE: 10000
- DESIGN_HEAD: 80
- UNITS:
- RATE: AM3_PER_HOUR
- HEAD: KJ_PER_KG
- EFFICIENCY: FRACTION
- - NAME: predefined_variable_speed_compressor_chart
- TYPE: COMPRESSOR_CHART
- CHART_TYPE: VARIABLE_SPEED
- UNITS:
- RATE: AM3_PER_HOUR
- HEAD: M # M or KJ_PER_KG
- EFFICIENCY: FRACTION
- CURVES:
- FILE: compressor_chart.csv
- - NAME: medium_fluid
- TYPE: FLUID
- FLUID_MODEL_TYPE: PREDEFINED
- EOS_MODEL: SRK
- GAS_TYPE: MEDIUM
- - NAME: turbine
- TYPE: TURBINE
- LOWER_HEATING_VALUE: 38 # MJ/Sm3
- TURBINE_LOADS: [0, 2.352, 4.589, 6.853, 9.125, 11.399, 13.673, 15.947, 18.223, 20.496, 22.767] # MW
- TURBINE_EFFICIENCIES: [0, 0.138, 0.210, 0.255, 0.286, 0.310, 0.328, 0.342, 0.353, 0.360, 0.362]
- - NAME: simplified_compressor_train_model
- TYPE: SIMPLIFIED_VARIABLE_SPEED_COMPRESSOR_TRAIN
- FLUID_MODEL: medium_fluid
- COMPRESSOR_TRAIN:
- STAGES:
- - INLET_TEMPERATURE: 30
- COMPRESSOR_CHART: generic_from_design_point_compressor_chart
- - INLET_TEMPERATURE: 30
- COMPRESSOR_CHART: generic_from_design_point_compressor_chart
- - INLET_TEMPERATURE: 30
- COMPRESSOR_CHART: predefined_variable_speed_compressor_chart
-
-VARIABLES:
- hydrocarbon_export_sm3_per_day:
- VALUE: SIM;OIL_PROD {+} SIM;GAS_PROD {/} 1000
- gas_export_rate_sm3_per_day:
- VALUE: SIM;GAS_PROD
- water_injection_rate:
- VALUE: SIM;WATER_INJ
- gas_export_condition:
- VALUE: SIM;GAS_PROD > 0
- base_production_load_mw:
- VALUE: 7.6 {+} 4.1 {*} (SIM;GAS_LIFT > 0)
- water_injection_condition:
- VALUE: SIM;WATER_PROD >0
- flare_a_fuel_rate_sm3_day:
- 2020-06-01:
- VALUE: 5000
- 2030-01-01:
- VALUE: 2000
- flare_b_fuel_rate_sm3_day:
- 2020-06-01:
- VALUE: 10000
- 2030-01-01:
- VALUE: 7000
-
-INSTALLATIONS:
- - NAME: Installation A
- HCEXPORT: $var.hydrocarbon_export_sm3_per_day
- FUEL: fuel_gas
- CATEGORY: FIXED
- GENERATORSETS:
- - NAME: Generator set A
- CATEGORY: TURBINE-GENERATOR
- ELECTRICITY2FUEL: genset
- CONSUMERS:
- - NAME: Fixed production loads A
- CATEGORY: FIXED-PRODUCTION-LOAD
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- LOAD: $var.base_production_load_mw
- - NAME: Gas export compressors system A
- CATEGORY: COMPRESSOR
- ENERGY_USAGE_MODEL:
- TYPE: COMPRESSOR_SYSTEM
- COMPRESSORS:
- - NAME: train1_A
- COMPRESSOR_MODEL: simplified_compressor_train_model
- - NAME: train2_A
- COMPRESSOR_MODEL: simplified_compressor_train_model
- TOTAL_SYSTEM_RATE: $var.gas_export_rate_sm3_per_day
- OPERATIONAL_SETTINGS:
- - RATE_FRACTIONS: [1.0, 0.0]
- SUCTION_PRESSURE: 20
- DISCHARGE_PRESSURE: 120
- - RATE_FRACTIONS: [0.5, 0.5]
- SUCTION_PRESSURE: 20
- DISCHARGE_PRESSURE: 120
- - NAME: Water injection pump system A
- CATEGORY: PUMP
- ENERGY_USAGE_MODEL:
- TYPE: PUMP_SYSTEM
- PUMPS:
- - NAME: pump1
- CHART: pump_chart
- - NAME: pump2
- CHART: pump_chart
- - NAME: pump3
- CHART: pump_chart
- - NAME: pump4
- CHART: pump_chart
- FLUID_DENSITY: 1026
- TOTAL_SYSTEM_RATE: $var.water_injection_rate
- CONDITION: $var.water_injection_condition
- OPERATIONAL_SETTINGS:
- - RATE_FRACTIONS: [1, 0, 0, 0]
- SUCTION_PRESSURES: [3, 3, 3, 3]
- DISCHARGE_PRESSURES: [200, 200, 200, 200]
- CROSSOVER: [2, 0, 0, 0]
- - RATE_FRACTIONS: [0.5, 0.5, 0, 0]
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- - RATE_FRACTIONS: [0.33, 0.33, 0.34, 0]
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- - RATE_FRACTIONS: [0.25, 0.25, 0.25, 0.25]
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- - NAME: Single pump A
- CATEGORY: PUMP
- ENERGY_USAGE_MODEL:
- TYPE: PUMP
- CONDITION: $var.water_injection_condition
- ENERGYFUNCTION: pump_chart
- RATE: 5000
- SUCTION_PRESSURE: 3
- DISCHARGE_PRESSURE: 200
- FLUID_DENSITY: 1026
- FUELCONSUMERS:
- - NAME: Flare A
- CATEGORY: FLARE
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- FUELRATE: $var.flare_a_fuel_rate_sm3_day
-
- - NAME: Installation B
- HCEXPORT: $var.hydrocarbon_export_sm3_per_day
- FUEL: bad_fuel_gas
- CATEGORY: FIXED
- GENERATORSETS:
- - NAME: Generator set B
- CATEGORY: TURBINE-GENERATOR
- ELECTRICITY2FUEL: genset
- CONSUMERS:
- - NAME: Fixed production loads B
- CATEGORY: FIXED-PRODUCTION-LOAD
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- LOAD: 7.6
- FUELCONSUMERS:
- - NAME: Flare B
- CATEGORY: FLARE
- ENERGY_USAGE_MODEL:
- TYPE: DIRECT
- FUELRATE: $var.flare_b_fuel_rate_sm3_day
- - NAME: Gas export compressors B
- CATEGORY: COMPRESSOR
- ENERGY_USAGE_MODEL:
- TYPE: COMPRESSOR
- ENERGYFUNCTION: gasexp
- CONDITION: $var.gas_export_condition
- RATE: $var.gas_export_rate_sm3_per_day
- SUCTION_PRESSURE: 20
- DISCHARGE_PRESSURE: 200
-~~~~~~~~
-
-### Input files
-~~~~~~~~text title="compressor_chart.csv"
-RATE, HEAD, EFFICIENCY, SPEED
-# [m3/h], [m], [frac], [rpm]
-3000, 8500, 0.72, 7500
-3500, 8000, 0.75, 7500
-4000, 7500, 0.74, 7500
-4500, 6500, 0.70, 7500
-4100, 16500, 0.72, 10500
-4600, 16000, 0.73, 10500
-5000, 15500, 0.74, 10500
-5500, 14500, 0.74, 10500
-6000, 13500, 0.72, 10500
-6500, 12000, 0.70, 10500
-~~~~~~~~
-
-~~~~~~~~text title="compressor_sampled.csv"
-RATE, FUEL
-0, 0
-0.01, 100
-10, 500
-20, 1200
-~~~~~~~~
-
-~~~~~~~~text title="genset.csv"
-POWER, FUEL
-# [MW], [Sm3/d]
-0, 0
-0.1, 75000
-10, 80000
-20, 100000
-50, 500000
-100, 1000000
-
-~~~~~~~~
-
-~~~~~~~~text title="pump_chart.csv"
-RATE, HEAD, EFFICIENCY, SPEED
-# [m3/h], [m], [%], [rpm]
-250, 2350, 50, 10000
-300, 2300, 55, 10000
-350, 2250, 60, 10000
-400, 2200, 70, 10000
-450, 2150, 75, 10000
-500, 2100, 80, 10000
-550, 2050, 75, 10000
-600, 2000, 70, 10000
-~~~~~~~~
-
-~~~~~~~~text title="base_profile.csv"
-DATE, OIL_PROD, WATER_PROD, GAS_PROD, WATER_INJ, GAS_LIFT
-01.01.2020, 1000, 20000, 4000000, 30000, 1200000
-01.01.2021, 1000, 20000, 4000000, 30000, 1200000
-01.01.2022, 1000, 20000, 4000000, 30000, 1200000
-01.01.2023, 2500, 21000, 4000000, 30000, 1200000
-01.01.2024, 3000, 22000, 4500000, 28000, 1300000
-01.01.2025, 3500, 23000, 5000000, 26000, 1350000
-01.01.2026, 4000, 24000, 5500000, 25000, 1400000
-01.01.2027, 4000, 25000, 6000000, 24000, 1400000
-01.01.2028, 4000, 20000, 6000000, 23000, 1400000
-01.01.2029, 5000, 20000, 5500000, 22000, 1350000
-01.01.2030, 9000, 20000, 5000000, 21000, 1300000
-01.01.2031, 5000, 20000, 3000000, 22000, 1300000
-01.01.2032, 4000, 22100, 3000000, 23000, 2000000
-01.01.2033, 4000, 22100, 3000000, 23000, 2000000
-01.01.2034, 1200, 25000, 1000000, 21000, 2000000
-01.01.2035, 1100, 25000, 1000000, 20000, 1500000
-01.01.2036, 1000, 22000, 500000, 18000, 1400000
-01.01.2037, 900, 20000, 500000, 17000, 1400000
-01.01.2038, 800, 18000, 500000, 17000, 1400000
-01.01.2039, 700, 18000, 200000, 17000, 1400000
-01.01.2040, 600, 10000, 200000, 15000, 1400000
-01.01.2041, 0, 0, 0, 0, 0
-~~~~~~~~
diff --git a/docs/docs/about/modelling/examples/advanced.mdx b/docs/docs/about/modelling/examples/advanced.mdx
new file mode 100644
index 0000000000..81079d1d30
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced.mdx
@@ -0,0 +1,320 @@
+import CodeLinesFromFile from "../../../../src/components/CodeLinesFromFile";
+import CodeBlock from '@theme/CodeBlock';
+import compressorChartCsv from '!!raw-loader!./advanced/compressor_chart.csv';
+import compressorSampledCsv from '!!raw-loader!./advanced/compressor_sampled.csv';
+import genset from '!!raw-loader!./advanced/genset.csv';
+import pumpChart from '!!raw-loader!./advanced/pump_chart.csv';
+import baseProfile from '!!raw-loader!./advanced/base_profile.csv';
+import yamlModel from '!!raw-loader!./advanced/model.yaml';
+
+# Advanced model example
+This is a model very similar to [Simple example](/about/modelling/examples/simple.mdx). The main difference is the use of more advanced
+energy usage models and consumer systems, and the addition of a second installation.
+
+Both installations exports oil (`OIL_PROD`) and gas (`GAS_PROD`).
+The installations emit CO2 and CH4.
+
+The following is an example with one installation called `Installation A` and `Installation B`.
+
+```mermaid
+graph TD;
+ Asset(Asset) --> A(Installation A);
+ A(Installation A) --> AA(Flare A);
+ A --> AD(Generator set A);
+ AD --> AE(Base production load A);
+ AD --> AF(Gas export compressor A);
+ AD --> AG(Produced water reinjection pump A);
+ AD --> AH(Sea water injection pump A);
+
+ Asset --> B(Installation B);
+ B --> BA(Generator set B);
+ B --> BD(Gas export compressor B);
+ BA --> BC(Base production load B);
+ B --> BB(Flare B);
+ style A stroke:red;
+ style B stroke:red;
+ style BC stroke:blue;
+ style AE stroke:blue;
+ style AF stroke:blue;
+ style AG stroke:blue;
+ style AH stroke:blue;
+```
+
+The results of a performed characterization of the equipment are listed below:
+
+| Consumer |Type | Description |
+|-------------------------------------|--------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
+| Generator set A |Generator set | Variable fuel consumer with electricity to fuel function |
+| Base production load A |Power consumer | Production base load varying depending on a binary condition |
+| Gas export compressor A |Power consumer | Variable consumption depending on gas sales rate |
+| Produced water reinjection pump A |Power consumer | Variable consumption depending on water production rate and water injection rate. The pump suction pressure is 10 bar and discharge pressure is 200 bar. |
+| Sea water injection pump A |Power consumer | Variable consumption depending on a complex combination on water injection rate and water production rate |
+| Flare A |Direct fuel consumer| Flare A |
+| Generator set B |Generator set | Variable fuel consumption with electricity to fuel function |
+| Base production load B |Power consumer| Production base load at 7.6 MW |
+| Gas export compressor B |Direct fuel consumer| Variable fuel consumption depending on gas sales rate |
+| Flare B |Direct fuel consumer| Flare B |
+
+## YAML model overview
+The YAML model consist of these main components:
+- Time series inputs - [TIME_SERIES](/about/references/keywords/TIME_SERIES.md)
+- Facility characterization input - [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md)
+- Fuel input - [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md)
+- Model specifications - [MODELS](/about/references/keywords/MODELS.md)
+- Model variables - [VARIABLES](/about/references/keywords/VARIABLES.md)
+- Installation topology - [INSTALLATIONS](/about/references/keywords/INSTALLATIONS.md)
+
+The YAML setup file looks like this:
+
+~~~~~~~~yaml title="model.yaml"
+TIME_SERIES:
+
+FACILITY_INPUTS:
+
+FUEL_TYPES:
+
+VARIABLES:
+
+INSTALLATIONS:
+
+~~~~~~~~
+
+We will now replace the placeholders for each of the main keywords above.
+
+## TIME_SERIES
+The reservoir variables, in this case, are found in a CSV (Comma separated file) `production_data.csv`.
+We give the time-series data a name that can be referenced as variables elsewhere in the form `:`.
+See [TIME_SERIES](/about/references/keywords/TIME_SERIES.md) for further details.
+
+{yamlModel}
+
+## FACILITY_INPUTS
+We specify CSV input data for processing equipment using FACILITY_INPUTS. This is used for generatorsets,
+tabulated/sampled models and pump charts. See [FACILITY_INPUTS](/about/references/keywords/FACILITY_INPUTS.md) for further details.
+
+Here we define a tabulated genset, a sampled compressor, and a single speed pump chart.
+Note that more complicated energy models are defined under the [MODELS](/about/references/keywords/MODELS.md)-keyword.
+
+{yamlModel}
+
+## FUEL_TYPES
+In this example there are two [FUEL_TYPES](/about/references/keywords/FUEL_TYPES.md) - `fuel_gas` and `bad_fuel_gas`.
+These are used for Installation A and Installation B respectively.
+Here we also define emissions in CO2 and CH4:
+
+{yamlModel}
+
+## MODELS
+
+This advanced example requires some energy usage models to be defined under the model section. See [MODELS](/about/references/keywords/MODELS.md) for details.
+
+Here we specify:
+- Compressor chart based on design points
+- Compressor chart based on chart data
+- Medium density fluid
+- Gas turbine
+- Simplified compressor train model
+
+{yamlModel}
+
+See [MODELS](/about/references/keywords/MODELS.md) for further details.
+
+## VARIABLES
+To run the model it is recommended to specify [VARIABLES](/about/references/keywords/VARIABLES.md),
+instead of hard coding values in difference places. This makes it easier to develop, maintain and understand the model
+by allowing descriptive variable names and avoid duplications.
+
+For our model, we specify the following variables:
+
+{yamlModel}
+
+We reference the [TIME_SERIES](#time_series) `SIM` using the column names from the CSV file.
+
+:::tip
+You can use boolean condition such as shown in base_production_load_mw and time varying variables such as shown in
+flare_a_fuel_rate_sm3_day and flare_b_fuel_rate_sm3_day to write simpler models with less duplicated code.
+
+The base_production_load_mw adds another 4.1 MW when the gas lift injection rate is positive.
+
+The flare rate changes in year 2030.
+:::
+
+## INSTALLATIONS
+
+An installation is composed of hydrocarbon export, a default fuel for that installation and consumers in the form
+of generatorsets (with electric sub-consumers), and direct fuel consumers.
+
+We specify:
+- `NAME`: the installation name
+- `HCEXPORT`: Hydrocarbon export in Sm3/day by referring to the variable $var.hydrocarbon_export_sm3_per_day specified under [VARIABLES](#variables) above.
+- `FUEl`: Default fuel specified in [FUEL_TYPES](#fuel_types) above. Note the different fuels used by the two installations.
+- `CATEGORY`: FIXED (installation) category is used to group result data for reporting. See [CATEGORY](/about/references/keywords/CATEGORY.md) for details.
+- `REGULARITY`: Defined by the variable $var.pea specified under [VARIABLES](#variables) above. `REGULARITY` is closely related to the production efficiency (PE) of a facility, and is used to convert between stream day (sd)- and calendar day (cd) rates.
+
+~~~~~~~~yaml
+INSTALLATIONS:
+ - NAME: Installation A
+ HCEXPORT: $var.hcexpa_cd
+ FUEL: fuel_gas
+ CATEGORY: FIXED
+ REGULARITY: $var.pea
+ GENERATORSETS:
+
+ FUELCONSUMERS:
+
+ - NAME: Installation B
+ HCEXPORT: $var.hcexpb_cd
+ FUEL: bad_fuel_gas
+ CATEGORY: FIXED
+ REGULARITY: $var.peb
+ GENERATORSETS:
+
+ FUELCONSUMERS:
+
+~~~~~~~~
+
+### Installation A
+There is one generator set, `Generator set A`. This has a power to fuel function defined in
+[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumers getting
+power from the generator set are *Base production load*, *Gas export compressor*, *Produced water reinjection pump*
+and *Water injection pump*.
+
+The direct fuel consumers are **Flare**.
+
+The setup for `Installation A` thus becomes:
+
+~~~~~~~~yaml
+ - NAME: Installation A
+ HCEXPORT: $var.hcexpa_cd
+ FUEL: fuel_gas
+ CATEGORY: FIXED
+ REGULARITY: $var.pea
+ GENERATORSETS:
+ - NAME: Generator set A
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads A
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Gas export compressors system A
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Water injection pump system A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+
+ - NAME: Single pump A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+
+ FUELCONSUMERS:
+ - NAME: Flare A
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+
+~~~~~~~~
+
+### Installation B
+There is one generator set, `Generator set B`. This has a power to fuel function defined in
+[FACILITY_INPUTS](#facility_inputs) with the name `genset`. Further, the consumer getting
+power from the generator set is *Base production load*.
+
+The direct fuel consumers are **Flare** and **Gas export compressor**.
+
+The setup for `Installation B` thus becomes:
+
+~~~~~~~~yaml
+ - NAME: Installation B
+ HCEXPORT: $var.hcexpb_cd
+ FUEL: bad_fuel_gas
+ CATEGORY: FIXED
+ REGULARITY: $var.peb
+ GENERATORSETS:
+ - NAME: Generator set B
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads B
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+
+ FUELCONSUMERS:
+ - NAME: Flare B
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+
+
+ - NAME: Gas export compressors B
+ CATEGORY: GAS-DRIVEN-COMPRESSOR
+ FUEL: fuel_gas
+ ENERGY_USAGE_MODEL:
+
+~~~~~~~~
+
+## ENERGY_USAGE_MODEL
+We will now fill in the final placeholders with detailed [ENERGY_USAGE_MODEL](/about/references/keywords/ENERGY_USAGE_MODEL.md)s.
+
+`Fixed production loads A` has a load of 7.6 MW with additional 4.1 MW when the field gas injection rate is positive:
+
+{yamlModel}
+
+`Gas export compressor system A` is represented by a consumer system of two simplified compressor train models.
+The system has defined the variable [gasratea_cd](#variables) and will run two different
+rate distributions between these two compressor trains. It will first send all rate to the first compressor train
+and nothing to the second `RATE_FRACTIONS: [1.0, 0.0]` and then it will run the same input while distributing equal
+rates to the two compressor trains `RATE_FRACTIONS: [0.5, 0.5]`. The final result will be composed of the first
+setting that returns a valid result for the compressors.
+See [COMPRESSOR_SYSTEM](/about/modelling/setup/installations/compressor_models_in_calculations/compressor_system.md) for further details.
+
+The compressor model is then defined:
+{yamlModel}
+
+`Water injection pump system A` is variable and its energy function is dependent on the field's water
+injection rate (`WATER_INJ`) that is set in the variable [water_injection_rate](#variables) as `SIM;WATER_INJ`.
+The pump only runs when the variables [water_injection_condition](#variables) evaluates to true as `SIM;WATER_PROD > 0`.
+This is when the water injection rate is positive. Fluid density, suction pressure and discharge pressure
+is also defined.
+
+This PUMP_SYSTEM behaves much the same as the COMPRESSOR_SYSTEM above.
+See [PUMP_SYSTEM](/about/modelling/setup/installations/pump_models_in_calculations.md#pump_system-energy-usage-model) for further details.
+{yamlModel}
+
+`Single pump A` has an energy function that is dependent on the seawater injection rate, same as the system above.
+It uses the pump_chart defined in [FACILITY_INPUTS](#facility_inputs) above.
+
+The pump model is then defined:
+{yamlModel}
+
+The `Flare A` is changing on the 1st of July 2020 and 1st of January 2030. Therefore, we need to use a different constant
+fuel consumption value before and after this date. This is done using the variable [flare_a_fuel_rate_sm3_day](#variables).
+
+The model becomes:
+{yamlModel}
+
+`Base production loads B` has a load of 7.6 :
+{yamlModel}
+
+The `Flare B` is changing on the 1st of July 2020 and 1st of January 2030. Therefore, we need to use a different constant
+fuel consumption value before and after this date. This is done using the variable [flare_a_fuel_rate_sm3_day](#variables).
+
+The model becomes:
+{yamlModel}
+
+The `Gas export compressors B` is a variable fuel consumer whose energy function depends on the field gas production rate (`GAS_PROD`) defined
+in the variable [gasrateb_cd](#variables) as `SIM;GAS_PROD`, and put to the condition [gas_export_condition](#variables) as `SIM;GAS_PROD > 0`
+
+The model is specified:
+{yamlModel}
+
+## Full eCalc YAML model
+{yamlModel}
+
+### Input files
+{compressorChartCsv}
+{compressorSampledCsv}
+{genset}
+{pumpChart}
+{baseProfile}
diff --git a/docs/docs/about/modelling/examples/advanced/base_profile.csv b/docs/docs/about/modelling/examples/advanced/base_profile.csv
new file mode 100644
index 0000000000..a97ba579de
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced/base_profile.csv
@@ -0,0 +1,23 @@
+DATE, OIL_PROD, WATER_PROD, GAS_PROD, WATER_INJ, GAS_LIFT
+01.01.2020, 1000, 20000, 4000000, 30000, 1200000
+01.01.2021, 1000, 20000, 4000000, 30000, 1200000
+01.01.2022, 1000, 20000, 4000000, 30000, 1200000
+01.01.2023, 2500, 21000, 4000000, 30000, 1200000
+01.01.2024, 3000, 22000, 4500000, 28000, 1300000
+01.01.2025, 3500, 23000, 5000000, 26000, 1350000
+01.01.2026, 4000, 24000, 5500000, 25000, 1400000
+01.01.2027, 4000, 25000, 6000000, 24000, 1400000
+01.01.2028, 4000, 20000, 6000000, 23000, 1400000
+01.01.2029, 5000, 20000, 5500000, 22000, 1350000
+01.01.2030, 9000, 20000, 5000000, 21000, 1300000
+01.01.2031, 5000, 20000, 3000000, 22000, 1300000
+01.01.2032, 4000, 22100, 3000000, 23000, 2000000
+01.01.2033, 4000, 22100, 3000000, 23000, 2000000
+01.01.2034, 1200, 25000, 1000000, 21000, 2000000
+01.01.2035, 1100, 25000, 1000000, 20000, 1500000
+01.01.2036, 1000, 22000, 500000, 18000, 1400000
+01.01.2037, 900, 20000, 500000, 17000, 1400000
+01.01.2038, 800, 18000, 500000, 17000, 1400000
+01.01.2039, 700, 18000, 200000, 17000, 1400000
+01.01.2040, 600, 10000, 200000, 15000, 1400000
+01.01.2041, 0, 0, 0, 0, 0
\ No newline at end of file
diff --git a/docs/docs/about/modelling/examples/advanced/compressor_chart.csv b/docs/docs/about/modelling/examples/advanced/compressor_chart.csv
new file mode 100644
index 0000000000..0fcd7d9c09
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced/compressor_chart.csv
@@ -0,0 +1,12 @@
+RATE, HEAD, EFFICIENCY, SPEED
+# [m3/h], [m], [frac], [rpm]
+3000, 8500, 0.72, 7500
+3500, 8000, 0.75, 7500
+4000, 7500, 0.74, 7500
+4500, 6500, 0.70, 7500
+4100, 16500, 0.72, 10500
+4600, 16000, 0.73, 10500
+5000, 15500, 0.74, 10500
+5500, 14500, 0.74, 10500
+6000, 13500, 0.72, 10500
+6500, 12000, 0.70, 10500
\ No newline at end of file
diff --git a/docs/docs/about/modelling/examples/advanced/compressor_sampled.csv b/docs/docs/about/modelling/examples/advanced/compressor_sampled.csv
new file mode 100644
index 0000000000..3d21a6c1ba
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced/compressor_sampled.csv
@@ -0,0 +1,5 @@
+RATE, FUEL
+0, 0
+0.01, 100
+10, 500
+20, 1200
\ No newline at end of file
diff --git a/docs/docs/about/modelling/examples/advanced/genset.csv b/docs/docs/about/modelling/examples/advanced/genset.csv
new file mode 100644
index 0000000000..cc8961f575
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced/genset.csv
@@ -0,0 +1,8 @@
+POWER, FUEL
+# [MW], [Sm3/d]
+0, 0
+0.1, 75000
+10, 80000
+20, 100000
+50, 500000
+100, 1000000
diff --git a/docs/docs/about/modelling/examples/advanced/model.yaml b/docs/docs/about/modelling/examples/advanced/model.yaml
new file mode 100644
index 0000000000..95c2e6f953
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced/model.yaml
@@ -0,0 +1,269 @@
+# mafro : 160524
+# Advanced v2: Regularity 0.87 / 0.95 + GEFAC rate conversion in variables
+# https://equinor.github.io/ecalc/docs/about/modelling/examples/advanced
+# Exercise for Equinor University course May 2024.
+TIME_SERIES:
+ - NAME: SIM
+ TYPE: DEFAULT
+ FILE: base_profile.csv
+
+FACILITY_INPUTS:
+ - NAME: genset
+ FILE: genset.csv
+ TYPE: ELECTRICITY2FUEL
+ - NAME: gasexp
+ FILE: compressor_sampled.csv
+ TYPE: COMPRESSOR_TABULAR
+ - NAME: pump_chart
+ FILE: pump_chart.csv
+ TYPE: PUMP_CHART_SINGLE_SPEED
+ UNITS:
+ RATE: AM3_PER_HOUR
+ HEAD: M
+ EFFICIENCY: PERCENTAGE
+
+FUEL_TYPES:
+ - NAME: fuel_gas
+ CATEGORY: FUEL-GAS
+ EMISSIONS:
+ - NAME: CO2
+ FACTOR: 2.20 #kg/Sm3
+ - NAME: CH4
+ FACTOR: 0.01 #kg/Sm3
+ - NAME: bad_fuel_gas
+ CATEGORY: FUEL-GAS
+ EMISSIONS:
+ - NAME: CO2
+ FACTOR: 5.0 #kg/Sm3
+ - NAME: CH4
+ FACTOR: 0.01 #kg/Sm3
+
+MODELS:
+ - NAME: generic_from_design_point_compressor_chart
+ TYPE: COMPRESSOR_CHART
+ CHART_TYPE: GENERIC_FROM_DESIGN_POINT
+ POLYTROPIC_EFFICIENCY: 0.75
+ DESIGN_RATE: 10000
+ DESIGN_HEAD: 80
+ UNITS:
+ RATE: AM3_PER_HOUR
+ HEAD: KJ_PER_KG
+ EFFICIENCY: FRACTION
+ - NAME: predefined_variable_speed_compressor_chart
+ TYPE: COMPRESSOR_CHART
+ CHART_TYPE: VARIABLE_SPEED
+ UNITS:
+ RATE: AM3_PER_HOUR
+ HEAD: M # M or KJ_PER_KG
+ EFFICIENCY: FRACTION
+ CURVES:
+ FILE: compressor_chart.csv
+ - NAME: medium_fluid
+ TYPE: FLUID
+ FLUID_MODEL_TYPE: PREDEFINED
+ EOS_MODEL: SRK
+ GAS_TYPE: MEDIUM
+ - NAME: turbine
+ TYPE: TURBINE
+ LOWER_HEATING_VALUE: 38 # MJ/Sm3
+ TURBINE_LOADS: [0, 2.352, 4.589, 6.853, 9.125, 11.399, 13.673, 15.947, 18.223, 20.496, 22.767] # MW
+ TURBINE_EFFICIENCIES: [0, 0.138, 0.210, 0.255, 0.286, 0.310, 0.328, 0.342, 0.353, 0.360, 0.362]
+ - NAME: simplified_compressor_train_model
+ TYPE: SIMPLIFIED_VARIABLE_SPEED_COMPRESSOR_TRAIN
+ FLUID_MODEL: medium_fluid
+ COMPRESSOR_TRAIN:
+ STAGES:
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: generic_from_design_point_compressor_chart
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: generic_from_design_point_compressor_chart
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: predefined_variable_speed_compressor_chart
+
+ - NAME: trainB
+ TYPE: VARIABLE_SPEED_COMPRESSOR_TRAIN
+ FLUID_MODEL: medium_fluid
+ COMPRESSOR_TRAIN:
+ STAGES:
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: predefined_variable_speed_compressor_chart
+ - INLET_TEMPERATURE: 30
+ COMPRESSOR_CHART: predefined_variable_speed_compressor_chart
+ - NAME: trainBturbine
+ TYPE: COMPRESSOR_WITH_TURBINE
+ COMPRESSOR_MODEL: trainB
+ TURBINE_MODEL: turbine
+
+VARIABLES:
+ hydrocarbon_export_sm3_per_day:
+ VALUE: SIM;OIL_PROD {+} SIM;GAS_PROD {/} 1000
+ gas_export_rate_sm3_per_day:
+ VALUE: SIM;GAS_PROD
+ water_injection_rate:
+ VALUE: SIM;WATER_INJ
+ gas_export_condition:
+ VALUE: SIM;GAS_PROD > 0
+ base_production_load_mw:
+ VALUE: 7.6 {+} 4.1 {*} (SIM;GAS_LIFT > 0)
+ water_injection_condition:
+ VALUE: SIM;WATER_PROD >0
+ flare_a_fuel_rate_sm3_day:
+ 2020-06-01:
+ VALUE: 5000
+ 2030-01-01:
+ VALUE: 2000
+ flare_b_fuel_rate_sm3_day:
+ 2020-06-01:
+ VALUE: 10000
+ 2030-01-01:
+ VALUE: 7000
+
+ pea:
+ VALUE: 0.95 # 0.87
+ peb:
+ VALUE: 0.95
+ gasratea_cd:
+ VALUE: $var.gas_export_rate_sm3_per_day {*} $var.pea
+ gasrateb_cd:
+ VALUE: $var.gas_export_rate_sm3_per_day {*} $var.peb
+ winjratea_cd:
+ VALUE: $var.water_injection_rate {*} $var.pea
+ hcexpa_cd:
+ VALUE: $var.hydrocarbon_export_sm3_per_day {*} $var.pea
+ hcexpb_cd:
+ VALUE: $var.hydrocarbon_export_sm3_per_day {*} $var.peb
+
+INSTALLATIONS:
+ - NAME: Installation A
+ HCEXPORT: $var.hcexpa_cd
+ FUEL: fuel_gas
+ CATEGORY: FIXED
+ REGULARITY: $var.pea
+ GENERATORSETS:
+ - NAME: Generator set A
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads A
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ LOAD: $var.base_production_load_mw
+ CONSUMPTION_RATE_TYPE: STREAM_DAY # (This is default)
+ - NAME: Gas export compressors system A
+ CATEGORY: COMPRESSOR
+ ENERGY_USAGE_MODEL:
+ TYPE: COMPRESSOR_SYSTEM
+ COMPRESSORS:
+ - NAME: train1_A
+ COMPRESSOR_MODEL: simplified_compressor_train_model
+ - NAME: train2_A
+ COMPRESSOR_MODEL: simplified_compressor_train_model
+ TOTAL_SYSTEM_RATE: $var.gasratea_cd
+ OPERATIONAL_SETTINGS:
+ - RATE_FRACTIONS: [1.0, 0.0]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 120
+ - RATE_FRACTIONS: [0.5, 0.5]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 120
+ - NAME: Water injection pump system A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ TYPE: PUMP_SYSTEM
+ PUMPS:
+ - NAME: pump1
+ CHART: pump_chart
+ - NAME: pump2
+ CHART: pump_chart
+ - NAME: pump3
+ CHART: pump_chart
+ - NAME: pump4
+ CHART: pump_chart
+ FLUID_DENSITY: 1026
+ TOTAL_SYSTEM_RATE: $var.winjratea_cd
+ CONDITION: $var.water_injection_condition
+ OPERATIONAL_SETTINGS:
+ - RATE_FRACTIONS: [1, 0, 0, 0]
+ SUCTION_PRESSURES: [3, 3, 3, 3]
+ DISCHARGE_PRESSURES: [200, 200, 200, 200]
+ CROSSOVER: [2, 0, 0, 0]
+ - RATE_FRACTIONS: [0.5, 0.5, 0, 0]
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.33, 0.33, 0.34, 0]
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.25, 0.25, 0.25, 0.25]
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ - NAME: Single pump A
+ CATEGORY: PUMP
+ ENERGY_USAGE_MODEL:
+ TYPE: PUMP
+ CONDITION: $var.water_injection_condition
+ ENERGYFUNCTION: pump_chart
+ RATE: 5000 {*} $var.pea
+ SUCTION_PRESSURE: 3
+ DISCHARGE_PRESSURE: 200
+ FLUID_DENSITY: 1026
+ FUELCONSUMERS:
+ - NAME: Flare A
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ FUELRATE: $var.flare_a_fuel_rate_sm3_day
+ CONSUMPTION_RATE_TYPE: STREAM_DAY # (This is default)
+
+ - NAME: Installation B
+ HCEXPORT: $var.hcexpb_cd
+ FUEL: bad_fuel_gas
+ CATEGORY: FIXED
+ REGULARITY: $var.peb
+ GENERATORSETS:
+ - NAME: Generator set B
+ CATEGORY: TURBINE-GENERATOR
+ ELECTRICITY2FUEL: genset
+ CONSUMERS:
+ - NAME: Fixed production loads B
+ CATEGORY: FIXED-PRODUCTION-LOAD
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ LOAD: 7.6
+ CONSUMPTION_RATE_TYPE: STREAM_DAY # (This is default)
+ FUELCONSUMERS:
+ - NAME: Flare B
+ CATEGORY: FLARE
+ ENERGY_USAGE_MODEL:
+ TYPE: DIRECT
+ FUELRATE: $var.flare_b_fuel_rate_sm3_day
+ CONSUMPTION_RATE_TYPE: STREAM_DAY # (This is default)
+
+ - NAME: Gas export compressors B
+ CATEGORY: GAS-DRIVEN-COMPRESSOR
+ FUEL: fuel_gas
+ ENERGY_USAGE_MODEL:
+ TYPE: COMPRESSOR_SYSTEM
+ COMPRESSORS:
+ - NAME: train1_B
+ COMPRESSOR_MODEL: trainBturbine
+ - NAME: train2_B
+ COMPRESSOR_MODEL: trainBturbine
+ - NAME: train3_B
+ COMPRESSOR_MODEL: trainBturbine
+ - NAME: train4_B
+ COMPRESSOR_MODEL: trainBturbine
+ TOTAL_SYSTEM_RATE: $var.gasrateb_cd
+ OPERATIONAL_SETTINGS:
+ - RATE_FRACTIONS: [1, 0, 0, 0]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.5, 0.5, 0, 0]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.34, 0.33, 0.33, 0]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 200
+ - RATE_FRACTIONS: [0.25, 0.25, 0.25, 0.25]
+ SUCTION_PRESSURE: 20
+ DISCHARGE_PRESSURE: 200
\ No newline at end of file
diff --git a/docs/docs/about/modelling/examples/advanced/pump_chart.csv b/docs/docs/about/modelling/examples/advanced/pump_chart.csv
new file mode 100644
index 0000000000..8b8f3e01c8
--- /dev/null
+++ b/docs/docs/about/modelling/examples/advanced/pump_chart.csv
@@ -0,0 +1,10 @@
+RATE, HEAD, EFFICIENCY, SPEED
+# [m3/h], [m], [%], [rpm]
+250, 2350, 50, 10000
+300, 2300, 55, 10000
+350, 2250, 60, 10000
+400, 2200, 70, 10000
+450, 2150, 75, 10000
+500, 2100, 80, 10000
+550, 2050, 75, 10000
+600, 2000, 70, 10000
\ No newline at end of file
diff --git a/docs/docs/about/modelling/examples/index.md b/docs/docs/about/modelling/examples/index.md
index ecc88ddfc5..b5e1c3f684 100644
--- a/docs/docs/about/modelling/examples/index.md
+++ b/docs/docs/about/modelling/examples/index.md
@@ -6,7 +6,7 @@ description: Examples of eCalc usage
Here you find some examples.
- [Simple example](/about/modelling/examples/simple.mdx)
-- [Advanced example](/about/modelling/examples/advanced.md)
+- [Advanced example](/about/modelling/examples/advanced.mdx)
- [Drogon example](/about/modelling/examples/drogon.md)
The models are also available in the Python library under the libecalc.examples module.