Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime error getting interpolated values for long period/high interval #54

Closed
sapdejong opened this issue Mar 14, 2018 · 3 comments
Closed
Labels

Comments

@sapdejong
Copy link
Collaborator

sapdejong commented Mar 14, 2018

  • PIconnect version: 0.5.1
  • Python version: 2.7.13 |Anaconda custom (32-bit)| (default, May 11 2017, 14:07:41) [MSC v.1500 32 bit (Intel)]
  • Operating System: Windows 10 Enterprise x64

Description

Tried to get interpolated values for a long period (years) with high interval (minutes). System gives a runetime error

What I Did

start = "01-01-2014"
eind = "13-03-2018"
interval = '2m'

for item in lijst: 
    with PI.PIServer() as server:
        tags = server.search(item)
        for tag in tags:
            data = tag.interpolated_values(start, eind, interval)
            data.to_csv(tag.tag + ".csv")
PITimeoutException: [-10722] PINET: Timeout on PI RPC or System Call.
   bij OSIsoft.AF.PI.PIException.ConvertAndThrowException(PIServer piServer, Exception ex, String message)
   bij OSIsoft.AF.PI.PIPoint.InterpolatedValuesByCount(AFTimeRange timeRange, Int32 numberOfValues, String filterExpression, Boolean includeFilteredValues)
   bij OSIsoft.AF.PI.PIPoint.InterpolatedValues(AFTimeRange timeRange, AFTimeSpan interval, String filterExpression, Boolean includeFilteredValues)
@Hugovdberg Hugovdberg added the bug label Mar 15, 2018
@Hugovdberg
Copy link
Owner

Thanks for your report. I think this can be solved by extending the OperationTimeout, I'll try to add it as an option to the PI.PIServer() constructor.

@anjazgodic
Copy link

@Hugovdberg I was wondering if you could provide some hints or a bit more guidance on this and I can try to add the option myself. I am facing the same issue.

@Hugovdberg
Copy link
Owner

The PIServer object has an attribute connection which is an AF.PI.PIServer() object. This itself has a property ConnectionInfo.OperationTimeOut which is a System.TimeSpan object containing the maximum time an operation can take. To override this I think you could do something similar to the following for now:

import PIconnect as PI
from System import TimeSpan

timeout = [
    0, #  hours
    5, #  minutes
    0, #  seconds
]

server_manager = PI.PIServer()
server_manager.connection.ConnectionInfo.OperationTimeOut = TimeSpan(*timeout)

with server_manager as server:
    print(server.connection.ConnectionInfo.OperationTimeOut)

To implement this in PIconnect, an extra argument could be added to the PIserver.__init__ method to which sets the property on initialisation. This is necessary because once connected (as inside the context manager) the ConnectionInfo is read only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants