Detecting Well Liquid loading with, Azure IoT, ML, and Pi

Overview

05.19.2007 003Legacy IIoT devices can be modernized utilizing edge of network devices to send data to the Azure IoT hub and Machine Learning. This can create cost and efficiency improvements and reduced downtime.

 

The issue(s)

I will try to quickly explain the issue of liquid loading and slow legacy communications. Keep in mind there are many other issues that can be alleviated with this solution and there is no way I could mention them all. Oil & Gas Wells can “Load Up” with liquid reducing production and possibly incurring costly intermediation to relieve the issue. In the Machine Learning Video at the bottom of this post I go into great detail about this issue.

Essentially liquids weigh a lot! About 1/2 lb per foot so a well 7,000 feet deep full of water can have around 3,000 psi exerted on the bottom of the hole. In order to lift the liquid, a pipe known as Tubing is ran down to the bottom of the hole inside of a bigger pipe called the Casing. Just like the common straw, the Tubing provides a means of lifting the liquid out of the well. If too much liquid builds up down in the hole, the weight of the liquid presses down on the formation, reducing gas pressure which exacerbates the problem of lifting. O&G companies usually bring in pressures and flow rates each hour. These data points fed into Machine Learning could quickly alert the operator of these issues forming.

Another issue relating to this challenge is getting higher resolution data, and getting it when events happen instead of waiting on a long poll cycle. “Real-time comms” can make a huge difference in quick intermediation. Legacy IIoT communicate with old slow protocols, we can use an “Edge of Network” device as a stop gap until manufacturers implement more efficient fast protocols like MQTT.

Here are some bullets that help describe the problem:

  • We need to be alerted when loading starts to head off costly issues.
  • We can send data to Azure Machine Learning (ML) to process and predict issues.
  • Data resolution is low because of costly and slow networks.
  • Modbus is the most common protocol for data acquisition. Modbus is not real-time and requires the master to initiate a poll.

The solution to this challenge is broken into five sections with a video for each.

  • 1. Overview of the entire project (above).
  • 2. Building the edge of network device using Raspberry Pi, Node-Red, and Modbus.
  • 3. Sending data to the Azure IoT Hub using Node-Red.
  • 4. Consuming IoT Hub data and sending it over to a database and machine learning.
  • 5. Machine learning tutorial with real world Oil & Gas example.

 

2. Building the Edge of Network Device using Raspberry Pi, Node-Red, and Modbus

An “Edge of Network Device” can poll devices locally on a much quicker poll cycle and instantly send the data to the cloud when it changes or issues arise using MQTT. In this example we use the Raspberry Pi but keep in mind if the environment is harsh (temperature ranges, explosive or corrosive atmosphere etc.) the Pi can be substituted with one of many industrial fan-less computers rated for the environment and power requirements.

Here are two examples of industrial devices for Edge of Network operation. elecsyscorp and www.ieiworld.com

The Pi is loaded simply with Node-Red which is the polling engine to talk to legacy devices and can convert and forward messages using many different protocols.

You also need to install modbus nodes for Node-Red to communicate with the IIoT devices.

npm install node-red-contrib-modbus

 

npm install node-red-contrib-modbustcp

If you are new to Node-Red here are some resources to get you going quickly: Installing Node Red on Windows and Installing Node Red on Raspberry Pi and Getting Started with Node-Red.

 

3. Sending data to the Azure IoT Hub using Node-Red

Node-Red can send data to the Microsoft Azure IoT Hub. Start by upgrading your version of node.js and installing the Azure IoT Hub modules.

This video describes the entire process of configuring Node-Red, building an IoT hub in Azure, downloading the IoT SDKS, building some devices, and publishing the data.

Here are the command line commands to install the Azure IoT node into Node-Red.

node -v

 

apt update

 

apt install nodejs

 

node -v

 

npm install -g azure-iot-device@latest

 

npm install -g azure-iot-device-mqtt@latest

 

npm install https://github.com/lcarli/NodeRedIoTHub.git

Navigate to the link below and copy the example flow. Go into your Node-Red instance and using the import from clipboard.

http://flows.nodered.org/flow/1270f25a183d67c5b50e6b4eb78cabea

Node red flow.png

Here is where you can download the Azure IoT SDKS:

https://github.com/Azure/azure-iot-sdks

 

4. Consuming IoT Hub data with Stream Analytics and sending it to database and Machine Learning

This video has all the information you need to set up Azure Stream Analytics to consume IoT hub data, move it to database, and use Machine Learning.

 

5. Machine learning tutorial with real world Oil & Gas example

Lets get started with machine learning. Honestly, if you are brand new to Azure Machine learning and or Data Science it might be helpful for you to take about 30 minutes and watch some great introductory videos to get you warmed up. https://azure.microsoft.com/en-us/documentation/articles/machine-learning-data-science-for-beginners-the-5-questions-data-science-answers/

Next I suggest going through this step by step exercise to create your first ML Experiment. I used it to create this Oil & Gas example and it was excellent. https://azure.microsoft.com/en-us/documentation/articles/machine-learning-create-experiment/

All instructions are included in this video.

You will want to visit the Cortana Intelligence Gallery and open up my Oil and Gas Well Loading experiment in Microsoft Azure Machine Learning Studio. This auto-magically creates a complete experiment, complete with test data set for you. Click “deploy” and within a few minutes you can have a Machine Learning Web Service up and running!

Machine Learning.png

 

Wrapping it all up

Hopefully the example of a real Oil & Gas challenge can give some context to why one would use something like Machine learning or MQTT to provide real time analysis of conditions. Many of these parts, pieces, and videos can be used independently from each other. This project touched many different job titles (Control Specialist, Microsoft Azure guy, Database guy, Data Scientist, Subject Matter Analyst); I know it got a bit confusing at times. Heck, I left out the UI Designer guy, but I think this is enough for one day.

Thanks for reading and watching!