A team project (2026-08) from the SSHS invention class "Smart Inventions with Boolean Algebra and Logic Gates". The rules that read 6 sensors and control 4 devices are written with only the three operations and, or, and not, and verified with a 64-row truth table.
The program, originally built as a tkinter window, was also ported to a simulator that needs no installation. It includes the truth table and the full test.
In a classroom, the air conditioner runs with a window left open, the heating is on with nobody there, and the air feels stuffy but nobody opens a window. The conditions for switching things on are clear, yet people miss them every time, so those conditions were written as logic expressions and left to a machine to decide.
Inputs and outputs
| Input | Meaning | Output | Meaning | |
|---|---|---|---|---|
R |
Is automatic mode on? | C |
Cooling | |
P |
Is someone in the classroom? | H |
Heating | |
W |
Is a window open? | A1 |
Close-window alarm | |
T1 |
Is the outdoor temperature above 28 °C? | A2 |
Open-window alarm | |
T2 |
Is the outdoor temperature below 18 °C? | |||
Q |
Is the carbon dioxide level high? |
With 6 inputs there are 2⁶ = 64 possible combinations. All of them were written out in a truth table and verified.
Logic expressions
hot = T1 and (not T2) # 더위 신호가 믿을 만한가
cold = T2 and (not T1) # 추위 신호가 믿을 만한가
C = R and P and (not W) and hot and (not Q)
H = R and P and (not W) and cold and (not Q)
A1 = R and P and W and (hot or cold) and (not Q)
A2 = P and (not W) and Q
When automatic mode is off, a person switches cooling and heating on and off directly. This is a 2:1 multiplexer with R as the select signal. The alarms are a safety feature, so they keep using the automatic decision even in manual mode.
C_최종 = (R and C) or ((not R) and 수동냉방)
H_최종 = (R and H) or ((not R) and 수동난방)
Results at a glance
- Of the 64 combinations, only 12 turn any device on. The other 52 leave everything off.
- Cooling and heating, and the close-window and open-window alarms, are never on together in any combination.
- Full test comparing the 64 truth table rows with the actual behavior: 64 / 64 passed.
| R | P | W | T1 | T2 | Q | C | H | A1 | A2 | Action |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | Auto cooling |
| 1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | Auto heating |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | Close-window alarm |
| 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | Close-window alarm |
| 0 | 1 | 0 | * | * | 1 | 0 | 0 | 0 | 1 | Open-window alarm (4 combinations) |
| 1 | 1 | 0 | * | * | 1 | 0 | 0 | 0 | 1 | Open-window alarm (4 combinations) |
* means the value of the temperature sensors does not matter. The air quality alarm does not look at temperature.
Three fixes made during design
| Problem | Symptom | Fix |
|---|---|---|
A1 had no window condition |
"Please close it" sounded while the window was closed | Added W |
A2 had no window condition |
"Please open it" sounded while the window was open | Added not W |
T1 and T2 could both be true |
Cooling and heating turned on together | Split into hot / cold |
The third is a physically impossible input. The temperature cannot be above 28 °C and below 18 °C at the same time, so if the sensors report that, it is treated as a fault and all the temperature-driven outputs are stopped. None of the three could be found from the expressions alone; all were found while scanning the 64 truth table rows by eye.
See also
- Design notes → — The assignment spec, the conditions in plain language, the design rationale, how it was verified, and what changed in the move to the web.
- classroom_hvac.py — The original tkinter implementation. It uses only the Python standard library, so there is nothing to install.
classroom_hvac.pyis published under the MIT license together with the내작업/folder of the original repository. You are free to use and modify it.- The practice files and PDFs received in class are not uploaded here because their authors hold the copyright. They are in the GitHub repository for reference.