Introduction to ModBus SnapIn
ModBus is a standard protocol used to communicate with a multitude of electronic measurement device, such as pressure and temperature sensors. Fekete has implemented the ModBus protocol into a module called the "ModBus SnapIn". Since 1999 F.A.S.T. FieldNotes has been able to monitor production tests in Real Time. The enhancements that the ModBus SnapIn provides F.A.S.T. FieldNotes include:
- Up to 1 second real time transfer
- Can poll multiple RTUs (Remote Terminal Unit) on a single multi-drop serial port
- Can poll multiple RTUs on multiple serial ports
- Simple user interface that describes the RTU's physical configuration, sensor alarms, and virtual meter descriptions.
- Simple user interface for field operations
Modbus SnapIn Real time Extensions

ModBus SnapIn Menu and Toolbar
- Start - Starts the real time data transfer. The user is prompted with the standard file open dialog from which they can select the appropriate .mbc file.
(ModBus Configuration File)
- A default configuration file can be specified for the computer by using the MBConfig Software. This will automatic load the specified .mbc when the Start button is activated Holding the shift key while pressing the button forces the bypass of the default .mbc file.
- Pause - Pauses data updates, data is still being acquired and spooled until pause is released
- Stop - Stops the currently running MBC configuration
- Status - Displays the Modbus Status Screen
Modbus Status Pannel
The ModBus Status Pannel allows you to view the current state of connectivity to the attached hardware.
- The Errors Tab - Will display any communication errors that happpen while polling the modbus RTUs.
- The Alarms Tab - Will display status of all the alarms being monitored.
- The All Inputs Tab - Displays the the most recent value sent to the application for the indicated channel being monitored.
- The In Between Tabs - Display a subset of the channels shown in the All Inputs Tab based on logical grouping such as all the channels associated to specific metering group.
- The Network Tab - Displays the configuration parameters of all the components within the system.

Introduction to MBConfig
Fekete has provide a simple tool that allow the user to quick describe the five components need to bring real time data into a F.A.S.T. Application. They are:
- Set up the serial communication parameters for the computer to talk to the RTU.
- Select the appropriate logical group that describes the meter configuration you are using.
- Fill in the channel properties, which describe the type of data we are monitoring and the physical properties as it relates to the RTU.
- Test your configuration against your hardware.
- Save as an .MBC file
When you open MBConfig you will see the following screen:

From top down you have:
- The Title Bar – which displays the program name and the name and path of the file you are working on.
- Menu Bar – this contains the programs primary menus.
- Tool Bar – provides quick access to commonly used features.
- System View – this is where you add, select and delete logical groups and channels
- Properties View – displays the editable properties of the channels and logical groups
- Description View – provides a brief description of the property being edited in the Properties View.
- Code View – information only.
- Status Bar – provides tool tips and the status of various operations.

Defining a Simple ModBus Configuration
The following series of figures illustrates a step by step procedure for defining a simple modbus configuration.
1. Set Global Properties
At his time there is only one global parameter, Sample Rate. The Sample Rate specifies how often reading are sent to FieldNotes. Key properties include:
- Read Only – This protects the value from being manipulated in the ModBus Status Panel. By default this is set to false. The advantage is while gathering data during a test the FieldNotes operator can change sample rate to measure specific events. An example is when the well goes from a flowing to shut-in state the more frequent the pressure readings are during the time immediately following the Shut-in the more useful the data is to well test analyst.
- Type – Allows the user to specify the data type (units of measurement) to use, in this case we have selected seconds from the available list..
- Value – Specifies how often the ModBus SnapIn will send the latest reading to the F.A.S.T. Application. In this case the value is set to 60. Combined with the data Type, the ModBus SnapIn will send a set of readings once every 60 seconds or once a minute.

2. Set ModBus Properties
Under the Modbus properties, we configure how the computer will communicate with the attached hardware. Key properties include:
- Baud – Specifies the baud rate at which data is transferred between the computer and the attached hardware.
- Port – What com port the physical hardware is attached to.
- Protocol - Defines how the data stream is to be interpolated.
- FlowControl – Is the physical communication method used to transfer the data.
- Parity – The parity bit is used for simple error detection.
- Silent Interval – Is the amount of time we will wait before sending out the next request.
- Stop Bit – Indicates the end of the data bits.
- Timeout – Is the amount of time the computer will wait in milliseconds for a response from the attached hardware.

3. Set RTU Properties
The Remote Terminal Unit is a single purpose computer which is responsible for communicating with each measuring device attached, logging data from those devices, performing calculations, and finally passing the data, to the computer. Since the ModBus SnapIn is deemed the “Master” in our communication with the RTU we control how often we poll the RTU for data, using the key property:
- Poll – Is the Polling rate used for retrieving data from the RTU and is measured in milliseconds. Note: this is not the as “Sample Rate”. In this example we are polling the RTU for data every 1000 milliseconds or once every second.

4. Add Logical Devices to a RTU
To add a logical group to an RTU simply right click on the RTU in the system view and select the group type you want from menu.

