2 Replies Latest reply on Nov 16, 2015 5:30 PM by Weikang Sun

    UFL ini question

    alittlejohn

      I have the following data in a file and not sure how to configure the ini file to be able to upload data to pi

       

      "time",13/11/15,06:15,15,"min",4

      0.56

      0.88

      1.00

      1.28

       

       

      So in this example

      the value 0.56 needs to be assigned to the time 13/11/15 06:15

      the value 0.88 needs to be assigned to the time 13/11/15 06:30

      the value 1.00 needs to be assigned to the time 13/11/15 06:45

      the value 1.28 needs to be assigned to the time 13/11/15 07:00

       

      So each line is given a different time based on starttime + the interval (which is set the the first line)

        • Re: UFL ini question
          Weikang Sun

          Great question!  This is definitely possible in the UFL configuration.  I would suggest creating a field called Offset (type Date, format "m" for minutes) and capturing the offset amount in the header.  In addition, create another field called Counter (type Number or Int32) and set that equal to 0 in the header as well.  Then, in the data section, after StoreInPI() is called, increment counter by 1. The incremented time stamp should look like:

          Timestamp + Counter * Offset

           

          If you wish to read multiple files in one go, then make sure to include the end of file function at the end of the .ini file so that the counter can reset:

          IF EOS() == 1 THEN Counter == 0 ENDIF

           

          I will implement a sample configuration for this file type, and post again with the source code once I have that working!

          1 of 1 people found this helpful
          • Re: UFL ini question
            Weikang Sun

            I completed a script that will format exactly what your input data file requires.  I ended up not needing to use a Counter variable or the counter reset IF statement at the end.  Since the data doesn't explicitly state a PI Point to write to, I specified one in the .ini file.  Hope this helps!

             

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            [INTERFACE]

            PLUG-IN = ASCIIFiles.dll

             

            [PLUG-IN]

            IFM = "C:\Program Files (x86)\PIPC\Interfaces\PI_UFL\Data\*.txt"

             

            [SETTING]

            DEB = 4

            MAXLOG = 10

            MAXLOGSIZE = 10

            OUTPUT = "C:\Program Files (x86)\PIPC\Interfaces\PI_UFL\Logs\PI_UFL.log"

             

            [FIELD]

            FIELD(1).NAME = "Tag"

             

            FIELD(2).NAME = "Timestamp"

            FIELD(2).TYPE = "DateTime"

            FIELD(2).FORMAT = "dd/MM/yy,hh:mm"

             

            FIELD(4).NAME = "Offset"

            FIELD(4).TYPE = "Time"

            FIELD(4).FORMAT = "m"

             

            FIELD(5).NAME = "Value"

            FIELD(5).TYPE = "Number"

             

            [MSG]

            MSG(1).NAME = "Header"

            MSG(2).NAME = "Data"

            MSG(2).EPC = "Float32"

             

            [Header]

            Header.FILTER = C1=="*time*"

            Timestamp = C8 - C21

            Offset = C23 - C24

             

            [Data]

            Data.FILTER = C11=="*"

            Tag = "test_point_UFL"

            Value = ["(*)"]

             

            StoreInPI(Tag,,Timestamp,Value,,)

            Timestamp = Timestamp + Offset

            3 of 3 people found this helpful