//***************************************************************************** // (C) Automotive Lighting Reutlingen GmbH // Tuebinger Strasse 123, 72762 Reutlingen, Germany // // Automotive Lighting Reutlingen GmbH owns all the rights to this work. // This work shall not be copied, reproduced, used, modified, transferred // or its information shall not be disclosed without the prior written // authorization of Automotive Lighting Reutlingen GmbH. //***************************************************************************** //----------------------------------------------------------------------------- /// \file StatM.c /// /// \brief software component module for statistic manager /// /// \descr The software component StatM can be initialized from the RTE. /// All operating hours counter will be initialized during initialization. /// The RTE call StatM cyclically. In each cycle call StatM will increment /// the operating hours counters. The operating hours counter will be /// written during the shutdown of the ECU. /// /// Additional information can be found in the design description (Link: /// doors://ittor47doorsal.mmemea.marelliad.net:36693/?version=2&prodID=0&urn=urn:telelogic::1-43eb3f040fd3425e-M-0004593d /// /// \author Marcel Radue ALDE-RT (F62443B) /// mailTo: Marcel.Radue[at]marelli.com /// //----------------------------------------------------------------------------- //============================================================================= // Includes //============================================================================= #include //HONGQI_Comment-- #include //HONGQI-Added-Start //#include //HONGQI-Added-End #include #include //============================================================================= // Defines //============================================================================= // Debug ---------------------------------------------------------------------- #ifndef UNIT_TEST #define STATM_DEBUG_TEST #else #undef STATM_DEBUG_TEST #endif // STATM_MT // End debug ------------------------------------------------------------------ //============================================================================= // Types //============================================================================= //============================================================================= // Exported Variables //============================================================================= #define ctaaStatM_START_SEC_VAR_NO_INIT_UNSPECIFIED #include "ctaaStatM_MemMap.h" tStatM_NvData StatM_sStatistic_data_NVRAM; // NvRAM-Struktur zu Betriebsstunden #define ctaaStatM_STOP_SEC_VAR_NO_INIT_UNSPECIFIED #include "ctaaStatM_MemMap.h" //============================================================================= // Variables //============================================================================= #define ctaaStatM_START_SEC_VAR_NO_INIT_8 #include "ctaaStatM_MemMap.h" static uint8 StatM_ucCycles; #define ctaaStatM_STOP_SEC_VAR_NO_INIT_8 #include "ctaaStatM_MemMap.h" #define ctaaStatM_START_SEC_VAR_NO_INIT_UNSPECIFIED #include "ctaaStatM_MemMap.h" uint8 StatMStatistics[700]; // global variable for Statistics Data as defined in NvRAM #define ctaaStatM_STOP_SEC_VAR_NO_INIT_UNSPECIFIED #include "ctaaStatM_MemMap.h" //----------------------------------------------------------------------------- // Function prototypes //----------------------------------------------------------------------------- #define ctaaStatM_START_SEC_CODE #include "ctaaStatM_MemMap.h" STATIC_AL void StatM_Cycle100ms(void); STATIC_AL void StatM_Init(void); //STATIC_AL void StatM_ClearStatisticsData(tieStatMData_Id eStatMDataId, uint8 ucArrayIx); //GHS Warning 177-D //STATIC_AL void StatM_GetStatisticsData(tisStatistics* psData); //GHS Warning 177-D STATIC_AL void StatM_IncrementEcuOpHoursCounter(uint32* puStatM_Counter); STATIC_AL void StatM_IncrementHssCounter(tiu32TimeDiff_us ulTimeDiff, uint32* puStatM_Counter); STATIC_AL void StatM_IncrementResetCounter(uint8* puStatM_Counter); //TODO STATIC_AL void StatM_IncrementLsCounter(tisVirtLsStatusFault status, uint32* puStatM_Counter); STATIC_AL void StatM_UpdateStepperStatistics(void); STATIC_AL void StatM_TemperatureHistograms(void); //============================================================================= // Function definitions //============================================================================= //----------------------------------------------------------------------------- /// \brief rpStatMCycle100ms /// /// \descr Cyclic runnable wrapper for StatM_Cycle100ms. /// /// \param void /// /// \return void //----------------------------------------------------------------------------- FUNC(void, ctaaStatM_CODE) rpStatM100ms(void) { /* NONFUNCTIONAL REQUIREMENTS FLM3.MDRS.StatM.130 FLM3.MDRS.StatM.172 */ //HONGQI_Comment-- ENTER_CYCLIC_RUNNABLE(RPSTATM100MS); StatM_Cycle100ms(); //HONGQI_Comment-- EXIT_CYCLIC_RUNNABLE(RPSTATM100MS); } //----------------------------------------------------------------------------- /// \brief Event based runnable /// /// \descr Event based runnable for StatM /// /// /// \param pointer to Statistics data /// /// \return Std_ReturnType //----------------------------------------------------------------------------- /*FUNC(Std_ReturnType, ctaaStatM_CODE) StatM_GetStatistics(P2VAR(tisStatistics, AUTOMATIC, RTE_APPL_DATA) psData) { StatM_GetStatisticsData(psData); return RTE_E_OK; }*/ //----------------------------------------------------------------------------- /// \brief Event based runnable /// /// \descr Event based runnable for StatM /// /// \param enum of statistics data element, index of statistics data element /// /// \return void //----------------------------------------------------------------------------- /*FUNC(void, ctaaStatM_CODE) StatM_ClearStatistics(tieStatMData_Id eStatMDataId, uint8 ucArrayIx) { StatM_ClearStatisticsData(eStatMDataId, ucArrayIx); }*/ //----------------------------------------------------------------------------- /// \brief Init runnable /// /// \descr Init runnable /// /// \param void /// /// \return void //----------------------------------------------------------------------------- FUNC(void, ctaaStatM_CODE) riStatMInit(void) { /* NONFUNCTIONAL REQUIREMENTS FLM3.MDRS.StatM.60 FLM3.MDRS.StatM.125 */ //HONGQI_Comment-- ENTER_INIT_RUNNABLE(RISTATMINIT); StatM_Init(); //HONGQI_Comment-- EXIT_INIT_RUNNABLE(RISTATMINIT); } //----------------------------------------------------------------------------- /// \brief StatM_ClearStatisticsData /// /// \descr /// /// \param /// /// \return void //----------------------------------------------------------------------------- //Before removing the comment, please remove the library function like memset/memcpy #if 0 STATIC_AL void StatM_ClearStatisticsData(tieStatMData_Id eStatMDataId, uint8 ucArrayIx) { switch (eStatMDataId) { case 0u: // clear OpTimeEcu_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.ulOpTimeEcu, 0, sizeof(StatM_sStatistic_data_NVRAM.ulOpTimeEcu)); break; case 1u: // clear OpTimeLS_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.ulOpTimeLs.ulOpTimeLs[ucArrayIx], 0, sizeof(StatM_sStatistic_data_NVRAM.ulOpTimeLs.ulOpTimeLs[ucArrayIx])); break; case 2u: // clear OpTimeHss_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.ulOpTimeHss.ulOpTimeHss[ucArrayIx], 0, sizeof(StatM_sStatistic_data_NVRAM.ulOpTimeHss.ulOpTimeHss[ucArrayIx])); break; case 3u: // clear LwrStpOpTimeHoldCurrent_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeHoldCurrent, 0, sizeof(StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeHoldCurrent)); break; case 4u: // clear LwrStpOpTimeRunCurrent_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeRunCurrent, 0, sizeof(StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeRunCurrent)); break; case 5u: // clear CtrReset_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.ucCtrReset, 0, sizeof(StatM_sStatistic_data_NVRAM.ucCtrReset)); break; case 6u: // clear HistEcu_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu, 0, sizeof(StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu)); break; case 7u: // clear HistLs_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeLs, 0, sizeof(StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeLs)); break; case 8u: // clear CtrLwrStpRefStarted_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefStarted, 0, sizeof(StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefStarted)); break; case 9u: // clear CtrLwrStpRefFinished_ID (void)Rte_Memset(&StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefFinished, 0, sizeof(StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefFinished)); break; default: // clear other values / not used (invalid) // do nothing break; } // update NvRAM //HONGQI_Comment-- (void)Rte_Call_ppNvMStatMStatistics_WriteBlock(&StatM_sStatistic_data_NVRAM); } #endif //----------------------------------------------------------------------------- /// \brief Cyclic function for StatM /// /// \descr Cyclic function is incerementing the operating hours counter /// /// \param void /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_Cycle100ms(void) { tiu32HssChannel ulHssIdx; tiu32TimeDiff_us ulHssTimeDiff = 0; //TODO tisVirtLsStatusFault status[STATM_CFG_LMM_MAX_NO_OF_VIRT_LS_CHANNELS]; //TODO tiu32LsChannel ulLsIdx; // StatM cyclic runnable is executed every 100 ms * STATM_CYCLES_MULTIPLIKATOR (10) = 1000 ms = 1 s if (STATM_CYCLES_MULTIPLIKATOR < StatM_ucCycles) { // reset cycle counter StatM_ucCycles = 0u; // update ECU operating hours counter StatM_IncrementEcuOpHoursCounter(&StatM_sStatistic_data_NVRAM.ulOpTimeEcu); // increment HSS operating hours counter for (ulHssIdx = 0u; ulHssIdx < STATM_CFG_HSS_MAX_NO_OF_HSS_CHANNELS; ulHssIdx++) { //(void)Rte_Call_ppCtrlHssGetOnTime_CtrlHss_GetOnTime(ulHssIdx, &ulHssTimeDiff); StatM_IncrementHssCounter(ulHssTimeDiff, &StatM_sStatistic_data_NVRAM.ulOpTimeHss.ulOpTimeHss[ulHssIdx]); } // increment LS operating hours counter //for (ulLsIdx = 0u; ulLsIdx < STATM_CFG_LMM_MAX_NO_OF_VIRT_LS_CHANNELS; ulLsIdx++) //{ //TODO (void)Rte_Read_ctaaStatM_ppCtrlLedLsStatusError0_asVal(&status[ulLsIdx]); //TODO StatM_IncrementLsCounter(status[ulLsIdx], &StatM_sStatistic_data_NVRAM.ulOpTimeLs.ulOpTimeLs[ulLsIdx]); //} // update temperature histogram counters StatM_TemperatureHistograms(); // update stepper motor statistics StatM_UpdateStepperStatistics(); //copy statistics data and operating hours counter to NvRAM (void)Rte_Memcpy(StatMStatistics, &StatM_sStatistic_data_NVRAM, sizeof(StatMStatistics)); } else { //increment the number of cycles StatM_ucCycles++; } } //----------------------------------------------------------------------------- /// \brief initialisation function for StatM /// /// \descr StatM_Init() is loading the stored values from NvRAM and /// evaluating the reset reason from CddSbc. /// Called once at start up. /// /// /// \param void /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_Init(void) { // initialize cycle counter StatM_ucCycles = 0u; tieResetReason CddSbc_ResetReason = 0u; //copy stored values from NvRAM to Statistics Data Struct (void)Rte_Memcpy(&StatM_sStatistic_data_NVRAM, StatMStatistics, sizeof(StatM_sStatistic_data_NVRAM)); // Read reset reason from CddSbc //HONGQI_Comment-- (void)Rte_Call_ppCddSbcGetResetReason_GetResetReason(&CddSbc_ResetReason); /* increment counter for the following reset reason ucOtherReset: - Power on reset - Software reset - PLL error - ECC error ucWdgReset: - Watchdog reset */ switch (CddSbc_ResetReason) { case 0u: // RESET_SNA //StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucSnaReset); break; case 1u: // RESET_UNDEFINED //StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucUndefinedReset); break; case 2u: // RESET_POWER_ON StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucOtherReset); break; case 3u: // RESET_WAKEUP //StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucWakeupReset); break; case 4u: // RESET_SOFTWARE StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucOtherReset); break; case 5u: // RESET_WATCHDOG StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucWdgReset); break; case 6u: // RESET_PLL_ERROR StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucOtherReset); break; case 7u: // RESET_ECC_ERROR StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucOtherReset); break; case 8u: // RESET_UNDER_VOLTAGE //StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucUnderVoltReset); break; case 9u: // RESET_MPU_SELFTEST_ERROR //StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucMpuSelfTestReset); break; default: // OTHER StatM_IncrementResetCounter(&StatM_sStatistic_data_NVRAM.ucCtrReset.ucOtherReset); break; } // copy reset reason from Statistics Data Struct in NvRAM (void)Rte_Memcpy(StatMStatistics, &StatM_sStatistic_data_NVRAM, sizeof(StatMStatistics)); // write reset reason to NvRAM //HONGQI_Comment-- (void)Rte_Call_ppNvMStatMStatistics_WriteBlock(&StatM_sStatistic_data_NVRAM); } //============================================================================= // Private Functions Definition //============================================================================= //----------------------------------------------------------------------------- /// \brief StatM_IncrementHSSCounter /// /// \descr Function to increment the operating hours counter for the /// high side switches /// /// \param tiu32TimeDiff_us ulTimeDiff, uint32* puStatM_Counter /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_IncrementHssCounter(tiu32TimeDiff_us ulTimeDiff, uint32* puStatM_Counter) { if (ulTimeDiff > 0u) { // convert usec to sec ulTimeDiff = ulTimeDiff / STATM_USEC_TO_SEC_CONVERSION_FACTOR; // if maximum threshold is not reached if (*puStatM_Counter < STATM_MAXIMUM_VALUE_FAN_COUNTERS) { (*puStatM_Counter) += (uint32)ulTimeDiff; } else { //limit the counter value to maximum (*puStatM_Counter) = STATM_MAXIMUM_VALUE_FAN_COUNTERS; } } else { // hss was turned off } } //----------------------------------------------------------------------------- /// \brief StatM_IncrementLsCounter /// /// \descr Function to increment the operating hours counter for the /// light sources /// /// \param tisVirtLsStatusFault status, uint32* puStatM_Counter /// /// \return void //----------------------------------------------------------------------------- // function is currently commented due to not used port by CtrlLed //TODO STATIC_AL void StatM_IncrementLsCounter(tisVirtLsStatusFault status, uint32* puStatM_Counter) //{ // if ((status.eStatOn != 0u) && (status.eErr != 0u)) // { // // light source is switched on and has no error // // if maximum threshold is not reached // if (*puStatM_Counter < STATM_MAXIMUM_VALUE_LS_COUNTERS) // { // (*puStatM_Counter)++; // } // else // { // //limit the counter value to maximum // (*puStatM_Counter) = STATM_MAXIMUM_VALUE_LS_COUNTERS; // } // } // else // { // // light source is switched off or has an error // // do nothing // } //} //----------------------------------------------------------------------------- /// \brief StatM_GetStatisticsData /// /// \descr function to provide the statistics data /// /// \param tisStatistics* psData /// /// \return void //----------------------------------------------------------------------------- #if 0 STATIC_AL void StatM_GetStatisticsData(tisStatistics* psData) { uint8 ucIdx; uint8 ucLsIdx; uint8 ucLsHistIdx; /* typedef struct{ tiu32TimeDiff_10s lOpTimeEcu; tiu32TimeDiff_10s lOpTimeLs[14]; tiu32TimeDiff_10s lOpTimeHss[3]; uint8 ucCtrReset[14]; tiu32TimeDiff_10s lHistEcu[6]; tiu32TimeDiff_10s lHistLs[14][6]; }tisStatistics; */ if (psData != NULL_PTR) { // ECU operating hours psData->ulOpTimeEcu = StatM_sStatistic_data_NVRAM.ulOpTimeEcu; // HSS operating hours for (ucIdx = 0u; ucIdx < STATM_CFG_HSS_MAX_NO_OF_HSS_CHANNELS; ucIdx++) { psData->ulOpTimeHss[ucIdx] = StatM_sStatistic_data_NVRAM.ulOpTimeHss.ulOpTimeHss[ucIdx]; } // LS operating time for (ucIdx = 0u; ucIdx < STATM_CFG_LMM_MAX_NO_OF_VIRT_LS_CHANNELS; ucIdx++) { psData->ulOpTimeLs[ucIdx] = StatM_sStatistic_data_NVRAM.ulOpTimeLs.ulOpTimeLs[ucIdx]; } // reset counter psData->ucCtrReset[0u] = StatM_sStatistic_data_NVRAM.ucCtrReset.ucWdgReset; psData->ucCtrReset[1u] = StatM_sStatistic_data_NVRAM.ucCtrReset.ucOtherReset; // stepper motor statistics psData->ulLwrStpOpTimeRunCurrent = StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeRunCurrent; psData->ulLwrStpOpTimeHoldCurrent = StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeHoldCurrent; psData->unCtrLwrStpRefStarted = StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefStarted; psData->unCtrLwrStpRefFinished = StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefFinished; // ECU temperature histogram for (ucIdx = 0u; ucIdx < STATM_HISTOGRAM_TEMP_CLASSES_NUM; ucIdx++) { psData->ulHistEcu[ucIdx] = StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[ucIdx]; } // light sources temperature histogram for (ucLsIdx = 0u; ucLsIdx < STATM_CFG_LMM_MAX_NO_OF_VIRT_LS_CHANNELS; ucLsIdx++) { for (ucLsHistIdx = 0u; ucLsHistIdx < STATM_HISTOGRAM_TEMP_CLASSES_NUM; ucLsHistIdx++) { psData->ulHistLs[ucLsIdx][ucLsHistIdx] = StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeLs[ucLsIdx][ucLsHistIdx]; } } } else { // do nothing } } // PRQA S 3206, 5334 #endif //----------------------------------------------------------------------------- /// \brief StatM_IncrementEcuOpHoursCounter /// /// \descr Function to increment the operating hours counter of the ECU /// /// \param uint32* puStatM_Counter /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_IncrementEcuOpHoursCounter(uint32* puStatM_Counter) { if (*puStatM_Counter < STATM_MAXIMUM_NUMBER_OF_SECONDS) { (*puStatM_Counter)++; } else { //limit the counter value to maximum (*puStatM_Counter) = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } //----------------------------------------------------------------------------- /// \brief StatM_IncrementResetCounter /// /// \descr function to increment the reset counter /// with reset reason from CddSbc /// /// \param uint8* puStatM_Counter /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_IncrementResetCounter(uint8* puStatM_Counter) { //if maximum threshold is not reached if (*puStatM_Counter < STATM_MAXIMUM_VALUE_RESET_COUNTERS) { //increment counter (*puStatM_Counter)++; } else { //limit the counter value to maximum (*puStatM_Counter) = STATM_MAXIMUM_VALUE_RESET_COUNTERS; } } //----------------------------------------------------------------------------- /// \brief StatM_UpdateStepperStatistics /// /// \descr function to update statics data for the /// stepper motor /// /// \param void /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_UpdateStepperStatistics(void) { uint32 nOpTimeHoldCur_s; uint32 nOpTimeRunCur_s; uint32 nOpTimeHoldCur_ms = 0; uint32 nOpTimeRunCur_ms = 0; //uint32 nOpMovedHs; uint8 ucStartRefRunCnt = 0; uint8 ucFinishedRefRunCnt = 0; // Read Stepper motor statistic data //HONGQI_Comment-- (void)Rte_Call_ppCddStpGetStepperStatisticData_GetData(&nOpTimeHoldCur_ms, &nOpTimeRunCur_ms, &nOpMovedHs, &ucStartRefRunCnt, &ucFinishedRefRunCnt); // convert ms to s nOpTimeHoldCur_s = nOpTimeHoldCur_ms / STATM_MSEC_TO_SEC_CONVERSION_FACTOR; nOpTimeRunCur_s = nOpTimeRunCur_ms / STATM_MSEC_TO_SEC_CONVERSION_FACTOR; StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeHoldCurrent += nOpTimeHoldCur_s; StatM_sStatistic_data_NVRAM.StpStatistics.ulLwrStpOpTimeRunCurrent += nOpTimeRunCur_s; StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefStarted += ucStartRefRunCnt; StatM_sStatistic_data_NVRAM.StpStatistics.unCtrLwrStpRefFinished += ucFinishedRefRunCnt; } //----------------------------------------------------------------------------- /// \brief StatM_Temperature_Histograms /// /// \descr function to increment the operating hours /// counter based on temperature classes /// /// \param /// /// \return void //----------------------------------------------------------------------------- STATIC_AL void StatM_TemperatureHistograms(void) { tis32Temperature_mCelsius rSensPcbTemperature = 0; // read the PCB temperature provided by IoHwAb, PAV Data has to be flashed in the ECU //HONGQI_Comment-- (void)Rte_Read_ppRSensPcbTemperature0_lActual(&rSensPcbTemperature); // PRQA S 288 1 // warning - QAC(Prio6) Msg: 288 - prohibited character '°' in comment rSensPcbTemperature = rSensPcbTemperature / 1000; // PCB-NTC - 23,45°C = '23450' // increment the operating hours based on temperature histogram for PCB temperature if (rSensPcbTemperature < (sint32)STATM_TEMPERATURE_CLASS_1) { if (StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_1] < STATM_MAXIMUM_NUMBER_OF_SECONDS) { StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_1]++; } else { // limit to maximum value StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_1] = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } else if ((rSensPcbTemperature >= (sint32)STATM_TEMPERATURE_CLASS_1) && (rSensPcbTemperature < (sint32)STATM_TEMPERATURE_CLASS_2)) { if (StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_2] < STATM_MAXIMUM_NUMBER_OF_SECONDS) { StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_2]++; } else { // limit to maximum value StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_2] = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } else if ((rSensPcbTemperature > (sint32)STATM_TEMPERATURE_CLASS_2) && (rSensPcbTemperature <= (sint32)STATM_TEMPERATURE_CLASS_3)) { if (StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_3] < STATM_MAXIMUM_NUMBER_OF_SECONDS) { StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_3]++; } else { // limit to maximum value StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_3] = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } else if ((rSensPcbTemperature > (sint32)STATM_TEMPERATURE_CLASS_3) && (rSensPcbTemperature <= (sint32)STATM_TEMPERATURE_CLASS_4)) { if (StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_4] < STATM_MAXIMUM_NUMBER_OF_SECONDS) { StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_4]++; } else { // limit to maximum value StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_4] = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } else if ((rSensPcbTemperature > (sint32)STATM_TEMPERATURE_CLASS_4) && (rSensPcbTemperature <= (sint32)STATM_TEMPERATURE_CLASS_5)) { if (StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_5] < STATM_MAXIMUM_NUMBER_OF_SECONDS) { StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_5]++; } else { // limit to maximum value StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_5] = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } else if ((rSensPcbTemperature > (sint32)STATM_TEMPERATURE_CLASS_5) && (rSensPcbTemperature <= (sint32)STATM_TEMPERATURE_CLASS_6)) { if (StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_6] < STATM_MAXIMUM_NUMBER_OF_SECONDS) { StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_6]++; } else { // limit to maximum value StatM_sStatistic_data_NVRAM.ulHist.ulOpTimeEcu[STATM_TEMPERATURE_HISTOGRAM_CLASS_6] = STATM_MAXIMUM_NUMBER_OF_SECONDS; } } else { // nothing to do } } // PRQA S 5336 // architectural complexity #define ctaaStatM_STOP_SEC_CODE #include "ctaaStatM_MemMap.h"