Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

LabJackPython DSP Feature


  • Please log in to reply
10 replies to this topic

#1 Strill

Strill
  • Members
  • 27 posts

Posted 23 March 2011 - 08:59 PM

I must be missing something about the DSP feature.

When I run the following code:
import u6
import LabJackPython

d = u6.U6()
s = d.getFeedback( u6.DSP(2))
print (s)
d.close()
I get [8580096] printed out. I don't have anything plugged into the labjack, so that may be correct, but I'm not really concerned with that at the moment.

My problem is that I only get [8580096] the first time I run the program after resetting the U6. If I try to run it again without unplugging and plugging back in my U6, I instead get

Traceback (most recent call last):
  File "TEST.py", line 6, in <module>
	s = d.getFeedback( u6.DSP(2))
  File "c:\work\labjack python tries\DSP\u6.py", line 429, in getFeedback
	raise LowlevelErrorException("\nThis Command\n	%s\nreturned an error:\n  %s" %  ( culprit, lowlevelErrorToString(rcvBuffer[6]) ) )
LabJackPython.LowlevelErrorException:
This Command
	<u6.DSP( PLine = 2, Resolution = 0, Gain = 0, SettlingFactor = 0, Differential = False, DSPAnalysis = 1, AcquireNewData = True )>
returned an error:
	UNKNOWN_ERROR (129)
Unrecognized error code (129)

This happens every time until I unplug my labjack and plug it back in, in which case I get [8580096] again the next time I run the program. Is there something else I need to run after DSP?

I'm using the Sept. 20 version of LabjackPython with driver version 3.25 and firmware version 1.24.

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 March 2011 - 01:22 PM

Error 129 is DSP_SIGNAL_OUT_OF_RANGE which means that the input signal cannot be analyzed by the DSP function. This happens because floating inputs tend to drift to the positive rail. Likewise if you ground the analog input you will probably get error 128 again because the analysis of the data failed. DSP Related errors: #define DSP_PERIOD_DETECTION_ERROR 0x80 // False rising edge, frequency to high, DC signal. #define DSP_SIGNAL_OUT_OF_RANGE 0x81 // Reduce gain or signal amplitude. To work properly the DSP function needs a periodic signal that is within the specified analog range.

#3 Strill

Strill
  • Members
  • 27 posts

Posted 31 March 2011 - 08:14 PM

All right for lack of a sine wave generator I've got a current transducer attached to a lamp power cable, and the transducer is hooked up to AIN3 through a LJTick Current Shunt. My DMM reads 1.45VDC on AIN3 with a 0.15VRMS AC signal when I turn the lamp on, but there appears to be some harmonic distortion so it's not a very good sine wave.

I've got DSP giving me results, but I'm also getting intermittent error code 128s. The results I'm getting also aren't making sense. For example, the signal is 60Hz, but when I try to measure the period with DSP using the following code
import u6

d = u6.U6()

x = d.getFeedback( u6.DSP( 3, DSPAnalysis=4) )

print x
I get [8580096] printed out every time. This is supposed to be milliseconds, which it obviously isn't.

When I try to measure the RMS Voltage I get something around [8840000], which appears to be decreasing as I run the program over and over again.

Is there some kind of conversion I need to do, or does DSP choke on certain kinds of waveforms? I can't copy the waveform from my DMM, but if it matters it looks almost exactly like the third one in this image.

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 01 April 2011 - 02:53 PM

The LabJack throws error 128 when it thinks the period is less than 2.5ms. So, I think what's happening here is that some noise or the distortion may be causing the LabJack to pick up a false zero crossing. I think turning up the gain would help, but that DC component is a problem. I would expect a current transformer to produce a sine centered at zero (no DC offset). Try grounding the negative side of the CT. So the CT leads connect to + and - on the current shunt then add a wire between the - terminal and GND. I think that should give us a good 0-40mV signal to work with. From there we can bump the gain up 10 so help with the period detection.

#5 communiss

communiss
  • Members
  • 5 posts

Posted 13 April 2014 - 04:00 PM

Is the DSP feature deprecated? I just bought a U6-Pro and am running it using python2.7 on Mavericks. I recently bought 2 U3-HVs and have had no problems getting them set up. I can also use getAIN with the U6 to get some simple data, so I began converting some of my U3 code for the U6-Pro. In the process I saw the DSP command in the U6 documentation, but I do not see it in U6.py and my python interpreter says that u6 has no such attribute.

 

For the record this is the code I tried:

 

import u6

d=u6.U6()

print d.getFeedback( u6.DSP( 3, DSPAnalysis=4) )

 

Thanks!



#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 13 April 2014 - 05:21 PM

DSP was an experimental feature that was removed from the U6 firmware and LabJackPython. Documentation and code examples for it were removed on our site, though we may have missed some. In an email to [email protected] , can you provide links to pages on labjack.com that still document the U6 DSP feature?



#7 communiss

communiss
  • Members
  • 5 posts

Posted 14 April 2014 - 07:33 AM

It is in the pdf of the U6 user's guide

 

http://labjack.com/s.../u6/users-guide

 

I know the pdf is not "canonical" but it is easier for me to deal with, since I couldn't find the "export all" link on the user guide link.

 

Too bad it was removed, two of the DSP functions were exactly what I was coding.



#8 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 14 April 2014 - 07:42 AM

A the export buttons are missing.  We will look into that.

 

Which functions are of interest?  Might be a possibility for the AIN-EF system on the T7 or other future t-series devices.



#9 communiss

communiss
  • Members
  • 5 posts

Posted 14 April 2014 - 08:43 AM

Well, I purchased the U6 without knowing that the DSP feature existed, so it is not a big deal; however, many applications that I envision using the labjack series for is to do AC measurements. It would simplify my life to have an RMS function built-in, and a function that could do FFT to do tone measurements.

 

For instance, I plan on using labjacks to train students in instrumentation, so I could envision outputting an analog DC voltage to a voltage controlled oscillator. The signal from the oscillator could go to a circuit and I measure the output with the AIN of a labjack. If I knew the frequency of the oscillator, I could construct Bode plots, or something similar. So using the DSP function would have allowed me to make the RMS measurement, measure the frequency, and produce the data I wanted.

 

Now, I can do this with a few function calls to scipy, but that adds a bit of complexity to my code, and in a teaching environment that can obfuscate the lessons I want them to take away.



#10 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 14 April 2014 - 03:08 PM

FYI:  RMS and frequency measurement are likely features of the AIN-EF system on the T7.



#11 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 14 April 2014 - 03:32 PM

It is in the pdf of the U6 user's guide

 

http://labjack.com/s.../u6/users-guide

 

I know the pdf is not "canonical" but it is easier for me to deal with, since I couldn't find the "export all" link on the user guide link.

 

Too bad it was removed, two of the DSP functions were exactly what I was coding.

 

We are currently addressing an issue with our server on generating PDFs.  For the meantime, there is a 'print all' button which will open a new window with the user's guide in it.  From that you can save it and convert it to a PDF (or just view it in a browser if you want a local copy).  We should have instructions up on the main page of each user's guide explaining those steps sometime tomorrow.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users