05.15.08
Posted in Electronics, PhD An Acoustic Disdrometer, Programming, Qt at 8:12 pm by philwinder
I’ve had a very serious problem recently regarding the long term stability of the NI-4462.
Problem:
Everything works fine for about 20-inf secs but then all of a suddent the DAQmxReadAnalogF64 function returns a 1 rather than a 0.
Solution:
The errors were buffer overrun errors (annoying that the 4462 almost always returns 1 as an error. Not very informative!). This, I eventually figured out, seemed to be happening every time my cpu hit 100% load. Then the DAQ would stop acquiring, post an error of 1 and quit. To fix this I manually set the sampsPerChanToAcquire setting in the DAQmxCfgSampClkTiming function.
Just a bit of background, I am using continuous acquiring, so the sampsPerChan… variable set the hardware buffer size. I am also interrupting every 50000 samples. So setting this value to 200000 or above (i.e. 4x your interrupt generation) seems to get rid of all my intermittent problems!! Woo!
Hope this helps someone in the future…
Permalink
05.06.08
Posted in Qt at 10:58 am by philwinder
If you ever get the error:
In file included from c:/Qt/4.3.4/include/QtCore/qcoreevent.h:1,
from c:/Qt/4.3.4/include/QtCore/../../src/corelib/kernel/qcoreapplication.h:48,
from c:/Qt/4.3.4/include/QtCore/qcoreapplication.h:1,
from c:/Qt/4.3.4/include/QtCore/QCoreApplication:1,
from src\qpnwsettings.cpp:3:
c:/Qt/4.3.4/include/QtCore/../../src/corelib/kernel/qcoreevent.h:52: error: `QtValidLicenseForCoreModule’ does not name a type
mingw32-make[1]: *** [build/qpnwsettings.o] Error 1
mingw32-make: *** [release] Error 2
This is due to a semicolon not being present at the end of a class definition in a header file when #ifdef and #endif statements are used. So for example:
#ifndef __FOO_H__
class foo
{
};
#endif
works fine (note the semicolon after the last bracket).
Permalink
04.14.08
Posted in PhD An Acoustic Disdrometer, Qt at 10:13 am by philwinder
Quick update, I wanted to try the matlab vs c++ routines again, because from what I can remember, matlab was several orders of magnitude quicker than the c++ program. But I recently found a library in Qt called QVector, which claims to be very quick on the
whole memory front. So I went back and did the test again. (Because for some reason I didnt leave any trail of documentation like I normally do?)
Now notice my shock, suprise and glee when I rewrote the program for Qt 4, put it in release mode instead of debug and opened a large can of groinal kickers on matlab. See the results below.
Programs, settings, etc. __________________________________
Matlab V7.3 (2006b)
Qt V4.3.4 (release mode, default optimisations, single threading, pure c++ (no QVectors etc.)
MATLAB_____________________________________________
x = -0.5; y = -0.24; hydrophoneDepth = -0.3; SoS = 1482; hydrophoneSpacing = 0.5;
T = [1000000*sqrt( x^2 + (y-hydrophoneSpacing)^2 + hydrophoneDepth^2 )/SoS;
1000000*sqrt( (x-hydrophoneSpacing)^2 + y^2 + hydrophoneDepth^2 )/SoS;
1000000*sqrt( x^2 + (y+hydrophoneSpacing)^2 + hydrophoneDepth^2 )/SoS;
1000000*sqrt( (x+hydrophoneSpacing)^2 + y^2 + hydrophoneDepth^2 )/SoS];
tic
for(x = 1:1000000)
SolvePosition(T,hydrophoneSpacing,hydrophoneDepth,SoS);
end
toc
tic
for(x = 1:1000000)
SolvePosition(T,hydrophoneSpacing,hydrophoneDepth,SoS);
end
toc
tic
for(x = 1:1000000)
SolvePosition(T,hydrophoneSpacing,hydrophoneDepth,SoS);
end
toc
tic
for(x = 1:1000000)
SolvePosition(T,hydrophoneSpacing,hydrophoneDepth,SoS);
end
toc
Elapsed time is 18.844249 seconds.
Elapsed time is 18.670732 seconds.
Elapsed time is 18.662103 seconds.
Elapsed time is 18.620391 seconds.
c++_____________________________________________
Starting Test
___Position Solve Speed Test___
This routine tests the speed of c++ vs.
Matlab for our developed Multilateration Algorithm
7015
Starting Test
___Position Solve Speed Test___
This routine tests the speed of c++ vs.
Matlab for our developed Multilateration Algorithm
6985
Starting Test
___Position Solve Speed Test___
This routine tests the speed of c++ vs.
Matlab for our developed Multilateration Algorithm
6969
Starting Test
___Position Solve Speed Test___
This routine tests the speed of c++ vs.
Matlab for our developed Multilateration Algorithm
6984
Note that the c++ program is in ms. It is clear to see that there is a clear speed advantage, not a lot I know, but it is clear. There is also more scope for firstly optimising my code specifically for c++, using more aggressive optimisations in the compiler and also using the fast access libraries included in Qt.
Permalink
04.11.08
Posted in XP, Qt, Vista at 11:01 am by philwinder
This is a post containing all the problems I had installing and using Qt. Most of them can be fixed quite simply.
Qt:__________________________________________________________
Error: Qt does not compile certain programs on Windows Vista (In my case this was qwt)
Error Code: “gcc: installation problem, cannot exec `cc1′: No such file or directory”
Solution:
to solve the problem, you have just to add the following line in the Qt\bin\qtvars.bat :
SET PATH=%PATH%;C:\MinGW\libexec\gcc\mingw32\3.4.2
replace the last number with your actual version of gcc.
giminik-Vista Complie Errors
QDevelop:______________________________________________________
Error: Errors whilst compiling anything.
Error Code: Various
Solution:
Make sure that you have all the executables (GDB and ctags not vital to compile) locations (i.e. locations to the respective exe’s) in the Tools->External Tools menu. Note that the make exe is actually mingw32-make in the mingw32 folder.
Qwt Install:_________________________________________________
Note: For the following instructions please alter the file paths for your installation.
Follow the instructions in the install file. I had to cd to the qwt directory then “qmake qwt.pro” then “make”. Note: I could compile the examples, but I could not run them because they required some microsoft Visual C dll. (For the dll’s see later - they do work)
Once installed copy the file “C:\Qt\qwt-5.0.2\designer\plugins\designer\qwt_designer_plugin.dll” to “C:\Qt\4.3.4\plugins\designer”. Now the new widgets will be available in designer. Second add “C:\Qt\qwt-5.0.2\lib\qwt5.dll” to the “C:\Qt\4.3.4\bin” folder. This will enable your programs to compile correctly.
Finally, add a LIB path in whatever IDE you are using (or just the pro file) to the “C:\Qt\qwt-5.0.2\lib\libqwt5.a” file and add the header include path “C:\Qt\qwt-5.0.2\src”.
Note: The instructions said to add the “include” folder, but there was none so I just included the source folder.
Now if your on vista, then it compiles, but then crashes. This is because it cannot find some microsoft visual c dlls. I believe this is another path problem, so it might work for XP (I will test later). All we need to do is locate all of these dll’s and place them in the bin directory of your program. I had to add:
msvcp80.dll
msvcr80.dll
And also include the normal Qt dlls:
QtCore4.dll
qwt5.dll
QtGui.dll
The MS dlls can be downloaded here:Microsoft Visual C dll’.
Hopefully, finally, all is good. I believe most of these problems lie with Vista, so XP users should be ok.
Permalink