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.07.08
Posted in PhD An Acoustic Disdrometer at 10:18 am by philwinder
I’ve been working on decomposing the different parts of the signal received, trying to figure out what each bit is and how to get rid of it.
The main conclusions of which are that bottom->surface reflections are the most predominant in the signal.
The attached two graphs of experiments where I was comparing the signals in a bucket to the signals in the tank, and in the tank at different heights.
The first test shows that side reflections constitute a fair amount of the signal but after the primary reflections have passed the main residing component is the reflections from the surface. (Although they can still be seen in the signal - just). The bottom->surface reflections have slightly different path lengths due to the odd shape of the bottom of the bucket and that the hydrophone protrudes by a few cm’s. These two paths constructively and destructively interfere to produce the remaining oscillatory signal.
The second experiment was to make sure that the remaining signal was produced by surface reflections and not by some resonance in the hydrophone itself. It can be seen that the cycles following the initial spike occur at a different time depending on the depth. The deeper the water, the longer it takes the reflection to return back to the hydrophone. This can be roughly seen but is shrouded by the different path lengths of the other reflections (because the drop wasnt directly over the hydrophone).
This seems to indicate that if we were to dampen the bottom->surface reflections using a lining then a lot of this type of “noise” could be removed.
I also noted that the oil used for this experiment was left in the tank a few days. It looked like the cooking oil had started to coagulate, and did not behave as intended. (the semi-solid pieces were not recombining quick enough to “heal” the patch where the drop had just landed.)
This also helps to answer another question: How thick does it need to be?
Well this roughly depends on how quick/much it is raining. If there is a thin film (about 2mm) then when a drop hits the surface it forces the oil away from the impact site. If another drop was to hit the same place then there would be no oil to stop the bubble noise. If the film is 2cm deep then the drop doesn’t have enough energy to break through the oil into the water, so if another drop did land in its place, there would still be enough oil left to inhibit bubble noise. So the only worse case scenario is when one drop hits and another drop at practically the same time hits exactly the same place in the same orientation. If this happened then a collision between the new drop and the old drop could occur and probably create some strange results.
Having a thicker film also helps to stop the oil coagulating. So basically, the thicker the better. BUT we have to make sure that we dont make it too big because reflections will occur on the boundary of the water and the oil and the speed of sound will be different, affecting the TDOA’s.


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
05.02.08
Posted in Projects, Electronics, PIC at 11:13 pm by philwinder
Got the first incarnation of the Phased array working now. Had a few hiccups along the way, but managed to get most of them sorted. Main problems included not having enough RAM to store a significant amount of data, so I fixed that using a simple compression technique (I say simple, took me ages to get it working!) and using a circular buffer.
The main problem is that the PIC30F’s can only acquire data sequentially, i.e. not simultaneously. This means that each acquire takes 1Tad to sample, therefore 4 sequential acquires takes 4Tad. This means that the actual sampling speed is Fad/4=50ksps max! Rubbish. So Ive ordered some PIC33f’s to try because they are simultaneous and work up to 1Msps!
Also need to desolder the power lead for the transmits because they should have their own separate power supply. Not the on board one.
Finally, some data!



