Hello,
I am experiencing an issue when programmatically building a DAQmx task with custom scales. Under the right circumstances, the DAQmx simulated output is not staying within the confines of my requested max & min of the channel.
My end goal: create a DAQmx task dynamically such that it mimics the existing behavior of a task preconfigured in MAX.
I am attaching a reproducing case of sample code for reference.There are two labled diagram disable structures that I will reference to explain the different situations where the issue occurs.
In MAX, I am using a simulated cDAQ 9178 with an NI 9220 in slot 1.
The program dynamically creates a DAQmx task and adds 4 channels, each with their own custom scale.
The problem comes from the first situation (1.1 & 2.1 enabled). I have set the min of Chnl4 to -51 and the max to 49; however, the output of the DAQmx acquisition shows Chnl4 extending from -175 to about 100. Inspecting the DAQmx channel with a property node, AI max and AI min are 324 and -176, respectively. I have not been able to figure out where these numbers are coming from.
If you disable the first diagram (enable 1.2) such that only chnl4 is enabled, the DAQmx acquisition output will stay within range even though the DAQmx channel property node still claims the max & min are 324 and -176 still. In fact, we will see the same behavior if we simply modify the physical channel of chnl4 to be 'after' the other three channels (change from ai0-> ai4).
Diagram 2.2 uses 'map ranges' custom scales. Enabling 1.1 & 2.2 we see that the DAQmx Channel property node now lists the max & min of chnl4 correctly. Additionally, although the output is still the larger amplitude waveform, it is clipped at -51 & 49. It is my understanding that the programmer is not in control of the frequency/amplitude of a simulated wave so this clipping is fine and expected.
It seems that if I create the channels 'in order' the issue does not present itself. However, the way I am dynamically creating the task, I cannot guarantee the ordering of the channels.
I am aware that the max & min inputs of the create channel VI are post-scaled values.
My questions:
- Why is the max & min only being taken into account when using a 'map ranges' scale, or if the channels are declared 'in order'?
- Why does the DAQmx Channel property node show different max & mins than configured? And where are these numbers coming from?
Thank you,
Sam