Index: firmware/App/Controllers/Fans.c =================================================================== diff -u -r3cdfce9c1c4fa0fd205756eb458ac5d3bffc9045 -r113f804decb50b9511bb8b7365288285fece6628 --- firmware/App/Controllers/Fans.c (.../Fans.c) (revision 3cdfce9c1c4fa0fd205756eb458ac5d3bffc9045) +++ firmware/App/Controllers/Fans.c (.../Fans.c) (revision 113f804decb50b9511bb8b7365288285fece6628) @@ -92,10 +92,10 @@ static FANS_EXEC_STATES_T handleExecStateRun( void ); static void setInletFansDutyCycle( F32 pwm ); -static F32 getMaximumTemperature( void ); +static F32 getMaximumTemperature( void ); static void convertTogglePeriod2RPM( void ); static void monitorFans( void ); -static U32 getPublishFansDataInterval( void ); +static U32 getPublishFansDataInterval( void ); static void publishFansData( void ); /*********************************************************************//** @@ -186,6 +186,7 @@ // Monitor the RPM of the fans monitorFans(); + // Check for the publication time publishFansData(); } @@ -350,16 +351,16 @@ // NOTE: A for loop was not used because the venous pressure sensor's temperature // is not used as one of temperature values to decide the hottest temperature - temperature = getTemperatureValue( THERMISTOR_ONBOARD_NTC ); + temperature = getTemperatureValue( THERMISTOR_ONBOARD_NTC ); maxTemperature = ( temperature > maxTemperature ? temperature : maxTemperature ); - temperature = getTemperatureValue( THERMISTOR_POWER_SUPPLY_1 ); + temperature = getTemperatureValue( THERMISTOR_POWER_SUPPLY_1 ); maxTemperature = ( temperature > maxTemperature ? temperature : maxTemperature ); - temperature = getTemperatureValue( TEMPSENSOR_FPGA_BOARD_SENSOR ); + temperature = getTemperatureValue( TEMPSENSOR_FPGA_BOARD_SENSOR ); maxTemperature = ( temperature > maxTemperature ? temperature : maxTemperature ); - temperature = getTemperatureValue( TEMPSENSOR_PBA_ADC_SENSOR ); + temperature = getTemperatureValue( TEMPSENSOR_PBA_ADC_SENSOR ); maxTemperature = ( temperature > maxTemperature ? temperature : maxTemperature ); return maxTemperature; @@ -407,26 +408,27 @@ { if ( ++fansMonitorCounter >= FANS_MONITOR_INTERVAL_COUNT ) { - if ( FALSE == hasAlarmBeenRaised ) - { - FAN_NAMES_T fan; - BOOL isFanRPMOutOfRange = FALSE; - BOOL isAlarmTriggered = FALSE; - F32 rpm = 0.0; + FAN_NAMES_T fan; + BOOL isFanRPMOutOfRange = FALSE; + BOOL isAlarmTriggered = FALSE; + F32 rpm = 0.0; - // The RPM is expected to be 5500 @ 100% duty cycle - // The nominal RPM = duty cycle * 5500 / 1.0 - // The RPM tolerance is -25% to +50% of the nominal RPM - F32 fansNominalRPM = fansStatus.targetDutyCycle * FANS_MAX_ALLOWED_RPM; - F32 fansMinAllowedRPM = fansNominalRPM - ( fansNominalRPM * FANS_MIN_RPM_OUT_OF_RANGE_TOL ); - F32 fansMaxAllowedRPM = fansNominalRPM + ( fansNominalRPM * FANS_MAX_RPM_OUT_OF_RANGE_TOL ); + // The RPM is expected to be 5500 @ 100% duty cycle + // The nominal RPM = duty cycle * 5500 / 1.0 + // The RPM tolerance is -25% to +50% of the nominal RPM + F32 fansNominalRPM = fansStatus.targetDutyCycle * FANS_MAX_ALLOWED_RPM; + F32 fansMinAllowedRPM = fansNominalRPM - ( fansNominalRPM * FANS_MIN_RPM_OUT_OF_RANGE_TOL ); + F32 fansMaxAllowedRPM = fansNominalRPM + ( fansNominalRPM * FANS_MAX_RPM_OUT_OF_RANGE_TOL ); - for ( fan = FAN_INLET_1; fan < NUM_OF_FANS_NAMES; fan++ ) - { - rpm = getMeasuredFanRPM( fan ); - isFanRPMOutOfRange |= ( rpm < fansMinAllowedRPM ) || ( rpm > fansMaxAllowedRPM ); - } + // Loop through the fans and make sure the each of them have RPM in range + for ( fan = FAN_INLET_1; fan < NUM_OF_FANS_NAMES; fan++ ) + { + rpm = getMeasuredFanRPM( fan ); + isFanRPMOutOfRange |= ( ( rpm < fansMinAllowedRPM ) || ( rpm > fansMaxAllowedRPM ) ? TRUE : FALSE ); + } + if ( FALSE == hasAlarmBeenRaised ) + { isAlarmTriggered = isPersistentAlarmTriggered( ALARM_ID_HD_FAN_RPM_OUT_OF_RANGE, isFanRPMOutOfRange ); if ( TRUE == isAlarmTriggered ) @@ -449,6 +451,15 @@ hasAlarmBeenRaised = FALSE; rpmAlarmStartTimer = 0; } + else + { + // If the alarm has been raised and 24 hours has not elapsed, check if the fans RPM is back in range again + // If the fans RPM is in range again, clear the alarm + if ( FALSE == isFanRPMOutOfRange ) + { + clearAlarmCondition( ALARM_ID_HD_FAN_RPM_OUT_OF_RANGE ); + } + } fansMonitorCounter = 0; }