CNET232 Week 1 Assignments TECH153 L04A – Greenhouse Controller II Overview In lab03 we returned fixed data values for the sensors. To help test the logic of our controller we are now going to have...

green house controller


CNET232 Week 1 Assignments TECH153 L04A – Greenhouse Controller II Overview In lab03 we returned fixed data values for the sensors. To help test the logic of our controller we are now going to have the sensor routines return random values in the control range, making use of our GhGetRandom function. As well we are going to change the interface to our set control function to respond to these test values. Task 1 – Simulating Reading Values Declare the constants SIMULATE with a value 1, USTEMP with a value 50, LSTEMP with a value -10, USHUMID with a value 100, LSHUMID with a value 0, USPRESS with a value 1016, LSPRESS with a value 985, USLIGHT with a value 255, and LSLIGHT with a value 0. Modify the following new functions to the ghcontrol.h/c files. Use the preprocessor and the SIMULATE constant to control either returning a simulated range of reading values or the current single fixed value. double GhGetTemperature(void); When simulating this function will return a random value between USTEMP and LSTEMP. double GhGetHumidity(void); When simulating this function will return a random value between USHUMID and LSHUMID. double GhGetPressure(void); When simulating this function will return a random value between USPRESS and LSPRESS double GhGetLight(void); When simulating this function will return a random value between USLIGHT and LSLIGHT inclusive. Task 2 – Display Setpoints Function In ghcontrol.h define constants for the setpoints, STEMP with a value 25.0, SHUMID with a value 55.0, and SLIGHT with a value of 255.0 Add a fprintf statement of print the setpoint data to the screen using these constants. Task 3 – Collecting Your Results 1. Use the WinSCP program to transfer your lab04 folder on the RPI and its contents to your H: network drive using the same folder structure as with the RPI. 2. Open up a new Word document and make a section title Lab04 Part A 3. Copy and paste the source code from lab04.c, makefile, ghcontrol.h, ghcontrol.c, ghutils.h, ghutils.c and a screenshot into this document. 4. Save the document with the file name LastName153S18L04, where you substitute your last name as viewed in Blackboard for the ‘LastName’ characters. Save the document to your H: drive in the lab04 folder there. We will be adding to this document in part B of this lab before submitting it on Blackboard Sample Output Screen: CNET232 Week 1 Assignments TECH153 L04B – Greenhouse Controller II Overview In part A we returned simulated data values for the sensors and displayed some setpoint values. In this lab we are going to use pointers to some global variables to set and display data that will be used by environmental controls for temperature, humidity, and light. Task 1 – Setting Controls This function will do the logic for controlling a heater, humidifier, and supplemental lighting in response to setpoint data and the current readings. Modify the current Set Controls function as follows: void GhSetControls(int * heater, int * humidifier, int * light, double readings[SENSORS]); 1. This function is passed references to the environment controls, and current sensor readings. 2. Declare constants ON with a value of 1, and OFF with a value of 0. 3. If the temperature is less than STEMP then heater is set to ON else it is set to OFF. 4. If the humidity is less than SHUMID then humidifier is set to ON else it is set to OFF. 5. The light variable is set to SLIGHT – the current light sensed. Task 2 – Displaying Controls Modify the DisplayControls function to have three pointer parameters with the control data and use these to print out this data to the screen. void GhDisplayControls(int * heater, int * humidifier, int * light); Create a printf statement to use the values passed to this function. Note that these parameters are memory addresses so to access the data you must use the dereferencing operator *. Task 3 – Calling The Functions In the main function create three integer variables tempc, humidc, and lightc and pass the addresses of these as arguments to the controls functions. Task 4 – Submitting Your Lab 1. Use the WinSCP program to transfer your lab04 folder on the RPI and its contents to your H: network drive using the same folder structure as with the RPI. 2. Open your lab04 word document and make a section title Lab04 Part B 3. Copy and paste the source code from lab04.c, ghcontrol.c/.h, ghutils.c/.h, and a screen shot into this. 4. Save the document with the file name LastName153S18L04, where you substitute your last name as viewed in Blackboard for the ‘LastName’ characters. Save the document to your H: drive in the lab04 folder there before submitting it on Blackboard Sample Output Screen:
Jun 09, 2020
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here