2 Replies Latest reply on Mar 6, 2018 1:01 PM by clonsberry

    PI-UFL reading in File

    alanR

      Hi ,

       

      I have setup a PI-UFL interface, where it reads in data from a text file.which has a format like such .

       

      A     B     C

      16/02/2018 08:32pm     1     2     3

      16/02/2018 09:32pm     2     3     4

      16/02/2018 10:32pm     2     3     4

      ...............

      So the Ouput should be:

      A 16/02/2018 08:32pm     1

      B 16/02/2018 08:32pm     2

      C 16/02/2018 08:32pm     3

      A 16/02/2018 09:32pm     2

      B 16/02/2018 09:32pm     3

      C 16/02/2018 09:32pm     4

      A 16/02/2018 10:32pm     2

      B 16/02/2018 10:32pm     3

      C 16/02/2018 10:32pm     4

       

      How can i get the UFl Designer to recognize the column headers as pi tagNames and assign the appropraite timestamp and value to it?

       

      Thanks

        • Re: PI-UFL reading in File
          Sidh

          Hello Alan,

           

          You can use following and tweak as per your requirement

           

          [FIELD]

          FIELD(1).NAME="Tag1"

          FIELD(1).TYPE="String"

          FIELD(2).NAME="Tag2"

          FIELD(2).TYPE="String"

          FIELD(3).NAME="Tag3"

          FIELD(3).TYPE="String"

          FIELD(4).NAME="timestamp"

          FIELD(4).TYPE="DateTime"

          FIELD(4).FORMAT="dd/M/yyyy h:m"

          FIELD(5).NAME="Value1"

          FIELD(5).TYPE="Number"

          FIELD(6).NAME="value2"

          FIELD(6).TYPE="Number"

          FIELD(7).NAME="value3"

          FIELD(7).TYPE="Number"

           

          [MSG]

          MSG(1).NAME="MSG_1"

          MSG(2).NAME="MSG_2"

           

          [MSG_1]

          MSG_1.FILTER=C1=="*A*"

          Tag1=["(*) * * * * * * * * * *"]

          Tag2=["* * * * * (*) * * * * *"]

          Tag3=["* * * * * * * * * * (*)"]

           

          [MSG_2]

          MSG_2.FILTER=C1=="*1*"

          timestamp=C1 - C16

          Value1=C24 - C24

          value2=C30 - C30

          value3=C36 - C36

          StoreInPI(Tag1, ,timestamp,Value1, , )

          StoreInPI(Tag2, ,timestamp,Value2, , )

          StoreInPI(Tag3, ,timestamp,Value3, , )

          2 of 2 people found this helpful
          • Re: PI-UFL reading in File
            clonsberry

            Hi Alan,

             

            If you're wondering how to configure the variables in UflDesigner, here are some screeners that might help. You'll want to have a variable for each tag name to be found in the source file.

             

            Create filters so UFL can tell the difference between the header line and the data lines.

            For the header line, the designer will select the correct columns when you tell it your file is space delimited.

            All of this finally produced a message very similar to Siddartha's, except that I used delimited format for the data lines.

             

            [INTERFACE] PLUG-IN=AsciiFiles.dll   [PLUG-IN] IFM=C:\Users\clonsberry\Desktop\35676.txt IFS=N REN=_OK ERR=BAD PURGETIME=1y PFN=False NEWLINE=13,10   [SETTING] DEB=0 MAXLOG=10 MAXLOGSIZE=20 MSGINERROR=C:\Program Files\PIPC\Interfaces\PI_UFL\Logs\err.log OUTPUT=C:\Program Files\PIPC\Interfaces\PI_UFL\Logs\out.log LOCALE=en-us   [FIELD] FIELD(1).NAME="Tag1" FIELD(1).TYPE="String" FIELD(2).NAME="Tag2" FIELD(2).TYPE="String" FIELD(3).NAME="Tag3" FIELD(3).TYPE="String" FIELD(4).NAME="Timestamp" FIELD(4).TYPE="DateTime" FIELD(4).FORMAT="d/MM/yyyy hh:mmpp" FIELD(5).NAME="v1" FIELD(5).TYPE="Number" FIELD(6).NAME="v2" FIELD(6).TYPE="Number" FIELD(7).NAME="v3" FIELD(7).TYPE="Number"   [MSG] MSG(1).NAME="HeaderLine" 'Data lines begin with a digit MSG(2).NAME="Data" MSG(2).EPC="Float32"   [HeaderLine] HeaderLine.FILTER=C1=="A*" Tag1=["(*) * * * * * * * * * *"] Tag2=["* * * * * (*) * * * * *"] Tag3=["* * * * * * * * * * (*)"]   [Data] Data.FILTER=C1=="#*" Timestamp=["(* *) * * * * * * * * * * * * * * *"] v1=["* * * * * * (*) * * * * * * * * * *"] v2=["* * * * * * * * * * * (*) * * * * *"] v3=["* * * * * * * * * * * * * * * * (*)"] StoreInPI(Tag1, ,Timestamp,v1, , ) StoreInPI(Tag2, ,Timestamp,v1, , ) StoreInPI(Tag3, ,Timestamp,v1, , )
            1 of 1 people found this helpful