• Nenhum resultado encontrado

flow, or there is the need for an additional run, or the value of BTU has changed. The partners involved on Trailblazer had met several times to discuss the type of information to be collected at the metering sites.

The entire system is developed around two areas: Hardware and software. A hardware block diagram is shown in Figure 1. All software programs were developed and tested in-house.

Natural Gas Pipeline Company has developed an electronic flow measurement system for custody transfer.

The flow measuring system contains the following features:

1) Makes a flow calculation in accordance with NX-19 and AGA Report #3.

2) Receives BTU, Specific Gravity, N2 and C02 analysis data from a chromatograph. Having control over the software allows the measurement department a choice in selecting a chromatograph. Currently the microcomputer can interface with three different chroraatographs.

3) Has remote, local and standby control mode capability.

4) Produces a hard copy printout every hour, daily summary at 8:00 AM and on demand. Also all setpoint changes and alarms, when set and cleared, are printed.

5) Accepts 32 analog inputs; 48 digital inputs and 48 digital outputs.

6) Contains complete hardware and software diagnostics for on-line debugging.

7) Allows operator changes of selected parameters(i.e. orifice size, run sizes, default value for BTU and Specific gravity, override setpoints, etc) through the console unit.

FIGURE 1.

8) Performs control routine actions such as flow control, runchanging, line break detection and back pressure override.

9) Uses floating point double precision arithmetic for all computations.

10) Displays all active alarms to the operator through the console.

11) Converts and stores data into a data base using standard conventions-ASCII, Integer, and Floating point formats. Attached to each value is a current status indicator. Data can be flagged as *—old data, M—

manually entered data, and b (blank)—good data.

12) A calibration routine for transducers.

13) Projects flow over a 24 hour period.

14) Hourly log displays flow factors used in calculating the orifice flow factor constant for each run.

15) Hourly and Daily log record running accumulated flow totals per run.

16) Accepts a pressure override and flow control setpoints.

17) Capable of annubar or orifice plate measurement.

I would like to point out some advantages and disadvantages associated with the development of this system.

ADVANTAGES

a) Software changes can be made quickly and in direct response to the company’s needs.

b) Modular construction allowed for quick and easy configuration of software modules.

c) The capability of troubleshooting software modules using an in-house debugging aid-IDR. This has been the single most valuable asset in developing a working procrram.

d) Gives accurate and reliable flow measurements.

e) Software written by NGPL for earlier energy systems is compatible to new versions as they are marketed.

f) Enables the real time collection of data for more accurate measurement over the conventional 24 hour chart averaging.

g) hardcopy printouts are tailored to the station needs or a general format can be used.

h) the microcomputer can use various types of chromatographs

i) the use of two programming- languages, “C” and macro assembly. C is used in all flow calculations.

DISADVANTAGES

a) The process of debugging software programs has been a time consuming effort.

b) Considerable time was spent in training personnel on the new equipment and in documentating procedures.

c) There were single transducers (static, temperature, and pressure) per run. Multiple transducers per run would offer variable range coverages. For example, 0–50", 0–100" and 0–200". NGPL is planning to experiment with dual range transducers inputs into the microprocessor at metering sites experiencing wide fluctuations in flow rates.

d) Power interruptions as a result of electrical storms have been a bier problem.

The electronic flow measurement for custody transfer system consists of a microcomputer, gas chromatgraph, H20 and H2S analyzer, a differential pressure, static and temperature transducers for each

run, communications modem, power supplies and battery charger, printer, and console terminal. All of this hardware, except for the printer, transducers, chromatograph and analyzers, is mounted to a free-standing 19" equipment rack. Terminal blocks are provided on this rack for analog and digital inputs (see photo).

Following is a description of topics considered in electronic flow measurement as approached by the Engineering Control department of NGPL.

PHOTO

HARDWARE 1.0.1

THE MICROCOMPUTER

The microcomputer is the heart of the system. It is a 16-bit microprocessor with added features such as memory management, FP-11 instruction set, double precision arithmetic, and four-level interrupt bus structure. It and eight other boards collect and perform all the necessary calculations for an accurate flow measurement. A typical backplane configuration depicting computer board placement is shown in Figure 2.

FIGURE 2.

1.0.2 POWER

