The simulator now simulates the heater power in Watts. Changed Mash Remove? prompt.

Sun, 27 Dec 2015 20:21:06 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sun, 27 Dec 2015 20:21:06 +0100
changeset 478
fe8bf61cde06
parent 477
9167ad4c2e77
child 479
0e6a1163e6e3

The simulator now simulates the heater power in Watts. Changed Mash Remove? prompt.

brewco/brewco.c file | annotate | diff | comparison | revisions
brewco/simulator.c file | annotate | diff | comparison | revisions
--- a/brewco/brewco.c	Sun Dec 27 17:52:26 2015 +0100
+++ b/brewco/brewco.c	Sun Dec 27 20:21:06 2015 +0100
@@ -426,6 +426,11 @@
 				    last_step = brew->brewstep;
 				    initlog(brew->name);
 				}
+				if (oldsec != seconds) {
+				    tempstatus();
+				    percstatus((seconds / 2) % 4);
+				    oldsec = seconds;
+				}
 				if (set_HLT_heater(unit, 1, 85.0))
 				    syslog(LOG_NOTICE, "AUTO: premash turn on HLT at %6.2f", hltSetpoint);
 				if (set_MLT_heater(unit, 1, 10.0))
@@ -537,6 +542,7 @@
 							    mlt_status(1);
 							    pump_status(unit->pump_onmash);
 							    last_fase = mash_fase;
+							    syslog(LOG_NOTICE, "AUTO: mash step %d fase HEATING started", brew->mashstep);
 							}
 							if (set_MLT_pump(unit, unit->pump_onmash))
 							    syslog(LOG_NOTICE, "AUTO: mash turn %s MLT pump", mlt_pump_state ? "on":"off");
@@ -612,12 +618,12 @@
 					prompt(118, NULL);          /* "AUTO --> Mash Out   " */
 					prompt(220, NULL);          /* "   Mash Removed?    " */
 					prompt(300, NULL);
-					prompt(410, NULL);          /* " Continue: Yes  No  " */
+					prompt(407, NULL);          /* "---  ---   No   Yes " */
 					last_step = brew->brewstep;
 				    }
 				    slcdDummy(slcdHandle);
 				    key = keycheck();
-				    if (key == KEY_RETURN) {
+				    if (key == KEY_ENTER) {
 					syslog(LOG_NOTICE, "AUTO: Confirmed Mash removed");
 					brew->brewstep = STEP_PREBOIL;
 				    }
--- a/brewco/simulator.c	Sun Dec 27 17:52:26 2015 +0100
+++ b/brewco/simulator.c	Sun Dec 27 20:21:06 2015 +0100
@@ -68,9 +68,9 @@
 	 * Then decrease both liquid temperatures and consider the volume.
 	 */
 	Config.simulator->hlt_temperature -= (Config.simulator->hlt_temperature - Config.simulator->room_temperature) / 
-		(40000 * (Config.simulator->hlt_heater_volume / 2));
+		(80000 * (Config.simulator->hlt_heater_volume / 2));
 	Config.simulator->mlt_temperature -= (Config.simulator->mlt_temperature - Config.simulator->room_temperature) / 
-		(40000 * (Config.simulator->mlt_heater_volume / 2));
+		(80000 * (Config.simulator->mlt_heater_volume / 2));
 
 	/*
 	 * If heating, calculate the heating element temperature but not higher then 250 degrees celcius.
@@ -79,19 +79,20 @@
 	 */
 	Config.simulator->hlt_heater_state = SIM_hlt_value;
 	if (SIM_hlt_value) {
-	    Config.simulator->hlt_heater_temp += (250 - Config.simulator->hlt_heater_temp) / 2000;
+	    Config.simulator->hlt_heater_temp += (250 - Config.simulator->hlt_heater_temp) / 2000.0 * (Config.simulator->hlt_heater_power / 2000.0);
 	} else {
 	    Config.simulator->hlt_heater_temp -= (Config.simulator->hlt_heater_temp - Config.simulator->hlt_temperature) / 250;
 	}
 	Config.simulator->mlt_heater_state = SIM_mlt_value;
 	if (SIM_mlt_value) {
-	    Config.simulator->mlt_heater_temp += (250 - Config.simulator->mlt_heater_temp) / 2000;
+	    Config.simulator->mlt_heater_temp += (250 - Config.simulator->mlt_heater_temp) / 2000.0 * (Config.simulator->mlt_heater_power / 2000.0);
 	} else {
 	    Config.simulator->mlt_heater_temp -= (Config.simulator->mlt_heater_temp - Config.simulator->mlt_temperature) / 250;
 	}
 
 	/*
 	 * If cooling, bring down the MLT temperature. Assume 14 degrees coolwater.
+	 * The cooler is turned on or off by sending SIGUSR1 or SIGUSR2 to this program.
 	 */
 	if (SIM_cooler) {
 	    Config.simulator->mlt_temperature -= (Config.simulator->mlt_temperature - 14) / (175 * Config.simulator->hlt_heater_volume);
@@ -101,10 +102,12 @@
 	 * Shift the liquid temperature towards the heating elements temperature,
 	 * but never higher then 100 degrees celcius.
 	 */
-	Config.simulator->hlt_temperature += (Config.simulator->hlt_heater_temp - Config.simulator->hlt_temperature) / (10000 * Config.simulator->hlt_heater_volume);
+	Config.simulator->hlt_temperature += (Config.simulator->hlt_heater_temp - Config.simulator->hlt_temperature) / 
+		(10000.0 * Config.simulator->hlt_heater_volume * (2000.0 / Config.simulator->hlt_heater_power));
 	if (Config.simulator->hlt_temperature > 100.25)
 	    Config.simulator->hlt_temperature = 100.25;
-	Config.simulator->mlt_temperature += (Config.simulator->mlt_heater_temp - Config.simulator->mlt_temperature) / (10000 * Config.simulator->mlt_heater_volume);
+	Config.simulator->mlt_temperature += (Config.simulator->mlt_heater_temp - Config.simulator->mlt_temperature) / 
+		(10000.0 * Config.simulator->mlt_heater_volume * (2000.0 / Config.simulator->mlt_heater_power));
 	if (Config.simulator->mlt_temperature > 100.25)
 	    Config.simulator->mlt_temperature = 100.25;
 
@@ -115,11 +118,11 @@
 	    /*
 	     * Each second
 	     */
-//	    if (debug)
-//		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, SIM_cooler ? "Yes":"No");
+	    if (debug)
+		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, SIM_cooler ? "Yes":"No");
 	    loops = 0;
 	}
 	usleep(50000);

mercurial