From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

testing DAQmx create scale function

I have implemented a custom scale and want to make sure it's working as i would expect.  I have been simulating functionality with a sim-CDAQ chassis and a few simulated cards running in NI-MAX.  My question is when i implement the custom scale, should i see the output values of the simulated channels scale accordingly?  If the simulated channels are supposed to scale like real channel data then I've done something wrong in my implementation.  I've checked that the input values to the scale are read properly and that there are no errors on the error output.  Thanks!

 

scale-question.png

0 Kudos
Message 1 of 3
(2,043 Views)

When you pull a task configured in MAX into LabVIEW, the task's settings take priority over settings configured before pulling in the task. Because the scale must be created before the Create Virtual Channel VI pulls in the task, this means that you must either 1) Configure the scale in MAX or 2) Create the task from scratch within LabVIEW to utilize the custom scale you've created within LabVIEW.

 

Best,

Lindsey Nestor
Program Manager, Hardware Services
National Instruments
Message 2 of 3
(1,956 Views)

Here's how I do it.  This is from code where I'm dealing with Flow Meters that operate in Current Loop, producing a current of 4-20 ma as the Flow goes from 0 to Maximum.  My USB 6001 is configured with a 500 ohm resistor from each input to Analog Ground, so the expected Voltage seen by each wired input will range from 2v to 10v.  I can also tell which channels are not wired to a Current Loop, as they will have a voltage near 0v (instead of 2v).

 

I set up a Linear Scale, which means I need to specify a Slope (Flow Range / Voltage Range) and Y-intercept (Flow corresponding to 0v).  Suppose the Flow Range is 200 L/m, corresponding to 20 ma which (flowing through the 500 ohm resistor) = 10v, with zero flow corresponding to 2v.  Slope = 200 / (10-2) = 25 (L/m)/v, while the Flow Offset = -2v * Slope = -50 L/m.  The sub-VI Flow Scaling does this calculation, returning Slope and Offset to set the Custom Scale so the numeric output from the Analog Inputs are in units of L/m.  Note that all the Channels (Active Flows = number of Channels) have the same Scaling -- had I actually calibrated each Channel, I could have had individualized Scaling to match the Channel's calibration. 

Custom ScalesCustom Scales

Bob Schor

0 Kudos
Message 3 of 3
(1,932 Views)