Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

qpsk_ber_test.h

Go to the documentation of this file.
00001 /*
00002  * SPUC - Signal processing using C++ - A DSP library
00003  * 
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2, or (at your option)
00007  * any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 #include <time.h>       // For time functions
00019 #ifdef KBHITD
00020 #include <conio.h>      // For kbhit
00021 #endif
00022 #include <max_pn.h>     // Maximal length PN generator
00023 #include <complex.h>
00024 #include <iostream>
00025 #include <iomanip>
00026 namespace SPUC {
00035 class qpsk_ber_test
00036 {
00037         public:
00038         long modc;
00039         time_t start_time;
00040         max_pn ref;
00041         complex<long> corr_sum;
00042         long errors;
00043         complex<long> rotate;
00044         bool sync;
00045         long interval;
00046         long prev_errors;
00047 
00048         qpsk_ber_test(void) : ref(0x006d,63,-1) {
00049                 modc = 1;
00050                 start_time = time(NULL);
00051                 errors = 0;
00052                 corr_sum = 0;
00053                 sync = 0;
00054                 rotate = complex<long>(0,0);
00055                 interval = 0;
00056                 prev_errors = 0;
00057         }
00058         void init_delay(int c) { for (int i=0;i<c;i++) ref.out(); }
00059         bool found_sync(void) { return(sync); }
00060         void ber_results(long received);
00061         long synchronize(long* received, complex<long> data);
00062         void final_results(long received);
00063         void correlate(long* received, complex<long> data) {
00064           synchronize(received, data);
00065           ber_results(*received);
00066         }
00067         void print_running_ber(void) {
00068           long sym_int = interval;
00069           cout << "Symbol interval = " << setw(8) << sym_int;
00070           cout << "BER = " << running_ber() << '\n';
00071         }
00072     double running_ber(void);
00073         double ber(long received) { return(errors/(double)received); }
00074         
00075 };
00076 } // namespace SPUC 

Generated on Fri Sep 16 11:02:21 2005 for spuc by  doxygen 1.4.4