Custom Data Reference - HexBinDec Convertor

Version 4

    /!\ Warning /!\ : For performance reasons, Custom Data Reference should be your last solution or should be used sparingly.

     

    Hello Everyone,

     

    Here is a small custom data reference that may help you if you are doing a lot of Hex / Bin / Dec convertion. In order to use it, you will need to register the attached .dll file :

    1. Copy the attached .dll in your AF Plugin folder (\PIPC\AF\PlugIns\)
    2. Open the command prompt in the AF folder (\PIPC\AF\)
    3. And run the command :
    RegPlugIn64.exe /f "C:\Program Files\PIPC\AF\PlugIns\OSIsoft.AF.Asset.DataReference.HexBinDecConvertor.dll"
    

     

    Then, you will be able to use the "HexBinDec Convertor" Data Reference. This custom data refernce take two parameters. The first one will be the AF Attribute to convert and the second one, a number between 1 & 6 in order to indicate the conversion wished :

    1. From Hex to Bin
    2. From Hex to Dec
    3. From Bin to Hex
    4. From Bin to Dec
    5. From Dec to Hex
    6. From Dec to Bin

     

    Use examples:

    • |Temperature;1
      • 15 => 10101
    • |Temperature;2
      • 15 => 21
    • |Temperature;3
      • 15 => Error : The input string 15 is not in binary. Parameter "3" means conversion from Bin to Hex.
    • |Temperature;4
      • 15 => Error : The input string 15 is not in binary. Parameter "4" means conversion from Bin to Dec.
    • |Temperature;5
      • 15 => F
    • |Temperature;6
      • 15 => 21

     

    I hope it will help you.

     

    Best regards,

     

    PS: the code is available on github
    GitHub - thib-osi/PI-AF-HexBinDexDataReference: The HexBinDecConvertor Custom Data Reference (CDR) is a small data refer…