thermferm/server.c

changeset 553
4091d4fe217f
parent 545
c382a6c58c20
child 554
ab9f22ab57b5
equal deleted inserted replaced
552:8b56f1b4e7ec 553:4091d4fe217f
1573 uuid_unparse(uu, simulator->uuid); 1573 uuid_unparse(uu, simulator->uuid);
1574 simulator->name = xstrcpy(param); 1574 simulator->name = xstrcpy(param);
1575 simulator->volume_air = 150; 1575 simulator->volume_air = 150;
1576 simulator->volume_beer = 50; 1576 simulator->volume_beer = 50;
1577 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0; 1577 simulator->room_temperature = simulator->air_temperature = simulator->beer_temperature = simulator->s_cool_temp = simulator->s_heat_temp = 20.0;
1578 simulator->cooler_temp = -3.0; /* Cooling temperature */ 1578 simulator->room_humidity = 48.6;
1579 simulator->chiller_temperature = 1.5; /* Chiller temperature */
1580 simulator->cooler_temp = 1.5; /* Cooling temperature */
1579 simulator->cooler_time = 720; /* About 12 minutes for the cooler plate */ 1581 simulator->cooler_time = 720; /* About 12 minutes for the cooler plate */
1580 simulator->cooler_size = 0.8; /* 0.8 square meter cooler plate */ 1582 simulator->cooler_size = 0.8; /* 0.8 square meter cooler plate */
1581 simulator->heater_temp = 150.0; /* Heating temperature */ 1583 simulator->heater_temp = 150.0; /* Heating temperature */
1582 simulator->heater_time = 3; /* 3 seconds to heat-up */ 1584 simulator->heater_time = 3; /* 3 seconds to heat-up */
1583 simulator->heater_size = 0.01; /* 0.01 square meter heater plate */ 1585 simulator->heater_size = 0.01; /* 0.01 square meter heater plate */
1620 srv_send((char *)"213 Simulator record follows:"); 1622 srv_send((char *)"213 Simulator record follows:");
1621 srv_send((char *)"NAME,%s", simulator->name); 1623 srv_send((char *)"NAME,%s", simulator->name);
1622 srv_send((char *)"VOLUME_AIR,%d", simulator->volume_air); 1624 srv_send((char *)"VOLUME_AIR,%d", simulator->volume_air);
1623 srv_send((char *)"VOLUME_BEER,%d", simulator->volume_beer); 1625 srv_send((char *)"VOLUME_BEER,%d", simulator->volume_beer);
1624 srv_send((char *)"ROOM_TEMPERATURE,%.1f", simulator->room_temperature); 1626 srv_send((char *)"ROOM_TEMPERATURE,%.1f", simulator->room_temperature);
1627 srv_send((char *)"ROOM_HUMIDITY,%.1f", simulator->room_humidity);
1625 srv_send((char *)"AIR_TEMPERATURE,%.3f", simulator->air_temperature); 1628 srv_send((char *)"AIR_TEMPERATURE,%.3f", simulator->air_temperature);
1626 srv_send((char *)"BEER_TEMPERATURE,%.3f", simulator->beer_temperature); 1629 srv_send((char *)"BEER_TEMPERATURE,%.3f", simulator->beer_temperature);
1630 srv_send((char *)"CHILLER_TEMPERATURE,%.3f", simulator->chiller_temperature);
1627 srv_send((char *)"COOLER_TEMP,%.1f", simulator->cooler_temp); 1631 srv_send((char *)"COOLER_TEMP,%.1f", simulator->cooler_temp);
1628 srv_send((char *)"COOLER_TIME,%d", simulator->cooler_time); 1632 srv_send((char *)"COOLER_TIME,%d", simulator->cooler_time);
1629 srv_send((char *)"COOLER_SIZE,%.3f", simulator->cooler_size); 1633 srv_send((char *)"COOLER_SIZE,%.3f", simulator->cooler_size);
1630 srv_send((char *)"HEATER_TEMP,%.1f", simulator->heater_temp); 1634 srv_send((char *)"HEATER_TEMP,%.1f", simulator->heater_temp);
1631 srv_send((char *)"HEATER_TIME,%d", simulator->heater_time); 1635 srv_send((char *)"HEATER_TIME,%d", simulator->heater_time);
1685 if (simulator->room_temperature != fval) 1689 if (simulator->room_temperature != fval)
1686 syslog(LOG_NOTICE, "Simulator %s room temperature %.1f to %.1f", simulator->uuid, simulator->room_temperature, fval); 1690 syslog(LOG_NOTICE, "Simulator %s room temperature %.1f to %.1f", simulator->uuid, simulator->room_temperature, fval);
1687 simulator->room_temperature = fval; 1691 simulator->room_temperature = fval;
1688 } 1692 }
1689 1693
1694 } else if (strcmp(kwd, (char *)"ROOM_HUMIDITY") == 0) {
1695 if (sscanf(val, "%f", &fval) == 1) {
1696 if (simulator->room_humidity != fval)
1697 syslog(LOG_NOTICE, "Simulator %s room hunidity %.1f to %.1f", simulator->uuid, simulator->room_humidity, fval);
1698 simulator->room_humidity = fval;
1699 }
1700
1690 } else if (strcmp(kwd, (char *)"AIR_TEMPERATURE") == 0) { 1701 } else if (strcmp(kwd, (char *)"AIR_TEMPERATURE") == 0) {
1691 if (sscanf(val, "%f", &fval) == 1) { 1702 if (sscanf(val, "%f", &fval) == 1) {
1692 if (simulator->air_temperature != fval) 1703 if (simulator->air_temperature != fval)
1693 syslog(LOG_NOTICE, "Simulator %s air temperature %.1f to %.1f", simulator->uuid, simulator->air_temperature, fval); 1704 syslog(LOG_NOTICE, "Simulator %s air temperature %.1f to %.1f", simulator->uuid, simulator->air_temperature, fval);
1694 simulator->air_temperature = fval; 1705 simulator->air_temperature = fval;
1697 } else if (strcmp(kwd, (char *)"BEER_TEMPERATURE") == 0) { 1708 } else if (strcmp(kwd, (char *)"BEER_TEMPERATURE") == 0) {
1698 if (sscanf(val, "%f", &fval) == 1) { 1709 if (sscanf(val, "%f", &fval) == 1) {
1699 if (simulator->beer_temperature != fval) 1710 if (simulator->beer_temperature != fval)
1700 syslog(LOG_NOTICE, "Simulator %s beer temperature %.1f to %.1f", simulator->uuid, simulator->beer_temperature, fval); 1711 syslog(LOG_NOTICE, "Simulator %s beer temperature %.1f to %.1f", simulator->uuid, simulator->beer_temperature, fval);
1701 simulator->beer_temperature = fval; 1712 simulator->beer_temperature = fval;
1713 }
1714
1715 } else if (strcmp(kwd, (char *)"CHILLER_TEMPERATURE") == 0) {
1716 if (sscanf(val, "%f", &fval) == 1) {
1717 if (simulator->chiller_temperature != fval)
1718 syslog(LOG_NOTICE, "Simulator %s chiller temperature %.1f to %.1f", simulator->uuid, simulator->chiller_temperature, fval);
1719 simulator->chiller_temperature = fval;
1702 } 1720 }
1703 1721
1704 } else if (strcmp(kwd, (char *)"COOLER_TEMP") == 0) { 1722 } else if (strcmp(kwd, (char *)"COOLER_TEMP") == 0) {
1705 if (sscanf(val, "%f", &fval) == 1) { 1723 if (sscanf(val, "%f", &fval) == 1) {
1706 if (simulator->cooler_temp != fval) 1724 if (simulator->cooler_temp != fval)

mercurial