Comments (9)
Note that the documentation contains a section API Reference
that shows what methods and attributes the different kinds of objects have. The attributes should all have at least some description, if you're missing something please let me know!
I was going to suggest the following, but I noticed the mock API for the tests breaks the automatic detection of the right location:
If you find yourself lost in the API Reference because you don't know in which section a certain object lives, than it might help to navigate there from the tutorials. If you click on the bold class names in the tutorials they link to the exact location in the reference.
Finally, if you know/feel some attribute of an object is stored in the PI Server but it isn't currently available in PIconnect
, then please let me know. If it is readily available in the PI AF SDK I can add it pretty quickly usually.
from piconnect.
@jbshiau235 you can install the package from the feature branch using pip install git+https://github.com/Hugovdberg/PIconnect@feature/feature/extract_single_historic_value
. Due to the coronacrisis I don't think I'll get around to merging it into the main branch and publishing a new version soon. Both PIPoint
and PIAFAttribute
have an attribute recorded_time
and interpolated_time
, that query the data for a single time. The documentation needs work, but hopefully this helps you get started!
from piconnect.
That's an interesting question. Yes, PIPoint
, PIAFElement
and PIAFAttribute
objects all have a name
attribute that contains the name of the item. For PIPoint
objects this contains the tag name.
So something like this should work, hope that helps:
import re
import PIconnect as PI
pattern = re.compile(r"FQI?[TS]?\d{3}")
with PI.PIServer() as server:
points = [point
for point in server.search("*")
if pattern.match(point.name)] # or pattern.match(point.tag)
from piconnect.
Perfect, that works for me. I was mainly struggling to find documentation regarding what kinds of attributes a PIPoint has that I can extract. Doing "point.tag" works for me as well as "point.current_value" to extract what value it has. I appreciate your help on this!
from piconnect.
What attributes can I pull from a PISeries data type? I looked at the API Reference, but it only tells me what parameters to put into a PISeries object. I'm looking to extract recorded values of PIPoint objects into a dictionary or list to put into a table with columns: Tag Name (string), Time Stamp (date/time), Value (either string or number). I can get the tag name from PISeries.tag, and value from PISeries[index] (after guessing around), but I can't seem to get the time stamp to come out. Is there a property I can use to pull that information?
from piconnect.
The PISeries
objects itself are not very informative, they are essentially a pandas.Series
with very little additional info. They have an attribute PISeries.tag
with the tag name, and PISeries.uom
with the units of measurement, and the timestamps are used as the PISeries.index
but more info is available from the PIPoint
objects.
The PIPoint
has the following attributes:
current_value
&last_update
: latest recorded value and the corresponding time stampname
: the tag namedescription
: the description of the PI Pointunits_of_measurement
: the units of measurement of the valuesraw_attributes
: the raw attributes as reported by the PI SDK
But to get a table like you suggest there you could use something like the following snippet:
with PI.PIServer() as server:
point = server.search("*")[0]
data = point.recorded_values("-1d", "*")
data.reset_index().rename(columns={"index": "Time Stamp"}).melt(
id_vars="Time Stamp", var_name="Tag Name", value_name="Value"
)
from piconnect.
Additional question regarding data extraction. Is it possible to pull an interpolated value for a PI Tag for a given single point in time? I know the reference shows you how to pull interpolated values over a time range, but I would like to know what the value was at a specific time stamp. I tried doing:
point.interpolated_values(start_time=some_time, end_time=some_time, interval='0s')
However, this didn't work since I believe this function only takes ranges with specified intervals. Ideally something like the current_value attribute would be nice, but for some time in the past history of the data.
from piconnect.
from piconnect.
Perfect, thank you very much. Stay healthy!
from piconnect.
Related Issues (20)
- How to download Audit Trails? HOT 1
- Trouble connecting to anything besides Testing HOT 3
- Question - how are servers discovered? HOT 2
- AttributeError: 'PIPoint' object has no attribute 'CurrentValue' HOT 1
- Open PI Connection without context manager HOT 3
- _time.to_af_time_range does not parse relative times correctly
- Search for attribute by providing entire Path as String in PIAF HOT 1
- Was able to connect for a while, until the server was migrated. HOT 4
- Create Point
- Get dataset from an event frame based on time period and choose attributes
- Search PI points by name and description using queries HOT 2
- Checking that status of Multiple PI Tag HOT 1
- Error when trying to fetch the highest value of the last 30 days
- PIData.py PISeriesContainer summary
- PIAuthenticationException
- Attribute Error: AFBufferOption, tried venv, also local download how fix? HOT 1
- Time Filtered Function as in Pidatalink
- Can not connect to PI server
- Connecting to All Known Data Archive and Asset Framework Servers on Import HOT 3
- Access PI Library Tables HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piconnect.