4 Replies Latest reply on Aug 1, 2012 8:04 AM by andreas

# Pressure trend along a pipeline

I am looking for a solution to show the pressure gradient along a gas pipeline.  The x axis would be the milepost and the y axis pressure or another variable.  The values for each mile post come from a different sensor, so it is a series of tags.

I am wondering if I can wrangle the x-y trend to display this by creating custom data sets, ideally in AF, but I haven't hit it yet.

Thanks! - Jeff

• ###### Re: Pressure trend along a pipeline

Here's one way I can think of doing it with an X-Y plot. I would build two tags; one reflecting the location (tag-L) and one reflecting and aggregating all the pressures at different points to a single tag (tag-P). Also I am assuming you have 6 (0-5) locations and 6 corresponding tags collecting pressure (tag0-tag5).

I would make a PI ACE calculation that runs every 10 seconds and checks current time: hh:mm:ss. Based on the value of ss it does the following:

• 00 <= ss < 10: push 0 to tag-L and push value of tag0 to tag-P
• 10 <= ss < 20: push 1 to tag-L and push value of tag1 to tag-P
• 20 <= ss < 30: push 2 to tag-L and push value of tag2 to tag-P
• 30 <= ss < 40: push 3 to tag-L and push value of tag3 to tag-P
• 40 <= ss < 50: push 4 to tag-L and push value of tag4 to tag-P
• 50 <= ss < 59: push 5 to tag-L and push value of tag5 to tag-P

This way every 10 second you update one location to both the location and aggregate pressure tag. When you draw the x-y plot with tag-L and tag-P it should show you the gradient. Obviously al the numbers I used here are for the sake of example.

• ###### Re: Pressure trend along a pipeline

Jeff - I just played around with PB - take the following just as an idea:

If your tags are named in a way that you can get the position in the name (for simplicity I used tags named CDT158#00 - CDT158#09, saying mile 0 to mile 9 )  you can use a SQL query like

SELECT
cast(SubString(tag,8,2) as int) as t2, cast(value as float) as v2
FROM
[MYPI].[piarchive]..[pisnapshot]
WHERE
tag LIKE 'CDT158#0%'


for a linked server (MS SQL -> PI OLEDB).

Due to some issues I have with my current AF CTP I used a SQL linked server and an ODBC dataset in PI ProcessBook to show the ODBC dataset:

finally it looks like that:

I guess you get the idea.

Hope this helps

• ###### Re: Pressure trend along a pipeline

Thanks Ahamed and Andreas.

Andreas, I think your method was closer to what I was thinking.  The time context in the dataset you present is always based on the snapshot value.  I suppose it would be possible to pass an ODBC placeholder of the end time of the trend to give the value array at a specific time (which could be the current time).  Similarly, I think you could come up with a range calculation (min\max\avg) based on the same sort of dataset query.  So the trend would be of the Minimum values within the time range set for the trend, or the max values, etc.

When I have a PI Server on hand to test this, I'll post the ODBC query and placeholders used (for start\end times)

• ###### Re: Pressure trend along a pipeline

Jeff - have you had success?