Index: firmware/App/Controllers/Heaters.c =================================================================== diff -u -re59287e5915e01c44af22fc54eafc29cb0f6c2c0 -rf5dc98b3d5fcd39e3ab502fbe81110e188ce0ec5 --- firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision e59287e5915e01c44af22fc54eafc29cb0f6c2c0) +++ firmware/App/Controllers/Heaters.c (.../Heaters.c) (revision f5dc98b3d5fcd39e3ab502fbe81110e188ce0ec5) @@ -666,26 +666,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