|
|
|
|
|
by rwjwjuwjudf
3734 days ago
|
|
Also you can decouple the handling of ac and heat, and check the current state to prevent a redundant transition into the current state. if (temp > max + error)
if (off (ac))
turn_on (ac);
if (temp < max - error)
if (on (ac))
turn_off (ac);
if (temp < min - error)
if (off (heat))
turn_on (heat);
if (temp > min + error)
if (on (heat))
turn_off (heat);
|
|
The take-away is that like programming lift controllers[0] it's not quite as simple as it might first seem - many many edge cases.
[0] http://play.elevatorsaga.com/ (for example)