### The Problem

Petroleum product pipelines provide an efficient method of delivering product to distribution terminals. These multi-purpose pipelines deliver many different fuels often injected into the pipeline in a sequential fashion with no physical barriers between products. The receiving terminal must detect and separate the products in order to send them to the appropriate tanks and also identify off-specification product that must be directed to slop for return to the refinery for reprocessing.

A typical sequence might be diesel, followed by high octane gasoline, then low octane gasoline, followed by fuel oil, etc. Directing a product to the wrong tank can lead to significant consequences. Switching too much product to slop reduces profits because valuable product is lost plus there is the refineries’ additional cost of reprocessing the slop.

### The Solution

The solution is to unambiguously identify the product in real-time as it arrives at the terminal thus facilitating the timing of the switching between tanks. Timewise, the stream will transition from 100% product A through an intermix region to 100% product B. Univariate sensors such as gravitometers (densiometers) and refractive index meters are not sophisticated enough to provide real compositional information about the product thus have limitations on their accuracy to detect the transition for all product combinations. Guided Wave’s Near Infrared (NIR) analyzers can provide direct compositional information that can be used to not only unambiguously detect the product change but also identify the product as gasoline, diesel, etc.

### The Smart Choice

Guided Wave has two smart choices to solve this problem. Our full range NIR-O™ spectrometer can be used to provide nearly complete chemical information on the sample. Alternatively, our ClearView™ db multi-wavelength photometer yields more limited information, but would still provide rapid interface detection plus some chemical information. These instruments use fiber optic cables and direct insertion probes into the pipe to measure the product as it flows by.

### Objective

**1)** Quantitatively detect the change from Product A to Product B in the pipeline and thus facilitate the switching from Tank A to slop (mixed product) to Tank B while minimizing the volume of slop.

**2)** Unambiguously identify the product in the pipeline.

This is illustrated in Figure 1 where Product A is injected into the pipeline followed by Product B sometime later. This creates an intermix region between the two products. The objective at the receiving end is to economically switch from Tank A to slop and then to Tank B without degrading either Product A or B and to minimize the amount of slop which needs to be re-processed.

Theoretically, the intermix region is representative of an exponential decay of Product A and an exponential increase in Product B.

Some common methods currently used to detect the pipeline product change are listed below. These univariate sensors are currently the best practices in the industry. They provide very little information about the actual product identification.

NIR spectroscopy (either full spectrum or discrete wavelength photometers) can provide significant information about the product itself and classify it as to various grades of gasoline, diesel, fuel oil, etc. The data described here was collected using a Guided Wave full spectrum NIR analyzer.

### Figure 1: Pipeline Product Flow

### Common Methods Currently Used

- Gravimetric (density) sensors - these can sense the change in product but cannot identify the product. These may have difficulty in detecting differences between similar products such as different grades of gasoline.
- Refractive Index (RI) sensors - a sensitive method that can easily detect some changes in products, but does not detect all changes. These may be able to identify some products but measurement is univariate and cannot assure the ID is correct.
- Color analysis - works for dyed fuels only.

### Experimental

We simulated a pipeline using existing laboratory equipment with sample flowing through 40 feet of tubing to a Guided Wave 10 mm multipurpose flow cell. The flow cell was connected via fiber optic cables to a Guided Wave full spectrum NIR analyzer. Spectral scans in the region of 1000 nm to 1600 nm were recorded at 6 second intervals. The products used were 87 pump octane gasoline that contained alcohol and commercial diesel fuel.

During the study we learned that gasoline and diesel do not always mix well. We could see layers and occasionally 2-phase flow (globules of one product in the other) in the tubing. A static mixer would have solved these problems but one was not available.

### Algorithm

The approach is to use NIR spectroscopy to sense the real time changes in the pipeline material, quantify the change and identify the products. The proposed method will make use of the Match Index (MI) equation. The Match Index is a common spectral similarity measure calculated as the cosine of the angle between two vectors. In this case the vectors are the pipeline spectra to be compared.

### Pipeline Simulation

The products used for the pipeline simulation are gasoline and diesel fuel. The NIR spectra of these individual products are shown in Figure 2. The significant functional groups are identified. Low octane gasoline has a short aromatic peak. The strong CH3 peak in the gasoline indicates that this product is primarily branched paraffins. The gasoline sample also has a band due to the OH group in ethanol (an additive). The diesel sample shows no aromatics and about equal amounts of CH3 & CH2, indicating a higher presence of normal parafins which is typical for diesel.

### Figure 2: Pipeline Simulation, Spectral Data

### Two Simulated Approaches are Studied

- In Case 1: No prior knowledge of what is coming down the pipe – A single isolated analyzer must detect the intermix region and quantify the changes. There is a library of potential products available to the analyzer.
- In Case 2: We have an upstream analyzer probably at the injection point that can collect a spectrum of product B and transmit that spectrum to the receiving terminal and its analyzer. Thus the receiving analyzer knows what is currently in the pipeline and what to expect. This makes quantification easier and more accurate.
- Both methods could benefit from having a spectral library of potential products that could come down the pipe. With this library, the products can be identified and potentially a true least squares or PLS mixture analysis performed. Thus the operator would at all times know the percentage of product A & B. That analysis is beyond the scope of this paper but is something that could easily be done.

