OSIsoft does not recommend the use of the PI API anymore as most of our active development is focused on .NET programming languages. Our .NET libraries (AF SDK) also provide much richer features (enhanced object models, data access options, multithreading) and are better supported for long-term development. We also have more resources on learning how to develop using the AF SDK in the Master PI section of this forum. Furthermore, we do not license PI API for development under normal circumstances anymore. You can refer to Q7 at the link below.
On top of what Eugene suggested, if .NET is not your thing, we have a platform-agnostic rich data access technology PI Web API. These are newer and safer technologies that are superior to PI API in terms of features and security.
1 of 1 people found this helpful
As Eugene and Ahmad have emphasized, please do not use the PI API for data access. However, for reference, the value you got returned is what is referred to as the "istat" value. For digital points, the "istat" value is the actual value of the tag, whereas for other tags (numeric, etc), the "istat" contains status information about the value.
To interpret a digital "istat" value: the upper 16 bits of the number is the digital state set, the lower 16 bits of the number is the offset within the state set.
In your case, True = -13303809
0n13303809 = 0b1100 1011 0000 0000 0000 0001
upper 16 bits = 0b1100 1011 = 0n203 (digital state set 203)
lower 16 bits = 0b1 = 0n1 (first offset within set 203)
Hope this helps.
Hi Yisrael; Although not stated by colleagues is true that the API is no longer being used, I understand that sometimes migrate to other platform is complicated when large developments. Maybe this VB6 with API code can help you..
Const array_size = 5000
Dim times(array_size) As Long
Dim rvals(array_size) As Single
Dim istat(array_size) As Long
Dim pttype As String * 1
res = pipt_pointtype(pt, pttype)
If pttype = "D" Then
res = piar_compvalues(pt, count&, times(0), rvals(0), istat(0), rev)
If res = 0 Then
For L = 0 To count - 1
n_aux = times(L)
pitm_formtime n_aux, fecha_string1, Len(fecha_string1)
res = pipt_digstate(istat(L), state, 12)
n_aux = times(L)
pitm_formtime n_aux, fecha_string, Len(fecha_string)
Estao = Mid(state, 1, 2)
If Estao = "SI" Or Estao = "NO" Then