The main source of power is a battery charger that converts AC power to DC voltage levels required by the microcomputer. Between the battery charger and backplane there are 3 DC regulated power supplies which provide +5 and +12 volt for the backplane and +28 volts for tranducers. Battery backup is provided so that the unit may operate for a number of days in the event, of a power loss. On the Trailblazer pipeline an emergency power unit was installed. Its main function was to supply enough power to the chromatograph, modem, and micro to continue giving analysis data during loner term power outages. An UPS (uninterruptible power supply) should be a requirement in rural areas where power is not clean or reliable.

1.0.3

GAS CHROMATOGRAPH

Natural Gas Pipeline Company is evaluating a number of energy measurement systems that reports natural gas data as each sample is analyzed, approximately every 13 minutes. The gas chromatocrraph reports Btu, specific gravity, and gas composition by name and percent of content for each analysis and as a 24-hour average at the end of each day. The chromatograph provides hardware diagnostics by number which allow a user to check the machine before operation.

1.0.4 INPUTS/OUTPUTS

Data enters/leaves the computer by various methods. First, transducers are connected to analog inputs (32 maximum inputs) via a terminal block. Measurement transducers for differential pressure, static pressure and gas temperature are installed for each run and interfaced to the microcomputer using an analog input. A zero point is established and maintained as a reference point for analog signals. Second, digital input contacts provide information about ambient temperature. AC power failure, write lock inhibit, and positional information about valves. In most every case, they are nothing more than relay contacts’. Third, digital outputs are bit mask assignments that result in a control action. For example, the action may be pulsing a solenoid that opens or closes a valve, or a time duration pulse that pulses a motor controlling a regulator.

All inputs and outputs have lightning protection and are coupled to the microcomputer through optical isolators. Finally, serial communication data links are connected between the chromatograph, console, and micro. The console furnishes the means by which an operator can manually alter a number of variables, such as tap position, orifice plate sizes, run sizes, and flow setpoint. It also displays individual data items by entering the correct request code and performing the proper read or write operation. Normally these functions are performed locally. See APPENDIX E.

1.0.5

PRINTERS AND HAND-HELD (CONSOLE)TERMINAL

Data values can be retrieved from the computer in five different ways. First, individual data items can be requested and displayed on the console unit. Second, multiple data items can be looked at by referring to the hourly and daily reports printed automatically. Third, data can be polled by a partner through an asynchronous serial communication link in an agreed format. Fourth, remote commands and data requests can be entered through a synchronous serial communication link over a microwave system. Gas control in

Lombard or Houston can poll remote sites and are capable of sending a flow setpoint, changing orifice and pipe diameters, and requesting individual/all data items. For example: alarms, flow rate, H20 content, BTU, C02, etc.. Finally, service personnel can attach a CRT to view 120 memory locations.

SOFTWARE

The software is the brains of the system. It is responsible for collecting transducer and chromatograph data, sensing and sending contact closures, remote and local communications and the time base and event driven execution of control routines. Routines most commonly used are flow control, runchanging, backpressure override and linebreak. The memory itself is limited to 32k-16 bit words and the last 4k is designated as the I/O page. Memory is divided into two parts: UVPROM and Random Access Memory. In the event of a power loss the program is non-volatile. Using a Prolog Prom Programmer the program is burnt on 4k ×8 UV PROMS. The number of proms used is dependent on the length of the program. Approximate size of the current program is 16k. The ram portion of memory is a static CMOS read/write memory with battery backup. This 12k of ram is used as a scratch pad area for data values, calculations, flags, buffers, pointers, counters, etc. If a power loss is experienced data is retained. Ram memory can be cleared by the operator.

The software is modular in construction. That is any module can be removed or inserted with no adverse effect on the overall operation of the program. Testing of software modules requires a three-step process.

First, a module is individually tested until all bugs are ironed out. Second, it is then added to the overall system where it undergoes further debugging. Finally, the program is installed and field tested. It may require additional changes because no bench test can give every possible condition. However, the program is very accurate and logical in carrying out its many sequences of operation. The EXECUTIVE routine controls the sequence in which the individual programs run. It does this by executing a series of subroutine calls first on a non-timed basis followed by those on a timed basis. The EXECUTIVE also has the duty of monitoring remote communications. In the event of a communication loss, the communication program is re-initialized. On a startup there are several modules that define hardware addresses to memory locations and various bit mask assignments, assign addresses and processor status to all the interrupt vectors, reset the system hardware and initialize all the system software and hardware. A software block diagram is shown in Figure 3.

2.0.1 SYSTEM STARTUP

