Coder Social home page Coder Social logo

Comments (12)

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

image

I added screenshot for my system with the issue.

from nisyscfg-python.

tkrebes avatar tkrebes commented on June 16, 2024

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.

tkrebes avatar tkrebes commented on June 16, 2024

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.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

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.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

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.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

i fount the property to read card/chassis model ---> resource.product_name.
it is working for me.

thanks and best regards!!

from nisyscfg-python.

tkrebes avatar tkrebes commented on June 16, 2024

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.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

I see Status on the NI System Configuration window, but cannot find relevant property when use the following query
image

        if resource.expert_name[0] == "daqmx": #just as example
            if resource.connects_to_bus_type == nisyscfg.enums.BusType.PCI_PXI:

from nisyscfg-python.

tkrebes avatar tkrebes commented on June 16, 2024

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.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

Thanks for the suggestion and the example! This works well for me.

thanks and best regards!

from nisyscfg-python.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

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.

nahumpodokshik avatar nahumpodokshik commented on June 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.