Greenhouse Watering System
Control greenhouse sprinklers based on soil moisture levels with hysteresis.
beginner
Parameters
| Name | Type | Usage | Description |
|---|
| In_Enable | BOOL | Input | System master enable. 0 disables sprinklers, 1 enables control. |
| In_SoilMoisture | REAL | Input | Current soil moisture percentage level. |
| Out_Sprinklers | BOOL | Output | Sprinkler control relay output. 1 for ON, 0 for OFF. |
Behavior
- When In_Enable is 0, set Out_Sprinklers to 0.
- When In_Enable is 1, compare In_SoilMoisture to set thresholds.
- If In_SoilMoisture is less than 30.0, set Out_Sprinklers to 1.
- If In_SoilMoisture is greater than or equal to 70.0, set Out_Sprinklers to 0.
- If In_SoilMoisture is greater than or equal to 30.0 and less than 70.0, maintain the current state of Out_Sprinklers.
Edge Cases
- In_SoilMoisture value is outside the 0.0 to 100.0 range.
- Initial scan when In_Enable transitions from 0 to 1.
Constraints
- Out_Sprinklers must be updated every scan while In_Enable is 1.
- Hysteresis logic must be stable within the 30.0 to 70.0 deadband.
Ready to start?
Open this exercise in Rungs Studio, write your solution, then click Test in the toolbar to verify your work against the built-in test cases.