/* fclrgc214.c =========== Author: R.J.Barnes & D.Andre */ /* Copyright 2004 The Johns Hopkins University/Applied Physics Laboratory. All rights reserved. This material may be used, modified, or reproduced by or for the U.S. Government pursuant to the license rights granted under the clauses at DFARS 252.227-7013/7014. For any other permissions, please contact the Space Department Program Office at JHU/APL. This Distribution and Disclaimer Statement must be included in all copies of "Radar Operating System" (hereinafter "the Program"). The Program was developed at The Johns Hopkins University/Applied Physics Laboratory (JHU/APL) which is the author thereof under the "work made for hire" provisions of the copyright law. JHU/APL assumes no obligation to provide support of any kind with regard to the Program. This includes no obligation to provide assistance in using the Program or to provide updated versions of the Program. THE PROGRAM AND ITS DOCUMENTATION ARE PROVIDED AS IS AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES WHATSOEVER. ALL WARRANTIES INCLUDING, BUT NOT LIMITED TO, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. YOU ASSUME THE ENTIRE RISK AND LIABILITY OF USING THE PROGRAM TO INCLUDE USE IN COMPLIANCE WITH ANY THIRD PARTY RIGHTS. YOU ARE ADVISED TO TEST THE PROGRAM THOROUGHLY BEFORE RELYING ON IT. IN NO EVENT SHALL JHU/APL BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, ANY LOST PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM." */ #include #include #include #include #include "rtypes.h" #include "gc214.h" #include "dio.h" #include "limit.h" #include "freq.h" #include "fft.h" /* $Log: fclrgc214.c,v $ Revision 1.13 2007/04/19 18:03:20 code Changed bandwidth to 0.8MHz. Revision 1.12 2005/07/14 19:19:04 barnes Moved the offsets of the real and imaginary parts to arguments. Revision 1.11 2005/07/14 19:12:29 barnes Modification to reverse the sample ordering for HF mode radars. Revision 1.10 2005/07/06 18:09:55 barnes Added Dieter's fix to correct the FFT for radars operating in the HF. Revision 1.9 2005/06/16 18:43:21 barnes Added Dieter Andre's code for operation at HF. Revision 1.8 2004/09/01 14:23:23 barnes Opened bandwidth of search to 1.5 MHz to take advantage of the physical filter. Revision 1.7 2004/05/14 16:27:31 barnes Divided noise value by three to correct for signal abnormalities. Revision 1.6 2004/05/11 15:27:41 barnes Changed buffer pointer types. Revision 1.5 2004/05/04 18:51:24 barnes Renamed the type header to avoid confusion. Revision 1.4 2004/05/03 20:05:38 barnes Changed type ipcid to ipcid_t. Revision 1.3 2004/05/03 18:00:08 barnes Reordered headers. Revision 1.2 2004/05/03 15:43:59 barnes Added ipcid type for the IPC calls. Revision 1.1 2004/03/13 20:07:53 barnes Initial revision */ #define DELAY 5 #define LOOP 3 int FCLRGC214(ipcid_t dioid,ipcid_t drid,struct FreqTable *fptr, int start,int end,int rsep,int Fclk,int roff,int ioff, void **bufadr,float *noise,float *statistic, int *flg,void (*user)(int start,int end,int rsep, int nn,float *pwr,void *usrdata), void *usrdata ) { int16 *ptr; float finc; int decimation; int n,c,l; int status; int nn=512,nave=20; int centre,bandwidth; int ind0,ind1; int imin,x; float fbw=3333.3; float minv,aval,fmin,freq; float *fft=NULL; float *pwr; pwr=malloc(sizeof(float)*nn); for (n=0;n0) x=n-1; else x=nn-1; aval=pwr[x]+pwr[n]+pwr[n+1]; x=(n>=(nn/2)) ? (n-nn) : n; freq=(centre*1000.0+x*finc)/1000.0; if ((FreqTest(fptr,(int) freq)==0) && (aval=(nn/2)) ? (n-nn) : n; freq=(centre*1000.0+x*finc)/1000.0; if ((FreqTest(fptr,(int) freq)==0) && (aval