##// END OF EJS Templates
3.2.0.5...
paul -
r354:6155c628c251 R3++ draft
parent child
Show More
@@ -1,2 +1,2
1 1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 5dfc0745a617f0b14b9b4c6d6c12d01f1fb9a801 header/lfr_common_headers
2 26659466eb11170e587645c796142ac8a7fd0add header/lfr_common_headers
@@ -176,6 +176,8 static inline void ASM_compress_reorgani
176 176
177 177 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
178 178
179 unsigned char isPolluted( u_int64_t t0, u_int64_t t1, u_int64_t tbad0, u_int64_t tbad1 );
180
179 181 unsigned char acquisitionTimeIsValid(unsigned int coarseTime, unsigned int fineTime, unsigned char channel);
180 182
181 183 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
@@ -208,7 +210,7 void SM_average( float *averaged_spec_ma
208 210 sum = INIT_FLOAT;
209 211 for ( k = 0; k < NB_SM_BEFORE_AVF0_F1; k++ )
210 212 {
211 if (incomingSMIsValid[k] == 1)
213 if (incomingSMIsValid[k] == MATRIX_IS_NOT_POLLUTED)
212 214 {
213 215 sum = sum + ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] ;
214 216 }
@@ -64,7 +64,7 option(FSW_debug_tch "?" OFF)
64 64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "3" CACHE STRING "Choose N4 FSW Version." FORCE)
67 set(SW_VERSION_N4 "5" CACHE STRING "Choose N4 FSW Version." FORCE)
68 68
69 69 if(FSW_verbose)
70 70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
@@ -94,5 +94,3 rw_f_t rw_f;
94 94 filterPar_t filterPar = {0};
95 95
96 96 fbins_masks_t fbins_masks = {0};
97 unsigned int acquisitionDurations[NB_ACQUISITION_DURATION]
98 = {ACQUISITION_DURATION_F0, ACQUISITION_DURATION_F1, ACQUISITION_DURATION_F2};
@@ -278,7 +278,7 void SM_average_f2( float *averaged_spec
278 278 sum = ( (int *) (ring_node->buffer_address) ) [ i ];
279 279 if ( (nbAverageNormF2 == 0) ) // average initialization
280 280 {
281 if (keepMatrix == 1) // keep the matrix and add it to the average
281 if (keepMatrix == MATRIX_IS_NOT_POLLUTED) // keep the matrix and add it to the average
282 282 {
283 283 averaged_spec_mat_f2[ i ] = sum;
284 284 }
@@ -291,7 +291,7 void SM_average_f2( float *averaged_spec
291 291 }
292 292 else
293 293 {
294 if (keepMatrix == 1) // keep the matrix and add it to the average
294 if (keepMatrix == MATRIX_IS_NOT_POLLUTED) // keep the matrix and add it to the average
295 295 {
296 296 averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum );
297 297 }
@@ -718,82 +718,95 int getFBinMask( int index, unsigned cha
718 718 return fbin;
719 719 }
720 720
721 unsigned char isPolluted( u_int64_t t0, u_int64_t t1, u_int64_t tbad0, u_int64_t tbad1 )
722 {
723 unsigned char polluted;
724
725 polluted = MATRIX_IS_NOT_POLLUTED;
726
727 if ( ((tbad0 < t0) && (t0 < tbad1)) // t0 is inside the polluted range
728 || ((tbad0 < t1) && (t1 < tbad1)) // t1 is inside the polluted range
729 || ((t0 < tbad0) && (tbad1 < t1)) // the polluted range is inside the signal range
730 || ((tbad0 < t0) && (t1 < tbad1))) // the signal range is inside the polluted range
731 {
732 polluted = MATRIX_IS_POLLUTED;
733 }
734
735 return polluted;
736 }
737
721 738 unsigned char acquisitionTimeIsValid( unsigned int coarseTime, unsigned int fineTime, unsigned char channel)
722 739 {
723 u_int64_t acquisitionTStart;
724 u_int64_t acquisitionTStop;
725 u_int64_t timecodeReference;
740 u_int64_t t0;
741 u_int64_t t1;
742 u_int64_t tc;
743 u_int64_t tbad0;
744 u_int64_t tbad1;
745
746 u_int64_t modulusInFineTime;
726 747 u_int64_t offsetInFineTime;
727 748 u_int64_t shiftInFineTime;
728 u_int64_t tBadInFineTime;
729 u_int64_t perturbationTStart;
730 u_int64_t perturbationTStop;
749 u_int64_t tbadInFineTime;
750
751 u_int64_t timecodeReference;
752
731 753 unsigned char pasFilteringIsEnabled;
732 754 unsigned char ret;
733 755
734 756 pasFilteringIsEnabled = (filterPar.spare_sy_lfr_pas_filter_enabled & 1); // [0000 0001]
735 ret = 1;
757 ret = MATRIX_IS_NOT_POLLUTED;
758
759 // compute the acquitionTime range
760 modulusInFineTime = ((u_int64_t) filterPar.sy_lfr_pas_filter_modulus) * CONST_65536;
761 offsetInFineTime = ((u_int64_t) filterPar.sy_lfr_pas_filter_offset) * CONST_65536;
762 shiftInFineTime = ((u_int64_t) filterPar.sy_lfr_pas_filter_shift) * CONST_65536;
763 tbadInFineTime = ((u_int64_t) filterPar.sy_lfr_pas_filter_tbad) * CONST_65536;
736 764
737 765 // compute acquisition time from caoarseTime and fineTime
738 acquisitionTStart = ( ((u_int64_t)coarseTime) << SHIFT_2_BYTES )
739 + (u_int64_t) fineTime;
766 t0 = ( ((u_int64_t)coarseTime) << SHIFT_2_BYTES ) + (u_int64_t) fineTime;
740 767 switch(channel)
741 768 {
742 769 case CHANNELF0:
743 acquisitionTStop = acquisitionTStart + ACQUISITION_DURATION_F0;
770 t1 = t0 + ACQUISITION_DURATION_F0;
771 tc = t0 + HALF_ACQUISITION_DURATION_F0;
744 772 break;
745 773 case CHANNELF1:
746 acquisitionTStop = acquisitionTStart + ACQUISITION_DURATION_F1;
774 t1 = t0 + ACQUISITION_DURATION_F1;
775 tc = t0 + HALF_ACQUISITION_DURATION_F1;
747 776 break;
748 777 case CHANNELF2:
749 acquisitionTStop = acquisitionTStart + ACQUISITION_DURATION_F2;
778 t1 = t0 + ACQUISITION_DURATION_F2;
779 tc = t0 + HALF_ACQUISITION_DURATION_F2;
750 780 break;
751 781 }
752 782
753 // compute the timecode reference
754 timecodeReference = (u_int64_t) ( (floor( ((double) coarseTime) / ((double) filterPar.sy_lfr_pas_filter_modulus) )
755 * ((double) filterPar.sy_lfr_pas_filter_modulus)) * CONST_65536 );
756
757 // compute the acquitionTime range
758 offsetInFineTime = ((double) filterPar.sy_lfr_pas_filter_offset) * CONST_65536;
759 shiftInFineTime = ((double) filterPar.sy_lfr_pas_filter_shift) * CONST_65536;
760 tBadInFineTime = ((double) filterPar.sy_lfr_pas_filter_tbad) * CONST_65536;
761
762 perturbationTStart =
763 timecodeReference
764 + offsetInFineTime
765 + shiftInFineTime;
783 // INTERSECTION TEST #1
784 timecodeReference = (tc - (tc % modulusInFineTime)) - modulusInFineTime ;
785 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
786 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
787 ret = isPolluted( t0, t1, tbad0, tbad1 );
766 788
767 perturbationTStop =
768 timecodeReference
769 + offsetInFineTime
770 + shiftInFineTime
771 + tBadInFineTime;
772
773 if ( (acquisitionTStart >= perturbationTStart)
774 && (acquisitionTStart <= perturbationTStop)
775 && (pasFilteringIsEnabled == 1) )
789 // INTERSECTION TEST #2
790 timecodeReference = (tc - (tc % modulusInFineTime)) ;
791 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
792 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
793 if (ret == MATRIX_IS_NOT_POLLUTED)
776 794 {
777 ret = 0; // the acquisition time is INSIDE the range, the matrix shall be ignored
778 }
779 else
780 {
781 ret = 1; // the acquisition time is OUTSIDE the range, the matrix can be used for the averaging
795 ret = isPolluted( t0, t1, tbad0, tbad1 );
782 796 }
783 797
784 // the last sample of the data used to compute the matrix shall not be INSIDE the range, test it now, it depends on the channel
785 if (ret == 1)
798 // INTERSECTION TEST #3
799 timecodeReference = (tc - (tc % modulusInFineTime)) + modulusInFineTime ;
800 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
801 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
802 if (ret == MATRIX_IS_NOT_POLLUTED)
786 803 {
787 if ( (acquisitionTStop >= perturbationTStart)
788 && (acquisitionTStop <= perturbationTStop)
789 && (pasFilteringIsEnabled == 1) )
790 {
791 ret = 0; // the acquisition time is INSIDE the range, the matrix shall be ignored
792 }
793 else
794 {
795 ret = 1; // the acquisition time is OUTSIDE the range, the matrix can be used for the averaging
796 }
804 ret = isPolluted( t0, t1, tbad0, tbad1 );
805 }
806
807 if (pasFilteringIsEnabled == 0)
808 {
809 ret = MATRIX_IS_NOT_POLLUTED;
797 810 }
798 811
799 812 return ret;
General Comments 0
You need to be logged in to leave comments. Login now