Question
c++ code only. tested numbers must MATCH EXACTLY how you see here! Many homes nowadays are equipped with what is known as a dual zone
c++ code only. tested numbers must MATCH EXACTLY how you see here!
Many homes nowadays are equipped with what is known as a dual zone Heating, Ventilation, and Air Conditioning (HVAC) system. There is usually one thermostat upstairs and one downstairs, so each floor can be heated or cooled separately. The thermostat is the little control panel on the wall where you can set the desired temperature. There is a controller in the attic that handles the logic of when to run the AC, when to run the furnace, and which floor to allow air flow into. The air flow is controlled by what is called a damper. The damper is a valve that either opens or closes the pipe where air flows into a floor. There is one damper on each floor.
You will write the code for a hyptothetical dual zone HVAC controller. Here are the requirements:
Initialize the zone 1 temperature and zone 1 thermostat to 75 degrees
Initialize the zone 2 temperature and zone 2 thermostat to 80 degrees
Initialize the controller status to HVAC OFF
Initialize both dampers to CLOSED
Run a loop that prints the status of the system and asks for user input with the following numerical menu:
Status: HVAC OFF Zone 1 thermostat: 75 Zone 2 thermostat: 80 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns
Allow the user to set the thermostats for each floor to a desired temperature
Assume that waiting 1 turn will wait the amount of time for the house to change by 1 degree
If the damper is open for a floor, then add 1 degree per turn if the furnace is on and subtract 1 per turn if the AC is on
Waiting 10 turns will change the house by 10 degrees, or reach a stable temperature, whichever comes first
Note that in the initial setup above, since the thermostats match the zone temperatures, the HVAC system is stable and will not turn anything on.
If a thermostat setting is less than its zone temperature, set the status to AC ON and open the damper for that zone.
If a thermostat setting is greater than its zone temperature, set the status to FURNACE ON and open the damper for that zone.
AC ON takes priority over FURNACE ON. You can't have both at the same time.
If a thermostat setting is equal to its zone temperature, close the damper for that zone.
If both thermostats are equal to their zone temperatures, set the status to HVAC OFF
A sample run of the program where cooling is activated and then stabilized for both zones is as follows. Note: Your output must exactly match for full points.
Status: HVAC OFF Zone 1 thermostat: 75 Zone 2 thermostat: 80 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 1 Set the thermostat for zone 1: 73 Set the thermostat for zone 2: 77 Status: AC ON Zone 1 thermostat: 73 Zone 2 thermostat: 77 Zone 1 damper is OPEN Zone 2 damper is OPEN Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 2 Status: AC ON Zone 1 thermostat: 73 Zone 2 thermostat: 77 Zone 1 damper is OPEN Zone 2 damper is OPEN Zone 1 temperature: 74 Zone 2 temperature: 79 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 2 Status: AC ON Zone 1 thermostat: 73 Zone 2 thermostat: 77 Zone 1 damper is CLOSED Zone 2 damper is OPEN Zone 1 temperature: 73 Zone 2 temperature: 78 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 2 Status: HVAC OFF Zone 1 thermostat: 73 Zone 2 thermostat: 77 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 73 Zone 2 temperature: 77 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns
A sample run where heating is activated for both zones and is stabilized is as follows:
Status: HVAC OFF Zone 1 thermostat: 75 Zone 2 thermostat: 80 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 1 Set the thermostat for zone 1: 78 Set the thermostat for zone 2: 81 Status: Furnace ON Zone 1 thermostat: 78 Zone 2 thermostat: 81 Zone 1 damper is OPEN Zone 2 damper is OPEN Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 2 Status: Furnace ON Zone 1 thermostat: 78 Zone 2 thermostat: 81 Zone 1 damper is OPEN Zone 2 damper is CLOSED Zone 1 temperature: 76 Zone 2 temperature: 81 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 2 Status: Furnace ON Zone 1 thermostat: 78 Zone 2 thermostat: 81 Zone 1 damper is OPEN Zone 2 damper is CLOSED Zone 1 temperature: 77 Zone 2 temperature: 81 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 2 Status: HVAC OFF Zone 1 thermostat: 78 Zone 2 thermostat: 81 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 78 Zone 2 temperature: 81 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns
A sample run where the wait 10 turns feature is utilized is as follows:
Status: HVAC OFF Zone 1 thermostat: 75 Zone 2 thermostat: 80 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 1 Set the thermostat for zone 1: 75 Set the thermostat for zone 2: 87 Status: Furnace ON Zone 1 thermostat: 75 Zone 2 thermostat: 87 Zone 1 damper is CLOSED Zone 2 damper is OPEN Zone 1 temperature: 75 Zone 2 temperature: 80 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns 3 Status: HVAC OFF Zone 1 thermostat: 75 Zone 2 thermostat: 87 Zone 1 damper is CLOSED Zone 2 damper is CLOSED Zone 1 temperature: 75 Zone 2 temperature: 87 Enter a menu choice: 0) Quit 1) Set thermostats 2) Wait 1 turn 3) Wait 10 turns
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started