The configuration information required by the program is entered by the local operator during a prompt and answer session. The number and type of questions can vary from one location to another. Normally, the following information is requested: stream selection, plate and run size for all runs, static tap location (upstream or downstream), default values and upper and lower limits for BTU and specific gravity, and a flow and back pressure override setpoints. In entering the last prompt value, the microcomputer begins executing the software modules. The operator still may exercise control or change data through the console terminal. For example, he can change the control mode to either local or remote, plate or orifice sizes, tap location, time and date, and force the program into a calibration. He may also view any value, or alarms using the console terminal. To view the current flow value the operator would key in a number code and the terminal would display the current value. The read operation can be performed at any time. However, changes made to the program, as in a write operation, are controlled by a key interlock switch preventing accidential or unauthorized entries. A fail-safe feature in case of a computer malfunction is the

incorporation of a watchdog hardware timer. If the timer is not strobbed within a given period of time, the DC power is cut off to the equipment control circuits.

2.0.2

GAS CHROMATOGRAPH

The microcomputer polls the chromatograph for gas heating value, specific gravity, gas composition for each analysis and 24-hour averages, the asynchronous digital link permits the program to remotely interrogate and gather data from the chromatograph. The link is activated by modules ECOM1 and ESTAT.

Basically these modules request a message, determine its status and process the data received for the current FIGURE 3.

sample analysis. If the 24-hour averages are available, they too are collected and stored in the data base common. Once stored in the database, other software modules convert the data into applicable data formats and store them in the database.

Of the three chromatographs used one is capable of transmitting 9 messages. Of these only five are requested. Type 4 message is polled continuously since it contains current data analysis, 24-hour average analysis and alarm information. To ensure that the micro did indeed receive the messages sent by the chromatograph, a cyclic redundancy checksum (CRC) is performed(bit error detection). The chromatograph calculates a CRC and stores it as the final two bytes—low “byte transmitted first. The micro using the same polynominal [P(x)=x16+x12+x5+1] compares its result with the CRC sent in the received message buffer.

Only after the message has successfully been identified does it get processed. As an example the following data messages are requested from a chromatograph:

1) TYPE 1 BTU, Specific Gravity 2) TYPE 2 Compositional analaysis data

3) TYPE 3 24-hr averages for BTU and Specific Gravity 4) TYPE D 24-hr averages for concentration data 5) TYPE 4 Current status message

The dicrital link between the microcomputer and eras chromatographs operate asynchronously, 1200 baud, and in full duplex mode.

2.0.3

HARD COPY PRINTOUTS

The software can support three types of printers. Each printer is capable of displayina identical information if necessary. However, the format is different for each case. The first printer has 132 characters/line the others 80 and 32. (See APPENDIX C for examples.) Printouts are supplied locally and to partners wishing to tie into an asynchronous port with their own equipment. The printouts need not be identical. That is, the information printed for our billing purposes may not be identical to others, or they just may like to see additional data points. Whatever the case may be, various files are built with the desired information and outputted using various FORMAT modules. These modules, respond to basic directive commands and are directed through a serial communication link to external eguipment.

Chromatograph values on the hourly log and averaae values on the daily log are flagged with their current status. Indicators are of the following type: *—old data; M—manually entered data; and b(blank) for current good data. An example would be, BTU * 1044.0 BTU/cf or BTU M 1044.0 BTU/cf.

2.0.4

FLOW CALCULATIONS

The microcomputer, together with a gas chromatocrraph and transducer inputs, computes a gas flow rate based on AGA report #3 and PAR research project NX-19 equations. A flow calculation is performed every 10 seconds and memory locations are updated based on these latest calculations. At the various metering sites, each run is handled as an independent flow calculation and the sum of these calculations provides a total flow measurement for the station. Also, in addition to a gas flow rate value, a therm flow rate value is

also calculated by multiplying the BTU by the total flow. The final value is converted to dekatherms. In the event of a power loss, battery backup ram is provided for memory retention of system components.

Orifice flow rate calculation and supercompressibility factor are calculated using floating-point double precision data type. This greatlv improves the accuracy of arithmetic operations allowing direct operation on double precision 64-bit words. All flow calculations are performed using “C” programming language.

Currently the program is a hybrid using “C” and macro assembly language. Orifice flow factors are calculated and printed on the hourly report per run allowing an operator a means of rechecking the total flow computation.

There are three modules that perform the necessary calculations required for flow measurement: FLWRAT, AGAFPV, and ORFLC. The first is the orifice flow rate calculation, C'. (See APPENDIX A for detailed information.) For this calculation the operator can select tap location, UPSTREAM or DOWNSTREAM for flange taps. Note: pipe taps were not considered since they are not used. The second is the supercompressibility factor, Fpv. Finally, the gas flow rate is calculated in MMCFD and MMBTUD.

