How do I pull data at 1 minute interval using piconfig?

I have a request to pull all data for a number of tags at 1 minute interval. This is 13 years of data. I gather that I will have to break this up into chunks of 4-5months at a time. I think I can live with this.

I have played with piconfig and a powershell script I found in another post. I have everything figured out except the 1 minute part. I can do this with Datalink, but Excel doesn't have nearly enough capacity for this much data.

 

Is there a way to do this 1m interval using piconfig or powershell?

 

Also, I'm open to ideas on how to get as much data as possible at a go so I can do with less effort.

Parents Reply Children
  • Gregor, I found a powershell script you wrote some 6 years ago that outputs a count of the data points. Can it be modified to output the datapoint themselves?

     

    #region defaults - apply changes here
        $PIDataArchiveHostName = "GB-PIDA1"
        $PIPointName = "CDT158"
        $StartTimeString = "1-Jan-2019"
        $EndTimeString = "1-Feb-2019"
        $tsYears = 0
        $tsMonths = 0
        $tsDays = 0
        $tsHours = 0
        $tsMinutes = 0
        $tsSeconds = 30
        $tsMillisends = 0;
    #endregion
    # Creating a Stopwatch to measure execution time
    $StopWatch = New-Object System.Diagnostics.Stopwatch
    $StopWatch.Start()
    # Load AF SDK
    [System.Reflection.Assembly]::Load("OSIsoft.AFSDK, Version=4.0.0.0, Culture=neutral, PublicKeyToken=6238be57836698e6")
    # Instantiate the PIServer object
    $KnownServers = New-Object OSIsoft.AF.PI.PIServers
    $PIServer = $KnownServers[$PIDataArchiveHostName]
    # Load the PI Point
    $PIPoint = [OSIsoft.AF.PI.PIPoint]::FindPIPoint($PIServer, $PIPointName)
    # Define time boundaries and interval for interpolations
    $StartTime = [OSIsoft.AF.Time.AFTime]::Parse($StartTimeString)
    $EndTime = [OSIsoft.AF.Time.AFTime]::Parse($EndTimeString)
    $TimeRange = New-Object OSIsoft.AF.Time.AFTimeRange($StartTime, $EndTime)
    $TimeSpan = New-Object OSIsoft.AF.Time.AFTimeSpan($tsYears, $tsMonths, $tsDays, $tsHours, $tsMinutes, $tsSeconds, $tsMillisends)
    # Request Interpolated values
    $AFValues = $PIPoint.InterpolatedValues($TimeRange, $TimeSpan, "", $true)
    # Report amount of values returned and elapsed time
    $AFValues.Count
    $StopWatch.Elapsed.TotalSeconds