added function to generate a C include file of tets bits, just single frame for now
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 11 Jun 2017 21:59:06 +0000 (21:59 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 11 Jun 2017 21:59:06 +0000 (21:59 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@3169 01035d8c-6547-0410-b346-abe4f91aad63

codec2-dev/octave/ofdm_dev.m
codec2-dev/octave/ofdm_lib.m
codec2-dev/src/test_bits_ofdm.h [new file with mode: 0644]

index 17e87fb9e88f2d5acb1dac7af31a3e55f034a5b7..f6cd831a3f4426e673dde744ebea99cc5b16a03c 100644 (file)
@@ -183,6 +183,7 @@ function [sim_out rx states] = run_sim(sim_in)
     % note for reasons unknown LdpcEncode() returns garbage if we use > 0.5 rather than round()
 
     tx_data_bits = round(rand(1,Nbits*rate));
+    %test_bits_ofdm_file(tx_data_bits);
 
     tx_bits = []; tx_symbols = [];
     for f=1:Nframes
@@ -524,14 +525,14 @@ function run_single(EbNodB = 100, error_pattern_filename);
   sim_in.Tcp = 0.002; 
   sim_in.Rs = 1/Ts; sim_in.bps = 2; sim_in.Nc = 16; sim_in.Ns = 8;
 
-  %sim_in.Nsec = 2*(sim_in.Ns+1)/sim_in.Rs;  % one frame
-  sim_in.Nsec = 50;
+  sim_in.Nsec = (sim_in.Ns+1)/sim_in.Rs;  % one frame, make sure sim_in.interleave_frames = 1
+  %sim_in.Nsec = 1;
 
   sim_in.EbNodB = EbNodB;
-  sim_in.verbose = 1;
-  sim_in.hf_en = 1;
+  sim_in.verbose = 2;
+  sim_in.hf_en = 0;
   sim_in.foff_hz = 0;
-  sim_in.dfoff_hz_per_sec = 0.02;
+  sim_in.dfoff_hz_per_sec = 0.00;
   sim_in.sample_clock_offset_ppm = 0;
 
   sim_in.timing_en = 1;
@@ -542,7 +543,7 @@ function run_single(EbNodB = 100, error_pattern_filename);
   sim_in.ldpc_code = HRA_112_112;
   sim_in.ldpc_en = 1;
 
-  sim_in.interleave_frames = 32;
+  sim_in.interleave_frames = 1;
 
   %sim_in.diversity_en = 1;
 
@@ -990,8 +991,8 @@ more off;
 
 init_cml('/home/david/Desktop/cml/');
 
-%run_single(6) 
-run_curves
+run_single(6) 
+%run_curves
 %run_curves_estimators
 %acquisition_histograms
 %acquisition_test
index 605d6bfef2e54e6c38084d146b41e145b45ae972..ef09b6a2f0b006e062429231b9ec8bb9cff27c8e 100644 (file)
@@ -4,9 +4,7 @@
 #{
   Library of functions that implement a BPSK/QPSK OFDM modem.  Rate Fs
   verison of ofdm_rs.m with OFDM based up and down conversion, and all
-  those nasty real-world details like fine freq, timing.
-
-  
+  those nasty real-world details like fine freq, timing.  
 #}
 
 
@@ -414,3 +412,18 @@ function [rx_bits states aphase_est_pilot_log rx_np rx_amp] = ofdm_demod(states,
   states.foff_est_hz = foff_est_hz;
 endfunction
 
+
+% Save test bits frame to a text file in the form of a C array
+
+function test_bits_ofdm_file(test_bits_ofdm)
+
+  f=fopen("../src/test_bits_ofdm.h","wt");
+  fprintf(f,"/* Generated by test_bits_ofdm_file() Octave function */\n\n");
+  fprintf(f,"const int test_bits_ofdm[]={\n");
+  for m=1:length(test_bits_ofdm)-1
+    fprintf(f,"  %d,\n",test_bits_ofdm(m));
+  endfor
+  fprintf(f,"  %d\n};\n",test_bits_ofdm(length(test_bits_ofdm)));
+  fclose(f);
+
+endfunction
diff --git a/codec2-dev/src/test_bits_ofdm.h b/codec2-dev/src/test_bits_ofdm.h
new file mode 100644 (file)
index 0000000..acbed01
--- /dev/null
@@ -0,0 +1,116 @@
+/* Generated by test_bits_ofdm_file() Octave function */
+
+const int test_bits_ofdm[]={
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  1,
+  0,
+  1,
+  0,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  1,
+  0,
+  1,
+  0,
+  0,
+  1,
+  0,
+  1,
+  0,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0,
+  0,
+  1,
+  1,
+  1,
+  0
+};