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

nidaqmx does not generate numbered virtual channel names correctly #579

Open
AlexHearnNI opened this issue May 9, 2024 · 0 comments
Open

Comments

@AlexHearnNI
Copy link

AlexHearnNI commented May 9, 2024

If a DAQmx channel is created for physicalChannel=Dev1/ai0:7 with nameToAssignToChannel=myChan09, then DAQmx will assign Dev1/ai0 the name myChan09, Dev1/ai1 the name myChan10, and so on. In particular, notice the renumbering of the channels and the zero padding of the numbers. See https://www.ni.com/docs/en-US/bundle/ni-daqmx/page/nameassignment.html for reference.

nidaqmx calculates the virtual names incorrectly.

To demonstrate, run the following script:

import nidaqmx

with nidaqmx.Task() as task:
    ai_channel = task.ai_channels.add_ai_voltage_chan("XSeries6363/ai0:3")
    print(ai_channel.name)
    print(ai_channel.chan_type)

with nidaqmx.Task() as task:
    ai_channel = task.ai_channels.add_ai_voltage_chan("XSeries6363/ai0:3", name_to_assign_to_channel="myChan09")
    print(ai_channel.name)
    print(ai_channel.chan_type)

It will fail on the last line with nidaqmx.errors.DaqError: Specified channel is not in the task..

The output before that is

XSeries6363/ai0:3
ChannelType.ANALOG_INPUT
myChan090:3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant