Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -ra5e4e578efe1af6c82530e73d58b09b2b7ad625c -r7c077d84b9db9f8b14d4ab49d4b02a7f41e8f923 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision a5e4e578efe1af6c82530e73d58b09b2b7ad625c) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision 7c077d84b9db9f8b14d4ab49d4b02a7f41e8f923) @@ -671,26 +671,29 @@ // Get the primary heater's efficiency and the last fill temperature from the ModeFill F32 heaterEfficiency = heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency; - /*if ( TRUE == checkEfficiency ) + if ( TRUE == checkEfficiency ) // TODO ignore the efficiency for now until it is fixed { - F32 lastFillTemperature = getLastFillTemperature(); - F32 trimmerTargetTemperature = heatersStatus[ DG_TRIMMER_HEATER ].targetTemp; + /*F32 lastFillTemperature = getLastFillTemperature(); + F32 primaryTargetTemperature = heatersStatus[ DG_PRIMARY_HEATER ].targetTemp; // If the last fill temperature > target temperature, it means the primary heater overshot the duty cycle // so with its efficiency is toned down for the next fill cycle // If the heater under-shoots the duty cycle, the efficiency increases the duty cycle for the next fill cycle - if ( lastFillTemperature - trimmerTargetTemperature > MAXIMUM_ALLOWED_TARGET_TEMPERATURE_DEVIATION_C ) + if ( lastFillTemperature - primaryTargetTemperature > MAXIMUM_ALLOWED_TARGET_TEMPERATURE_DEVIATION_C ) { - heaterEfficiency -= ( lastFillTemperature - trimmerTargetTemperature ) * PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C; + heaterEfficiency -= ( lastFillTemperature - primaryTargetTemperature ) * PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C; } - else if ( lastFillTemperature - trimmerTargetTemperature <= MAXIMUM_ALLOWED_TARGET_TEMPERATURE_DEVIATION_C ) + else if ( lastFillTemperature - primaryTargetTemperature <= MAXIMUM_ALLOWED_TARGET_TEMPERATURE_DEVIATION_C ) { - heaterEfficiency += ( lastFillTemperature - trimmerTargetTemperature ) * PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C; + heaterEfficiency += ( primaryTargetTemperature - lastFillTemperature ) * PRIMARY_HEATER_DUTY_CYCLE_PER_TEMPERATURE_C; } + heaterEfficiency = heaterEfficiency <= 0.0 ? 0.0 : heaterEfficiency; + //heaterEfficiency = heaterEfficiency >= 1.0 ? 1.0 : heaterEfficiency; + // Update the heaters efficiency - heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency = heaterEfficiency; - }*/ + heatersStatus[ DG_PRIMARY_HEATER ].heaterEfficiency = heaterEfficiency; */ + } // Duty cycle = ( 69.73 * flow rate * deltaT / primary heater maximum power ) ^ 1/2 // Multiply the duty cycle to the heater efficiency