diff -r f84501d8dd87 -r 045db83dd013 brewco/simulator.c --- a/brewco/simulator.c Sat Dec 12 19:31:35 2015 +0100 +++ b/brewco/simulator.c Sat Dec 12 21:20:46 2015 +0100 @@ -31,6 +31,7 @@ int SIM_hlt_value = 0; int SIM_mlt_value = 0; +int SIM_cooler = FALSE; #ifdef HAVE_WIRINGPI_H @@ -80,13 +81,20 @@ if (SIM_hlt_value) { Config.simulator->hlt_heater_temp += (250 - Config.simulator->hlt_heater_temp) / 2000; } else { - Config.simulator->hlt_heater_temp -= (Config.simulator->hlt_heater_temp - Config.simulator->hlt_temperature) / 1000; + Config.simulator->hlt_heater_temp -= (Config.simulator->hlt_heater_temp - Config.simulator->hlt_temperature) / 500; } Config.simulator->mlt_heater_state = SIM_mlt_value; if (SIM_mlt_value) { Config.simulator->mlt_heater_temp += (250 - Config.simulator->mlt_heater_temp) / 2000; } else { - Config.simulator->mlt_heater_temp -= (Config.simulator->mlt_heater_temp - Config.simulator->mlt_temperature) / 1000; + Config.simulator->mlt_heater_temp -= (Config.simulator->mlt_heater_temp - Config.simulator->mlt_temperature) / 500; + } + + /* + * If cooling, bring down the MLT temperature. Assume 14 degrees coolwater. + */ + if (SIM_cooler) { + Config.simulator->mlt_temperature -= (Config.simulator->mlt_temperature - 14) / (250 * Config.simulator->hlt_heater_volume); } /* @@ -108,10 +116,10 @@ * Each second */ if (debug) - fprintf(stdout, "HLT temp=%f plate=%f val=%d MLT temp=%f plate=%f val=%d Room %.1f loops=%d\n", + fprintf(stdout, "HLT temp=%f plate=%f val=%d MLT temp=%f plate=%f val=%d Room %.1f loops=%d cool=%s\n", Config.simulator->hlt_temperature, Config.simulator->hlt_heater_temp, Config.simulator->hlt_heater_state, Config.simulator->mlt_temperature, Config.simulator->mlt_heater_temp, Config.simulator->mlt_heater_state, - Config.simulator->room_temperature, loops); + Config.simulator->room_temperature, loops, SIM_cooler ? "Yes":"No"); loops = 0; } usleep(50000);