21 *****************************************************************************/ |
21 *****************************************************************************/ |
22 |
22 |
23 #include "thermferm.h" |
23 #include "thermferm.h" |
24 #include "simulator.h" |
24 #include "simulator.h" |
25 |
25 |
|
26 int my_simulator_state = 0; |
|
27 |
26 #ifdef USE_SIMULATOR |
28 #ifdef USE_SIMULATOR |
27 |
29 |
28 extern int my_shutdown; |
30 extern int my_shutdown; |
29 extern sys_config Config; |
31 extern sys_config Config; |
30 |
32 |
31 int SIMcooling = 0; |
33 int SIMcooling = 0; |
32 int SIMheating = 0; |
34 int SIMheating = 0; |
33 int SIMfan = 0; |
35 int SIMfan = 0; |
34 int SIMlight = 0; |
36 int SIMlight = 0; |
35 |
37 |
36 |
38 |
37 #ifdef HAVE_WIRINGPI_H |
|
38 PI_THREAD (my_simulator_loop) |
|
39 #else |
|
40 void *my_simulator_loop(void *threadid) |
39 void *my_simulator_loop(void *threadid) |
41 #endif |
|
42 { |
40 { |
43 simulator_list *simulator; |
41 simulator_list *simulator; |
44 time_t now, last = (time_t)0; |
42 time_t now, last = (time_t)0; |
45 int seconds = 0; |
43 int seconds = 0; |
46 double k_room_air, sqm_room_air, thick_room_air, air_heat_transfer; |
44 double k_room_air, sqm_room_air, thick_room_air, air_heat_transfer; |
47 double air_change, vhc_air = 0.00121; |
45 double air_change, vhc_air = 0.00121; |
48 |
46 |
|
47 my_simulator_state = 1; |
49 syslog(LOG_NOTICE, "Thread my_simulator_loop started"); |
48 syslog(LOG_NOTICE, "Thread my_simulator_loop started"); |
50 |
49 |
51 for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
50 for (simulator = Config.simulators; simulator; simulator = simulator->next) { |
52 /* |
51 /* |
53 * Heater and cooler have the air temperature |
52 * Heater and cooler have the air temperature |