Quantcast
Channel: OSIsoft Users Community
Viewing all 1120 articles
Browse latest View live

Using PI SDK in C

$
0
0

Hi everyone,

 

I'm new here so please be a little patient :)

 

I am PI datalink in excel with VBA for sometime but now i need to start using it in C or C++ language. I compiled the apisnap example, it connects to the server but i can't search for tags ("Tag SINUSOID does not exist"). i think it has to do with PI security (i'm using pidemo as username) can someone help me and/or explain me how the SDK works?

 

Best regards,

Rúben Andrade

 


PI OLEDB and ConCat

$
0
0

I need to create a dynamic Curve expression in PI OLEDB. I've been able to get the normal expression working using b6.expr = 'Curve(15,(0,0)(20,5))' which give me a value of 3,75. This is just a simply example to test the expression. The value 15 will be a different value each day and this I get using another query. I tried using the Cocat function but I'm loosing the battle here. The idea here is that we calculate the average valve position and map that to a determined curve to calulate the flow. In Excel we have it as

 

="Curve("&D24&",(0,0)(5,4.81)(10,9.615)(15,14.42)(20,19.225)(25,24.03)(30,28.835)(35,33.64)(40,38.445)(45,43.25)(50,48.055)(55,52.86)(60,57.665)(65,62.47))" where D24 is a cell reference to a normal average datalink calculation.

 

I thought it would be simple as ConCat('Curve(',15,"(0,0)(20,5))'")

Incompatibility between PI Datalink and SAP Bex Analyzer add-in on Excel

$
0
0

Hi,

 

Does anyone know if there any incompatibility between PI Datalink and SAP Bex Analyzer add-in on Excel.

 

When I use an worksheet using BEx Analyzer, some Datalink functions don´t works, showing #Value on cell and when I use only Datalink, all values are showed normaly.

 

 

PI data into Meridium APM

$
0
0

I have a couple Meridium APM servers running and we have purchased the PDI connector which allows us to bring in and monitor PI tags for production and equipment reliablity. However, when installing the OSI PI suite we can see the tags but we can not marry the value in PI into Meridium. Upon investigation we are missing a PI Messaging Queue on the server. Am I missing an installation that should be Queuing the PI tags for storage? What PI tool would do this? 

PI SDK filtered summaries total

$
0
0

Hello,

 

I am trying to get the amount of time a digital tag had the state "ON" in the last 24 hrs using the SDK, I am trying this but its saying

 

"System.ArgumentException: Cannot do summary calculation on non-numeric data"

 

 

summaries = ipidata2.FilteredSummaries(SearchStart, SearchEnd, "", "('tag' =\"ON\")",ArchiveSummariesTypeConstants.asAll, PISDK.CalculationBasisConstants.cbTimeWeighted, PISDK.FilterSampleTypeConstants.fstExpRecordedValues);

Question about consuming PI processbook using VBA

$
0
0

Hi guys,

 

I wonder is there have any way we can open an element of interest in PI processbook using VBA?

 

So far, what I get is

so far.PNG

 

 

 

 but what I really want is we can open the layer for the element we are displaying.

 

like this:

2.PNG

3.PNG

 

 

Can you help me out?

 

Thanks,

Yuan

PI Excel Datalink Addin

$
0
0

Hello!

 

A quick question.  All the equipment at my workplace is tied into a tag in our historian.  The are tracked constantly by "Active" or "Inactive" status.  I there a way using the excel pi datalink add-in to count the number of time it reads "Active" or "Inactive" every minute throughout a specific start and end time?  I can setup an array every minute and do this but it the files become enormous.

 

Thank you for your help in adavance!

 

Josh

PI Datalink - calculated total query

$
0
0

Hi.

 

I have what is probably a really obvious question but anyway.

 

In Datalink I am doing a total calc for a tag over a time period, my question is what calculation is the total actually performing as I am getting a value much lower than the maximum value within that period.

 

This looks wrong to me but I am not 100% sure.

 

Cheers

 

Paul.


PI Sample Rate from DeltaV

$
0
0

Hello all,

 

We are using a PI Server as a replacement for our DeltaV Continous Historian. I am DCS Engineer and not PI guru.,

 

I am reading here on page 13 http://www2.emersonprocess.com/siteadmincenter/PM%20DeltaV%20Documents/Whitepapers/WP_PIProtocolConv_FAQ.pdf

 

" For example, if a parameter is collected at a 1-second sample rate, the Protocol Converter will retrieve 5 samples every 5-second 
period. If a parameter is collected at a 5 second sample rate, the Protocol Converter will retrieve 1 sample every 5-
second period. "
 
Does this mean on the PI chart, the data will be displayed for every second during that 5 second interval, or does PI take an avearage of the 5 data points during the 5 second period.
 
I am trying to make sure I understand how often PI displaying the data on the chart for pressure spikes analyzes. I want to make sure we don't miss quick pressure spikes.

 

I have a few questions:

 

Thank you kindly

