##// END OF EJS Templates
modulus, tbad, offset, shift are stored in finetime (uint64_t)...
paul -
r355:c502a62ca98f R3++ draft
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 26659466eb11170e587645c796142ac8a7fd0add header/lfr_common_headers
2 e904b329ff977514bf36af92617afefd22fd06ab header/lfr_common_headers
@@ -188,11 +188,13 rtems_task Init( rtems_task_argument ign
188
188
189 // initialize filtering parameters
189 // initialize filtering parameters
190 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
190 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
191 filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS;
191 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
192 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
192 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
193 filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET;
194 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
193 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
195 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
194 filterPar.modulus_in_finetime = DEFAULT_MODULUS;
195 filterPar.tbad_in_finetime = DEFAULT_TBAD;
196 filterPar.offset_in_finetime = DEFAULT_OFFSET;
197 filterPar.shift_in_finetime = DEFAULT_SHIFT;
196 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
198 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
197
199
198 // waveform picker initialization
200 // waveform picker initialization
@@ -753,17 +753,13 unsigned char acquisitionTimeIsValid( un
753 unsigned char pasFilteringIsEnabled;
753 unsigned char pasFilteringIsEnabled;
754 unsigned char ret;
754 unsigned char ret;
755
755
756 pasFilteringIsEnabled = (filterPar.spare_sy_lfr_pas_filter_enabled & 1); // [0000 0001]
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;
764
765 // compute acquisition time from caoarseTime and fineTime
756 // compute acquisition time from caoarseTime and fineTime
766 t0 = ( ((u_int64_t)coarseTime) << SHIFT_2_BYTES ) + (u_int64_t) fineTime;
757 t0 = ( ((u_int64_t)coarseTime) << SHIFT_2_BYTES ) + (u_int64_t) fineTime;
758 t1 = t0;
759 tc = t0;
760 tbad0 = t0;
761 tbad1 = t0;
762
767 switch(channel)
763 switch(channel)
768 {
764 {
769 case CHANNELF0:
765 case CHANNELF0:
@@ -778,36 +774,50 unsigned char acquisitionTimeIsValid( un
778 t1 = t0 + ACQUISITION_DURATION_F2;
774 t1 = t0 + ACQUISITION_DURATION_F2;
779 tc = t0 + HALF_ACQUISITION_DURATION_F2;
775 tc = t0 + HALF_ACQUISITION_DURATION_F2;
780 break;
776 break;
777 default:
778 break;
781 }
779 }
782
780
783 // INTERSECTION TEST #1
781 // compute the acquitionTime range
784 timecodeReference = (tc - (tc % modulusInFineTime)) - modulusInFineTime ;
782 modulusInFineTime = filterPar.modulus_in_finetime;
785 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
783 offsetInFineTime = filterPar.offset_in_finetime;
786 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
784 shiftInFineTime = filterPar.shift_in_finetime;
787 ret = isPolluted( t0, t1, tbad0, tbad1 );
785 tbadInFineTime = filterPar.tbad_in_finetime;
786 timecodeReference = INIT_INT;
788
787
789 // INTERSECTION TEST #2
788 pasFilteringIsEnabled = (filterPar.spare_sy_lfr_pas_filter_enabled & 1); // [0000 0001]
790 timecodeReference = (tc - (tc % modulusInFineTime)) ;
789 ret = MATRIX_IS_NOT_POLLUTED;
791 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
792 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
793 if (ret == MATRIX_IS_NOT_POLLUTED)
794 {
795 ret = isPolluted( t0, t1, tbad0, tbad1 );
796 }
797
790
798 // INTERSECTION TEST #3
791 if ( (tbadInFineTime == 0) || (pasFilteringIsEnabled == 0) )
799 timecodeReference = (tc - (tc % modulusInFineTime)) + modulusInFineTime ;
800 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
801 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
802 if (ret == MATRIX_IS_NOT_POLLUTED)
803 {
804 ret = isPolluted( t0, t1, tbad0, tbad1 );
805 }
806
807 if (pasFilteringIsEnabled == 0)
808 {
792 {
809 ret = MATRIX_IS_NOT_POLLUTED;
793 ret = MATRIX_IS_NOT_POLLUTED;
810 }
794 }
795 else
796 {
797 // INTERSECTION TEST #1
798 timecodeReference = (tc - (tc % modulusInFineTime)) - modulusInFineTime ;
799 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
800 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
801 ret = isPolluted( t0, t1, tbad0, tbad1 );
802
803 // INTERSECTION TEST #2
804 if (ret == MATRIX_IS_NOT_POLLUTED)
805 {
806 timecodeReference = (tc - (tc % modulusInFineTime)) ;
807 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
808 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
809 ret = isPolluted( t0, t1, tbad0, tbad1 );
810 }
811
812 // INTERSECTION TEST #3
813 if (ret == MATRIX_IS_NOT_POLLUTED)
814 {
815 timecodeReference = (tc - (tc % modulusInFineTime)) + modulusInFineTime ;
816 tbad0 = timecodeReference + offsetInFineTime + shiftInFineTime;
817 tbad1 = timecodeReference + offsetInFineTime + shiftInFineTime + tbadInFineTime;
818 ret = isPolluted( t0, t1, tbad0, tbad1 );
819 }
820 }
811
821
812 return ret;
822 return ret;
813 }
823 }
@@ -351,19 +351,26 int action_load_filter_par(ccsdsTelecomm
351
351
352 //****************************
352 //****************************
353 // store PAS filter parameters
353 // store PAS filter parameters
354
354 // sy_lfr_pas_filter_enabled
355 // sy_lfr_pas_filter_enabled
355 filterPar.spare_sy_lfr_pas_filter_enabled = parameter_dump_packet.spare_sy_lfr_pas_filter_enabled;
356 filterPar.spare_sy_lfr_pas_filter_enabled = parameter_dump_packet.spare_sy_lfr_pas_filter_enabled;
356 set_sy_lfr_pas_filter_enabled( parameter_dump_packet.spare_sy_lfr_pas_filter_enabled & BIT_PAS_FILTER_ENABLED );
357 set_sy_lfr_pas_filter_enabled( parameter_dump_packet.spare_sy_lfr_pas_filter_enabled & BIT_PAS_FILTER_ENABLED );
358
357 // sy_lfr_pas_filter_modulus
359 // sy_lfr_pas_filter_modulus
358 filterPar.sy_lfr_pas_filter_modulus = parameter_dump_packet.sy_lfr_pas_filter_modulus;
360 filterPar.modulus_in_finetime = ((uint64_t) parameter_dump_packet.sy_lfr_pas_filter_modulus) * CONST_65536;
361
359 // sy_lfr_pas_filter_tbad
362 // sy_lfr_pas_filter_tbad
360 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_tbad,
363 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_tbad,
361 parameter_dump_packet.sy_lfr_pas_filter_tbad );
364 parameter_dump_packet.sy_lfr_pas_filter_tbad );
365 filterPar.tbad_in_finetime = (uint64_t) (filterPar.sy_lfr_pas_filter_tbad * CONST_65536);
366
362 // sy_lfr_pas_filter_offset
367 // sy_lfr_pas_filter_offset
363 filterPar.sy_lfr_pas_filter_offset = parameter_dump_packet.sy_lfr_pas_filter_offset;
368 filterPar.offset_in_finetime = ((uint64_t) parameter_dump_packet.sy_lfr_pas_filter_offset) * CONST_65536;
369
364 // sy_lfr_pas_filter_shift
370 // sy_lfr_pas_filter_shift
365 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_shift,
371 copyFloatByChar( (unsigned char*) &filterPar.sy_lfr_pas_filter_shift,
366 parameter_dump_packet.sy_lfr_pas_filter_shift );
372 parameter_dump_packet.sy_lfr_pas_filter_shift );
373 filterPar.shift_in_finetime = (uint64_t) (filterPar.sy_lfr_pas_filter_shift * CONST_65536);
367
374
368 //****************************************************
375 //****************************************************
369 // store the parameter sy_lfr_sc_rw_delta_f as a float
376 // store the parameter sy_lfr_sc_rw_delta_f as a float
General Comments 0
You need to be logged in to leave comments. Login now