Errata: Slight cock up, in the second image the pulse labeled reverbaration is not reverbaration. I think it was a reflection from something about 45 degrees out. This poses an interesting question, how do I stop signals that are out of phase by exactly 1 cycle adding up to a large number? I will have to consult the literature to figure this one out!
Permalink
04.25.08
Posted in Electronics, Robotics, Future Project Ideas, ZBot at 3:23 pm by philwinder
Not tested yet, but here are some images of the finished PCB!
Image 1 img_0002.JPG Image 3 Image 4
Permalink
Posted in PhD An Acoustic Disdrometer at 2:39 pm by philwinder
Over the past week I have had enough of the surface tension tests since I was getting nowhere. I redid the low surface tension (Ethylene Oxide) and the high surface tension (salt) tests to get some more resolute data. (I thought I might have just been either putting too much in at a time or something.) I found that when I reduced the surface tension this increased the amount of large bubbles being created and the amount that were sustained on the surface (surface bubbles for a long time). This meant that there were some semi-large bubble noise but some utterly huge signals when the large bubbles on the surface popped. Hence, not a good route to go down.
For the higher surface tension test with salt I found that the results were little better. What seems to happen here is that the production of many smaller bubbles is more apparent. Im assuming this is because the large bubbles that are created cannot withstand the pressure inside the water and break up into lots of small bubbles. This is quite good to watch, since the 1 large bubble that is created due to the drop seems to ‘blow up’ and scatter into many smaller bubbles; typically in a spherical arrangement. This also leads to quite a lot of small ‘foam’ on the surface. So the signals from the ‘exploding’ bubbles plus the signal from the drop hitting the foam is also pretty rubbish.
So I sat back and started thinking why oil works so well again. After a small conversation to Sergei we decided that the only other parameter to play with was viscosity. This reminded me of the idea that Kevin had that a change in viscosity may change the frequency of the escaping bubbles. So I thought I would give it a go; a double whammy if you will. Sergei pointed me to Glycerol, stating that it had good thickening properties, but it wasnt very good. Infact it was very similar to the ethylene oxide tried before. So I went back down my simplistic metal path and decided the easiest thing that I could get hold of to make things thicker was Jelly! At worst I would have a nice pudding for tea.
First attempt I didnt use enough jelly, but second attempt I got is spot on. (It is a bit annoying that I have to leave it overnight, but thats the price I pay!) With about a mixture of 3 parts water 1 part jelly-water (as mixed to the directions on the packet) I got a consistency very similar to oil. After a few data captures I knew I was onto a winner.
So, for once I think this almost categorically means that viscosity is the key when trying to minimise bubbles, not surface tension. A nice think liquid acts like a cushion not allowing a depression to form and also preventing the backlash of water that you get on the exit of the bubble.
The images below compare the oil results to the new jelly results. Note the similarity.
The jelly has 3 levels of zoom. The first is the normal 10 second data. The second is zooming in on the noise that you can see in the 10 second data. I think this is the actual oscillation of the liquid iteslf. I could quite easily test for this later. The third image is zoomed right in to the spike itself. The very quick oscillation you can see is reflections of the side walls. These tests are done in a 6×6″ bucket, and will be a lot less in real life. (So will the surface oscillation)



Permalink
04.23.08
Posted in Electronics, PhD An Acoustic Disdrometer at 8:57 pm by philwinder
Just for future reference (because I always forget), using the naff double sided PCB, 3:30 exposure was enough, but by far and away the most important point was to remember to jam the acetate down to the exposure unit, to the point of stressing the joints. Too many times have I relied on the foam in the lid of the exposure unit only to find that the acetate has warped slightly so I get a blurring after developing. Argh! Never again!
On the preamp front, it died! I dont know why, but I know what could have happened. Today in the lab, I came back from cleaning the “drop chamber”, as I like to call it, plugged it back in and it didnt work. I think it was because there was a DC spike on the output of the hydrophone which then knocked out the amplifier input. Here is my reasoning. I washed the hydrophone in hot water, boiling hot, since its the best way of getting rid of all the contaminants. I think this cause a charge build up in the peizoelectric material (either that or it was still hot, hence a wierd DC value) which then discharged (or stayed the same if it was simply due to the heat) and wiped out the input with a fair amount of voltage.
So next PCB, remember the protection diodes! I didnt put them on this time because I couldnt be bothered, and I didnt think this would happen!
p.s. Also, dont forget to place some text so you know which way round the acetate is supposed to go! Plus that the text that is to be on the bottom layer should be flipped! Elementary I know, but always forgotten!
Permalink
Posted in PhD An Acoustic Disdrometer at 8:57 pm by philwinder
After lots of testing, here is the brief version. What I have found is that if you lower the surface tension, you increase the longevity and the size of bubbles under, and on top of the water. If you increase the surface tension, the opposite happens. You get lots of tiny bubbles. Neither actually gets rid of bubbles. (Disclaimer: This could be a coincidence)
Thinking what else could be making the oil work so well in preventing bubble formation is viscosity. This is the only difference between oil and the rest of the tested liquids. So I am in the process of making some scientific jelly, but I dont think I’m going to get it quite right to catagorically prove one thing or another (as usual).
The problem I have is the inability to change one single constant. For example, all the chemicals that are specifically designed for decreasing the surface tension also tend to be quite viscous (although nowhere near oil, and a lot more expensive!) and very very foamy (if that’s a word). Great for washing machine engineers, bad for scientists.
So in the end, I will still probably end up using oil and although it doesn’t mix, it does provide good results and its cheap.
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
« Previous entries