PI Notifications - Tag takes "Starting" and "Good" with the same timestamp.

$
0
0

Hello

 

I´m working with PI Notifications and I have a question. 

 

There is a tag (device_status) that is monitoring an interface. This Tag can take the following values:

 

• Good.
• 1 | Starting 
• 2 | Connected / No Data | Primary secondary waiting for.
• 3 | 1 | device (S) in error |
• 4 | Intf Shutdown

 

When the interface reinitializes, the Tag takes the value “1 | Starting” and “Good” with the same timestamp, and therefore, the Notification can't read the value “1 | Starting ” and doesn't send the e-mail.

 

15-jul-14 18:49:37

Good

15-jul-14 20:24:17

1 | Starting

15-jul-14 20:24:17

Good

 

I made the notification by doing the following:

Trigger -> New Condition -> And Conditions ->  New Comparison -> Tag = 1 | Starting

 

Is there any way to fix this?

Thanks!!

DataLink Sampled Data in VBA

$
0
0

Hi,

 

I am trying to use the PI Excel Addin functions in VBA.

This function gives me a value, but not the right one(41836.51). The PISampData should be returning a timestamp and either open/close for the breaker tag I have selected.

However, when I try to use the function on just the worksheet, I get the expected output. (16-jul-14 12:18:54 CLOSE)

Please tell me what could be wrong.

Below is my VBA Code.

 

Sub cals()

Dim ranker As Range

Set ranker = Range("K8:L8")

Cells(1, 1).Value = "25THST  .25TH ST 4KV BNK BKR     .SV"

Cells(1, 2).Value = "14-jul-2014"

Cells(1, 3).Value = "15-jul-2014"

Cells(1, 4).Value = "1h"

Cells(1, 5).Value = "msdmzhis1"

ranker.Formula = "=PISampDat($A$1,$B$1,$C$1,$D$1,1,$E$5)"

 

End Sub

PI Notifications Issue

$
0
0

We recently experienced a power outage at our plant that appears to have had an effect on our PI Notifications database.  Prior to the outage the system was functioning normally without issues.  However now the notifications state "Ready but not running. Check that service is running this database." I anyone could offer suggestions on how to resolve this issue that would be greatly appreciated.

 

Thank you, 

 

Cody

ADO.Net Sample code available?

$
0
0

Hi There - We are having trouble making an OLEDB driver connection work for a SQL Server linked server. To obtain more debug info, we are creating and ADO.Net sample application from which we can send more debug info to the output window. This may tell us what about our Provider String or other connection info is not working.

 

Are there any code samples for this? Beyond the obvious, there appear to be PI-SDK syntax peculiarities if you want to return any data this way. Attached is a screenshot from the OSISoft "retail" website.

 

Thanks in advance. 

Attached Images

  • ADO Example.png

PI ProcessBook VBA Code not Running in Order

$
0
0

Hello,

I am new to PI and Semi New to VBA, I am posting here but if this is not the correct question area I will try a different route.

I have been working on a set of displays for the past couple of months. Currently, I am working on a Fit All button to open up all of the entries in a ProcessBook and then resize them to the screen. I am doing this using VBA and have the code working for one Entry. I am having to use the Display.Close workaround because that function isn't applicable with our version of ProcessBook. The code works well for one Entry, however, upon trying to resize all the entries the code works out of order. It opens the entry, resizes and saves just fine, but, the entry stays open and does not close until ALL of the displays have been cycled through. This happens even though I have each page as a seperate subroutine and then call those subroutines in order. To my knowledge the code should run in line order. Is there a way to ensure this? Is this an inherent trait of the workaround? Thanks in advance!

PI Analytics Service

$
0
0

Hi,

 

I am new to PI Analytics.In PSE I have Configured the Analytics but Analytics status shows "Could not connect to the PI Analytics Service "

If anyone know the Cause of this Problem,help me to Solve this Problem.

 

 

Thanks in Advance


Setting Flag in Different Process Display

$
0
0

Dear Sir / Madam,

I have created two different process display for two different process. I want to set a flag in a process display if there is abnormal conditions or alarms in other process display. May be with VBA code. 

How it can be done?

I am waiting for your valuable replies.

 

Have a great day 

 

 

 

Pirecalc - Am I doing something wrong??

$
0
0

Hi

 

I am trying to perform a recalc on a newly created PE tag.

 

I have backfilled my data (and seen that it is in the archive)

However when I run a recalc it deletes my data from the archive

 

The command I used to recalc is:

pirecalc.exe /execute=<TagName>,"16-May-14","17-May-14"

 

Does it make a difference that the tag I am trying to recalc is an event based tag so is expecting something to happen before it can calculate?

 

Paul.

Python & PI Code

$
0
0

I am absolutely shocked that PI doesn't have a python library or R library for data analysis, but that is another discussion altogether. I figured that since it took me a while to figure out how to retrieve data that I should probably share my script so others don't have to go through the pain. This script worked for me with python 2.7.6 and pywin32.

