##// END OF EJS Templates
version 2.0 pour la R3 + modif de init_coefficients
chust -
r17:a5a60b47035d TCH
parent child
Show More
@@ -0,0 +1,1
1 5tJ�n ��j�I�!�D%t�d�D˙�K]&��j�č/8I,F���jC�K�AO�'�)E��dKFKwHU����t5E����.ˑ��LB68ŭ.%M� �M No newline at end of file
@@ -0,0 +1,12
1 # --------------------------------------------------------
2 # MISSION NAME : LFR/RPW/SO
3 # DATA NAME : test matrix
4 # NB_TOTAL_VALUES : 25
5 # NB_COMPONENTS : 25
6 # FORMAT : (25(e16.8))
7 # UNIT : floating
8 # COMMENT :
9 # --------------------------------------------------------
10 # BEGIN DATA
11 4.00109575e+06 -2.19891187e+03 1.73193325e+06 1.88106079e+03 -1.00001638e+06 6.23724854e+02 2.00016860e+07 -3.46422920e+07 -1.44333826e+03 7.54424812e+05 -4.36785375e+05 2.34538879e+02 8.65882200e+06 -3.31611108e+03 2.71719702e+03 1.50027590e+07 2.53229094e+05 -4.99895450e+06 2.90329712e+03 -2.17048022e+03 -8.66275100e+06 1.00002952e+08 -2.94739111e+03 1.73206224e+08 3.00003392e+08
12 # END DATA
@@ -0,0 +1,20
1 TEMPLATE = app
2 CONFIG += console
3 CONFIG -= app_bundle
4 CONFIG -= qt
5
6 DEFINES += DEBUG_TCH
7 DEFINES += LSB_FIRST_TCH # PC convention
8 #DEFINES += MSB_FIRST_TCH # SPARC convention
9
10 SOURCES += main.c \
11 basic_parameters.c \
12 file_utilities.c
13
14 HEADERS += \
15 basic_parameters.h \
16 basic_parameters_params.h \
17 basic_parameters_utilities.h \
18 file_utilities.h
19
20
@@ -1,4 +1,4
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.0: 31/07/2013
3 3 // version 1.1: 02/04/2014
4 4 // version 1.2: 30/04/2014
@@ -7,15 +7,48
7 7 // version 1.5: 20/05/2014
8 8 // version 1.6: 19/12/2014
9 9 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
10 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
11 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
12 // version 2.0: 19/06/2015
10 13
11
14 #include <stdio.h>
12 15 #include <stdint.h>
13 16 #include "basic_parameters_params.h"
14 17
18 void init_k_coefficients_f0( float *k_coeff_intercalib, unsigned char nb_binscompressed_matrix );
19 void init_k_coefficients_f1( float *k_coeff_intercalib, unsigned char nb_binscompressed_matrix );
20 void init_k_coefficients_f2( float *k_coeff_intercalib, unsigned char nb_binscompressed_matrix );
21
15 22 void init_k_coefficients(float *k_coefficients,
16 23 unsigned char nb_binscompressed_matrix )
17 24 {
18 uint16_t i; // 16 bits unsigned
25
26 switch (nb_binscompressed_matrix)
27 {
28 case 11:
29 puts("F0 data: initialization of the intercalibration k-coefficients");
30 init_k_coefficients_f0(k_coefficients, nb_binscompressed_matrix);
31 break;
32 case 13:
33 puts("F1 data: initialization of the intercalibration k-coefficients");
34 init_k_coefficients_f1(k_coefficients, nb_binscompressed_matrix);
35 break;
36 case 12:
37 printf("F2 data: initialization of the intercalibration k-coefficients");
38 init_k_coefficients_f2(k_coefficients, nb_binscompressed_matrix);
39 break;
40 default:
41 puts("there is a problème !!?");
42 break;
43 }
44 }
45
46
47 void init_k_coefficients_f0(float *k_coefficients,
48 unsigned char nb_binscompressed_matrix )
49 {
50
51 uint8_t i; // 8 bits unsigned
19 52 for(i=0; i<nb_binscompressed_matrix; i++){
20 53 k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
21 54 k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
@@ -50,4 +83,94 void init_k_coefficients(float *k_coeffi
50 83 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
51 84 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
52 85 }
86
53 87 }
88
89
90 void init_k_coefficients_f1(float *k_coefficients,
91 unsigned char nb_binscompressed_matrix )
92 {
93
94 uint8_t i; // 8 bits unsigned
95 for(i=0; i<nb_binscompressed_matrix; i++){
96 k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
97 k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
98 k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
99 k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
100 k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
101 k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
102 k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
103 k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
104 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
105 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
106 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
107 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
108 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
109 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
110 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
111 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
112 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
113 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
114 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
115 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
116 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
117 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
118 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
119 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
120 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
121 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
122 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
123 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
124 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
125 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
126 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
127 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
128 }
129
130 }
131
132
133 void init_k_coefficients_f2(float *k_coefficients,
134 unsigned char nb_binscompressed_matrix )
135 {
136
137 uint8_t i; // 8 bits unsigned
138 for(i=0; i<nb_binscompressed_matrix; i++){
139 k_coefficients[i*NB_K_COEFF_PER_BIN+K44_PE] = 1;
140 k_coefficients[i*NB_K_COEFF_PER_BIN+K55_PE] = 1;
141 k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_RE] = 1;
142 k_coefficients[i*NB_K_COEFF_PER_BIN+K45_PE_IM] = 1;
143 k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_RE] = 1;
144 k_coefficients[i*NB_K_COEFF_PER_BIN+K14_SX_IM] = 1;
145 k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_RE] = 1;
146 k_coefficients[i*NB_K_COEFF_PER_BIN+K15_SX_IM] = 1;
147 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_RE] = 1;
148 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_SX_IM] = 1;
149 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_RE] = 1;
150 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_SX_IM] = 1;
151 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_RE] = 1;
152 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_SX_IM] = 1;
153 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_RE] = 1;
154 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_SX_IM] = 1;
155 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_RE] = 1;
156 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NY_IM] = 1;
157 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_RE] = 1;
158 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NY_IM] = 1;
159 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_RE] = 1;
160 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NY_IM] = 1;
161 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_RE] = 1;
162 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NY_IM] = 1;
163 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_RE] = 1;
164 k_coefficients[i*NB_K_COEFF_PER_BIN+K24_NZ_IM] = 1;
165 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_RE] = 1;
166 k_coefficients[i*NB_K_COEFF_PER_BIN+K25_NZ_IM] = 1;
167 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_RE] = 1;
168 k_coefficients[i*NB_K_COEFF_PER_BIN+K34_NZ_IM] = 1;
169 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_RE] = 1;
170 k_coefficients[i*NB_K_COEFF_PER_BIN+K35_NZ_IM] = 1;
171 }
172
173 }
174
175
176
@@ -1,4 +1,4
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.0: 31/07/2013
3 3 // version 1.1: 02/04/2014
4 4 // version 1.2: 30/04/2014
@@ -8,6 +8,8
8 8 // version 1.6: 19/12/2014
9 9 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
10 10 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
11 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
12 // version 2.0: 19/06/2015
11 13
12 14 #ifndef BASIC_PARAMETERS_H_INCLUDED
13 15 #define BASIC_PARAMETERS_H_INCLUDED
@@ -21,7 +23,7
21 23 static inline void BP1_set(float * compressed_spec_mat, float * k_coeff_intercalib, unsigned char nb_bins_compressed_spec_mat, unsigned char * lfr_bp1);
22 24 static inline void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * lfr_bp2);
23 25
24 void init_k_coefficients( float *k_coefficients_f0, unsigned char nb_binscompressed_matrix );
26 void init_k_coefficients( float *k_coeff_intercalib, unsigned char nb_binscompressed_matrix );
25 27
26 28 //***********************************
27 29 // STATIC INLINE FUNCTION DEFINITIONS
@@ -67,11 +69,11 void BP1_set( float * compressed_spec_ma
67 69 #endif
68 70
69 71 // initialization for managing the exponents of the floating point data:
70 nbitexp = 5; // number of bits for the exponent
71 expmax = 30; // maximum value of the exponent
72 nbitexp = 6; // number of bits for the exponent
73 expmax = 32+5; // maximum value of the exponent
72 74 expmin = expmax - (1 << nbitexp) + 1; // accordingly the minimum exponent value
73 // for floating point data to be recorded on 12-bit words:
74 nbitsig = 12 - nbitexp; // number of bits for the significand
75 // for floating point data to be recorded on 16-bit words:
76 nbitsig = 16 - nbitexp; // number of bits for the significand
75 77 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
76 78
77 79 #ifdef DEBUG_TCH
@@ -81,14 +83,13 void BP1_set( float * compressed_spec_ma
81 83
82 84 for(i=0; i<nb_bins_compressed_spec_mat; i++){
83 85 //==============================================
84 // BP1 PSDB == PA_LFR_SC_BP1_PB_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
86 // BP1 PSDB == PA_LFR_SC_BP1_PB_F0 == 16 bits = 6 bits (exponent) + 10 bits (significand)
85 87 PSDB = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX] // S11
86 88 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9] // S22
87 89 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16]; // S33
88 90
89 significand = frexpf(PSDB/3, &exponent); // 0.5 <= significand < 1
90 // PSDB/3 = significand * 2^exponent
91 // the division by 3 is to ensure that max value <= 2^30
91 significand = frexpf(PSDB, &exponent); // 0.5 <= significand < 1
92 // PSDB = significand * 2^exponent
92 93
93 94 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
94 95 exponent = expmin;
@@ -121,27 +122,25 void BP1_set( float * compressed_spec_ma
121 122 #endif
122 123 #ifdef DEBUG_TCH
123 124 printf("\nBin number: %d\n", i);
124 printf("PSDB / 3 : %16.8e\n",PSDB/3);
125 printf("PSDB : %16.8e\n",PSDB);
125 126 printf("significand : %16.8e\n",significand);
126 127 printf("exponent : %d\n" ,exponent);
127 128 printf("psd for PSDB significand : %d\n",psd);
128 129 printf("exp for PSDB exponent : %d\n",exp);
129 130 printf("pt_uint8[1] for PSDB exponent + significand: %.3d or %.2x\n",pt_uint8[1], pt_uint8[1]);
130 printf("pt_uint8[0] for PSDB exponent + significand: %.3d or %.2x\n",pt_uint8[0], pt_uint8[0]);
131 printf("pt_uint8[0] for PSDB significand: %.3d or %.2x\n",pt_uint8[0], pt_uint8[0]);
132 printf("lfr_bp1[i*NB_BYTES_BP1+2] : %.3d or %.2x\n",lfr_bp1[i*NB_BYTES_BP1+2], lfr_bp1[i*NB_BYTES_BP1+2]);
131 133 printf("lfr_bp1[i*NB_BYTES_BP1+3] : %.3d or %.2x\n",lfr_bp1[i*NB_BYTES_BP1+3], lfr_bp1[i*NB_BYTES_BP1+3]);
132 printf("lfr_bp1[i*NB_BYTES_BP1+2] : %.3d or %.2x\n",lfr_bp1[i*NB_BYTES_BP1+2], lfr_bp1[i*NB_BYTES_BP1+2]);
133 134 #endif
134 135 //==============================================
135 // BP1 PSDE == PA_LFR_SC_BP1_PE_F0 == 12 bits = 5 bits (exponent) + 7 bits (significand)
136 // BP1 PSDE == PA_LFR_SC_BP1_PE_F0 == 16 bits = 6 bits (exponent) + 10 bits (significand)
136 137 PSDE = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K44_PE] // S44
137 138 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K55_PE] // S55
138 139 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+22] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K45_PE_RE] // S45 Re
139 140 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+23] * k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K45_PE_IM]; // S45 Im
140 141
141 significand = frexpf(PSDE/2, &exponent); // 0.5 <= significand < 1
142 // PSDE/2 = significand * 2^exponent
143 // the division by 2 is to ensure that max value <= 2^30
144 // should be reconsidered by taking into account the k-coefficients ...
142 significand = frexpf(PSDE, &exponent); // 0.5 <= significand < 1
143 // PSDE = significand * 2^exponent
145 144
146 145 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
147 146 exponent = expmin;
@@ -173,16 +172,15 void BP1_set( float * compressed_spec_ma
173 172 lfr_bp1[i*NB_BYTES_BP1+1] = pt_uint8[0]; // Record LSB of tmp_uint16
174 173 #endif
175 174 #ifdef DEBUG_TCH
176 printf("Bin number: %d\n", i);
177 printf("PSDE/2 : %16.8e\n",PSDE/2);
175 printf("PSDE : %16.8e\n",PSDE);
178 176 printf("significand : %16.8e\n",significand);
179 177 printf("exponent : %d\n" ,exponent);
180 178 printf("psd for PSDE significand : %d\n",psd);
181 179 printf("exp for PSDE exponent : %d\n",exp);
182 180 printf("pt_uint8[1] for PSDE exponent + significand: %.3d or %.2x\n",pt_uint8[1], pt_uint8[1]);
183 printf("pt_uint8[0] for PSDE exponent + significand: %.3d or %.2x\n",pt_uint8[0], pt_uint8[0]);
181 printf("pt_uint8[0] for PSDE significand: %.3d or %.2x\n",pt_uint8[0], pt_uint8[0]);
182 printf("lfr_bp1[i*NB_BYTES_BP1+0] : %.3d or %.2x\n",lfr_bp1[i*NB_BYTES_BP1+0], lfr_bp1[i*NB_BYTES_BP1+0]);
184 183 printf("lfr_bp1[i*NB_BYTES_BP1+1] : %.3d or %.2x\n",lfr_bp1[i*NB_BYTES_BP1+1], lfr_bp1[i*NB_BYTES_BP1+1]);
185 printf("lfr_bp1[i*NB_BYTES_BP1+0] : %.3d or %.2x\n",lfr_bp1[i*NB_BYTES_BP1+0], lfr_bp1[i*NB_BYTES_BP1+0]);
186 184 #endif
187 185 //==============================================================================
188 186 // BP1 normal wave vector == PA_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
@@ -270,9 +268,9 void BP1_set( float * compressed_spec_ma
270 268 printf("lfr_bp1[i*NB_BYTES_BP1+6] for NVEC_V2 + ellipticity + DOP : %u\n",lfr_bp1[i*NB_BYTES_BP1+6]);
271 269 #endif
272 270 //=======================================================================================
273 // BP1 X_SO-component of the Poynting flux == PA_LFR_SC_BP1_SX_F0 == 8 (+ 2) bits
274 // = 5 bits (exponent) + 3 bits (significand)
275 // + 1 sign bit + 1 argument bit (two sectors)
271 // BP1 X_SO-component of the Poynting flux == PA_LFR_SC_BP1_SX_F0 == 16 bits
272 // = 1 sign bit + 1 argument bit (two sectors)
273 // + 6 bits (exponent) + 8 bits (significand)
276 274 e_cross_b_re = compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+17]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K34_SX_RE] //S34 Re
277 275 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+19]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K35_SX_RE] //S35 Re
278 276 + compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+5] *k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K14_SX_RE] //S14 Re
@@ -300,26 +298,23 void BP1_set( float * compressed_spec_ma
300 298 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+13]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K24_SX_RE] //S24 Im
301 299 - compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+15]*k_coeff_intercalib[i*NB_K_COEFF_PER_BIN+K25_SX_RE]; //S25 Im
302 300 #ifdef DEBUG_TCH
303 printf("ReaSX / 2 : %16.8e\n",e_cross_b_re/2);
301 printf("ReaSX : %16.8e\n",e_cross_b_re);
304 302 #endif
305 303 pt_uint8 = (uint8_t*) &e_cross_b_re; // Affect an uint8_t pointer with the adress of e_cross_b_re
306 304 #ifdef LSB_FIRST_TCH
307 lfr_bp1[i*NB_BYTES_BP1+0] = lfr_bp1[i*NB_BYTES_BP1+0] | (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
305 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
308 306 // Record it at the 8th bit position (from the right to the left)
309 // of lfr_bp1[i*NB_BYTES_BP1+0]
307 // of lfr_bp1[i*NB_BYTES_BP1+7]
310 308 pt_uint8[3] = (pt_uint8[3] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
311 309 #endif
312 310 #ifdef MSB_FIRST_TCH
313 lfr_bp1[i*NB_BYTES_BP1+0] = lfr_bp1[i*NB_BYTES_BP1+0] | (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
311 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
314 312 // Record it at the 8th bit position (from the right to the left)
315 // of lfr_bp1[i*NB_BYTES_BP1+0]
313 // of lfr_bp1[i*NB_BYTES_BP1+7]
316 314 pt_uint8[0] = (pt_uint8[0] & 0x7f); // Make e_cross_b_re be positive in any case: |ReaSX|
317 315 #endif
318 significand = frexpf(e_cross_b_re/2, &exponent); // 0.5 <= significand < 1
319 // ReaSX/2 = significand * 2^exponent
320 // The division by 2 is to ensure that max value <= 2^30 (rough estimate)
321 // Should be reconsidered by taking into account the k-coefficients ...
322
316 significand = frexpf(e_cross_b_re, &exponent); // 0.5 <= significand < 1
317 // ReaSX = significand * 2^exponent
323 318 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
324 319 exponent = expmin;
325 320 significand = 0.5; // min value that can be recorded
@@ -333,23 +328,22 void BP1_set( float * compressed_spec_ma
333 328 significand = 0.5; // min value that can be recorded
334 329 }
335 330
336 lfr_bp1[i*NB_BYTES_BP1+7] = (uint8_t) ((significand*2-1)*7 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
337 // where just the first 3 bits are used (0, ..., 7)
331 lfr_bp1[i*NB_BYTES_BP1+8] = (uint8_t) ((significand*2-1)*255 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
332 // where all bits are used (0, ..., 255)
338 333 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
339 // just the first 5 bits are used (0, ..., 2^5-1)
334 // just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
340 335 #ifdef DEBUG_TCH
341 printf("|ReaSX| / 2 : %16.8e\n",e_cross_b_re/2);
336 printf("|ReaSX| : %16.8e\n",e_cross_b_re);
342 337 printf("significand : %16.8e\n",significand);
343 338 printf("exponent : %d\n" ,exponent);
344 printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]);
345 339 printf("tmp_uint8 for ReaSX exponent : %d\n",tmp_uint8);
346 340 #endif
347 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | (tmp_uint8 << 3); // Shift these 5 bits to the left before logical addition
348 // with lfr_bp1[i*NB_BYTES_BP1+7]
341 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | tmp_uint8; // Record these nbitexp bits in the nbitexp first bits
342 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+7]
349 343 #ifdef DEBUG_TCH
350 printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX exponent + significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]);
351 printf("lfr_bp1[i*NB_BYTES_BP1+0] for ReaSX sign + PSDE 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+0]);
352 printf("ImaSX / 2 : %16.8e\n",e_cross_b_im/2);
344 printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX sign + RealSX exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]);
345 printf("lfr_bp1[i*NB_BYTES_BP1+8] for ReaSX significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+8]);
346 printf("ImaSX : %16.8e\n",e_cross_b_im);
353 347 #endif
354 348 pt_uint8 = (uint8_t*) &e_cross_b_im; // Affect an uint8_t pointer with the adress of e_cross_b_im
355 349 #ifdef LSB_FIRST_TCH
@@ -360,17 +354,17 void BP1_set( float * compressed_spec_ma
360 354 #endif
361 355 tmp_uint8 = (e_cross_b_im > e_cross_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
362 356 // an unsigned 8-bit char with 01000000; otherwise with null.
363 lfr_bp1[i*NB_BYTES_BP1+0] = lfr_bp1[i*NB_BYTES_BP1+0] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
364 // to the left) of lfr_bp1[i*NB_BYTES_BP1+0], by simple logical addition.
357 lfr_bp1[i*NB_BYTES_BP1+7] = lfr_bp1[i*NB_BYTES_BP1+7] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
358 // to the left) of lfr_bp1[i*NB_BYTES_BP1+7], by simple logical addition.
365 359 #ifdef DEBUG_TCH
366 printf("|ImaSX| / 2 : %16.8e\n",e_cross_b_im/2);
360 printf("|ImaSX| : %16.8e\n",e_cross_b_im);
367 361 printf("ArgSX sign : %u\n",tmp_uint8);
368 printf("lfr_bp1[i*NB_BYTES_BP1+0] for ReaSX & ArgSX signs + PSDE 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+0]);
362 printf("lfr_bp1[i*NB_BYTES_BP1+7] for ReaSX & ArgSX signs + ReaSX exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+7]);
369 363 #endif
370 364 //======================================================================
371 // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 8 (+ 2) bits
372 // = 5 bits (exponent) + 3 bits (significand)
373 // + 1 sign bit + 1 argument bit (two sectors)
365 // BP1 phase velocity estimator == PA_LFR_SC_BP1_VPHI_F0 == 16 bits
366 // = 1 sign bit + 1 argument bit (two sectors)
367 // + 6 bits (exponent) + 8 bits (significand)
374 368 ny = sin(alpha_M)*NVEC_V1 + cos(alpha_M)*NVEC_V2;
375 369 nz = NVEC_V0;
376 370 bx_bx_star = cos(alpha_M)*cos(alpha_M)*compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9] // S22 Re
@@ -418,15 +412,15 void BP1_set( float * compressed_spec_ma
418 412 // vphi = n_cross_e_scal_b_re / bx_bx_star => sign(VPHI) = sign(n_cross_e_scal_b_re)
419 413 pt_uint8 = (uint8_t*) &n_cross_e_scal_b_re; // Affect an uint8_t pointer with the adress of n_cross_e_scal_b_re
420 414 #ifdef LSB_FIRST_TCH
421 lfr_bp1[i*NB_BYTES_BP1+2] = lfr_bp1[i*NB_BYTES_BP1+2] | (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
415 lfr_bp1[i*NB_BYTES_BP1+9] = lfr_bp1[i*NB_BYTES_BP1+9] | (pt_uint8[3] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 4th octet:PC convention)
422 416 // Record it at the 8th bit position (from the right to the left)
423 // of lfr_bp1[i*NB_BYTES_BP1+2]
417 // of lfr_bp1[i*NB_BYTES_BP1+9]
424 418 pt_uint8[3] = (pt_uint8[3] & 0x7f); // Make n_cross_e_scal_b_re be positive in any case: |n_cross_e_scal_b_re|
425 419 #endif
426 420 #ifdef MSB_FIRST_TCH
427 lfr_bp1[i*NB_BYTES_BP1+2] = lfr_bp1[i*NB_BYTES_BP1+2] | (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
421 lfr_bp1[i*NB_BYTES_BP1+9] = lfr_bp1[i*NB_BYTES_BP1+9] | (pt_uint8[0] & 0x80); // Extract its sign bit (32-bit float, sign bit in the 1th octet:SPARC convention)
428 422 // Record it at the 8th bit position (from the right to the left)
429 // of lfr_bp1[i*NB_BYTES_BP1+2]
423 // of lfr_bp1[i*NB_BYTES_BP1+9]
430 424 pt_uint8[0] = (pt_uint8[0] & 0x7f); // Make n_cross_e_scal_b_re be positive in any case: |n_cross_e_scal_b_re|
431 425 #endif
432 426 if (bx_bx_star != 0.) { // no division by 0.
@@ -436,11 +430,8 void BP1_set( float * compressed_spec_ma
436 430 {
437 431 vphi = 1.e+20; // Put a huge value
438 432 }
439 significand = frexpf(vphi/2, &exponent); // 0.5 <= significand < 1
440 // vphi/2 = significand * 2^exponent
441 // The division by 2 is to ensure that max value <= 2^30 (rough estimate)
442 // Should be reconsidered by taking into account the k-coefficients ...
443
433 significand = frexpf(vphi, &exponent); // 0.5 <= significand < 1
434 // vphi = significand * 2^exponent
444 435 if (exponent < expmin) { // value should be >= 0.5 * 2^expmin
445 436 exponent = expmin;
446 437 significand = 0.5; // min value that can be recorded
@@ -453,41 +444,39 void BP1_set( float * compressed_spec_ma
453 444 exponent = expmin;
454 445 significand = 0.5; // min value that can be recorded
455 446 }
447
448 lfr_bp1[i*NB_BYTES_BP1+10] = (uint8_t) ((significand*2-1)*255 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
449 // where all the bits are used (0, ..., 255)
450 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
451 // just the first nbitexp bits are used (0, ..., 2^nbitexp-1)
456 452 #ifdef DEBUG_TCH
457 printf("|VPHI| / 2 : %16.8e\n",vphi/2);
453 printf("|VPHI| : %16.8e\n",vphi);
458 454 printf("significand : %16.8e\n",significand);
459 455 printf("exponent : %d\n" ,exponent);
460 #endif
461 lfr_bp1[i*NB_BYTES_BP1+8] = (uint8_t) ((significand*2-1)*7 + 0.5); // Shift and cast into a 8-bit uint8_t with rounding
462 // where just the first 3 bits are used (0, ..., 7)
463 tmp_uint8 = (uint8_t) (exponent-expmin); // Shift and cast into a 8-bit uint8_t where
464 // just the first 5 bits are used (0, ..., 2^5-1)
465 #ifdef DEBUG_TCH
466 printf("lfr_bp1[i*NB_BYTES_BP1+8] for VPHI significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+8]);
467 456 printf("tmp_uint8 for VPHI exponent : %d\n",tmp_uint8);
468 457 #endif
469 lfr_bp1[i*NB_BYTES_BP1+8] = lfr_bp1[i*NB_BYTES_BP1+8] | (tmp_uint8 << 3); // shift these 5 bits to the left before logical addition
470 // with lfr_bp1[i*NB_BYTES_BP1+8]
458 lfr_bp1[i*NB_BYTES_BP1+9] = lfr_bp1[i*NB_BYTES_BP1+9] | tmp_uint8; // Record these nbitexp bits in the nbitexp first bits
459 // (from the right to the left) of lfr_bp1[i*NB_BYTES_BP1+9]
471 460 #ifdef DEBUG_TCH
472 printf("lfr_bp1[i*NB_BYTES_BP1+8] for VPHI exponent + significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+8]);
473 printf("lfr_bp1[i*NB_BYTES_BP1+2] for VPHI sign + PSDB 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+2]);
461 printf("lfr_bp1[i*NB_BYTES_BP1+9] for VPHI sign + VPHI exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+9]);
462 printf("lfr_bp1[i*NB_BYTES_BP1+10] for VPHI significand : %u\n",lfr_bp1[i*NB_BYTES_BP1+10]);
474 463 #endif
475 464 pt_uint8 = (uint8_t*) &n_cross_e_scal_b_im; // Affect an uint8_t pointer with the adress of n_cross_e_scal_b_im
476 465 #ifdef LSB_FIRST_TCH
477 pt_uint8[3] = pt_uint8[3] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX| (32-bit float, sign bit in the 4th octet:PC convention)
466 pt_uint8[3] = pt_uint8[3] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaNEBX| (32-bit float, sign bit in the 4th octet:PC convention)
478 467 #endif
479 468 #ifdef MSB_FIRST_TCH
480 pt_uint8[0] = pt_uint8[0] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaSX| (32-bit float, sign bit in the 1th octet:SPARC convention)
469 pt_uint8[0] = pt_uint8[0] & 0x7f; // Make n_cross_e_scal_b_im be positive in any case: |ImaNEBX| (32-bit float, sign bit in the 1th octet:SPARC convention)
481 470 #endif
482 tmp_uint8 = (n_cross_e_scal_b_im > n_cross_e_scal_b_re) ? 0x40 : 0x00; // Determine the sector argument of SX. If |Im| > |Re| affect
471 tmp_uint8 = (n_cross_e_scal_b_im > n_cross_e_scal_b_re) ? 0x40 : 0x00; // Determine the sector argument of NEBX. If |Im| > |Re| affect
483 472 // an unsigned 8-bit char with 01000000; otherwise with null.
484 lfr_bp1[i*NB_BYTES_BP1+2] = lfr_bp1[i*NB_BYTES_BP1+2] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
485 // to the left) of lfr_bp1[i*NB_BYTES_BP1+3], by simple logical addition.
473 lfr_bp1[i*NB_BYTES_BP1+9] = lfr_bp1[i*NB_BYTES_BP1+9] | tmp_uint8; // Record it as a sign bit at the 7th bit position (from the right
474 // to the left) of lfr_bp1[i*NB_BYTES_BP1+9], by simple logical addition.
486 475 #ifdef DEBUG_TCH
487 476 printf("|n_cross_e_scal_b_im| : %16.8e\n",n_cross_e_scal_b_im);
488 printf("|n_cross_e_scal_b_im|/bx_bx_star/2: %16.8e\n",n_cross_e_scal_b_im/bx_bx_star/2);
489 printf("ArgNEBX sign : %u\n",tmp_uint8);
490 printf("lfr_bp1[i*NB_BYTES_BP1+2] for VPHI & ArgNEBX signs + PSDB 'exponent' : %u\n",lfr_bp1[i*NB_BYTES_BP1+2]);
477 printf("|n_cross_e_scal_b_im|/bx_bx_star : %16.8e\n",n_cross_e_scal_b_im/bx_bx_star);
478 printf("ArgNEBX sign : %u\n",tmp_uint8);
479 printf("lfr_bp1[i*NB_BYTES_BP1+9] for VPHI & ArgNEBX signs + VPHI exponent : %u\n",lfr_bp1[i*NB_BYTES_BP1+9]);
491 480 #endif
492 481 }
493 482 }
@@ -519,12 +508,13 void BP2_set( float * compressed_spec_ma
519 508 nbitexp = 6; // number of bits for the exponent
520 509 nbitsig = 16 - nbitexp; // number of bits for the significand
521 510 rangesig = (1 << nbitsig)-1; // == 2^nbitsig - 1
522 expmax = 32;
511 expmax = 32 + 5;
523 512 expmin = expmax - (1 << nbitexp) + 1;
524 513
525 514 #ifdef DEBUG_TCH
526 printf("nbitexp : %d, nbitsig : %d, rangesig : %d\n", nbitexp, nbitsig, rangesig);
527 printf("expmin : %d, expmax : %d\n", expmin, expmax);
515
516 printf("nbitexp : %d, expmax : %d, expmin : %d\n", nbitexp, expmax, expmin);
517 printf("nbitsig : %d, rangesig : %d\n", nbitsig, rangesig);
528 518 #endif
529 519
530 520 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
@@ -769,9 +759,9 void BP2_set( float * compressed_spec_ma
769 759 printf("autocor for S11 significand : %u\n",autocor);
770 760 printf("exp for S11 exponent : %u\n",exp);
771 761 printf("pt_uint8[1] for S11 exponent + significand : %.3d or %2x\n",pt_uint8[1], pt_uint8[1]);
772 printf("pt_uint8[0] for S11 exponent + significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
762 printf("pt_uint8[0] for S11 significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
763 printf("lfr_bp2[i*NB_BYTES_BP2+0] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+0], lfr_bp2[i*NB_BYTES_BP2+0]);
773 764 printf("lfr_bp2[i*NB_BYTES_BP2+1] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+1], lfr_bp2[i*NB_BYTES_BP2+1]);
774 printf("lfr_bp2[i*NB_BYTES_BP2+0] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+0], lfr_bp2[i*NB_BYTES_BP2+0]);
775 765 #endif
776 766 // S22
777 767 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+9], &exponent); // 0.5 <= significand < 1
@@ -814,9 +804,9 void BP2_set( float * compressed_spec_ma
814 804 printf("autocor for S22 significand : %u\n",autocor);
815 805 printf("exp for S11 exponent : %u\n",exp);
816 806 printf("pt_uint8[1] for S22 exponent + significand : %.3d or %2x\n",pt_uint8[1], pt_uint8[1]);
817 printf("pt_uint8[0] for S22 exponent + significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
807 printf("pt_uint8[0] for S22 significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
808 printf("lfr_bp2[i*NB_BYTES_BP2+2] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+2], lfr_bp2[i*NB_BYTES_BP2+2]);
818 809 printf("lfr_bp2[i*NB_BYTES_BP2+3] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+3], lfr_bp2[i*NB_BYTES_BP2+3]);
819 printf("lfr_bp2[i*NB_BYTES_BP2+2] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+2], lfr_bp2[i*NB_BYTES_BP2+2]);
820 810 #endif
821 811 // S33
822 812 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+16], &exponent); // 0.5 <= significand < 1
@@ -859,9 +849,9 void BP2_set( float * compressed_spec_ma
859 849 printf("autocor for S33 significand : %u\n",autocor);
860 850 printf("exp for S33 exponent : %u\n",exp);
861 851 printf("pt_uint8[1] for S33 exponent + significand : %.3d or %2x\n",pt_uint8[1], pt_uint8[1]);
862 printf("pt_uint8[0] for S33 exponent + significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
852 printf("pt_uint8[0] for S33 significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
853 printf("lfr_bp2[i*NB_BYTES_BP2+4] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+4], lfr_bp2[i*NB_BYTES_BP2+4]);
863 854 printf("lfr_bp2[i*NB_BYTES_BP2+5] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+5], lfr_bp2[i*NB_BYTES_BP2+5]);
864 printf("lfr_bp2[i*NB_BYTES_BP2+4] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+4], lfr_bp2[i*NB_BYTES_BP2+4]);
865 855 #endif
866 856 // S44
867 857 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+21], &exponent); // 0.5 <= significand < 1
@@ -905,9 +895,9 void BP2_set( float * compressed_spec_ma
905 895 printf("autocor for S44 significand : %u\n",autocor);
906 896 printf("exp for S44 exponent : %u\n",exp);
907 897 printf("pt_uint8[1] for S44 exponent + significand : %.3d or %2x\n",pt_uint8[1], pt_uint8[1]);
908 printf("pt_uint8[0] for S44 exponent + significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
898 printf("pt_uint8[0] for S44 significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
899 printf("lfr_bp2[i*NB_BYTES_BP2+6] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+6], lfr_bp2[i*NB_BYTES_BP2+6]);
909 900 printf("lfr_bp2[i*NB_BYTES_BP2+7] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+7], lfr_bp2[i*NB_BYTES_BP2+7]);
910 printf("lfr_bp2[i*NB_BYTES_BP2+6] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+6], lfr_bp2[i*NB_BYTES_BP2+6]);
911 901 #endif
912 902 // S55
913 903 significand = frexpf(compressed_spec_mat[i*NB_VALUES_PER_SPECTRAL_MATRIX+24], &exponent); // 0.5 <= significand < 1
@@ -952,9 +942,9 void BP2_set( float * compressed_spec_ma
952 942 printf("autocor for S55 significand : %u\n",autocor);
953 943 printf("exp for S55 exponent : %u\n",exp);
954 944 printf("pt_uint8[1] for S55 exponent + significand : %.3d or %2x\n",pt_uint8[1], pt_uint8[1]);
955 printf("pt_uint8[0] for S55 exponent + significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
945 printf("pt_uint8[0] for S55 significand : %.3d or %2x\n",pt_uint8[0], pt_uint8[0]);
946 printf("lfr_bp2[i*NB_BYTES_BP2+8] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+8], lfr_bp2[i*NB_BYTES_BP2+8]);
956 947 printf("lfr_bp2[i*NB_BYTES_BP2+9] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+9], lfr_bp2[i*NB_BYTES_BP2+9]);
957 printf("lfr_bp2[i*NB_BYTES_BP2+8] : %3u or %2x\n",lfr_bp2[i*NB_BYTES_BP2+8], lfr_bp2[i*NB_BYTES_BP2+8]);
958 948 #endif
959 949 }
960 950 }
@@ -1,16 +1,18
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.4: 16/05/2014
3 3 // version 1.5: 20/05/2014
4 4 // version 1.6: 19/12/2014
5 5 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
6
6 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
7 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
8 // version 2.0: 19/06/2015
7 9
8 10 #ifndef BASIC_PARAMETERS_PARAMS_H
9 11 #define BASIC_PARAMETERS_PARAMS_H
10 12
11 13 #define NB_VALUES_PER_SPECTRAL_MATRIX 25
12 14
13 #define NB_BYTES_BP1 9
15 #define NB_BYTES_BP1 11
14 16 #define NB_BYTES_BP2 30
15 17
16 18 //********************************************
@@ -1,7 +1,9
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.6: 19/12/2014
3 3 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
4
4 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
5 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
6 // version 2.0: 19/06/2015
5 7
6 8 #ifndef BASIC_PARAMETERS_UTILITIES_H
7 9 #define BASIC_PARAMETERS_UTILITIES_H
@@ -11,7 +13,7
11 13
12 14 #include "basic_parameters_params.h"
13 15
14 #define NB_BINS_COMPRESSED_MATRIX_f0 1
16 #define NB_BINS_COMPRESSED_MATRIX_f0 11
15 17 #define NB_BINS_COMPRESSED_MATRIX_f1 13
16 18 #define NB_BINS_COMPRESSED_MATRIX_f2 12
17 19
@@ -1,4 +1,4
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.0: 31/07/2013
3 3 // version 1.1: 02/04/2014
4 4 // version 1.2: 30/04/2014
@@ -7,7 +7,9
7 7 // version 1.5: 20/05/2014
8 8 // version 1.6: 19/12/2014
9 9 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
10
10 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
11 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
12 // version 2.0: 19/06/2015
11 13
12 14 #include "basic_parameters_utilities.h"
13 15
@@ -31,7 +33,7 int lecture_file_sm(const char *fileName
31 33
32 34 for(i=0; i<NB_BINS_COMPRESSED_MATRIX_f0; i++){
33 35
34 printf("Bin number: %d\n", i);
36 printf("\nBin number: %d\n", i);
35 37
36 38 printf("Element %.2d (S11) (%.2d & --) => Re:%16.8e Im:%16.8e\n", 1, 0,
37 39 compressed_spectral_matrix_f0[i*NB_VALUES_PER_SPECTRAL_MATRIX+0], 0.);
@@ -1,4 +1,4
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.0: 31/07/2013
3 3 // version 1.1: 02/04/2014
4 4 // version 1.2: 30/04/2014
@@ -7,7 +7,9
7 7 // version 1.5: 20/05/2014
8 8 // version 1.6: 19/12/2014
9 9 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
10
10 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
11 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
12 // version 2.0: 19/06/2015
11 13
12 14 #ifndef FILE_UTILITIES_H
13 15 #define FILE_UTILITIES_H
@@ -1,4 +1,4
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013)
1 // In the frame of RPW LFR Sofware ICD Issue1 Rev8 (05/07/2013) => R2 FSW
2 2 // version 1.O: 31/07/2013
3 3 // version 1.1: 02/04/2014
4 4 // version 1.2: 30/04/2014
@@ -7,7 +7,9
7 7 // version 1.5: 20/05/2014
8 8 // version 1.6: 19/12/2014
9 9 // version 1.7: 15/01/2015 (modifs de Paul + correction erreurs qui se compensaient (LSB <=> MSB + indices [0,2] <=> [1,3])
10
10 // version 1.8: 02/02/2015 (gestion des divisions par zéro)
11 // In the frame of RPW LFR Sofware ICD Issue3 Rev6 (27/01/2015) => R3 FSW
12 // version 2.0: 19/06/2015
11 13
12 14 #include <stdio.h>
13 15
@@ -30,14 +32,16 int main(void)
30 32 printf("The multi-byte quantities are laid out in a MSB FIRST (big endian) fashion\n\n");
31 33 #endif
32 34
33 filename="/WIN/Users/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests2/sm_test2.dat";
35 filename="/WIN/Users/chust/DD CHUST/Missions/Solar Orbiter/LFR/Prog C/tests bp Paul/tests7/sm_test2_R3.dat";
34 36 lecture_file_sm(filename);
35 37
38 printf("\n");
39
36 40 init_k_coefficients(k_coefficients_f0, NB_BINS_COMPRESSED_MATRIX_f0);
37 41 init_k_coefficients(k_coefficients_f1, NB_BINS_COMPRESSED_MATRIX_f1);
38 42 init_k_coefficients(k_coefficients_f2, NB_BINS_COMPRESSED_MATRIX_f2);
39 43
40 printf("\n");
44 printf("\n\n");
41 45
42 46 BP1_set(compressed_spectral_matrix_f0, k_coefficients_f0, NB_BINS_COMPRESSED_MATRIX_f0, LFR_BP1_f0);
43 47
General Comments 0
You need to be logged in to leave comments. Login now