All exercises

Greenhouse Watering System

Control greenhouse sprinklers in rungs.dev based on soil moisture with hysteresis: turn on below 30%, off at or above 70%, hold inside the deadband.

beginner

Parameters

NameTypeUsageDescription
In_EnableBOOLInputSystem master enable. 0 disables sprinklers, 1 enables control.
In_SoilMoistureREALInputCurrent soil moisture percentage level.
Out_SprinklersBOOLOutputSprinkler control relay output. 1 for ON, 0 for OFF.

Behavior

  1. When In_Enable is 0, set Out_Sprinklers to 0.
  2. When In_Enable is 1, compare In_SoilMoisture to set thresholds.
  3. If In_SoilMoisture is less than 30.0, set Out_Sprinklers to 1.
  4. If In_SoilMoisture is greater than or equal to 70.0, set Out_Sprinklers to 0.
  5. If In_SoilMoisture is greater than or equal to 30.0 and less than 70.0, maintain the current state of Out_Sprinklers.
  6. The hysteresis logic remains stable in the 30.0 to 70.0 deadband and evaluates the provided REAL value directly even when it is outside the 0.0 to 100.0 range.

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.