Skip to content

nidaqmx does not generate numbered virtual channel names correctly #579

@AlexHearnNI

Description

@AlexHearnNI

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

AB#3099973

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions