Assembly language in microchip

CHAPTER -1

INTRODUCTION

The project includes the development of the software and hardware for a Micro controller based of Oil Well Monitoring System. Here the project comes under the SCADA systems, which is the combination of software and hardware and perhaps additional mechanical or other parts, design to perform a specific function. The project is done using Microchips Microcontroller PIC16F73.This has very much influence in industrial application. Micro controller programming is done using Assembly language in Microchips Integrated Development Environment MPLAB version 5.30.00.

The project is concerned with the process of monitoring of an oil well.

The monitoring system consists of a flow sensor, pressure sensor, level sensor, microcontroller (PIC 16 F73), LCD display, Zigbee Module.

The basic function carried out here is oil well monitoring. The oil is pumped from the well to the tank. The pressure sensor detects the pressure at well head and correspondingly it will switch on and switch off the pump.

The flow sensor will detect the flow of oil through the pipe lines and if the flow rate is high then it will control the flow by controlling the valve. The level sensor will detect the level of oil in temporary storage station and will switch the valve on/off as required.

The microcontroller (PIC 16 F73) is the brain of the system. It receives data from the sensors, displays the real time value on LCD as well as on the PC and give instructions to the devices such as valves and pump for the required action to take place.

The circuit is interfaced with the PC hence process is monitored on the PC using a program developed using Microsofts Visual Basic.

The sensors used are all wireless sensors which work on Zigbee module, hence the remote station/ control station should be at one kilometer range of the sensors for monitoring and controlling the process.

1.1 SCADA Systems

