Skip to main content

Simple model example

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:

The results of a performed characterization of the equipment are listed below:

ConsumerTypeDescription
Generator set AGenerator setVariable fuel consumer with electricity to fuel function
Base production loadPower consumerConstant load 11.8 MW
Gas injection compressorPower consumerVariable consumption depending on gas injection rate and lift gas rate
Produced water reinjection pumpPower consumerVariable 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 pumpPower consumerVariable consumption depending on a complex combination on water injection rate and water production rate
FlareDirect fuel consumerBefore 1.1.2005: Constant fuel rate 10000 Sm3/day, From 1.1.2005: Constant fuel rate 7000 Sm3/day
Gas export compressorDirect fuel consumerVariable fuel consumer depending on gas sales rate

YAML model overview

The YAML model consist of these main components:

The YAML setup file looks like this:

model.yaml
TIME_SERIES:
<placeholder>
FACILITY_INPUTS:
<placeholder>
FUEL_TYPES:
<placeholder>
VARIABLES:
<placeholder>
INSTALLATIONS:
<placeholder>

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 <NAME>:<NAME OF COLUMN>. See TIME_SERIES for further details.

model.yaml
TIME_SERIES:
- NAME: SIM
FILE: production_data.csv
TYPE: DEFAULT

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

See the input data further down to understand the input formats.

model.yaml
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 #!include, commented !include is now supported
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

In this example there is only one FUEL_TYPES - fuel_gas. The emissions we model with the fuel is CO2. The CO2 factor is 2.19 kg CO2 per Sm3 fuel gas burned.

model.yaml
FUEL_TYPES:
- NAME: fuel_gas
EMISSIONS:
- NAME: CO2
FACTOR: 2.19 # CO2/Sm3 fuel gas burned

VARIABLES

To run the model it is recommended to specify VARIABLES, 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:

model.yaml
VARIABLES:
hydrocarbon_export_sm3_per_day:
VALUE: SIM;OIL_PROD {+} SIM;GAS_SALES {/} 1000 # divide the gas rate by 1000 to get oil equivalent
salt_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_SALES
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

We reference the 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 above.
  • FUEl: Default fuel specified in FUEL_TYPES above.
INSTALLATIONS:
- NAME: Installation A
HCEXPORT: $var.hydrocarbon_export_sm3_per_day
FUEL: fuel_gas
GENERATORSETS:
<placeholder>
FUELCONSUMERS:
<placeholder>

GENERATORSETS

There is one generator set, Generator set A. This has a power to fuel function defined in 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:

    GENERATORSETS:
- NAME: Generator set A
ELECTRICITY2FUEL: genset
CATEGORY: TURBINE-GENERATOR
CONSUMERS:
- NAME: Base production load
CATEGORY: BASE-LOAD
ENERGY_USAGE_MODEL:
<placeholder>
- NAME: Gas injection compressor
CATEGORY: COMPRESSOR
ENERGY_USAGE_MODEL:
<placeholder>
- NAME: Produced water reinjection pump
CATEGORY: PUMP
ENERGY_USAGE_MODEL:
<placeholder>
- NAME: Sea water injection pump
CATEGORY: PUMP
ENERGY_USAGE_MODEL:
<placeholder>

FUELCONSUMERS

The direct fuel consumers are Flare and Gas export compressor.

model.yaml
    FUELCONSUMERS:
- NAME: Flare
CATEGORY: FLARE
ENERGY_USAGE_MODEL:
<placeholder>
- NAME: Gas export compressor
CATEGORY: COMPRESSOR
ENERGY_USAGE_MODEL:
<placeholder>

ENERGY_USAGE_MODEL

We will now fill in the final placeholders with detailed ENERGY_USAGE_MODELs.

Base production load has a constant load of 11.8 MW:

model.yaml
          - NAME: Base production load
CATEGORY: BASE-LOAD
ENERGY_USAGE_MODEL:
TYPE: DIRECT
LOAD: 11.8 # MW

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 as SIM;GAS_INJ {+} SIM;GAS_LIFT:

model.yaml
          - NAME: Gas injection compressor
CATEGORY: COMPRESSOR
ENERGY_USAGE_MODEL:
TYPE: COMPRESSOR
ENERGYFUNCTION: compressor_sampled
RATE: $var.gas_injection_rate_sm3_per_day
- NAME: Produced water reinjection pump
CATEGORY: PUMP

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 as SIM;WATER_PROD. The pump only runs when the variables produced_water_reinjection_condition 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:

model.yaml
          - 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

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 above and is defined as:

The model is specified:

model.yaml
          - NAME: Sea water injection pump
CATEGORY: PUMP
ENERGY_USAGE_MODEL:
TYPE: TABULATED
ENERGYFUNCTION: pump_sampled
VARIABLES:
- NAME: RATE
EXPRESSION: $var.salt_water_injection_rate_m3_per_day

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 above.

The model is specified:

model.yaml
      - NAME: Flare
CATEGORY: FLARE
ENERGY_USAGE_MODEL:
TYPE: DIRECT
FUELRATE: $var.flare_fuel_rate_sm3_day

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 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:

model.yaml
      - NAME: Gas export compressor
CATEGORY: COMPRESSOR
ENERGY_USAGE_MODEL:
TYPE: COMPRESSOR
ENERGYFUNCTION: compressor_with_turbine_sampled
RATE: $var.gas_export_rate_sm3_per_day

Full eCalc YAML model

model.yaml
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 #!include, commented !include is now supported
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_SALES {/} 1000 # divide the gas rate by 1000 to get oil equivalent
salt_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_SALES
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
- 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.salt_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: COMPRESSOR
ENERGY_USAGE_MODEL:
TYPE: COMPRESSOR
ENERGYFUNCTION: compressor_with_turbine_sampled
RATE: $var.gas_export_rate_sm3_per_day

Input files

compressor_sampled.csv
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
compressor_sampled_with_turbine.csv
RATE,FUEL
#[SM3/day],[SM3/day]
0,0
0.1,50000
3000000,50000
3500000,130000
7000000,170000
genset.csv
POWER,FUEL
#[MW],[SM3/day]
0, 0
0.1, 65000
10.0, 75000
20.0, 126000
40.0, 250000
100.0, 750000
pump_chart.csv
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
pump_sampled.csv
RATE,POWER
#[Sm3/day],[MW]
0,0
1,3
8500,4
9000,4
17000,6
17500,9
36000,13
production_data.csv
Dates,                  OIL_PROD,    GAS_SALES,     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, 17000, 34000, 220000000, 13000000
2021-01-01 00:00:00, 8000, 3600000, 17200, 33000, 220000000, 17000000
2022-01-01 00:00:00, 7000, 3700000, 15000, 30000, 220000000, 21000000
2023-01-01 00:00:00, 6000, 3800000, 16000, 33000, 230000000, 24000000
2024-01-01 00:00:00, 6000, 3900000, 14000, 35000, 230000000, 28000000
2024-12-01 00:00:00, 6000, 4000000, 15000, 36000, 240000000, 31000000
2026-01-01 00:00:00, 7000, 4100000, 17000, 36000, 240000000, 35000000
2027-01-01 00:00:00, 6000, 4500000, 15000, 38000, 240000000, 39000000
2028-01-01 00:00:00, 6000, 3500000, 12000, 33000, 240000000, 43000000
2029-01-01 00:00:00, 5000, 2500000, 14000, 36000, 240000000, 46000000
2030-01-01 00:00:00, 6000, 2000000, 16000, 35000, 240000000, 50000000
2031-01-01 00:00:00, 4000, 3000000, 14000, 33000, 240000000, 53000000