Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CMPSC 200 Lab 1 Objectives: HVAC Control 1. Practice using variable assignment, order of operations, and Boolean operations. 2. Create the commands necessary to determine
CMPSC 200 Lab 1 Objectives: HVAC Control 1. Practice using variable assignment, order of operations, and Boolean operations. 2. Create the commands necessary to determine the control of a simple HVAC system. HVAC Control Logic The heating, ventilation, and air conditioning system of a building has a complex set of controls to keep the temperature and humidity of a building within comfortable parameters. For this lab, we are considering the control of a system that has a heater, an air conditioner, a humidifier, and a dehumidifier. The system is used to keep the temperature between 68F and 72F and the relative humidity between 40% and 60%. In this lab you will: . . Develop the lines of code that will calculate the relative humidity based on sensor readings. Determine whether the heater and air conditioner are on or off. Determine whether the humidifier and dehumidifier are on or off. Check that two devices are not working against each other. Check if the temperature and humidity are within a comfortable range. . Instructions: Setup: 1. Open MATLAB and navigate to the MATLAB folder in your personal drive if it doesn't open there automatically. 2. Create the folder "Lab 01" in your MATLAB directory. Open the folder. 3. Download "GetPartialPressureWater.m" and "GetTemp.m" from Canvas and put them in the "Lab 01" folder. 4. (2 pts) Click the "New Script" button at the top left of the screen. Save the script as "psu123_Lab01.m" replacing psu123 with your email ID. 5. (2 pts) Typing commands into a script file allows a series of commands to be saved together and run all at once. You can still test commands in the Command Window, but all of your commands should be saved, in order, in the script file. You can run the script either by clicking the green arrow at the top of the Editor window in the Editor tab or by typing the name of the script file into the command window. At the beginning of the script type the following lines: % Your Name, Class and Section #, Lab #, date, Year format compact clear clc Calculations: 6. (15 pts) Follow camel case or underscore conventions for variable names. Whenever you are not given the variable name to use for something, you decide what to name your variable. Be sure that you follow good variable naming practices. Note that the variables as shown in the equation below do not follow good naming practice as they are not very descriptive 7. (5 pts) Your first step should be to use the provided functions to obtain values for the partial pressure of water vapor in the air and the air temperature and store those values in variables created for them. Variable names should be easily understood, but not overly lengthy. These functions require no inputs and can be used as follows: yourVariableName = GetPartialPressure Water() yourVariableName = GetTemp() 8. (20 pts) Calculate the saturation pressure for water vapor based on the following equation: 67) *) (1- T +459.67 T +459.67 T +459.67 1165.67 4.39553-3.469. +3.072 -0.8833 1000 1000 1000 Psat 3226 * 101 T +459.67 where Psat will be in psia and T is the temperature in F. At 100F you should calculate Psat to be 0.949 psia. Note: This is a very long equation, you should break it up into manageable pieces. For instance, you could define a variable T_R=T + 459.67. No equation should span multiple lines or require scrolling sideways in MATLAB. 9. (6 pts) Relative humidity is the ratio of the partial pressure of water vapor in the air to the saturation pressure. Calculate the relative humidity and store the value in new variable. Logic: 10. (5 pts) Using relational operators, determine whether the heater should be on or off. Write an equation that stores a value of True in a Boolean variable if the heater should be on. 11. (5 pts each) Repeat the previous step for the air conditioner, humidifier, and dehumidifier. 12. (10 pts) Set-up an expression using logical operators that will evaluate to True if the heater and AC are both on or if the humidifier and dehumidifier are both on and assign the result to a variable named "malfunction". 13. (10 pts) Using relational operators and logical operators, set up an expression that evaluates to True if the temperature and humidity are within a comfortable range. Assign the value of this expression to the variable "isComfy". Finalize: 14. (10 pts) Test the final version of your script before submitting on Canvas. The script you submit must suppress all output except: the temperature, the relative humidity, the status of each device, the results of the malfunction test, and the results of the comfortable range test. 15. Save and upload your document to Canvas. CMPSC 200 Lab 1 Objectives: HVAC Control 1. Practice using variable assignment, order of operations, and Boolean operations. 2. Create the commands necessary to determine the control of a simple HVAC system. HVAC Control Logic The heating, ventilation, and air conditioning system of a building has a complex set of controls to keep the temperature and humidity of a building within comfortable parameters. For this lab, we are considering the control of a system that has a heater, an air conditioner, a humidifier, and a dehumidifier. The system is used to keep the temperature between 68F and 72F and the relative humidity between 40% and 60%. In this lab you will: . . Develop the lines of code that will calculate the relative humidity based on sensor readings. Determine whether the heater and air conditioner are on or off. Determine whether the humidifier and dehumidifier are on or off. Check that two devices are not working against each other. Check if the temperature and humidity are within a comfortable range. . Instructions: Setup: 1. Open MATLAB and navigate to the MATLAB folder in your personal drive if it doesn't open there automatically. 2. Create the folder "Lab 01" in your MATLAB directory. Open the folder. 3. Download "GetPartialPressureWater.m" and "GetTemp.m" from Canvas and put them in the "Lab 01" folder. 4. (2 pts) Click the "New Script" button at the top left of the screen. Save the script as "psu123_Lab01.m" replacing psu123 with your email ID. 5. (2 pts) Typing commands into a script file allows a series of commands to be saved together and run all at once. You can still test commands in the Command Window, but all of your commands should be saved, in order, in the script file. You can run the script either by clicking the green arrow at the top of the Editor window in the Editor tab or by typing the name of the script file into the command window. At the beginning of the script type the following lines: % Your Name, Class and Section #, Lab #, date, Year format compact clear clc Calculations: 6. (15 pts) Follow camel case or underscore conventions for variable names. Whenever you are not given the variable name to use for something, you decide what to name your variable. Be sure that you follow good variable naming practices. Note that the variables as shown in the equation below do not follow good naming practice as they are not very descriptive 7. (5 pts) Your first step should be to use the provided functions to obtain values for the partial pressure of water vapor in the air and the air temperature and store those values in variables created for them. Variable names should be easily understood, but not overly lengthy. These functions require no inputs and can be used as follows: yourVariableName = GetPartialPressure Water() yourVariableName = GetTemp() 8. (20 pts) Calculate the saturation pressure for water vapor based on the following equation: 67) *) (1- T +459.67 T +459.67 T +459.67 1165.67 4.39553-3.469. +3.072 -0.8833 1000 1000 1000 Psat 3226 * 101 T +459.67 where Psat will be in psia and T is the temperature in F. At 100F you should calculate Psat to be 0.949 psia. Note: This is a very long equation, you should break it up into manageable pieces. For instance, you could define a variable T_R=T + 459.67. No equation should span multiple lines or require scrolling sideways in MATLAB. 9. (6 pts) Relative humidity is the ratio of the partial pressure of water vapor in the air to the saturation pressure. Calculate the relative humidity and store the value in new variable. Logic: 10. (5 pts) Using relational operators, determine whether the heater should be on or off. Write an equation that stores a value of True in a Boolean variable if the heater should be on. 11. (5 pts each) Repeat the previous step for the air conditioner, humidifier, and dehumidifier. 12. (10 pts) Set-up an expression using logical operators that will evaluate to True if the heater and AC are both on or if the humidifier and dehumidifier are both on and assign the result to a variable named "malfunction". 13. (10 pts) Using relational operators and logical operators, set up an expression that evaluates to True if the temperature and humidity are within a comfortable range. Assign the value of this expression to the variable "isComfy". Finalize: 14. (10 pts) Test the final version of your script before submitting on Canvas. The script you submit must suppress all output except: the temperature, the relative humidity, the status of each device, the results of the malfunction test, and the results of the comfortable range test. 15. Save and upload your document to Canvas
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