Add Wellhead
When “Add WellHead” is selected MBConfig will automatically add four predefined hardware channels to the RTU. These channels are specifically used to measure the pressure and temperature of the tubing and casing at the wellhead.

Add Aux Channels
When “Add Aux Channel” is selected MBConfig will automatically add a new logical group to the RTU called “Aux Channel”. Then right click on the “AuxChannel” group and highlight “Add Aux Channel” again, a menu will display all the available channel types, left click on the channel type to add it to the “Aux Channel” group.

Add Gas Meter
When you highlight “Add Gas Meter” a menu containing a list of available Gas meters will be displayed. Left click on the specific meter type you wish to use. This will create a new logical meter group for the RTU. Within that logical meter group the appropriate channel types will be added. For example if we selected “Gas Orifice Meter” MBConfig will create the group called OrificeMeter and add channels for Static Pressure, Differential Pressure and Meter Temperature.

Add Oil, Water and Condensate Meters
When you highlight “Add Oil Meter” a menu containing a list of available Oil meters will be displayed. Left click on the specific meter type you wish to use. This will create a new logical meter group for the RTU. Within that logical meter group the appropriate channel types will be added. For example if we selected “Measured Level Meter” MBConfig will create the group called OilMeassuredLiquidLevelMeter and add channels for Oil Density, Meter Pressure, Meter Temperature, Liquid Level and Level Constant

Add/Delete RTU
When select the delete the RTU and all logical groups and channels attached to the RTU will be deleted as well. You can always add new RTU by right-clicking on Modbus group and selecting “Add RTU”.

5. Configure a Gas Orfice Meter
Once we’ve added a Gas Orifice Meter to the system we will have 3 channels that need to be configure. For this example I have selected the Static Pressure channel which is called “MeterStatic2”. The key properties include:
- Address – This is the address of the register in the RTU that stores the most recent reading of the meters static pressure. Typically these addresses start around 40000.
- RegisterType- This specifies the way in which the number is stored.
- Type - Allows the user to specify the data type (units of measurement) to use, in this case we have selected psig gauge pressure from the available list.

6. Configure an Oil Measured Level Meter
Once you’ve added the Oil Measured Level Meter to the system, you will need to configure the Meters properties. The key properties include:
- HydroStatic – When the Hydrostatic flag is set to “False” the ModBus SnapIn tells F.A.S.T. Applications that this meter will provide level information in the form of height measurements. MBConfig will automatically add 5 predefined hardware channels:
- MeterOilApiDensity – Is the data stream that provides the current API value of the oil.
- MeterStatic – Is pressure at the metering device.
- MeterTemperature – Is the temperature at the metering device.
- MeterLevelConstant – If the area of the tank is constant for its entire height, then we can multiply the height reading by the “MeterLevelConstant” to determine the current volume of oil in the tank.
- MeterMeasuredLiquidLevel – Is the measured height of the fluid in the tank.
- MeassurementType – Indicates if the readings are cumulative, constantly increasing or incremental which is the difference in height from this reading and the last reading (Not Recommended).

- HydroStatic – When the Hydrostatic flag is set to “True” the ModBus SnapIn tells F.A.S.T. Applications that this meter will provide level information in the form of pressure measurements. MBConfig will automatically add 5 predefined hardware channels:
- MeterOilApiDensity – Is the data stream that provides the current API value of the oil.
- MeterStatic – Is the hydrostatic pressure head.
- MeterTemperature – Is the temperature at the metering device.
- MeterLevelConstant – If the area of the tank is constant for its entire height, then we can multiply the height reading by the “MeterLevelConstant” to determine the current volume of oil in the tank.
- MeterLiquidDensity – Is the measured density of the fluid in the tank.
- MeassurementType – Indicates if the readings are cumulative, constantly increasing or incremental which is the difference in height from this reading and the last reading (Not Recommended).

Finally we need to configure the individual channels. The key properties include:
- Address – This is the address of the register in the RTU that stores the most recent reading of the meters static pressure. Typically these addresses start around 40000.
- RegisterType- This specifies the way in which the number is stored.
- Type - Allows the user to specify the data type (units of measurement) to use, in this case we have selected Inches of Water from the available list.
Note: Channels that are not required can be removed by simply right clicking on the channel name and selecting “Delete” from the menu.
Channel Properties

