thermferm/simulator.c

changeset 571
6f8eda55ec2c
parent 553
4091d4fe217f
child 595
d7342a8e7f4d
equal deleted inserted replaced
570:1e0192b295b9 571:6f8eda55ec2c
1 /***************************************************************************** 1 /*****************************************************************************
2 * Copyright (C) 2008-2018 2 * Copyright (C) 2014-2019
3 * 3 *
4 * Michiel Broek <mbroek at mbse dot eu> 4 * Michiel Broek <mbroek at mbse dot eu>
5 * 5 *
6 * This file is part of the mbsePi-apps 6 * This file is part of the mbsePi-apps
7 * 7 *
46 int seconds = 0; 46 int seconds = 0;
47 double k_room_air, sqm_room_air, thick_room_air, air_heat_transfer; 47 double k_room_air, sqm_room_air, thick_room_air, air_heat_transfer;
48 double air_change, vhc_air = 0.00121; 48 double air_change, vhc_air = 0.00121;
49 49
50 syslog(LOG_NOTICE, "Thread my_simulator_loop started"); 50 syslog(LOG_NOTICE, "Thread my_simulator_loop started");
51 if (debug)
52 fprintf(stdout, "Thread my_simulator_loop started\n");
53 51
54 for (simulator = Config.simulators; simulator; simulator = simulator->next) { 52 for (simulator = Config.simulators; simulator; simulator = simulator->next) {
55 /* 53 /*
56 * Heater and cooler have the air temperature 54 * Heater and cooler have the air temperature
57 */ 55 */
126 // Cheap trick, just follow slowly the air temp. 124 // Cheap trick, just follow slowly the air temp.
127 simulator->beer_temperature += ((simulator->air_temperature - simulator->beer_temperature) / 500.0); 125 simulator->beer_temperature += ((simulator->air_temperature - simulator->beer_temperature) / 500.0);
128 simulator->air_temperature += ((simulator->beer_temperature - simulator->air_temperature) / 2500.0); 126 simulator->air_temperature += ((simulator->beer_temperature - simulator->air_temperature) / 2500.0);
129 simulator->chiller_temperature = simulator->cooler_temp; // Libk these 127 simulator->chiller_temperature = simulator->cooler_temp; // Libk these
130 128
131 if ((seconds % 15) == 0) 129 // if ((seconds % 15) == 0)
132 syslog(LOG_NOTICE, "air=%.3f beer=%.3f heater=%.3f cooler=%.3f", simulator->air_temperature, simulator->beer_temperature, 130 // syslog(LOG_NOTICE, "air=%.3f beer=%.3f heater=%.3f cooler=%.3f", simulator->air_temperature, simulator->beer_temperature,
133 simulator->s_heat_temp, simulator->s_cool_temp); 131 // simulator->s_heat_temp, simulator->s_cool_temp);
134 132
135 // if (debug) 133 // if (debug)
136 // fprintf(stdout, "sqm_room_air=%f air=%f air_heat_transfer=%f air_change=%f beer=%f\n", 134 // fprintf(stdout, "sqm_room_air=%f air=%f air_heat_transfer=%f air_change=%f beer=%f\n",
137 // sqm_room_air, simulator->air_temperature, air_heat_transfer, air_change, simulator->beer_temperature); 135 // sqm_room_air, simulator->air_temperature, air_heat_transfer, air_change, simulator->beer_temperature);
138 } 136 }
140 } 138 }
141 usleep(50000); 139 usleep(50000);
142 } 140 }
143 141
144 syslog(LOG_NOTICE, "Thread my_simulator_loop stopped"); 142 syslog(LOG_NOTICE, "Thread my_simulator_loop stopped");
145 if (debug)
146 fprintf(stdout, "Thread my_simulator_loop stopped\n");
147 return 0; 143 return 0;
148 } 144 }
149 145
150 146
151 #endif 147 #endif

mercurial