diff --git a/tasmota/xdrv_39_thermostat.ino b/tasmota/xdrv_39_thermostat.ino index b6d2e2739..b1825e39d 100644 --- a/tasmota/xdrv_39_thermostat.ino +++ b/tasmota/xdrv_39_thermostat.ino @@ -146,17 +146,26 @@ struct THERMOSTAT { int32_t time_total_pi; // Time total (proportional + integral) of the PI controller uint16_t kP_pi = 0; // kP value for the PI controller uint16_t kI_pi = 0; // kP value for the PI controller multiplied by 100 +<<<<<<< HEAD <<<<<<< HEAD int16_t temp_measured = 0; // Temperature measurement received from sensor in tenths of degrees uint8_t time_output_delay = THERMOSTAT_TIME_OUTPUT_DELAY; // Output delay between state change and real actuation event (f.i. valve open/closed) uint8_t counter_rampup_cycles = 0; // Counter of ramp-up cycles ======= +>>>>>>> new_branch_dev +======= >>>>>>> new_branch_dev int32_t temp_rampup_meas_gradient = 0; // Temperature measured gradient from sensor in thousandths of degrees per hour calculated during ramp-up uint32_t timestamp_rampup_start = 0; // Timestamp where the ramp-up controller mode has been started uint32_t time_rampup_deadtime = 0; // Time constant of the thermostat system (step response time) uint32_t time_rampup_nextcycle = 0; // Time where the ramp-up controller shall start the next cycle <<<<<<< HEAD +<<<<<<< HEAD +======= + int16_t temp_measured = 0; // Temperature measurement received from sensor in tenths of degrees + uint8_t time_output_delay = THERMOSTAT_TIME_OUTPUT_DELAY; // Output delay between state change and real actuation event (f.i. valve open/closed) + uint8_t counter_rampup_cycles = 0; // Counter of ramp-up cycles +>>>>>>> new_branch_dev ======= int16_t temp_measured = 0; // Temperature measurement received from sensor in tenths of degrees uint8_t time_output_delay = THERMOSTAT_TIME_OUTPUT_DELAY; // Output delay between state change and real actuation event (f.i. valve open/closed) @@ -187,9 +196,12 @@ struct THERMOSTAT { int8_t temp_hysteresis = THERMOSTAT_TEMP_HYSTERESIS; // Range hysteresis for temperature PI controller, in tenths of degrees celsius uint8_t temp_frost_protect = THERMOSTAT_TEMP_FROST_PROTECT; // Minimum temperature for frost protection, in tenths of degrees celsius uint16_t power_max = THERMOSTAT_POWER_MAX; // Maximum output power in Watt +<<<<<<< HEAD <<<<<<< HEAD uint16_t energy_thermostat_output_max = THERMOSTAT_ENERGY_OUTPUT_MAX; // Maximum allowed energy output for thermostat valve in Watts ======= +>>>>>>> new_branch_dev +======= >>>>>>> new_branch_dev ThermostatBitfield status; // Bittfield including states as well as several flags } Thermostat; @@ -332,16 +344,22 @@ bool HeatStateManualToAuto() bool change_state; // If switch input inactive +<<<<<<< HEAD <<<<<<< HEAD // AND no switch input action (time in current state) bigger than a pre-defined time // then go to automatic if ((ThermostatSwitchStatus(Thermostat.input_switch_number) == 0) ======= +======= +>>>>>>> new_branch_dev // AND sensor alive // AND no switch input action (time in current state) bigger than a pre-defined time // then go to automatic if ((ThermostatSwitchStatus(Thermostat.input_switch_number) == 0) &&(Thermostat.status.sensor_alive == IFACE_ON) +<<<<<<< HEAD +>>>>>>> new_branch_dev +======= >>>>>>> new_branch_dev && ((uptime - Thermostat.timestamp_input_on) > ((uint32_t)Thermostat.time_manual_to_auto * 60))) { change_state = true; @@ -444,8 +462,12 @@ void ThermostatCalculatePI() // Reset of antiwindup // If error does not lay within the integrator scope range, do not use the integral // and accumulate error = 0 +<<<<<<< HEAD <<<<<<< HEAD if (abs(Thermostat.temp_pi_error) > Thermostat.temp_reset_anti_windup) { +======= + if (abs(Thermostat.temp_pi_error) > (int16_t)Thermostat.temp_reset_anti_windup) { +>>>>>>> new_branch_dev ======= if (abs(Thermostat.temp_pi_error) > (int16_t)Thermostat.temp_reset_anti_windup) { >>>>>>> new_branch_dev @@ -525,8 +547,12 @@ void ThermostatCalculatePI() } } // If target value has not been reached +<<<<<<< HEAD <<<<<<< HEAD // AND we are withing the histeresis +======= + // AND we are withinvr the histeresis +>>>>>>> new_branch_dev ======= // AND we are withinvr the histeresis >>>>>>> new_branch_dev @@ -729,13 +755,19 @@ void ThermostatWork() case THERMOSTAT_MANUAL_OP: // State manual operation following input switch Thermostat.time_ctr_checkpoint = 0; <<<<<<< HEAD +<<<<<<< HEAD ======= +======= +>>>>>>> new_branch_dev if (ThermostatSwitchStatus(Thermostat.input_switch_number) == 1) { Thermostat.status.command_output = IFACE_ON; } else { Thermostat.status.command_output = IFACE_OFF; } +<<<<<<< HEAD +>>>>>>> new_branch_dev +======= >>>>>>> new_branch_dev break; } @@ -862,10 +894,16 @@ void CmndTempMeasuredSet(void) uint32_t timestamp = uptime; // Calculate temperature gradient if temperature value has changed if (value != Thermostat.temp_measured) { +<<<<<<< HEAD <<<<<<< HEAD int16_t temp_delta = (value - Thermostat.temp_measured); // in tenths of degrees uint32_t time_delta = (timestamp - Thermostat.timestamp_temp_meas_change_update); // in seconds Thermostat.temp_measured_gradient = (int32_t)((360000 * (int32_t)temp_delta) / (int32_t)time_delta); // hundreths of degrees per hour +======= + int32_t temp_delta = (value - Thermostat.temp_measured); // in tenths of degrees + uint32_t time_delta = (timestamp - Thermostat.timestamp_temp_meas_change_update); // in seconds + Thermostat.temp_measured_gradient = (int32_t)((360000 * temp_delta) / ((int32_t)time_delta)); // hundreths of degrees per hour +>>>>>>> new_branch_dev ======= int32_t temp_delta = (value - Thermostat.temp_measured); // in tenths of degrees uint32_t time_delta = (timestamp - Thermostat.timestamp_temp_meas_change_update); // in seconds @@ -1177,7 +1215,10 @@ bool Xdrv39(uint8_t function) dtostrfd(Thermostat.time_total_pi, 0, result_chr); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat.time_total_pi: %s"), result_chr); <<<<<<< HEAD +<<<<<<< HEAD ======= +======= +>>>>>>> new_branch_dev dtostrfd(Thermostat.temp_measured_gradient, 0, result_chr); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat.temp_measured_gradient: %s"), result_chr); dtostrfd(Thermostat.time_rampup_deadtime, 0, result_chr); @@ -1188,6 +1229,9 @@ bool Xdrv39(uint8_t function) AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat.time_ctr_changepoint: %s"), result_chr); dtostrfd(Thermostat.temp_rampup_output_off, 0, result_chr); AddLog_P2(LOG_LEVEL_DEBUG, PSTR("Thermostat.temp_rampup_output_off: %s"), result_chr); +<<<<<<< HEAD +>>>>>>> new_branch_dev +======= >>>>>>> new_branch_dev AddLog_P2(LOG_LEVEL_DEBUG, PSTR("------ Thermostat End ------")); AddLog_P2(LOG_LEVEL_DEBUG, PSTR(""));