- (Name)
- Name – Uniquely identifies the channel within the RTU. The Name most be unique and can not contain any spaces.
- Communication
- Address – This is the address of the register in the RTU that stores the most recent reading of the meters static pressure. Typically these addresses start around 40000.
- ReadErrorLimit – Specifies the number of read attempts before the channel is records the failure and its content cleared.
- ReadOnly - This protects the value from being manipulated in the ModBus Status Panel. By default this is set to false the exception to this is Sample Rate. The advantage is while gathering data during a test the FieldNotes operator can change sample rate to measure specific events. An example is when the well goes from a flowing to shut-in state the more frequent the pressure readings are during the time immediately following the Shut-in the more useful the data is to well test analyst.
- RegisterType – Describe the physical characteristic of the data field (how the bytes are physically ordered).
- Simulated – This is used for testing the channel when not actual connected to hardware
- General
- AddToRecorder – Makes the channel accessible to the F.A.S.T. Applications and should be set to “True” for Wellhead and AuxChannels. For meter specific channels this field can be left in it’s default state of “False”.
- Description - Describe the channel data type (Read Only).
- DisplayName – Is the Name that appears in the Modbus Status Panel. Note that all the WellHead Channels have reserved names that cannot be changed.
- Resolution – Specifies the gauges resolution for the specified units
- Type - Allows the user to specify the data’s unit type (units of measurement).
- Value – is the value returned when the channel is designated as simulation the exception to this is the Sample Rate channel. Here it is
- Utilities Alarm
- CriticalMax – If the data value exceeds the value specified than an alarm will trigger.
- CriticalMaxClear – If an alarm was triggered on the channel and the value read on the channel drops bellow the specified value, then the alarms condition will be cleared.
- CriticalMbComErr- Triggers an alarm when communication on this channel is disrupted.
- CriticalMin – – If the data value drops bellow the value specified than an alarm will trigger.
- CriticalMinClear – If an alarm was triggered on the channel and the value read on the channel exceeds the specified value, then the alarms condition will be cleared.
- Description - Describe the Alarm channel data type (Read Only).
- DisplayName – Is the Alarm channels name that appears in the Modbus Status Panel..
- Enabled – Turns the Alarm on or off
- Name - Uniquely identifies the Alarm channel within the RTU (Read Only).
- Utilities Filter
- Description - Describe the Filter channel data type (Read Only).
- DisplayName – Is the Filter channel name that appears in the Modbus Status Panel.
- Enabled – Turns the Filtering on or off
- Minimum – Specifies the Minimum value to return if the sampled data value is less then the “Threshold” value.
- n – the number of sample used to filter in the filter function for smoothing the data.
- Name - Uniquely identifies the Filter channel within the RTU (Read Only).
- Threshold – Specifies the minimum allowable value for the channel; if the channel value drops bellow the value specified the system will return the specified “Minimum”.
- UseThresholdAndMin – Activates the Threshold filter
Alarms
Since the current ModBus Snap-In can sample the RTU (aka Rtu.Poll) at a different a rate then what it supplies to FieldNotes (aka Recorder.UpdateRate) we can provide alarm detection on each channel within the ModBus Snap-In. Therefore, Alarms will require a properly working Modbus stream and RTU (for polling), and an actively running Recorder with a SampleRate channel (for update rates).
Features include:
- Each channel will have the option to activate Alarm monitoring: We can monitor CriticalMax/Min and its counterpart CriticalMax/MinClear on each sensor.
- The Alarm will trigger when a specified Maximum value is reached or exceeded: If an acquired value is greater than CriticalMax, the alarm is triggered.
- When an Alarm condition is triggered The following will happen:
- The sample rate for sending data to FieldNotes will be immediately be set to match the sample rate of the RTU until the Alarm is cleared. When all the alarms are cleared, the sample rate is restored to value before alarms were detected
- FieldNotes will be immediately notified of the Alarm condition: Update the FieldNotes’ column values
- A visible Alarm will be displayed on the screen. Message will be logged to the pop-up. The alarm condition will not clear until the monitored value is below CriticalMaxClear.
- FieldNotes upon receiving the Alarm notification will:
- Log the Alarm into the Events column
- Activate the FN-Mailer to send the updated file If the ‘enable remote email’ is checked and the file meet all FN-Mailer requirements.
- FieldNotes upon receiving the Cleared notification will:
- Log the Clear condition into the events column
- Activate the FN-Mailer to send the updated file. if the ‘enable remote email’ is checked and the file meet all FN-Mailer requirements.
Process Flow Diagram
This is a Process flow diagram of a configuration with two Modbus serial communication streams. Stream 1 contains two multi-drop RTUs and stream 2 contains a single RTU.

Each Modbus Port (and associated RTUs) operate in a separate process thread. RTUs are polled in a round robin fashion according to each RTUs poll rate. An RTU poll reads the modbus registers and updates the channel array. If the RTU poll fails the corresponding channel values are set to null in the channel array.
Channels in the Input display (Status Window) are updated at the poll rate of the channels RTU or whenever a channel value changes (in the case of a global channel).
Recorder interfaces also operate within a separate process thread. Data is time stamped and transferred from the channel array to F.A.S.T. applications according to the Recorders Sample Rate (and is independent of the RTU polls). If the pause button is pressed (from FieldNotes) the samples are queued until pause is released.
Glossary of Terms
Channel: A Channel represent a single raw data stream entering an RTU. It describes the type of data we are monitoring and the physical properties of the attached equipment as it relates to the RTU. A RTU channel can have addition processing attached to it forming a virtual channel. Currently there are 2 virtual channel types the F Channel which reduces noise in the raw data by applying a moving average calculation, and the A Channel only displays data when an alarm condition has occurred.
RTU: Remote Terminal Unit, simply is the device responsible for: communication with the individual measurement devices, the logging of the readings from the measurement devices and finally communicating with computer using the ModBus protocol.
F.A.S.T. Application: F.A.S.T.FieldNotes F.A.S.T. Welltest F.A.S.T ValiData