Using the Case Study supplied, you are to create a program which meets the requirements then write a report which describes in detail how the program works. Your program, at a minimum, must demonstrate the use of variables, arrays, strings, control logic, file input/output and a simple GUI. To achieve maximum marks, you will also need to make use of a user-defined class with methods or special methods to perform needed calculations or other necessary actions.
Your report must describe the requirements of the application, outline the design of the solution, and provide a testing procedure to prove the application works. In your report, you will be expected to use flow charts to show control logic and assist with your description of the source code.
Most of the components for this program will be dealt with in workshops, but you will need to integrate them into a single working unit which matches the design proposed.
Case Study: Greenhouse Humidity control
Growing food or plants in a greenhouse environment requires control of many aspects of the internal environment including temperature, humidity, soil ph, soil moisture, nutrient level, and lighting. You have been employed to develop software that will simulate the control of humidity and soil moisture in a greenhouse. Your program will consist of two parts, one is the control system that will respond to sensor information to turn on/off a misting device, turn on/off a watering system and open/close ventilation windows. The second part of the program will act as simulated sensors allowing the user to simulate readings of a set of sensors (soil moisture, interior humidity, exterior humidity).
The greenhouse uses a misting system to increase the internal humidity and ventilation flaps to reduce the humidity. Soil moisture is increased through the use of irrigation soakers. The optimum values for these conditions vary depending on the requirements of the crops being grown in the greenhouse. These values will be determined and set by the farmer. (See table 1).
Table 1 Environmental Settings
Humidity 75 65 65 85 5%
Soil Moisture 20 20 25 30 10%
The range of values for any setting is between 0 and 100. A setting of 0 for humidity turns off humidity control. For soil moisture, 0 turns off the soakers. A setting of 100 turns on the relevant devices.
The control system:
Humidity control: In all cases, if the internal humidity is within the allowed variance, the misters are turned off. If the greenhouse humidity is below the required setting, and the external humidity value is above the required value, the ventilation flaps are opened and the mist system is left off. Otherwise the ventilation is closed and the misters are turned on. If the internal humidity is too high and external humidity is either lower or equal to the internal humidity, the misting system is turned off and the ventilation system is opened.
Soil moisture: The soakers are turned on if the soil moisture is below the required setting and they stay on until the reading reaches the setting plus the variance. They then remain off until the level falls below the setting.
For the control system, a GUI needs to provide for the system to show the state of the misting system, soakers and ventilation windows. The user should have buttons which provide for turning off the system, closing the system, running the system, and adjusting the environmental values.
The simulation system:
This is a simple GUI that allows values to be set for the sensors by a user. The values always range between 0 and 100 for each sensor. The time of day also needs to be set to one of the 4 values. Usually a control systems checks the values of the sensors about once every minute, but for simulation purposes, the simulation system can send a signal to the control system that its value has changed.
The GUI for this system should be available whenever the control system is turned on. The ‘default’ values for sensors should match the environmental settings.