Edit lots of logged points from the past


energy_meter (1).png
There is an option in the PI System Management Tools --> Archive Editor to edit logged points from the past. I need to edit a lot of points, so this would take forever. Is there another option e.g. with the Excel Add-Ins PI DataLink and PI Builder?

 

We have energy meters that are visualised on WinCC. Until recently, these energy meters were displayed in kWh, but now the supplier has changed the unit to MWh in WinCC. As all future values will now be logged as MWh, I would like to divide the points logged in kWh by 1000 so that we have a consistent curve over the entire logging period. As we have 10 energy meters, some of which have over 70,000 logged points, the methods I know would take far too long to correct this deviation.

  • I think the easiest approach would be to use AF/AA, create a template for the items, then create an analysis to take the source value, divide it by 1000 and write it back to itself.

    Then, create elements for each item and backfill them.

    Note: ensure you only do the backfill once for each item, otherwise, you will be dividing by 1000 more times than needed.

    If that isn't an option, you can use PI OLEDB provider to update them, probably via code.

  • Tim, I'm not sure if the analysis option would work.

    When backfilling, you have the two options to "fill gaps" or "delete" the history. If you select "fill gaps" it only writes values to new timestamps - it doesn't update any existing events, so this option won't work.

    You would need to choose the other option then, and here's when the warning lights start flashing. I don't think having the same PI Point Attribute as both input and output to an analysis is a good practice, if it's even allowed. But if it's technically allowed, you need to figure out in which order things are done.

    If you backfill 100 values over a span of an hour, when does the delete operation occur in the timeline of events? Is it reading 1 event, processing that event in the expression, deleting the same event from the output point before finally writing back? Or does the delete occur for the entire hour / 100 values first, before it attempts to read / process / write back? One incorrect operation here and you could find yourself in a situation where you have data loss!

     

    In this case, with the potential of over 70k tags, I would most certainly go the code way.

     

    If you can convince your company to use AF attributes to access these data, I would rather configure this with a formula attribute instead. Let the formula evaluate if the values exist before a configured "cutoff date", and return a converted number, or simply return the input value directly if it's after the cutoff date. That way you have a consistent curve directly from the PI System - the only difference is that it's coming from an AF attribute instead of a PI tag.

  • Well said, not enough coffee yet, but I agree with what you wrote.

  • Thanks a lot for your inputs! Luckily we have a test System, so if I mess up no harm is made. So I'll give it a try Slight smile

  • Use PowerShell or the AF SDK. Retrieve all values for the whole time range (or chunk it), and then replace the value at the spot with the converted value.