Processing and Storing Well Test Results

Once the well test action sequence completes, the well test contents must be generated. Since the values for the well test record can come from various locations due to the unique configurations at the field-level, a programmable approach in the form of a VBScript is required. After the test is complete, a Script action is necessary to process the results.

The path to the script file is configured in the Script action type in the well test configuration XML. A sample script is provided to illustrate the concept of processing supplied arguments and providing the necessary output that the CygNet Well Test module expects in order to process a well test record. The sample VBScript will need to be customized for the user's specific environment.

See Sample Well Test Screens and Scripts for more information.

About Well Test Dates

The CygNet Well Test module uses the same timestamp for the date and time of the actual well test supplied within the well test record (retrieved via script) and the date and time when the well test record is posted to the VHS (the VHS entry date). To avoid confusion the date provided in the well test record is the same as the entry date in the VHS. See Timestamps for more information about CygNet timestamps.

Script File Tokens

The VBScript referenced in the Script action type must output the well test values. The script action is expecting the well test variables to be returned in a specific way.

Single Well Test Record

There are seven (7) reserved token names that can be used to specify the value for a given process variable. For single well test records, the script tokens need to output in the following format:

Token Description Example

%OIL%

The value for this token is expected to be a rate with units of barrels per day (bbl/D).

%OIL%80.6

%WATER%

The value for this token is expected to be a rate with units of barrels per day (bbl/D).

%WATER%172

%GAS%

The value for this token is expected to be a rate with units of MCF per day (MCFD).

%GAS%149.9

%DURATION%

The value for this token is expected to be in seconds.

%DURATION%15.3

%STATUS%

A generic user-specified status value.

%STATUS%1:Good

%DATETIME%

The timestamp of the well test record. It is expected to be local time of the server from where the well test is performed.

%DATETIME%1/6/2024 9:43:27 AM

%FACILITYTAG%

The Facility Tag of the well associated with the well test record.

%FACILITYTAG%C4PROD.UIS::ELLIOT_WL

Historical Well Test Record

The historical well test record needs to indicate the type of output, so it will start with the %HISTORICAL% token. The start of each record will start with the %RECORD% token. The tokens and value used for an individual record are similar to those used for the single well test record format. The main difference is that historical records will not have a %FACILITYTAG% token, but they will have a %POSITION% token instead. The %POSITION% token and its subsequent value are used to lookup the facility tag. The position that is defined in the Header section of the well test configuration XML is the same position value used in the lookup. Typically, a device isn’t going to know the facility tag. It typically only knows of the position it is are currently on. So, the %POSITION% token is used to figure out the well facility tag to post the well test result to.

For historical records, the script tokens need to output in the following format:

Token Description Example

%HISTORICAL%

Indicates the type of output: Historical well test record.

 

%RECORD%

The start of each historical record.

%RECORD%

%POSITION%

Used to lookup the facility tag. The position defined in the Header section of the well test configuration XML is the same position value used in the lookup.

%POSITION%1

%DATETIME%

The timestamp of the well test record. It is expected to be local time of the server from where the well test is performed.

%DATETIME%1/1/2024 3:04:00 AM

%OIL%

The value for this token is expected to be a rate with units of barrels per day (bbl/D).

%OIL%417.3486

%WATER%

The value for this token is expected to be a rate with units of barrels per day (bbl/D).

%WATER%341.8908

%GAS%

The value for this token is expected to be a rate with units of MCF per day (MCFD).

%GAS%1.288

%DURATION%

The value for this token is expected to be in seconds.

%DURATION%9

%RECORD%

The start of each historical record.

%RECORD%

%POSITION%

Used to lookup the facility tag. The position defined in the Header section of the well test configuration XML is the same position value used in the lookup.

%POSITION%1

%DATETIME%

The timestamp of the well test record. It is expected to be local time of the server from where the well test is performed.

%DATETIME%8/20/2024 1:01:00 AM

%OIL%

The value for this token is expected to be a rate with units of barrels per day (bbl/D).

%OIL%2465.628

%WATER%

The value for this token is expected to be a rate with units of barrels per day (bbl/D).

%WATER%8.639225

%GAS%

The value for this token is expected to be a rate with units of MCF per day (MCFD).

%GAS%1094.051

%DURATION%

The value for this token is expected to be in seconds.

%DURATION%0

Script Processing

The oil, water, and gas values come from the separator facility, which is specified in the Tag property on the Headers page of the well test configuration control ('tag' attribute of the <Header> element of the XML configuration). The duration, facility tag, and timestamp values come from the Well facility, which is specified in the Tag property on the Wells section of the well test configuration control ('tag' attribute of the <Well> element). All values are concatenated and passed into the script. The generic script then turns around and passes those same values back out in the appropriate format. From there, the XML record gets generated and posted to the VHS as a Blob string.

Script Engine Process and VHS Blob Storage

Well test records are stored as XML strings in VHS entries for each configured well. The module will pass out the tokens and the values, and generate an XML string and publish it to the "Result" UDC specified in the UDC configuration on the General page of the well test configuration control (or if configured, the override UDC specified in the Script action type).

The Microsoft script engine exits after it has executed a user-provided VBScript file, waiting at most 10 seconds to exit. The Well Test results are stored in VHS blobs in the following manner:

Export Well Test Record

The following is a sample script procedure to export the values in the correct manner.

Copy
Export Script
'---------------------------------------------------------------------
' Standard output method
'---------------------------------------------------------------------
Sub WriteOutput(Oil, Water, Gas, Duration, Status, RecordTimeStamp)
    ConstoilToken = "%OIL%"
    ConstwaterToken = "%WATER%"
    ConstgasToken = "%GAS%"
    ConstdurationToken = "%DURATION%"
    ConststatusToken = "%STATUS%"
    ConsttimeStampToken = "%DATETIME%"
    ConstfacilityTagToken = "%FACILITYTAG%"
     
    SetobjStdOut = WScript.StdOut
    objStdOut.Write oilToken
    objStdOut.Write Oil
    objStdOut.WriteBlankLines(1)
    objStdOut.Write waterToken
    objStdOut.Write Water
    objStdOut.WriteBlankLines(1)
    objStdOut.Write gasToken
    objStdOut.Write Gas
    objStdOut.WriteBlankLines(1)
    objStdOut.Write durationToken
    objStdOut.Write Duration
    objStdOut.WriteBlankLines(1)
    objStdOut.Write statusToken
    objStdOut.Write Status
    objStdOut.WriteBlankLines(1)
    objStdOut.Write timeStampToken
    objStdOut.Write RecordTimeStamp
End Sub

Retrieving Well Test Records

Any third-party application can retrieve well test records using the CygNet.API.WellTest. See Retrieving Well Test Records for more information.

Back to top