import time
from datetime import datetime, timedelta
from win32com.client import Dispatch


def get_pi_avg_data(database, start_time, end_time, pi_tag, interval):
    """
    :param database: DNS name of database as string object.
    :param start_time: Start time of interval as a datetime object.
    :param end_time: End time of interval as a datetime object.
    :param pi_tag: Tag name in PI database as a string object.
    :param interval: Interval of data required as a string object, i.e., 1d (one day), 1h (o                     ne hour).
    :return: Returns a list object as [date(datetime), value(float), quality(float)]
    """
    td_max = timedelta(minutes=15)
    pisdk = Dispatch('PISDK.PISDK')
    my_server = pisdk.Servers(database)
    con = Dispatch('PISDKDlg.Connections')
    con.Login(my_server,
              '',
              '',
              1,
              0)
    pi_time_start = Dispatch('PITimeServer.PITimeFormat')
    pi_time_end = Dispatch('PITimeServer.PITimeFormat')
    pi_time_start.InputString = start_time.strftime('%m-%d-%Y %H:%M:%S')
    pi_time_end.InputString = end_time.strftime('%m-%d-%Y %H:%M:%S')
    sample_asynch_status = Dispatch('PISDKCommon.PIAsynchStatus')
    sample_point = my_server.PIPoints[pi_tag]
    sample_values = sample_point.Data.Summaries2(pi_time_start,
                                                 pi_time_end,
                                                 interval,
                                                 5,
                                                 0,
                                                 sample_asynch_status)

    t0 = datetime.now()
    while True:
        try:
            valsum = sample_values("Average").Value  # retrieve the value
            break  # it will get out of infinite loop when there is no error
        except:  # it failed because server needs more time
            td = datetime.now() - t0
            if td > td_max:
                print "It is taking so long to get PI data ! Exiting now ...."
                exit(1)
            time.sleep(3)

    i = 1
    temp_data = []
    while i < valsum.Count+1:
        dt = datetime.utcfromtimestamp(int(valsum(i).TimeStamp))
        avg_value = valsum(i).Value
        quality = valsum(i).ValueAttributes('Percentgood').Value
        temp_data.append(dt, avg_value, quality)
        i += 1

    return temp_data

Credit: http://nquintos.blogspot.ca/2011/01/using-python-to-access-osi-softs-pi.html

How to have code search a tag list and generate a table with Pi Point tag information.

$
0
0

This statement searches the designated server for tags with "_flt_" in its name. I would like for the code to grab info from the server based off a list of tags, that I will provide in the code.

I would like to create some list or array with all tags that I would like information on and then place it into the ptList.. Do you know of a way I could do this?

Here is my Full Code

 

Private Sub CommandButton1_Click()

Dim ptList As PointList

 

 

Set srv = Servers.Item("cokepiserver")

srv.Open

 

 

Set ptList = srv.GetPointsSQL("Tag = '*_flt_*'")

 

ListView1.ColumnHeaders.Clear

ListView1.ListItems.Clear

 

ListView1.ColumnHeaders.Add , , "Tag", ListView1.Width / 12

ListView1.ColumnHeaders.Add , , "Trigger Val", ListView1.Width / 32

ListView1.ColumnHeaders.Add , , "Message", ListView1.Width / 8

ListView1.ColumnHeaders.Add , , "Date-Time", ListView1.Width / 12

 

 

ListView1.View = lvwReport

 

Dim mItem As ListItem

Dim pt As PIPoint

 

For Each pt In ptList

If (pt.Data.Snapshot = "OK") Then

 

 

Set mItem = ListView1.ListItems.Add

mItem.Text = pt.Name

mItem.SubItems(1) = "OK"

mItem.SubItems(2) = CStr(pt.PointAttributes.Item("descriptor"))

mItem.SubItems(3) = CStr(pt.Data.Snapshot.TimeStamp.LocalDate

 

'THIS CODE WORKS, BUT GIVES INFO ON TAGS I DONT NEED, I WOULD LIKE TO ADD THE LIST OF TAGS FOR WHICH I WOULD LIKE THE INFORMATION DISPLAYED

 

ex:

(My idea for adding in an Array) ' Dim tagPt As Variant

(Gives runtime error) 'tagPt = Array("aux_flt_spwst-qt", "aux_flt_srwst-qt")

 

 

 

ptList=srv.GetPointsSQL(tagPt)

Search for Alarm History based off Date entered by User, VBA Code-Processbook

$
0
0

I would like to code for a search bar, where the user can input some date and a list is generated in table format, listing all the alarms active for that timerange or date...

I have no clue as to where to start for the search bar, taking input, giving output based on input.

 

I do however, have some idea for how to create the columns and display the information in the columns...

 

How can I ask the user for input, take the input & search the server for tag info for tht time... The tag info I would like is descriptor, time stamp, localdate...for date given.Displayed in list format.

 

Hope you can understand what I'm asking for...

 

 

Thanks in advance,

Whitney M.

Viewing all 1120 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>