Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

weird problems (bug?) with custom scales

I have really weird problems with the custom scales feature using DAQmx and a USB 6008 DAQ.
 
The analog output is used to steer a motor controller.  The motor controller has two modes: speed control and torque control.  Also, it has a single direction mode, and a dual direction mode.  
My driver/program is able to select any of these, (using DIO output to the motor controller) and has custom scales for all four of them.    I'm switching custom scales using the DAQmx channel property node
 
To set the proper max and min values, I actually start the AO channel in Volt mode, with min/max values of 0 and 5 Volt.  Then, I switch to the custom scales.  The max/min values are properly translated into the new units. 
 
 
When using speed control, I can switch freely between single and dual direction mode as often as I want.  No problem, works perfect.  It takes the new scale, and operates fine.  
 
I can also switch from speed control to torque control with no problem.   
 
But here's the problem:  When I switch back from torque to speed control (single direction), and I try to set a speed, then I get an error, saying that my value of for example 35 (Hz)  is too high, and should be between 0 and 5.    (presumably the original 0 and 5 Volt...)     It seems that somehow, the system doesn't understand anymore, and defaults back to Volt mode...
 
Even more strangely, there's a workaround for it:
  1. I switch from torque to speed (single direction), and don't set a value.... 
  2. Then switch the scale to speed dual direction, and immediately back to speed single direction.  (I.e.   I basicly do nothing, as I'm back to single direction speed again.)
  3. Now set a speed value, and it works fine.

So the difference is step 2... and then things work fine.   Obviously, step 2 shouldnt't make a difference.  It's just loading two extra scales, but in the end, the same scale is used...

Does this sound familiar to someone?    Any ideas?      I've been looking at it for days, and can't find a solution.  I have the feeling it's a bug in the custom scale implementation...   
 
 
 
These are the scales:       
                                          slope      offset      unit
speed single direction:       43            -110       Hz
speed dual direction:         -43             110       Hz
torque single direction:      -0,0488    0,122    mN m
torque dual direction:         0,0488    -0,122    mN m
 
(Typically, the system would drive up to four motors, and these values will be different for all 4 motors.   Custom scales is perfect for this, as my program doesn't have to care about it, except loading the custom scales...)
0 Kudos
Message 1 of 4
(3,347 Views)

I've written a very small test program, that illustrates the problem.    
(Scales the same as above.  Penny1:1 is a simple 1-to-1 scale.  Thus slope 1, offset 0.)

Start at scale = 1:1, and increase the speed.   This gives a error at value > 5, like it should.   (Channel is limited to 5 Volt)

Switch to scale = Unidirect Speed.   Because of the different scale, you should be able to set speed to 100, before reaching 5 volt analog output from the DAQ.   However,  you get an error at speed > 5.   Although the channel reports the new scale, it doesn't seem to use it yet.

Now... Switch to scale = Bidirect Speed, and immediately switch to Scale = Unidirect Speed.     Now, the scale works fine, and you can increase the speed above 5, like it should.   

I don't understand it...   

 

Attached:    test vi and the used custom scales exported from MAX.

Download All
0 Kudos
Message 2 of 4
(3,338 Views)
The owning .lvlib is missing and therefore your example can not be executed.

Are you aware that the minimal and maximal values must be set in the physical and not the electrical unit ?

Please try following :
  1. Run MAX (Measurement and Automation Explorer)
  2. Create an AO task
  3. Set the range to Max = 5, Min = 0
  4. Select the Penny 1to1 scale (note that the unit of the scale is displayed near Max and Min)
  5. Run the task --> OK
  6. Select the Penny Bidirect Torque
  7. Run the task --> Error --> press Details... and read the error description
Unless I'm missing something, in your VI, the range is always set to 0..5 (electrical unit) instead of the physical unit which depends on the scale.

0 Kudos
Message 3 of 4
(3,323 Views)

Oops...  The vi was in a LVOOP class folder.    Try it again, now it should open. 

As for the min/max suggestion. The min/max values automatically rescale when selecting a new scale.   As soon as I go from 1:1 scale (min/max 0 - 5 Volt) to the unidirectional speed scale, the min/max values I get from the channel property node immediately switch to approx.  -110 Hz and +110 Hz.  (minus indicates direction.)   So that's correct.   However, when I then give a value of, for example, 35Hz, the system responds that 35 is too high, because min/max are 0 and 5...    So while the property node reports a physical min/max of 110Hz, the DAQmx write vi uses a min/max of 0 to 5 Hz.  Physical values, not electrical!

If I then load the bidirectional speed scale, and then immediately load the unidirectional speed scale again, it does accept 35Hz as a valid value...   

0 Kudos
Message 4 of 4
(3,309 Views)