Systems
Greenhouse Climate Simulation
A Java desktop simulation with independently timed environmental controllers, live equipment states, and saved histories for reviewing each run.
- Java
- Swing
- Concurrency
- Simulation
- File I/O
Exploring environmental feedback
I built a desktop application for exploring how a greenhouse responds to changing conditions and equipment settings.
Users configure targets and sampling intervals for temperature, humidity, and soil moisture, then inspect the simulated readings and save a history of the run.
Temperature control rule
target − 3 ≤ current ≤ target + 3
- Furnace
- Off
- Air conditioner
- Off
Both temperature actuators are off inside the target band.
Responding to a target band
I built a desktop simulation for exploring how temperature, humidity, and soil moisture respond to environmental change and actuator settings. Users choose starting conditions, targets, and rates, then watch the simulated values and equipment states during a run.
The temperature controller heats below the target band and cools above it. Both actuators turn off within three units of the target. Humidity and soil moisture each have one actuator, a humidifier or sprinkler, that activates below its lower threshold. These rules model feedback in software without physical sensors.
Coordinating independent controllers
Each environmental subsystem runs on its own worker with a configurable sampling interval. A separate results loop reads their values and actuator states for the Swing display. This lets temperature, humidity, and soil moisture advance at different rates.
The configuration form accepts rates in minutes or hours and converts sampling intervals into worker delays. Numeric parsing reports invalid input before a run starts. The view and controller objects are connected through constructor arguments, keeping setup separate from each subsystem’s update logic.
Independent timing also creates coordination work. The implementation shares mutable state with the results loop and needs stronger synchronization and worker shutdown handling; interrupting a thread alone does not reliably stop every subsystem.
Keeping a record of each run
Each display update appends elapsed time, environmental readings, and actuator states to a temporary text log. Saving copies the log to a named file and adds it to a local index. Users can reopen a previous run in a read-only results view.
The live display and saved history use the same snapshots, so a run can be inspected as it progresses and revisited afterward. All simulation state and files stay local to the desktop application.
Tools and technologies
- Java
- Swing
- AWT
- Runnable / Thread
- Java file I/O
Java Swing and AWT provide the desktop interface and events. Java threads drive the independently sampled controllers; standard file I/O handles run logs and saved history without an external service or database.