AnsweredAssumed Answered

PI UFL - Migrating Historical Digital Values from Another Historian

Question asked by nikhil.kaul on Jun 3, 2015
Latest reply on Jun 8, 2015 by Eugene Lee

Hello All!


We are migrating some historical data from IP21 to PI for which we are using PI UFL to read the text files extracted in the format of TagName,Timestamp,Value from IP21. While everything is fine, there are these following situations:


1. There are 2 fields in IP21 called as Value & Quality. Now, there are certain "0" in Value, with "Good" in the Quality field and there are certain "0" with "Bad" quality. We are successful in migrating all good values properly.


Now for the Bad values (and there are other states like Bad, Bad Tag, Unavail, Suspect etc) we achieved replacing the "0" with text "Bad" in our SQL script during the extraction. However, when we parse this file through UFL, it throws this error (at bottom, here there is a value called "NaN", we need to parse this through as Bad). Now the thing is, even if our tag is a Float32 or a Booleean, it won't recognize String. 


What we are attempting is to trick PI to atleast pick this value through the interface, recognize it as "Bad" and write the System Digital State as "Bad" in the PI Server. If this would have been achieved, we would have been successful in replacing any unrequired quality such as "Unavailable, BadTag" with just "Bad"! But Alas, this is not happening.


2. However, if we achieve the this gets me thinking what about the digital values which are coming as CLOSED/OPEN, RUN/STOP? They are also stored as strings in IP21 associated with an underlying boolean value from DCS (much like DigitalStates in PI). Now because we are fetching data through IP21 and not the DCS, it is not taking the underlying Value coming from DCS but treating the digital value text and not passing through UFL.


So my questions are :


Q1. Is it possible to somehow parse the textual values through UFL by using a CMD parameter in interface configuration, so that these textual values are atleast picked up by PI, rejected due to Float32/Digital format of tag, and then write the System Digital State of "Bad" in place of that value? Or any other method?


Q2. Is it possible to read the underlying value coming from the DCS in a boolean tag, while fetching the values from IP21, instead of reading the IPValueFormat of NORMAL/CLOSED, TRAVEL/STOP/RUN etc? Anyone who has a knowledge about IP21 functions which we can use in our SQL Script?


Much thanks to all!