@@ -94,7 +94,7 unsigned int check_update_info_hk_thr_mo | |||||
94 | void set_hk_lfr_sc_rw_f_flag( unsigned char wheel, unsigned char freq, float value ); |
|
94 | void set_hk_lfr_sc_rw_f_flag( unsigned char wheel, unsigned char freq, float value ); | |
95 | void set_hk_lfr_sc_rw_f_flags( void ); |
|
95 | void set_hk_lfr_sc_rw_f_flags( void ); | |
96 | void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC ); |
|
96 | void getReactionWheelsFrequencies( ccsdsTelecommandPacket_t *TC ); | |
97 |
void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, float k |
|
97 | void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, float sy_lfr_rw_k ); | |
98 | void build_sy_lfr_rw_mask( unsigned int channel ); |
|
98 | void build_sy_lfr_rw_mask( unsigned int channel ); | |
99 | void build_sy_lfr_rw_masks(); |
|
99 | void build_sy_lfr_rw_masks(); | |
100 | void merge_fbins_masks( void ); |
|
100 | void merge_fbins_masks( void ); |
@@ -1080,7 +1080,7 void getReactionWheelsFrequencies( ccsds | |||||
1080 |
|
1080 | |||
1081 | } |
|
1081 | } | |
1082 |
|
1082 | |||
1083 |
void setFBinMask(unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, float k |
|
1083 | void setFBinMask( unsigned char *fbins_mask, float rw_f, unsigned char deltaFreq, float sy_lfr_rw_k ) | |
1084 | { |
|
1084 | { | |
1085 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
1085 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. | |
1086 | * |
|
1086 | * | |
@@ -1100,6 +1100,7 void setFBinMask(unsigned char *fbins_ma | |||||
1100 | float fi; |
|
1100 | float fi; | |
1101 | float deltaBelow; |
|
1101 | float deltaBelow; | |
1102 | float deltaAbove; |
|
1102 | float deltaAbove; | |
|
1103 | float freqToFilterOut; | |||
1103 | int binBelow; |
|
1104 | int binBelow; | |
1104 | int binAbove; |
|
1105 | int binAbove; | |
1105 | int closestBin; |
|
1106 | int closestBin; | |
@@ -1107,31 +1108,35 void setFBinMask(unsigned char *fbins_ma | |||||
1107 | int selectedByte; |
|
1108 | int selectedByte; | |
1108 | int bin; |
|
1109 | int bin; | |
1109 | int binToRemove[NB_BINS_TO_REMOVE]; |
|
1110 | int binToRemove[NB_BINS_TO_REMOVE]; | |
1110 |
int |
|
1111 | int k; | |
|
1112 | bool filteringSet; | |||
1111 |
|
1113 | |||
1112 | closestBin = 0; |
|
1114 | closestBin = 0; | |
1113 | whichByte = 0; |
|
1115 | whichByte = 0; | |
1114 | bin = 0; |
|
1116 | bin = 0; | |
|
1117 | filteringSet = false; | |||
1115 |
|
1118 | |||
1116 |
for ( |
|
1119 | for (k = 0; k < NB_BINS_TO_REMOVE; k++) | |
1117 | { |
|
1120 | { | |
1118 |
binToRemove[ |
|
1121 | binToRemove[k] = -1; | |
1119 | } |
|
1122 | } | |
1120 |
|
1123 | |||
1121 | if (!isnan(rw_f)) |
|
1124 | if (!isnan(rw_f)) | |
1122 | { |
|
1125 | { | |
|
1126 | // compute the frequency range to filter [ rw_f - delta_f; rw_f + delta_f ] | |||
|
1127 | f_RW_min = rw_f - ((filterPar.sy_lfr_sc_rw_delta_f) * sy_lfr_rw_k); | |||
|
1128 | f_RW_MAX = rw_f + ((filterPar.sy_lfr_sc_rw_delta_f) * sy_lfr_rw_k); | |||
1123 |
|
1129 | |||
1124 | // compute the frequency range to filter [ rw_f - delta_f/2; rw_f + delta_f/2 ] |
|
1130 | freqToFilterOut = f_RW_min; | |
1125 | f_RW_min = rw_f - ( (filterPar.sy_lfr_sc_rw_delta_f * kcoeff) / DELTAF_DIV); |
|
1131 | while ( filteringSet == false ) | |
1126 | f_RW_MAX = rw_f + ( (filterPar.sy_lfr_sc_rw_delta_f * kcoeff) / DELTAF_DIV); |
|
1132 | { | |
1127 |
|
||||
1128 | // compute the index of the frequency bin immediately below rw_f |
|
1133 | // compute the index of the frequency bin immediately below rw_f | |
1129 |
binBelow = (int) ( floor( ((double) |
|
1134 | binBelow = (int) ( floor( ((double) freqToFilterOut) / ((double) deltaFreq)) ); | |
1130 |
deltaBelow = |
|
1135 | deltaBelow = freqToFilterOut - binBelow * deltaFreq; | |
1131 |
|
1136 | |||
1132 | // compute the index of the frequency bin immediately above rw_f |
|
1137 | // compute the index of the frequency bin immediately above rw_f | |
1133 |
binAbove = (int) ( ceil( ((double) |
|
1138 | binAbove = (int) ( ceil( ((double) freqToFilterOut) / ((double) deltaFreq)) ); | |
1134 |
deltaAbove = binAbove * deltaFreq - |
|
1139 | deltaAbove = binAbove * deltaFreq - freqToFilterOut; | |
1135 |
|
1140 | |||
1136 | // search the closest bin |
|
1141 | // search the closest bin | |
1137 | if (deltaAbove > deltaBelow) |
|
1142 | if (deltaAbove > deltaBelow) | |
@@ -1153,9 +1158,9 void setFBinMask(unsigned char *fbins_ma | |||||
1153 | // thus, the index 0 in a mask corresponds to the bin 1 of the spectrum |
|
1158 | // thus, the index 0 in a mask corresponds to the bin 1 of the spectrum | |
1154 | //************************************************************************************** |
|
1159 | //************************************************************************************** | |
1155 |
|
1160 | |||
1156 |
// 1. IF |
|
1161 | // 1. IF freqToFilterOut is included in [ fi_min; fi_MAX ] | |
1157 | // => remove f_(i), f_(i-1) and f_(i+1) |
|
1162 | // => remove f_(i), f_(i-1) and f_(i+1) | |
1158 |
if ( ( f |
|
1163 | if ( ( freqToFilterOut > fi_min ) && ( freqToFilterOut < fi_MAX ) ) | |
1159 | { |
|
1164 | { | |
1160 | binToRemove[0] = (closestBin - 1) - 1; |
|
1165 | binToRemove[0] = (closestBin - 1) - 1; | |
1161 | binToRemove[1] = (closestBin) - 1; |
|
1166 | binToRemove[1] = (closestBin) - 1; | |
@@ -1170,16 +1175,32 void setFBinMask(unsigned char *fbins_ma | |||||
1170 | binToRemove[2] = (-1); |
|
1175 | binToRemove[2] = (-1); | |
1171 | } |
|
1176 | } | |
1172 |
|
1177 | |||
1173 |
for ( |
|
1178 | for (k = 0; k < NB_BINS_TO_REMOVE; k++) | |
1174 | { |
|
1179 | { | |
1175 |
bin = binToRemove[ |
|
1180 | bin = binToRemove[k]; | |
1176 | if ( (bin >= BIN_MIN) && (bin <= BIN_MAX) ) |
|
1181 | if ( (bin >= BIN_MIN) && (bin <= BIN_MAX) ) | |
1177 | { |
|
1182 | { | |
1178 |
|
||||
1179 | whichByte = (bin >> SHIFT_3_BITS); // division by 8 |
|
1183 | whichByte = (bin >> SHIFT_3_BITS); // division by 8 | |
1180 | selectedByte = ( 1 << (bin - (whichByte * BITS_PER_BYTE)) ); |
|
1184 | selectedByte = ( 1 << (bin - (whichByte * BITS_PER_BYTE)) ); | |
1181 | fbins_mask[BYTES_PER_MASK - 1 - whichByte] = |
|
1185 | fbins_mask[BYTES_PER_MASK - 1 - whichByte] = | |
1182 | fbins_mask[BYTES_PER_MASK - 1 - whichByte] & ((unsigned char) (~selectedByte)); // bytes are ordered MSB first in the packets |
|
1186 | fbins_mask[BYTES_PER_MASK - 1 - whichByte] & ((unsigned char) (~selectedByte)); // bytes are ordered MSB first in the packets | |
|
1187 | ||||
|
1188 | } | |||
|
1189 | } | |||
|
1190 | ||||
|
1191 | // update freqToFilterOut | |||
|
1192 | if ( freqToFilterOut == f_RW_MAX ) | |||
|
1193 | { | |||
|
1194 | filteringSet = true; // end of the loop | |||
|
1195 | } | |||
|
1196 | else | |||
|
1197 | { | |||
|
1198 | freqToFilterOut = freqToFilterOut + deltaFreq; | |||
|
1199 | } | |||
|
1200 | ||||
|
1201 | if ( freqToFilterOut > f_RW_MAX) | |||
|
1202 | { | |||
|
1203 | freqToFilterOut = f_RW_MAX; | |||
1183 | } |
|
1204 | } | |
1184 | } |
|
1205 | } | |
1185 | } |
|
1206 | } |
General Comments 0
You need to be logged in to leave comments.
Login now