Well Test - Measurement
For the measurement piece, in PLC Shift Manager, we start by creating a Gas Flow application, a Liquid Flow application for oil measurement, and a Liquid Flow application for water measurement.
See the Well Test - Downloads section to get the exact configuration that we use in this demo.
It's strongly recommended to download the configurations and import them into PLC Shift rather than following the instructions below.
|

PLC Shift Apps for Well Testing
The steps below assume that we are starting with a new default application configuration. Only changes from default values are listed. See the Codesys OPC-UA section in this manual for an explanation of the device level settings and a better understanding of how to configure PLC Shift apps to work with a Codesys soft PLC.
Device
Create a new device in the PLC Shift Manager tree view and configure it as follows:
-
Set the value of 'Host Name' in the 'Device Settings' group to host name of your hardware.
-
Change the value of the 'SSH User Name' in the 'Device Settings' group to the correct value for your system.
-
Set 'Enable Tag DB' in the 'Device Settings' group to 'True';
-
Set 'Database Protocol' in the 'Device Settings' group to 'OPC UA'.
-
Set the value of 'OPC UA Node ID' in the 'Device Settings' group to the value that matches your Codesys project setup. For the demo project, it's set to '|var|CODESYS Control for Raspberry Pi MC SL.Application'.
Gas Flow - Gas01
Take the following steps to configure the gas flow application:
-
Set the 'User Defined Name' tag in the 'Overall Settings' group to 'Gas01'.
-
Set the 'Application Tag Name Prefix' tag in the 'Overall Settings' group to 'GF01_'
-
Set the 'PLC Tag Name' parameter in the 'Overall Settings' group to 'GF01'
-
Set the base temperature and pressure in the 'Contract' group to your desired values. For the demo, the value was changed to 15 C.
-
Select the 'Compressibility Group' and choose the 'Sync All with PLC' option. This makes the gas composition tags available to the PLC.
-
Set the 'Operation Mode' parameter in the 'Flow Calculation' group to 'Batch'.
-
Set the 'Sync with PLC' option on the 'Execution Count' status parameter in the 'Application Information' group. This is used to determine whether the PLC has a connection to the application.
-
Set the 'Sync with PLC' option on the 'Compressibility Group Invalid' tag in the 'Configuration Group Status' group. This lets the PLC program know when the configuration of gas composition group is not valid.
-
Set the 'Sync with PLC' option on the 'Alarm Active' tag in the 'Input Alarm Status' group. This lets the PLC program know when the inputs are out of range. Note that for this demo, we have not configured or enabled any alarms, but the PLC code is written to indicate that alarms are active on the HMI, so this tag is required.
-
Set the 'Sync with PLC' option for all tags in the 'Batch Current Status' group.
-
Set the 'Sync with PLC' option for all 'Batch 1' tags in the 'Batch History' group.
-
Use the units wizard to set all gas volume units to m3. This isn't required, of course, but the PLC program assumes that purge volumes are in m3 and units are hardcoded in the HMI.
Liquid Flow - Liquid01
Take the following steps to configure the liquid flow application that is used to measure oil:
-
Set the 'User Defined Name' tag in the 'Overall Settings' group to 'Liquid01'.
-
Set the 'Application Tag Name Prefix' tag in the 'Overall Settings' group to 'LF01_'.
-
Set the 'PLC Tag Name' parameter in the 'Overall Settings' group to 'LF01'.
-
Set the base temperature and pressure in the 'Contract' group to your desired values. For the demo, the temperature value was changed to 15 C.
-
Set the 'Input Type' parameter in the 'Inputs' group to 'Volume Flow'.
-
Set the 'Sync with PLC' option on the 'Density Type' tag in the 'Inputs' group.
-
Set the 'Sync with PLC' option on the 'Fixed Density' tag in the 'Inputs' group.
-
Set the 'Sync with PLC' option on the 'Density Type' tag in the 'Inputs' group.
-
Set the 'Operation Mode' parameter in the 'Flow Calculation' group to 'Batch'.
-
Set the 'Sync with PLC' option on the 'Product Type' tag in the 'Flow Calculation' group.
-
Set the 'Sync with PLC' option on the 'Base Density Oil' tag in the 'Flow Calculation' group.
-
Set the 'Sync with PLC' option on the 'Correction Factor Oil' tag in the 'Flow Calculation' group.
-
Set the 'Enable Two Phase Detection' parameter in the 'Flow Calculation' group to 'True'.
-
Set the 'Sync with PLC' option on the 'Two Phase Threshold' tag in the 'Inputs' group.
-
Set the 'Sync with PLC' option on the 'Execution Count' status parameter in the 'Application Information' group. This is used to determine whether the PLC has a connection to the application.
-
Set the 'Sync with PLC' option on the 'Inputs Group Invalid' tag in the 'Configuration Group Status' group. This lets the PLC program know when the configuration of the group is not valid.
-
Set the 'Sync with PLC' option on the 'Flow Calculation Group Invalid' tag in the 'Configuration Group Status' group. This lets the PLC program know when the configuration of the group is not valid.
-
Set the 'Sync with PLC' option on the 'Alarm Active' tag in the 'Input Alarm Status' group. This lets the PLC program know when the inputs are out of range. Note that for this demo, we have not configured or enabled any alarms, but the PLC code is written to indicate that alarms are active on the HMI, so this tag is required.
-
Set the 'Sync with PLC' option for all tags in the 'Batch Status' group.
-
Set the 'Sync with PLC' option for all 'Batch 1' tags in the 'Batch History' group.
Liquid Flow - Water01
Copy the configuration of the Liquid01 app and make the following changes:
-
Set the 'User Defined Name' tag in the 'Overall Settings' group to 'Water01'.
-
Set the 'Application Tag Name Prefix' tag in the 'Overall Settings' group to 'WT01_'.
-
Set the 'PLC Tag Name' parameter in the 'Overall Settings' group to 'WT01'.
-
Set the base temperature and pressure in the 'Contract' group to your desired values. For the demo, the temperature value was changed to 15 C.
-
Clear the 'Sync with PLC' option on the 'Product Type' tag in the 'Inputs' group.
-
Clear the 'Sync with PLC' option on the 'Base Density Oil' tag in the 'Inputs' group.
-
Clear the 'Sync with PLC' option on the 'Correction Factor Oil' tag in the 'Inputs' group.
-
Set the 'Sync with PLC' option on the 'Correction Factor Water' tag in the 'Inputs' group.
-
Clear the 'Sync with PLC' option on the 'Density Type' tag in the 'Inputs' group.
-
Set the 'Water Volume Correction Type' parameter in the 'Flow Calculation' group to 'API 11.4.1 (Water''.
-
Set the 'Measurement Type' parameter in the 'Flow Calculation' group to 'Water'.
-
Set the 'Enable Two Phase Detection' parameter in the 'Flow Calculation' group to 'False'.
-
Clear the 'Sync with PLC' option on the 'Two Phase Threshold' tag in the 'Inputs' group.
-
Clear the 'Sync with PLC' option on the 'Alarm Active' tag in the 'Input Alarm Status' group. This isn't needed for the water run.
Deployment
One the device and apps are configured, install the PLC Shift runtime on your hardware, if needed, and then download the configuration.
Codesys Soft PLC
If you are using Codesys, select the device from the tree view in PLC Shift Manager and then from the top menu, choose 'File -> Export -> Codesys DUT'. Export all app configurations as Codesys DUTs. Import the DUTs into Codesys and create tags from the DUTs. The name of the tags in Codesys must match the tag names configured above. See the Codesys OPC-UA section for more details on how to link PLC Shift Apps with a Codesys soft PLC.
SCADAPack 47xi
If you are using a SCADAPack 470xi or 474xi, select the device from the tree view in PLC Shift Manager and then from the top menu choose 'FIle -> Export -> Remote Connect'. Export all app configurations as Remote Connect objects. Import the objects into Remote Connect. See the SCADAPack 47xi section for more details on how to link PLC Shift Apps with Remote Connect.
RA Logix
If you are using a Rockwell Automation Logix PLC, select the device from the tree view in PLC Shift Manager and then from the top menu choose 'FIle -> Export -> L5X UDT'. Export all app configurations as User Defined Types (UDTs). Import the objects into Studio 5000. See the Logix EtherNET/IP section for more details on how to link PLC Shift Apps with Logix PLCs.