The accuracy of the microcomputer flow rate calculation was compared to a ‘FLOW FINDER’ modular program inserted into the hack of a TI59 calculator. This together with an overlay and instruction manual provides all that is necessary to verify a flow calculation. This module is available from the SOLTAR Corporation located in Spring, Texas. I’ve listed what appears to be the differences between their method of calculation and the one we use in Appendix B.

2.0.5

CONTROL ROUTINES

Not only is the microcomputer a data acquisition system, but also a control system. It collects and transmits data and performs the necessary control actions based on current flow calculations. Modules are periodically run by the EXEC to determine if control is necessary. The control programs implemented are flow control, runchanging, backpressure override, and linebreak detection.

Flow control controls a regulator that responds to a flow setpoint received from a remote location or entered locally through the console. Results of the current flow are compared to the setpoint and differences between the two will increase or decrease the position of the valve.

Runchanging monitors the differential pressure on run number one for 90 inches of water. If reached, the next available run is opened only after the current flow is reduced by 60%. This prevents the orifice plates from receiving a large flow of gas and possibly damaging the plates. If there are no further runs to open and the DP is at a maximum, runchanging will control the controller so that the DP will not exceed 90 inches.

Likewise, if all available runs are open and DP drops below 10″ the furthest available run from run #1 is closed.

When closing a run there is no need to reduce the flow.

Linebreak detection will monitor rate of flow and pressure differences on a timed basis. Currently this module is under development.

Back pressure override looks at down stream pressure. If it exceeds a predetermined level, the condition is flagged and the flow controller will control the flow of gas through the regulator so that downstream pressure is below the pressure setpoint.

2.0.6 CALIBRATION

Since tranducers are calibrated on a periodic basis, a module called CALIBC was designed to allow calibration of the transducers using the console unit and a series of front panel switches. A mode switch allows the operator to view transducer inputs (analog signals) in three formats: Engineering unite, counts, and voltages.

2.0.7 DIAGNOSTICS

To ensure that the hardware and software are operational there are available to the operator hardware and software diagnostics. There are three levels of maintenance. For the first level there are hardware diagnostics available for the chromatograph and microcomputer. The measurement operator or communication technician can perform these tests before he starts the system UP. The chromatograph software has 8 self checks built into it which flag contradictions in its logic. These errors are a result of some system failure. Also the chromatograph provides a diagnostic package designed for rapid on-site verification. The microcomputer provides diagnostic programs that test the processor, the memory and the user’s console.

The second level of operator maintenance is through a software module called DGNSTC. The diagnostic module operates in coniunction with front panel LED’s and toggle switches. DGNSTC interprets the 16 panel switches as a memory address and outputs the contents of that memory address on the LED’s. Peripheral device addresses (considered memory addresses by the hardware) can be viewed as well. If a byte address is selected, it is displayed in the low byte of the LET) word. Switches requesting a display of a non-existent memory location cause all ones to appear on the LED lights.

The third and final level of maintenance, not made available to the operator, is an IDR or interactive display routine. IDR is a diagnostic utility which enables the user to view and change the contents of memory locations in a program being debugged. This module when assembled with the program displays on a CRT, 3 full pages or 120 memorv locations showing critical buffers, pointers, counters, etc.

(APPENDIX D illustrates such a page of information that might be displayed in troubleshooting a control routine called RUNCHG.) This scanning technique was developed in-house to assist in the debugging of software modules before they are introduced into the field. This has been the most valuable tool in the development of software modules.

2.0.8

COMMUNICATIONS and PARTNER HANDOFF

The communication processor routine, COMM, has the duty of handling data requests and command messages from the Master station via microwave communication circuits. Natural Gas Pipeline Company has developed its own protocol to which a cyclic redundancy checksum (CRC) is added for error checking.

The generating polynominal used for CRC or error bit detection is X16+X15+X2+1. Partners wishing to retrieve information from the processor database have available an asynchronous RS232 port. They need only connect a cable between this port and their equipment. NGPL has designed a ASCII format transmission for partner handoff. This communication format that NGPL uses for data exchanges is 1200 baud, asynchronous with 1 start bit and 2 stop bits, all bytes 8 bit ASCII (except CRC), no parity, transmitted as often as requested(normally between 1 and 10 minutes), and appended with a CRC.