### Case 1 (Figure 3)

Case 1 starts by first selecting a sample (spectrum) that can be used as the reference spectrum in the Match Index calculation. If for example it takes 1 hour for the intermix region to pass through, then the reference spectrum should be collected about 2-3 hours prior. A new reference spectrum could be selected every hour to keep it current with the flowing product. Next we calculate the noise in the MI results. Again this is done for a period of time 2-3 hours ahead of the commencement of the intermixed sample.

Multiplying the noise by 3 gives 95% confidence that any product below a Match Index of (1- 3σ) is significantly different, thus providing us with the first trigger point for switching tanks.

In addition to monitoring the MI value, we also want to monitor the derivative of the MI function. The derivative can be approximated by computing the 1st difference between the samples. Again we can calculate the noise during steady state conditions and determine a 3σ threshold for our second switching point.

As we approach the intermix region, we see the MI function decrease significantly, i.e., it drops below the 95% confidence limit thus triggering our switching from Tank A to slop.

We see the derivative (slope) of the MI function has gone through a maximum indicating the rate of change and passed the inflection point in the exponential decay curve for Product A. As a side note, we have normalized the derivative function to unity at the inflection point. Thus it provides a crude direct reading of the degree of mixing of the sample, the peak being ~50%.

As we proceed through the intermix region, the MI function levels out and asymptotically approaches a fixed value. When the derivative function drops below its 3σ line, we can trigger the second switch from slop to Tank B with confidence that the sample is statistically no longer changing.

Our experimental setup caused higher noise in the data than what would be anticipated in a field experiment. This noise is orders of magnitude greater than the instrumental noise.

### Figure 3: Case 1 Simulation

### Case 2 (Figure 4)

Prior knowledge of products in the line – This requires two analyzers, one at the injection point and one at the terminus with a network link. Analyzer #1 sends ahead the product spectra so that analyzer #2 can anticipate its reception and more accurately quantify the products. There is a library of potential products available to the analyzer. Case 2 is where we have prior knowledge of the anticipated product. With prior knowledge we can compute 2 MI values, one for Product A and one for Product B. Thus we can trace out the double exponential curves that we showed earlier. Again we can set 3σ for both calculations and determine the switch points.

Figure 4 is an example of the double “S” curve. Since we know the spectrum of both products, we could do a simple least squares fit and actually plot percentages of both products in real time.

All of the previous results were for a full spectrum analyzer with >500 individual data points on the wavelength axis. Can this be reduced to just a handful of wavelengths so that the measurement can be made by a photometer using the previous data? In the previous data we did a simple 2 point baseline correction at 1100 nm and 1330 nm. Using peak wavelengths of 1151, 1191, and 1208 nm (shown in Figure 5), we repeated the MI calculation.

### Figure 4: Case 2 Simulation

### Figure 5: Photometer Simulation

### Analysis

Figure 6 shows a comparison of the MI calculations for full spectrum vs. a simulated 3 analytical wavelength photometer. Note the similarity of the results. They reach the asymptote at different values for Product B but this is immaterial due to the nature of the match index calculation and use of the 3σ limit.

Hence, we can conclude that a simpler alternative, a five wavelength photometer (two baseline and three analytical wavelengths) could in fact provide equivalent results at a much lower installation cost. Adding a sixth wavelength would make it even more robust.

A limited wavelength photometer would not be as accurate as a full spectrum analyzer at identifying the sample from a library but it still could do mixture analysis and could work in Case 1 or Case 2 mode.

### Figure 6: Photometer Simulation Results

### Highlights

• NIR spectroscopy can quantitatively detect pipeline interface transitions

• Both full spectrum analyzers and limited wavelength photometers can be used depending on the number of measurement points and accuracy levels needed

• The information obtainable is significantly greater than what can be obtained with univariate methods such as RI and gravimetric sensors

• Match Index calculations can compare the current unknown sample with samples in a spectral data base to quickly identify the sample

• Similarly PLS classification can identify the sample through a scores space calculation, potentially reducing mistakes that send product to the wrong tank

• Result are available in real-time (seconds)

• Ensures product quality

• Minimizes slop hence reduces re-processing volume and associated costs

• Maximizes the quantity of valuable saleable product

### Discussion and Conclusions

The pipeline product interface detection methods described here using Near Infrared (NIR) spectroscopy are both fast and reliable utilizing either the Guided Wave NIR spectrometer or the NIR filter photometer. This method minimizes the need for laboratory sample collection. Results are available in real-time (seconds) for both transition detection and product identification. For more detailed information regarding system specifications please contact a Guided Wave technical sales specialist.

### Control You Can Measure

By partnering with Guided Wave, customers gain the advantage of 30+ years of experience in online process monitoring and stream sample analysis. Our entire product line is designed and developed to meet the challenges of the most demanding production environments for control you can measure.