Comments (12)
I added screenshot for my system with the issue.
from nisyscfg-python.
MXI card is considered a device by NI System Configuration so more information is needed to identify the PXIe-4309 devices. Given that all these DAQmx devices are the same, you could filter with product_id. But, I would recommend using expert_name. The following code snippet will give you the name of primary expert:
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.expert_user_alias[0]}: {resource.expert_name[0]}')
It should return "daqmx" as the expert name for the PXIe-4309s. If you set that property on the filter, the code give you the calibration temperatures for these devices:
import nisyscfg
nisystem_resource = []
with nisyscfg.Session() as session:
filter = session.create_filter()
filter.is_present = True
filter.is_ni_product = True
filter.is_device = True
filter.expert_name = 'daqmx'
for resource in session.find_hardware(filter):
nisystem_resource.append(str(resource.expert_user_alias[0]))
nisystem_resource.append(str(resource.serial_number))
nisystem_resource.append(str(resource.external_calibration_last_time))
nisystem_resource.append(str(resource.current_temp))
print (nisystem_resource)
from nisyscfg-python.
Depending on your use case, here are a few other option that might work.
Ignore devices not connected to the PCI bus
import nisyscfg
import nisyscfg.enums
nisystem_resource = []
with nisyscfg.Session() as session:
filter = session.create_filter()
filter.is_present = True
filter.is_ni_product = True
filter.is_device = True
filter.expert_name = 'daqmx'
for resource in session.find_hardware(filter):
if resource.connects_to_bus_type == nisyscfg.enums.BusType.PCI_PXI:
nisystem_resource.append(str(resource.expert_user_alias[0]))
nisystem_resource.append(str(resource.serial_number))
nisystem_resource.append(str(resource.external_calibration_last_time))
nisystem_resource.append(str(resource.current_temp))
print (nisystem_resource)
Catch the exception and ignore PROP_DOES_NOT_EXIST
import nisyscfg
import nisyscfg.errors
nisystem_resource = []
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):
nisystem_resource.append(str(resource.expert_user_alias[0]))
nisystem_resource.append(str(resource.serial_number))
try:
nisystem_resource.append(str(resource.external_calibration_last_time))
nisystem_resource.append(str(resource.current_temp))
except nisyscfg.errors.LibraryError as e:
if e.code != nisyscfg.errors.Status.PROP_DOES_NOT_EXIST:
raise
print (nisystem_resource)
Use get_property which can default the value if the property does not exist
import nisyscfg
nisystem_resource = []
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):
nisystem_resource.append(str(resource.expert_user_alias[0]))
nisystem_resource.append(str(resource.serial_number))
nisystem_resource.append(str(resource.get_property("external_calibration_last_time", default=None)))
nisystem_resource.append(str(resource.get_property("current_temp", default=None)))
print (nisystem_resource)
from nisyscfg-python.
the filter "if resource.connects_to_bus_type == nisyscfg.enums.BusType.PCI_PXI" doing the job perfectly for our PXIe-4309 and for PXI-628X
['PXI1Slot5', '01D80D59', '2018-09-03 13:22:35', '36.0', 'Dev1', '01D73EF9', '2018-08-21 05:55:29', '36.75', 'PXI1Slot2', '01D73F07', '2018-08-16 13:57:49', '36.5', 'PXI1Slot3', '01D80D54', '2018-08-30 14:37:40', '36.25', 'PXI1Slot4', '01D80D5F', '2018-09-06 15:42:47', '36.0']
What is the resource property can be used to add to my query card model (4309, etc.) ?
Thank you very much for the help!!
from nisyscfg-python.
please advice, if possible to read with the resource. query PXI cards healthy states (functional/not-functional/active/idle/etc.)?
thanks and best regards!
from nisyscfg-python.
i fount the property to read card/chassis model ---> resource.product_name.
it is working for me.
thanks and best regards!!
from nisyscfg-python.
please advice, if possible to read with the resource. query PXI cards healthy states (functional/not-functional/active/idle/etc.)?
thanks and best regards!
I don't know if all that information is available via NI System Configuration. If you can find it is NI MAX, it can likely be queried from this API. Lots of the device information found in NI MAX can be accessed via NI System Configuration, but some may come from device specific APIs.
In this Python API, HardwareResource supports running self_test() which might be useful. It also supports, the Resource and IndexedResource listed in nisyscfg/properties.py. Properties listed in these two groups are accessed with their lower-case equivalents as properties of the HardwareResource object. The names of the properties should be similar to their LabVIEW counterparts: https://zone.ni.com/reference/en-XX/help/373107N-01/nisyscfg/property_node_hardware/
from nisyscfg-python.
I see Status on the NI System Configuration window, but cannot find relevant property when use the following query
if resource.expert_name[0] == "daqmx": #just as example
if resource.connects_to_bus_type == nisyscfg.enums.BusType.PCI_PXI:
from nisyscfg-python.
The Status property is a special case for NI MAX and is the combination of IsPresent and IsSimulated. Below is the Python equivalent of how NI MAX implements Status. (Note: The NI GPIB-ENET/1000 has a slightly different implementation.)
import nisyscfg.enums
import nisyscfg.hardware_resource
def get_status(resource: nisyscfg.hardware_resource.HardwareResource) -> str:
"""Returns the status of the target"""
if resource.is_simulated:
return "Simulated"
return {
nisyscfg.enums.IsPresentType.PRESENT: "Present",
nisyscfg.enums.IsPresentType.NOT_PRESENT: "Not Present",
nisyscfg.enums.IsPresentType.INITIALIZING: "Initializing",
}.get(resource.is_present, "Unknown")
If you are not working with simulated devices, you can just query resource.is_present.
from nisyscfg-python.
Thanks for the suggestion and the example! This works well for me.
thanks and best regards!
from nisyscfg-python.
please advice how to use the same python API to query and to collect version of installed NI-DAQmx Device Driver?
thanks!
from nisyscfg-python.
i will open "new issue" for my last questions.
Case for PXIe-4309 is solved and the solution works properly for me. Thanks and best regards!!!
from nisyscfg-python.
Related Issues (12)
- Please upload this project to PyPI HOT 1
- 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
- resource.external_calibration_last_time and resource.current_temp not works for PXI-4309 card HOT 12
- 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.