Comments (12)
Hi,
I tested out the sample code provided above. I have a few ideas on what might be happening. I was able to test it with a PXIe-4309, but I did not have a PXI-6284 on hand. I think it is likely that the PXI-6284 does not support the external_calibration_last_time
property. And I suspect, the exception is occurring on that resource instead of the PXIe-4309.
I would recommend trying the following things:
import nisyscfg
with nisyscfg.Session() as session:
filter = session.create_filter()
filter.is_present = True
filter.is_ni_product = True
for resource in session.find_hardware(filter):
print(f'{resource.product_name} "{resource.expert_user_alias[0]}"')
print(f" Settings")
print(f" Name {resource.expert_user_alias[0]}")
print(f" Vendor {resource.vendor_name}")
print(f" Model {resource.product_name}")
print(f" Serial Number {resource.serial_number}")
current_temp = resource.get_property("current_temp", None)
if current_temp is not None:
print(f" Current Device Temperature {resource.current_temp:0.1f}")
external_calibration_last_time = resource.get_property("external_calibration_last_time", None)
if external_calibration_last_time is not None:
print(f" External Calibration")
print(f" Calibration Date {external_calibration_last_time}")
This will produce a report similar to NI MAX. I expect that you'll see Calibration Date
listed for PXIe-4309 but not the PXI-6284. Also, find_hardware might be returning some other device that does the external_calibration_last_time
property.
Let me know if Calibration Date
does not show up for the PXIe-4309.
I hope this helps,
-Tyler
from nisyscfg-python.
from nisyscfg-python.
I suspect the PXIe-8301 does not support the expert_user_alias[0]
property. However, I did not have the opportunity to test this theory. I am considering adding has_property()
to the HardwareResource class in PR #47. Below is an example of the code that leverages this new method and should work with the PXIe-8301 assuming my theory is correct.
import nisyscfg
with nisyscfg.Session() as session:
filter = session.create_filter()
filter.is_present = True
filter.is_ni_product = True
for resource in session.find_hardware(filter):
print(f'{resource.product_name} "{resource.name}"')
print(f" Settings")
if resource.has_property("expert_user_alias", index=0):
print(f" Name {resource.expert_user_alias[0]}")
print(f" Vendor {resource.vendor_name}")
print(f" Model {resource.product_name}")
print(f" Serial Number {resource.serial_number}")
if resource.has_property("current_temp"):
print(f" Current Device Temperature {resource.current_temp:0.1f}")
if resource.has_property("external_calibration_last_time"):
print(f" External Calibration")
print(f" Calibration Date {resource.external_calibration_last_time}")
If you would like to try it out, there is a prebuilt wheel under the Artifacts section on https://github.com/tkrebes/nisyscfg-python/actions/runs/3374456755.
For Orderable Part Number
property, is this something that you need? I know some drivers report it in NI MAX. Though, it is not currently part of the NI System Configuration API. And in my experience, few drivers implement this property. If you need it, I will see what can be done.
from nisyscfg-python.
from nisyscfg-python.
from nisyscfg-python.
from nisyscfg-python.
hi TyIer,
I see my screenshot is not on received properly.
added NIMAX HW configuration
from nisyscfg-python.
after discussion, i understand "Orderable Part Number" is equal for all PXIe-8301. i dont need this parameter.
thanks
from nisyscfg-python.
i try to run the fixed HardwareResource class from the GitHub
my script:
import nisyscfg
with nisyscfg.Session() as session:
filter = session.create_filter()
filter.is_present = True
filter.is_ni_product = True
for resource in session.find_hardware(filter):
print(f" Settings")
print(f" Resource is present / is device / is ni product = {resource.is_present} / {resource.is_device} / {resource.is_ni_product}")
if resource.has_property("expert_user_alias", index=0):
print(f" Name {resource.expert_user_alias[0]}")
print(f" Vendor {resource.vendor_name}")
print(f" Model {resource.product_name}")
print(f" Serial Number {resource.serial_number}")
if resource.has_property("current_temp"):
print(f" Current Device Temperature {resource.current_temp:0.1f}")
if resource.has_property("external_calibration_last_time"):
print(f" External Calibration")
print(f" Calibration Date {resource.external_calibration_last_time}")
**and receiving the exception, see below. it is trying to query second time at chassis, but resource.is_device response with Fail **
*** Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32. ***
*** Remote Interpreter Reinitialized ***
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXI1Slot2
Vendor National Instruments
Model NI PXIe-4309
Serial Number 01FE2661
Current Device Temperature 30.2
External Calibration
Calibration Date 2021-09-09 05:06:13
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXI1Slot3
Vendor National Instruments
Model NI PXIe-4309
Serial Number 01F05BFF
Current Device Temperature 29.8
External Calibration
Calibration Date 2020-07-27 07:01:29
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXI1Slot4
Vendor National Instruments
Model NI PXIe-4309
Serial Number 01FCF84E
Current Device Temperature 29.8
External Calibration
Calibration Date 2021-09-21 18:33:16
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXI1Slot6
Vendor National Instruments
Model NI PXIe-4309
Serial Number 01FDA832
Current Device Temperature 30.8
External Calibration
Calibration Date 2021-09-21 13:55:52
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXI1Slot7
Vendor National Instruments
Model NI PXI-6284
Serial Number 019EE39F
Current Device Temperature 24.8
External Calibration
Calibration Date 2018-12-11 20:51:30
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXI1Slot5
Vendor National Instruments
Model NI PXIe-4309
Serial Number 01D80D54
Current Device Temperature 30.2
External Calibration
Calibration Date 2018-08-30 14:37:40
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name TB-4309 (ST)/PXI1Slot4/0
Vendor National Instruments
Model NI TB-4309 (ST)
Serial Number 01F722F5
Settings
Resource is present / is device / is ni product = 1 / 1 / 1
Name PXIChassis1
Vendor National Instruments
Model NI PXIe-1092
Serial Number 322DEA6
Current Device Temperature 22.0
External Calibration
Calibration Date 2021-09-30 16:35:21
Settings
Resource is present / is device / is ni product = 1 / 0 / 1
Name PXIChassis1
Traceback (most recent call last):
File "C:\SVSHARE\NI\module2.py", line 11, in
print(f" Vendor {resource.vendor_name}")
File "C:\Python38\lib\site-packages\nisyscfg\properties.py", line 568, in get
return self._type_property.get(instance._property_accessor)
File "C:\Python38\lib\site-packages\nisyscfg\properties.py", line 173, in get
return accessor.get_string_property(self._id)
File "C:\Python38\lib\site-packages\nisyscfg\properties.py", line 69, in get_string_property
return self._getter(id, ctypes.c_char_p)
File "C:\Python38\lib\site-packages\nisyscfg\hardware_resource.py", line 151, in _get_property
nisyscfg.errors.handle_error(self, error_code)
File "C:\Python38\lib\site-packages\nisyscfg\errors.py", line 85, in handle_error
raise LibraryError(status, description)
nisyscfg.errors.LibraryError: Status.PROP_DOES_NOT_EXIST:
from nisyscfg-python.
from nisyscfg-python.
I got a change to look at a system with a PXIe-8301 and a PXIe-109x chassis. I found that find_hardware() returns resources that are not classified as a device or chassis. These resources are not required to support properties like vendor name or product name. I would recommend ignoring resources that are not a device or chassis. The following sample code worked for me on that system.
import nisyscfg
with nisyscfg.Session() as session:
filter = session.create_filter()
filter.is_present = True
filter.is_ni_product = True
for resource in session.find_hardware(filter):
if not (resource.is_device or resource.is_chassis):
continue
print(f'{resource.product_name} "{resource.expert_user_alias[0]}"')
print(f" Settings")
print(f" Name {resource.expert_user_alias[0]}")
print(f" Vendor {resource.vendor_name}")
print(f" Model {resource.product_name}")
print(f" Serial Number {resource.serial_number}")
current_temp = resource.get_property("current_temp", None)
if current_temp is not None:
print(f" Current Device Temperature {resource.current_temp:0.1f}")
external_calibration_last_time = resource.get_property("external_calibration_last_time", None)
if external_calibration_last_time is not None:
print(f" External Calibration")
print(f" Calibration Date {external_calibration_last_time}")
from nisyscfg-python.
from nisyscfg-python.
Related Issues (12)
- Please upload this project to PyPI HOT 1
- nisyscfg resource.is_device query for PXIe-4309 is not working as expected HOT 12
- how to use nisyscfg PY API to read version of NI-DAQmx Device Driver? HOT 8
- [question] how to change the network settings from a remote target? HOT 2
- [question] Getting some crashes in Ubuntu 20.04 while the code works in Windows 10 HOT 5
- authorship question HOT 3
- session.get_installed_software_components() output format HOT 2
- Creating a Python API for PXI Chassis Fan Speed Control HOT 3
- Self-Calibrate HOT 3
- README Mistake: is_in_product? HOT 2
- code to to activate blinking LED on PXIe-4309 front panel HOT 4
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 nisyscfg-python.