removed redundant loop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Marius Eggert 2022-09-23 14:37:48 +02:00
parent 46ec376e4d
commit cd11e08193

View File

@ -218,47 +218,26 @@ void SunSensor::Calibration(uint8_t Sensornumber) {
beta_m < ((CompleteCellWidth * (l / 3)) - HalfCellWidth))) {
index = (3 * (k - 1) + l) - 1; // calculate the index of the datapoint for the right cell
// -> first cell has number 0
alpha_calibrated =
AlphaBetaCalibrated[Sensornumber][0] =
CoeffAlpha[Sensornumber][index][0] + CoeffAlpha[Sensornumber][index][1] * alpha_m + CoeffAlpha[Sensornumber][index][2] * beta_m +
CoeffAlpha[Sensornumber][index][3] * alpha_m * alpha_m + CoeffAlpha[Sensornumber][index][4] * alpha_m * beta_m +
CoeffAlpha[Sensornumber][index][5] * beta_m * beta_m +
CoeffAlpha[Sensornumber][index][6] * alpha_m * alpha_m * alpha_m +
CoeffAlpha[Sensornumber][index][7] * alpha_m * alpha_m * beta_m +
CoeffAlpha[Sensornumber][index][8] * alpha_m * beta_m * beta_m +
CoeffAlpha[Sensornumber][index][9] * beta_m * beta_m * beta_m;
CoeffAlpha[Sensornumber][index][9] * beta_m * beta_m * beta_m; //[°]
AlphaBetaCalibrated[Sensornumber][1] =
CoeffBeta[Sensornumber][index][0] + CoeffBeta[Sensornumber][index][1] * alpha_m +
CoeffBeta[Sensornumber][index][2] * beta_m + CoeffBeta[Sensornumber][index][3] * alpha_m * alpha_m +
CoeffBeta[Sensornumber][index][4] * alpha_m * beta_m +
CoeffBeta[Sensornumber][index][5] * beta_m * beta_m +
CoeffBeta[Sensornumber][index][6] * alpha_m * alpha_m * alpha_m +
CoeffBeta[Sensornumber][index][7] * alpha_m * alpha_m * beta_m +
CoeffBeta[Sensornumber][index][8] * alpha_m * beta_m * beta_m +
CoeffBeta[Sensornumber][index][9] * beta_m * beta_m * beta_m; //[°]
}
}
}
// while loop iterates above all calibration cells to use the different calibration functions in
// each cell
k = 0;
while (k < 3) {
k = k + 1;
l = 0;
while (l < 3) {
l = l + 1;
// if condition to check in which cell the data point has to be
if ((alpha_m > ((CompleteCellWidth * ((k - 1) / 3)) - HalfCellWidth) &&
alpha_m < ((CompleteCellWidth * (k / 3)) - HalfCellWidth)) &&
(beta_m > ((CompleteCellWidth * ((l - 1) / 3)) - HalfCellWidth) &&
beta_m < ((CompleteCellWidth * (l / 3)) - HalfCellWidth))) {
index = (3 * (k - 1) + l) - 1; // calculate the index of the datapoint for the right cell
// -> first cell has number 0
beta_calibrated = CoeffBeta[Sensornumber][index][0] + CoeffBeta[Sensornumber][index][1] * alpha_m +
CoeffBeta[Sensornumber][index][2] * beta_m + CoeffBeta[Sensornumber][index][3] * alpha_m * alpha_m +
CoeffBeta[Sensornumber][index][4] * alpha_m * beta_m +
CoeffBeta[Sensornumber][index][5] * beta_m * beta_m +
CoeffBeta[Sensornumber][index][6] * alpha_m * alpha_m * alpha_m +
CoeffBeta[Sensornumber][index][7] * alpha_m * alpha_m * beta_m +
CoeffBeta[Sensornumber][index][8] * alpha_m * beta_m * beta_m +
CoeffBeta[Sensornumber][index][9] * beta_m * beta_m * beta_m;
}
}
}
AlphaBetaCalibrated[Sensornumber][0] = alpha_calibrated; //[°]
AlphaBetaCalibrated[Sensornumber][1] = beta_calibrated; //[°]
}
void SunSensor::CalculateSunVector(uint8_t Sensornumber) {