> For the complete documentation index, see [llms.txt](https://help.qtech.co.nz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qtech.co.nz/water-insight/sprinkler-control/irrigation-point-controller/valve-control.md).

# How the IPC runs its valve

How an IPC decides when to open and close its valve, from its clock, its day cycle and its schedule.

In general terms the main job of the IPC is to switch a valve on and off at certain times of day.

{% hint style="info" %}
**Applies to:** all IPCs. From application note AN17 (Rev 01), AN36 (Rev 02) and the QIMS IPC and EP3 User Guide V4.1.
{% endhint %}

## The clock and the cycle

The IPC has an internal clock that maintains the current date and time, but which also keeps track of which day it is in the cycle. The cycle is the period of time over which a schedule operates. Think of the cycle as being a period of time just like a week, only it doesn't have to be seven days long. It must be specified during the configuration process and can be any number of days between 1 and 16 long. For example, it's the 2nd day of a 3 day cycle.

* In version 5 of the firmware the cycle period is defined in the schedule file.
* In systems prior to version 5 the cycle length and current day of the cycle are part of the Timeset message sent out to the IPCs from the EP3 or INC.

## The schedule

The schedule defines when the IPC will turn its valve on and off each cycle in a general way. Below is an example of the information contained in a schedule.

| Day of the cycle | Valve on | Valve off |
| ---------------- | -------- | --------- |
| 1                | 8:00     | 8:30      |
| 3                | 14:30    | 15:00     |
| 4                | 20:00    | 20:30     |

The alarm table is a list of date and time values that the IPC calculates which are used during the currently running cycle. The IPC uses these date and time values to set alarms in its internal clock.

## What makes the valve move

| Event                      | What the IPC does                                                                                                                                                                                                                                                                                                                                           |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Midnight                   | Increment the current day of the cycle. If the current day was the last day of the cycle then also reset the current day of the cycle back to 1 and calculate the alarm table Time/Date values for the current (new) cycle. At midnight (IPC time) all schedules are re-calculated and solenoids are attempted to be switched to match intended scheduling. |
| A valve-on time            | Opens the valve                                                                                                                                                                                                                                                                                                                                             |
| A valve-off time           | Close the valve. Set Valve On and Valve Off alarms and increment the current alarm index.                                                                                                                                                                                                                                                                   |
| A new schedule arrives     | Store the schedule to memory. Calculate the alarm table Time/Date values for the current (new) cycle. Find the next Valve On alarm time in the alarm table based on the date and time now and set the current alarm index to this entry. Set Valve On and Valve Off alarms and increment the current alarm index.                                           |
| A timeset arrives          | Update the clock time and date values including the cycle length and current day of the cycle. After a timeset (e.g. global timeset to site) IPCs recalculate their schedule and solenoids are attempted to be switched to match intended scheduling (v5 firmware and above only).                                                                          |
| A manual on or off arrives | Opens or closes the valve                                                                                                                                                                                                                                                                                                                                   |

## What the IPC can't tell you

The IPC will send a pulse to the solenoid in the appropriate direction for an open/close operation. However, there is no feedback of whether the solenoid plunger has moved or any indication a valve has actually operated as intended.

Valve ON (open) – solenoid plunger is pulled in; bonnet drain orifice is open. Valve OFF (closed) – solenoid plunger is pushed out; bonnet drain orifice is closed.

## Inhibit

An inhibited IPC has all scheduled watering deliberately suspended. Starting the schedule distribution process will bring any inhibited IPCs out of the inhibited state when they receive their schedule file.

If a valve seems to be on or off at the wrong time, see [The sprinkler won't turn off, or runs at the wrong time](https://help.qtech.co.nz/water-insight/sprinkler-control/irrigation-point-controller/troubleshooting/valve-wrong.md).
