Configure a simulation routine
Configure simulation routines to run simulations. Routines include scheduling information, data preprocessing settings, input and output mapping, and execution steps. Simulator routines can have multiple revisions, which enables you to track changes and evolve the routine over time. Each model can have multiple routines, each performing different tasks, such as calculating optimal operation set points, forecasting production, and benchmarking asset performance.
Before you start
Before you configure a simulation routine, consider:
- The input data to the simulator. These are the values set into the simulator model. You can use constant values or time series, such as data from process sensors. For time series, make sure to consider data sampling.
- The execution steps to issue to the simulator. Each simulator may support different steps which are defined in the
stepFields
property of the Simulator resource in CDF. - The output data to read from the simulator. These are the values read from the simulation model. All connectors provided by Cognite support unit management, so you can define the units of the input and output values.
The script in a routine determines the order of how the connector sets the input, issues commands, and fetches outputs.
Configure a routine
This example shows a simple routine configuration for a system calculation using a PROSPER simulator.
{
"externalId": "SystemCalculation-LER-WELL-A2-v1",
"routineExternalId": "SystemCalculation-LER-WELL-A2",
"configuration": {
"schedule": { "enabled": true, "cron_expression": "0 * * * *" },
"dataSampling": { "enabled": true, "validationWindow": 60, "samplingWindow": 60, "granularity": 1 },
"logicalCheck": [
{
"enabled": true,
"timeseriesExternalId": "AP07-019THP-PSI2120.PV",
"aggregate": "average",
"operator": "ge",
"value": 80
}
],
"steadyStateDetection": [],
"inputs": [
{
"name": "RateMethod",
"value": "2",
"valueType": "STRING",
"referenceId": "RateMethod",
},
{
"name": "Tubing Head Pressure",
"referenceId": "THP",
"unit": { "name": "psig", "quantity": "Pressure" },
"sourceExternalId": "AP07-019THP-PSI2120.PV",
"aggregate": "average",
"saveTimeseriesExternalId": "SystemCalculation-LER-WELL-A2-INPUT-THP"
},
{
"name": "ClearSensDB",
"value": "1",
"valueType": "STRING",
"referenceId": "ClearSensDB",
}
],
"outputs": [
{
"name": "Gas Flowrate",
"referenceId": "GasRate",
"unit": { "name": "MMscf/day", "quantity": "GasRate" },
"valueType": "DOUBLE",
"saveTimeseriesExternalId": "SystemCalculation-LER-WELL-A2-OUTPUT-GasRate"
},
{
"name": "Oil Flowrate",
"referenceId": "OilRate",
"unit": { "name": "STB/day", "quantity": "LiqRate" },
"valueType": "DOUBLE",
"saveTimeseriesExternalId": "SystemCalculation-LER-WELL-A2-OUTPUT-OilRate"
},
{
"name": "Water Flowrate",
"referenceId": "WatRate",
"unit": { "name": "STB/day", "quantity": "LiqRate" },
"valueType": "DOUBLE",
"saveTimeseriesExternalId": "SystemCalculation-LER-WELL-A2-OUTPUT-WatRate"
},
{
"name": "Liquid Flowrate",
"referenceId": "LiqRate",
"unit": { "name": "STB/day", "quantity": "LiqRate" },
"valueType": "DOUBLE",
"saveTimeseriesExternalId": "SystemCalculation-LER-WELL-A2-OUTPUT-LiqRate"
},
{
"name": "Bottom Hole Pressure",
"referenceId": "BHP",
"unit": { "name": "psig", "quantity": "Pressure" },
"valueType": "DOUBLE",
"saveTimeseriesExternalId": "SystemCalculation-LER-WELL-A2-OUTPUT-BHP"
}
]
},
"script": [
{
"order": 1,
"description": "Set Inputs",
"steps": [
{
"order": 1,
"stepType": "Set",
"description": "Set RateMethod to Automatic",
"arguments": { "referenceId": "RateMethod", "address": "PROSPER.ANL.SYS.RateMethod" }
},
{
"order": 2,
"stepType": "Set",
"arguments": { "referenceId": "THP", "address": "PROSPER.ANL.SYS.Pres" }
}
]
},
{
"order": 2,
"description": "Perform Calculation",
"steps": [
{
"order": 1,
"stepType": "Set",
"description": "Clear table with sensitivity variables",
"arguments": { "referenceId": "ClearSensDB", "address": "PROSPER.ANL.SYS.Sens.SensDB.Clear" }
},
{
"order": 2,
"stepType": "Command",
"arguments": { "address": "PROSPER.ANL.SYS.CALC" }
}
]
},
{
"order": 3,
"description": "Set Outputs",
"steps": [
{
"order": 1,
"stepType": "Get",
"arguments": { "referenceId": "GasRate", "address": "PROSPER.OUT.SYS.Results[0].Sol.GasRate" }
},
{
"order": 2,
"stepType": "Get",
"arguments": { "referenceId": "OilRate", "address": "PROSPER.OUT.SYS.Results[0].Sol.OilRate" }
},
{
"order": 3,
"stepType": "Get",
"arguments": { "referenceId": "WatRate", "address": "PROSPER.OUT.SYS.Results[0].Sol.WatRate" }
},
{
"order": 4,
"stepType": "Get",
"arguments": { "referenceId": "LiqRate", "address": "PROSPER.OUT.SYS.Results[0].Sol.LiqRate" }
},
{
"order": 5,
"stepType": "Get",
"arguments": { "referenceId": "BHP", "address": "PROSPER.OUT.SYS.Results[0].Sol.BHP" }
}
]
}
]
}
Routine revision identification
The routine revision is uniquely identified by externalId ("SystemCalculation-LER-WELL-A2-v1")
and is associated with a parent routine ID, "routineExternalId": "SystemCalculation-LER-WELL-A2"
, which is associated with a particular simulator ("PROSPER"
) and a simulator model ("LER-WELL-A2"
).
Schedule configuration
The routine revision is configured to run on a schedule, as indicated by the "enabled": true
in the "schedule"
section. The "cronExpression": "0 * * * *"
means that the routine will run at the beginning of every hour.
Data sampling
Data sampling is enabled for this routine. validationWindow
and samplingWindow
are both set to 60 minutes, with a granularity of 1 minute. This means that the connector will look for valid data within the last hour, sampling data every 1 minute.
Logical check
A logical check is configured for the tubing head pressure. It checks if the average value of time series "AP07-019THP-PSI2120.PV"
is greater than 80
. This ensures that the simulation only runs when the tubing head pressure is above a certain threshold.
Input configuration
The routine revision defines three inputs for the simulation:
- RateMethod: A constant value of
"2"
. - Tubing Head Pressure: Sourced from the
"AP07-019THP-PSI2120.PV"
time series, using the average aggregate, with data stored in"psig"
. - ClearSensDB: A constant value of
"1"
.
Each input is assigned a reference ID for use in the simulation script. Some inputs are configured to save their values to time series for later analysis.
Output configuration
The routine revision defines five outputs from the simulation:
- Gas Flowrate: In
"MMscf/day"
, to be saved to a time series. - Oil Flowrate: In
"STB/day"
, to be saved to a time series. - Water Flowrate: In
"STB/day"
, to be saved to a time series. - Liquid Flowrate: In
"STB/day"
, to be saved to a time series. - Bottom Hole Pressure: In
"psig"
, to be saved to a time series.
Simulation script
The script section defines the steps for executing the simulation:
- Set Inputs: The script sets all the input values into the simulation model.
- Perform Calculation: The system calculation command,
"PROSPER.ANL.SYS.CALC"
is issued to run the simulation. - Set Outputs: The script retrieves the output values from the simulation model.
This configuration allows for a system calculation of well A2, taking into account real-time tubing head pressure data and some PROSPER configuration flags. The simulation calculates the resulting production conditions, which can be used for various purposes such as virtual metering, production optimization, and asset health.