SCADA is the abbreviation for Supervisory Control And Data Acquisition. SCADA systems are highly distributed systems used to control geographically isolated resources, often scattered over thousands of square kilometers, where centralized data acquisition and control are critical to system operation [1]. They are used in distribution systems such as water distribution and wastewater collection systems, oil and gas pipelines, electrical power grids, and railway transportation systems [1]. There are many parts of a working SCADA system. A SCADA system usually includes signal hardware input and output, controllers, networks, user interface (HMI), communications equipment and software. An industrial measurement and control system consisting of a central host or master (usually called a master station, master terminal unit or MTU); one or more field data gathering and control units or remotes (usually called remote stations, remote terminal units, or RTU's); and a collection of standard or custom software used to monitor and control remotely located field data elements [1]. Contemporary SCADA systems display mostly open-loop control characteristics and make use of mostly long distance communications; although some elements of closed-loop control and short distance communications may also be present [1].

A SCADA system performs four functions:

  1. Data acquisition
  2. Networked data communication
  3. Data presentation
  4. Control

Chapter - 2

Oil Production Process Overview

The following figure gives a simplified overview of the typical oil and gas production process.

At the left side, we find the wellheads. They feed into production and test manifolds. In a distributed production system this would be called the gathering system. The remainder of the figure is the actual process, often called the Gas Oil Separation Plant (GOSP) [2]. While there are oil or gas only installations, more often the well stream will consist of a full range of hydrocarbons from gas (methane, butane, propane etc.), condensates (medium density hydro-carbons) to crude oil. With this well flow we will also get a variety of non wanted components such as water, carbon dioxide, salts, sulphur and sand. The purpose of the GOSP is to process the well flow into clean marketable products: oil, natural gas or condensates [2]. Also included are a number of utility systems, not part of the actual process, but providing energy, water, air or some other utility to the plant [2].

The most important method in extracting oil is to use simple mechanical pumps to lift oil to the surface. There are a number of methods that are used to get better primary recovery. The most common is infill drilling, which involves drilling more wells into the same pool so the oil does not have to travel as far through the rock to reach a wellbore [2].

additional oil production can be obtained by injecting water ("water flooding") or natural gas to retain reservoir pressure and push oil out of the rock.

More superior methods are referred to as tertiary recovery. The most common tertiary recovery method for light and medium crude oil is miscible flooding. In this procedure, natural gas liquids (ethane, propane and butane) are injected into special injection wells [2]. When dissolved, these liquids reduce surface tension and viscosity to help release the oil from the reservoir rock [2]. Once oil is produced, it needs to be transported to refineries and onward to consumer markets. The most suitable way to move oil overland is pumping it through pipelines [2]. Some of these pipelines are massive steel conduits more than a meter in diameter, while others are plastic tubes a few centimeters[]across.

They form delivery systems as vast and complex as the railroads, highways or electric utilities. However, pipelines are basically invisible, buried a meter or more underground [2].

2.1 Well Head

The wellhead sits on top of the actual oil or gas well leading down to the reservoir. A wellhead may also be an injection well, used to inject water or gas back into the reservoir to preserve pressure and levels to maximize production. Once a natural gas or oil well is drilled, and it has been confirmed that commercially viable quantities of natural gas are there for extraction, the well must be 'completed' to permit for the flow of petroleum or natural gas out of the development and up to the surface [2]. This process includes strengthening the well hole with casing, evaluating the pressure and temperature of the formation, and then installing the suitable equipment to ensure an efficient flow of natural gas out of the well. The well flow is guarded with a choke [2]. The wellhead structure, often called a Christmas tree, must allow for a number of operations relating to production and well work over. Well work over refers to various technologies for maintaining the well and improving its production capacity [2]. The wellhead consists of the pieces of equipment mounted at the opening of the well to control and monitor the extraction of hydrocarbons from the underground formation. It also prevents leaking of oil or natural gas out of the well, and prevents blowouts due to high pressure formations. Formations that are under high pressure typically require wellheads that can withstand a great deal of upward pressure from the escaping gases and liquids [2]. The wellhead consists of three components: the casing head, the tubing head, and the Christmas Tree.

A typical Christmas tree consist of a master gate valve, a pressure gauge, a wing valve, a swab valve. The Christmas tree may also have a number of check valves [2]. At the bottom we find the Casing Head and casing Hangers. The casing will be screwed, bolted or welded to the hanger. Several valves and plugs will normally be fitted to give access to the casing. This will allow the casing to be opened, closed, bled down, and, in some cases, allow the flowing well to be produced through the casing as well as the tubing. The valve can be used to determine leaks in casing, tubing or the packer, and will also be used for lift gas injection into the casing [2].

The tubing hanger (also called donut) is used to position the tubing correctly in the well. Sealing also allows Christmas tree removal with pressure in the casing [2].

Master gate valve. The master gate valve is a high quality valve. It will give full opening, which means that it opens to the similar inside diameter as the tubing so that specialized tools may be run through it. It must be able of holding the full pressure of the well safely for all expected purposes. This valve is usually left fully open and is not used to control flow [2].

The pressure gauge. The minimum instrumentation is a pressure gauge placed above the master gate valve before the wing valve. In addition other instruments such as temperature will normally be fitted [2].

The wing valve. The wing valve be able to be a gate valve, or ball valve. When shutting in the well, the wing gate or valve is usually used so that the tubing pressure can be simply read [2].

The swab valve. The swab valve is used to increase access to the well for wire line operations, intervention and other work over actions , on top of it is a tree adapter and cap that will mate with a range of equipment.

The variable flow choke valve. The variable flow choke valve is typically a huge needle valve. Its calibrated opening is adjustable in 1/64 inch increments (called beans). High-quality steel is used in order to resist the high-speed flow of abrasive materials that pass through the choke, usually for many years, with little damage except to the dart or seat [2]. If a variable choke is not essential, a less expensive positive choke is usually installed on smaller wells. This has a built in restriction that limits flow when the wing valve is fully open [2].

This is a vertical tree. Christmas trees can also be horizontal, where the master, wing and choke is on a horizontal axis. This reduces the height and may allow easier intervention. Horizontal trees are especially used on subsea wells [2].

CHAPTER 3

DESIGN OF THE SYSTEM

The System of oil well monitoring can be divided into two parts. The hardware and the software part. Hardware part consists of the instruments such as pressure sensor, flow sensor, microcontroller, Zigbee module etc.

The software parts consist of the system software we designed in Microsoft visual basic for interfacing the circuit with the computer.

These instruments are installed at the site of the pipelines and the measurement taken by the sensor is fed as input to the PIC16f73 microcontroller. In this system we consider the oil well head pressure will be 10000psi which also depends on different places. We use strain gauge type pressure sensor which can measure up to 60000psi. We assume the flow arrange to be 50-150 GPM. We use electromagnetic flow sensor for measuring the flow of oil through the pipeline, since the oil pumped may contain mud and other particles the ultrasonic flow sensor may not be reliable since the waves may scatter. In an electromagnetic flow senor there will be two field coils there will be an pole shoe which help the coils to generate magnetic field on entire cross section of the flow meter. Two electrodes are placed to collect induced electrons at right angles of the coil. Once there is a flow in the pipe the electrically charged fluid in the pipe will separate and flow through the sides of the pipe, which will induce a voltage and its been picked up by the electrode. The voltage induced is directly proportional to velocity of flow. The microcontroller check the input data, compare it with desired values and necessary action is taken like switch on/off the pump and control the main gate valve. In the same time the measure values is displayed in the LCD monitor and the values are send to the control station via zigbee wireless transmitter. The receiver part in the control station receives the information and fed the input to the computer.

The SCADA software developed will gather this information and display them as programmed. So the user gets real time values and can monitor the process from the control station.

3.1 Block Diagram & Description

3.2 Data Acquisition

Data acquisition systems are used to measure and record information or data Measured signals may be of two types, signals that originate from the direct measurement of electrical quantities such as a voltage measurement where we can directly use the signals for input to signal conditioning unit. In other cases where the required quantities are not electrical in nature, transducers are used to convert the nonelectrical quantity into corresponding voltage signals. In our system we have to measure pressure and flow level. We used pressure and flow sensor to measure pressure and flow.

Signal conditioning circuit converts the signals into a form acceptable by the Microcontroller. These include various amplifier circuits, noise eliminating capacitors and the like. In this system we have used coupling decoupling capacitors so as to filter AC noise.

The inputs to our system are analogue quantities, which are to be converted into digital, and this is accomplished using the analogue to digital converter. Each of the quantities, i.e. pressure and flow are processed and given to different ADC analog input channels. By reading the different channels one after the other in a cyclic sequence data is acquired.

Software for the SCADA system must handle problems beyond those found in application software for desk computers or mainframe computers. SCADA software often have several things to do at once, respond to external events, cope with unusual conditions without human intervention, while being subjected to deadlines etc. All SCADA systems do not have the same hardware and software, which is why these system perform, varied task. All SCADA systems need a microprocessor, and the kinds of microprocessor used in them are quite varied.

SCADA system is a combination of hardware, software and perhaps additional mechanical parts designed to perform a specific function.

3.3 LCD (Liquid Crystal Display)

LCD is a module used for monitoring various functions of the system. It consists of LCD controller IC and LCD unit

A crystal cell consists of a layer of liquid crystal material sandwiched between glass sheets with transparent metal film electrodes deposited on the inside faces. When both glass sheets are transparent the cell is known as transmitive type cell. When only one glass sheet is transparent and the other has a reflective coating the cell is known as reflective type.

The LCD driver generates liquid crystal display drive waveforms according to the display information sent from the MCU and uses the waveforms to drive the LCD.

The LCD drivers are of two types, the common driver and the segment driver.

The PIC cannot directly interface the LCD driver. So the LCD controller is placed between the MCU and the LCD drivers to handle the interface between them. The LCD controller receives the display information from the MCU, converts it into the display timing signals and display data required for the LCD drivers.

3.4 Signal Conditioning And Amplification

This block signal condition and amplification is defined for the conditioning and boosting of the sensor output. Boosting is provided using differential amplifier. The block consists of two parts

  1. Conditioning sensor output.
  2. Amplifying the signal as to drive the PIC

Conditioning Sensor Output

The output from the sensors is analog in nature. There may be chances for noise and should be removed. In this part the output from sensor is filtered by coupling capacitor.

Amplification of the signal

The output from the sensors will be of only small range values, which cannot be sensed by the PIC. So to amplify the signal in order to make effect on the PIC the differential amplifier is provided.

The differential amplifier is the basic building block of operational amplifier. In the differential amplifier we can provide two input signals. Then at the output we will get the amplified form of the difference between the input signals. The figure of a differential amplifier is shown below

Fig: 3.2 Differential Amplifier

In the differential amplifier the difference of the input signals (Vx-Vy) is amplified and obtained as the output. The signal is amplified according to the gain of the amplifier [4]. The gain of the differential amplifier is given as

A = RF

R1

The output of the differential amplifier is given by its equation

Vo = A (Vx Vy)

The gain that we used here is 3dB. Thus the output from the sensors will be amplified 3 times and thus according to the changes in the sensors, PIC also can change its function [4].

Advantages

  1. To give high performance signal.
  2. To give accurate signal.
  3. The noise in the input signal is reduced.
  4. Provide sufficient amplification to the input signal.

3.5 PIC-Peripheral Interface Controller

PIC micro devices are grouped by the size of their instruction word. The three current PIC micro families are:

Base Line: 12-bit instruction Word length

Mid Range: 14-bit instruction Word length

High End: 16- bit instruction Word length

CHAPTER 4

SYSTEM DESCRIPTION

4.1 Circuit Description

The figure shows the circuit monitoring system used for oil well. The basic element used is micro controller (PIC 16 F73), which is used for embedded projects. The circuit used measuring pressure and flow of the oil flow from the oil well.

The output of pressure sensor and flow sensor is connected to the amplification and signals conditioning circuit, whose output is fed to the input port of PIC (PORT A) The sensor outputs are analog signals so it is given to the ADC through PORT A PINS of PIC because it having an inbuilt ADC. The PIC functions are controlled by the software. Output of pressure sensor is connected to RA1, whereas flow sensor output is connected to RA0. Using software the results from first channel is stored in ADRES register. The result taken from ADRES is compared with the required pressure and flow of the given system.

The system is having display sections, which is divided into two: LCD and display in PC. LCD is connected to the PORT B pin of PIC. RB1 to RB7 pins are used of connecting it. The result from ADRES is converted to the ASCII code, which is given to the LCD through PORT B directly.

The figure shows that the signal conditioning circuit which is made up of using an op- amp LM324. Signal conditioning circuit converts the output of transducer to the acceptable from of the PIC micro controller. This includes a differential amplifier and spike eliminating capacitors etc. Its output is calibrating signals, which is given to the ADC input of micro controller.

4.2 Software Description

The SCADA system is having two parts: hard ware and the other is software. In order to design the software part we must design the program for the each part of the hardware then only the system will work according to the instructions given.

In order to design the software part we follow certain steps. The embedded system is having two parts: hardware and software. The electronic, mechanical and the IC circuit are known as the hardware whereas software is the list of programs and instructions written in the Micro controller IC to control these hardware systems. These programs called software helps the user to perform various kinds of function on the devices, these type of software are called known as Application Software.

The program does the execution of the temperature and fuel level of the system. It controls the monitoring function. This program or software is written according to the hardware architecture, which gives to the accurate and precise values of the hardware or sensor etc.

The steps in software designing are:

4.2.1 Initialization Of Registers

The registers are initialized for the storage and the retrieval of the data or the bits given to the hardware devices of the system.

4.2.2 Initialization Of Lcd

The LCD is used to display the sensor outputs and the monitoring section. The LCD is displaying the ASCII codes or the sensor values which are converted into ASCII codes. Initialization steps for LCD

  1. Configure port B as o/p Port
  2. 15ms delay
  3. Out 0X30 to port B
  4. Set enable bit (3 micro second pulse clear enable bit)
  5. 5 ms delay
  6. Repeat step 3 and 4
  7. 150 micro second delay
  8. Repeat step 3 and 4
  9. Out the codes to LCD

0X21- function set

0X0C- Display ON/ OFF

0X06 Entry mode

0X02 cursor home position

0X01- clear display

4.2.3 ADC Initialization

The ADC used here is an 8-bit ADC, which are inbuilt the PIC IC .To initialize the port A pins are activated. By initializing the ADC we must provide sufficient delays. The pressure sensor and flow sensor outputs are connected to the pins of this port. The PORTA pins of the PIC IC are directly connected to its inbuilt ADC.

Steps for ADC INITIALIZATION

  1. Configure ADCONI & ADCONO as required.
  2. 20 micro second transition/ acquisition delay (delay for charging the capacitor)
  3. Set go bit
  4. Check for done
  5. Move the result from result register to a register.

4.2.4 Code Conversion And Storage

The inbuilt ADC is used for conversion of analog input into corresponding digital signals these sensor outputs are converted to hex code and stored in the ADRESS register. This hex code is compared with the required levels of the given system. The compared out hex codes are converted to ASCII codes because the LCD outputs or display the ASCII codes only.

CHAPTER 5

CONCLUSION

A SCADA system for monitoring oil well is designed. This particular system will measure the pressure at well head and flow of oil thorough the pipe line.

This project will surely give an overall view of vast features of the PIC micro controller. The microprocessor based information revolution is above the surface and very visible. However the larger revolution happens beneath the surface the embedded information processing revolution, where the social significant and investment opportunities are perhaps much greater.

As we only do the monitoring of the datas in future we can add some more extensions to this circuit. This involves mostly the automatic controlling of the whole oil exploration system.

By using existing system we can only read or monitor only two data or values. But in future if we want more datas to be read we can do that without any change in the PIC or program used in existing system. This is a because of the fact that in the ADC that is inbuilt in the PIC that we used here we can add up to to seven datas. In the existing system we use only 2 datas.

REFRENCES

[1]. Keith Stouffer, Joe Falco, Karen Kent, Guide to Supervisory Control and Data Acquisition (SCADA) and Industrial Control Systems Security. NIST, 2006.

[2]. Havard Devold, An Introduction to Oil and Gas Production, ABB Manual, 2006.

[3]. John.B. peatman, Design with PIC microcontrollers, Prentice Hall, 1998.

[4]. Ramakant. A. Gayakward, Op-amps and Linear Integrated circuits,PHI, 2004.

[5]. : Allan Mottershead, Electronic Devices And circuits, Good Year Pub Co., 1973.

[6]. www.microchip.com

[7]. www.picbook.com

Please be aware that the free essay that you were just reading was not written by us. This essay, and all of the others available to view on the website, were provided to us by students in exchange for services that we offer. This relationship helps our students to get an even better deal while also contributing to the biggest free essay resource in the UK!