thermferm/rdconfig.c

changeset 553
4091d4fe217f
parent 540
5a26429abbf8
child 554
ab9f22ab57b5
equal deleted inserted replaced
552:8b56f1b4e7ec 553:4091d4fe217f
912 } 912 }
913 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature)) < 0) { 913 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_TEMPERATURE", "%.1f", simulator->room_temperature)) < 0) {
914 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); 914 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
915 return 1; 915 return 1;
916 } 916 }
917 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "ROOM_HUMIDITY", "%.1f", simulator->room_humidity)) < 0) {
918 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
919 return 1;
920 }
917 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature)) < 0) { 921 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "AIR_TEMPERATURE", "%f", simulator->air_temperature)) < 0) {
918 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); 922 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
919 return 1; 923 return 1;
920 } 924 }
921 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature)) < 0) { 925 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "BEER_TEMPERATURE", "%f", simulator->beer_temperature)) < 0) {
922 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); 926 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
923 return 1; 927 return 1;
928 }
929 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "CHILLER_TEMPERATURE", "%f", simulator->chiller_temperature)) < 0) {
930 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
931 return 1;
924 } 932 }
925 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp)) < 0) { 933 if ((rc = xmlTextWriterWriteFormatElement(writer, BAD_CAST "COOLER_TEMP", "%f", simulator->cooler_temp)) < 0) {
926 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement"); 934 syslog(LOG_NOTICE, "wrconfig: error at xmlTextWriterWriteElement");
927 return 1; 935 return 1;
928 } 936 }
1933 simulator->next = NULL; 1941 simulator->next = NULL;
1934 simulator->version = 1; 1942 simulator->version = 1;
1935 simulator->uuid = simulator->name = NULL; 1943 simulator->uuid = simulator->name = NULL;
1936 simulator->volume_air = simulator->volume_beer = 0; 1944 simulator->volume_air = simulator->volume_beer = 0;
1937 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0; 1945 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0;
1946 simulator->chiller_temperature = 1.5;
1947 simulator->room_humidity = 49.2;
1938 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0; 1948 simulator->cooler_temp = simulator->cooler_size = simulator->heater_temp = simulator->heater_size = simulator->frigo_isolation = 0.0;
1939 simulator->cooler_time = simulator->heater_time = simulator->cooler_state = simulator->heater_state = 0; 1949 simulator->cooler_time = simulator->heater_time = simulator->cooler_state = simulator->heater_state = 0;
1940 simulator->s_yeast_started = simulator->s_cool_changed = simulator->s_heat_changed = (time_t)0; 1950 simulator->s_yeast_started = simulator->s_cool_changed = simulator->s_heat_changed = (time_t)0;
1941 simulator->s_yeast_heat = simulator->s_cool_temp = simulator->s_heat_temp = 0.0; 1951 simulator->s_yeast_heat = simulator->s_cool_temp = simulator->s_heat_temp = 0.0;
1942 1952
1973 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1983 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1974 if (sscanf((const char *)key, "%f", &fval) == 1) 1984 if (sscanf((const char *)key, "%f", &fval) == 1)
1975 simulator->room_temperature = fval; 1985 simulator->room_temperature = fval;
1976 xmlFree(key); 1986 xmlFree(key);
1977 } 1987 }
1988 if ((!xmlStrcmp(cur->name, (const xmlChar *)"ROOM_GUMIDITY"))) {
1989 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1990 if (sscanf((const char *)key, "%f", &fval) == 1)
1991 simulator->room_humidity= fval;
1992 xmlFree(key);
1993 }
1978 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) { 1994 if ((!xmlStrcmp(cur->name, (const xmlChar *)"AIR_TEMPERATURE"))) {
1979 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 1995 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1980 if (sscanf((const char *)key, "%f", &fval) == 1) 1996 if (sscanf((const char *)key, "%f", &fval) == 1)
1981 simulator->air_temperature = fval; 1997 simulator->air_temperature = fval;
1982 xmlFree(key); 1998 xmlFree(key);
1983 } 1999 }
1984 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) { 2000 if ((!xmlStrcmp(cur->name, (const xmlChar *)"BEER_TEMPERATURE"))) {
1985 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 2001 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1986 if (sscanf((const char *)key, "%f", &fval) == 1) 2002 if (sscanf((const char *)key, "%f", &fval) == 1)
1987 simulator->beer_temperature = fval; 2003 simulator->beer_temperature = fval;
2004 xmlFree(key);
2005 }
2006 if ((!xmlStrcmp(cur->name, (const xmlChar *)"CHILLER_TEMPERATURE"))) {
2007 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
2008 if (sscanf((const char *)key, "%f", &fval) == 1)
2009 simulator->chiller_temperature = fval;
1988 xmlFree(key); 2010 xmlFree(key);
1989 } 2011 }
1990 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_TEMP"))) { 2012 if ((!xmlStrcmp(cur->name, (const xmlChar *)"COOLER_TEMP"))) {
1991 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1); 2013 key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
1992 if (sscanf((const char *)key, "%f", &fval) == 1) 2014 if (sscanf((const char *)key, "%f", &fval) == 1)

mercurial