Formulas, Functions and Variables

Probe for Windows can use variables, formulas, operators, functions and constants in various places...

Global formulas

Use: ProbeMenu/Global formulas

Global formulas and functions calculate results and variables that can be used anywhere else in Prwin - the values are global and available to all sites. For example...

Global Formula Comment
SHIRAZFAC = 0.25 SHIRAZFAC can now be used in limit formulas
BUDBURST = #12 December 2001# BUDBURST can be used to plot lines on graph reports

Readings screen

Use: SitesMenu/Edit Keydata tab

Formulas must start with a +, - or @. and can be optionally followed by a colon (:) and the number of decimal places or a format code.


Formula Output Comment
+COTTON.DWU:DWU 3.2 Value from dwu file for each date in the readings screen, displayed in user selected dwu units. Can also be graphed
@CUM(EDWU):0 134 Accumulated daily water use over the season, giving total water through the plant, to 0 decimal places.
@LKV(CLAY.RTN,RZ1/70):2 56.32 Calculate the equivalent soil moisture tension from lookup file CLAY.RTN, display to 2 decimal places.
but see functions

Upper and Lower Limits

Use: ReadingsMenu/Scheduling Current State tab

The upper and lower limit for irrigation scheduling is calculated from a formula.
The default formulas are UPPER: FULL, and LOWER: REFILL


  Formula Value Comment
LOWER REFILL-20 190 Set lower limit to 20 mm below refill
UPPER FULL-(FULL-REFILL)*0.5 234 Set upper limit to 50% to refill
LOWER PWP+(FULL-PWP)*SHIRAZFAC 175 Set lower limit to be between permanent wilting and full. Actual position set with global variable SHIRAZFAC
LOWER REFILL-(FULL-REFILL)*SHIRAZ.FAC   Similar to above, but position factor read from season file SHIRAZ.FAC.

The upper and lower limits can be graphed.

Historical daily water use

Use: ReadingsMenu/Scheduling Historical DWU tab

There is a single global formula to calculate the current daily water use from historical data; and in addition each site can optionally have it's own formula. If the site formula is blank the global formula takes precedence.

The value of the site historical dwu is used...

  1. As the suggested value of estimated dwu when posting irrigation's, rainfalls and readings; which the user can change.
  2. When calculating the third predicted irrigation (GPIAMT and GPIDATE)


Formula Output Comment
4.3 4.3 mm/day Always 4.3 mm/day
COTTON.DWU 2.3 mm/day Current value from this dwu file
COTTON.DWU * 1.2 2.8 mm/day Increase value by 20%

Print Reports and Export

Use: FileMenu/Export

Each line in the report definition file will print some data from a source (or calculated from a formula) at a nominated position on the paper - see page 59 for a full description.

Examples of formulas

Formula Output Comment
EDWU 2.3 mm/day Estimated daily water use
EPIAMT 132 Amount in mm that needs to be applied at the scheduled irrigation
EPIAMT*AREA*FACTOR2 2.3 mm/day Amount required in Kl, multiplied by site factor as set on ReadingsMenu/Scheduling delivery tab
DELIVIRRI*AREA*10 2,345 Kl Total amount delivered in kl
WATERTIME/WATERVOL 2,345 Kl/day Delivery rate
24*DELIVIRRI*WATERTIME*AREA*10/WATERVOL 145 hrs Total amount delivered in hours

The output can be scaled depending on the units selected by the user with ProbeMenu/DisplayUnits.

Report output can be restricted with a where clause - for example...

Where Clause Comment
EPIDATE < (TODAY+3) Only output scheduled irrigation's due in the next 3 days
CRNTAMT< (REFILL+20) Only output sites that are within 20 mm of the refill point

Graph reports

Use: ProbeMenu/SystemOptionsreport definition tab to edit the GPT file

Line in the graph report definition file can print data from a source (or calculated from a formula) at a nominated position on the paper, or plot boxes, lines and arrows - see page 23 for a full description.

Formulas for data are similar to export.

Some examples of formulas to plot lines and arrows

X1 X2 Y1 Y2 Type Comment
80 20 95 40 BOX Plot box from 80,20 to 95,40
80 20 CRNTDATE CRNTAMT LINE Plot line from 80,20 on paper to last probe readings
PREVDATE PREVAMT PREVDATE PREVAMT+10 ARROW vertical arrow pointing at last probe reading
BUDBURST BUDBURST TYMIN TYMAX LINE Line at BUDBURST date (as set on global formulas), the full height of the time graph

Graph Scales

The scales for a graph can be entered as a fixed number (e.g. 20 or 1/1/2001), or as a formula.
Scales can be entered...

  1. Directly on the graph screen (in the scale text boxes)
  2. As the 'reset' value on GraphMenu/Options Reset tab
  3. In a graph report definition file using ProbeMenu/SystemOptions report definitions tab.

Reset scales are only used when the user clicks the <reset> button on the graph screen.

Scales set in a graph report definition overide the value entered by the user on the screen

Some examples

Formula Result Comment
FULL+20 235 Sets the vertical scale to be full point + 20
CRNTDATE+10 1/2/2001 Set the date axis to be last date in the readings screen plus 10 days. If this is the reset formula the time graph will 'stretch' each time <reset> is used.
PDATE-10 20/9/2000 Set the date axis to be 10 days before planting date (as set for each site on SitesMenu/Edit).


The following variables can be used in formulas and function for export, import and graph report definitions.

Variable Comment Units
TODAY Today's date date
NOW Today, now (includes time) date
NULL Empty (used in @IF())  
LXA Constant to calculate Volume
Volume = Area * Depth *LXA ( = 10)
SITE Site number  
NAME Name of site  
SELECTED Site is 'selected'  
YEAR Season number  
FARM Farm number  
CROP Name of crop  
CropNum ID number of crop (v3)  
AREA Area Ha
POSITION Position of tube (0-100)  
WATERTIME Total water delivery time (days and fraction) days
WATERVOL Total delivered volume
DeliverRate=WATERVOL/(WATERTIME *24)(Kl/Hr)
LIRRDATE Date of last irrigation date
LIRRAMT RZ1 amount after last irrigation mm
REFILL Refill point mm
FULL Full point mm
LPRBDATE Date of last probe reading date
LPRBAMT RZ1 at last probe reading mm
PROBEDWU Latest probe dwu mm/day
PPIDATE Predicted date based on pdwu date
PPIAMT Amount to be delivered mm
ESTDWU Latest estimated dwu mm/day
EPIDATE Predicted date based on edwu date
EPIAMT Amount to be delivered mm
SITEGDWU Formula for site historical dwu text
GPIDATE Predicted date based on sitegdwu date
GPIAMT Amount to be delivered mm
CRNTAMT Rz1 value in latest column mm
CRNTDATE Date in latest column date
PDATE Planting date date
PWP Permanent wilting point mm
PREVAMT RZ1 at previous probe readings mm
PREVDATE Date of previous probe reading date
DELIVIRRI Total delivered irrigations mm
EFFIRRI Total effective irrigations mm
DELIVRAIN Total delivered rain mm
EFFRAIN Total effective rains mm
NUMIRRI Number of irrigations  
NUMRAIN Number of rains  
UPPER Formula for upper limit text
LOWER Formula for lower limit text
UPPERAMT Value of UPPER formula at CRNTDATE mm
LOWERAMT Value of LOWER formula at CRNTDATE mm
SUPPERAMT Value of UPPER formula at next scheduled irrigation date mm
SLOWERRAMT Value of LOWER formula at next scheduled irrigation date mm
FACTOR2 Delivery factor numeric
COMMENT Comment for grower about site text
XCOORD GPS coordinate (not used)  
YCOORD GPS coordinate (not used)  
RZTEXT1 Root zone 1 definition eg 0-70cm text
RZTEXT2 Root zone 2 definition eg 25-70cm text
RZTEXT3 Root zone 3 definition eg 90-130cm text
RZAMT2 Latest root zone 2 amount mm
RZAMT3 Latest root zone 3 amount mm
LIRRDAMT Last irrigation delivered amount. mm
LIRREAMT Last irrigation effective amount. mm
LIRRDRAIN Total delivered rain since last irrigation. mm
LIRRERAIN Total effective rain since last irrigation. mm
ROWSPACE Row spacing cm
EMITSPACE Emitter spacing cm
EMITRATE Emitter rate litre/hour
DRIPDAYS Number of days over which drip volumes calculated
RDIFACTOR Formula that evaluates to RDIfactor value.
PLANTSPACE Spacing between plants cm
WETWIDTH Width of wetted zone. If value=0 assume wetted over entire area cm
DATE1 Critical date 1 (e.g. Bud burst') (v3) date
DATE2 Critical date 2 (v3) date
DATE3 Critical date 3 (v3) date
DATE4 Critical date 4 (v3) date
DATE5 Critical date 5 (v3) date
DATE6 Critical date 6 (v3) date
KSOILFILE name of file with dwu correction factors depending water content realative to refill/full (v3)
SCHEDULEDWU Value of DWU used to calculate 'scheduled' irrigation (v3) mm/day
SCHEDULEAMT Amount required using schedule DWU (v3) mm
SCHEDULEDATE Date of irrigation using schedule DWU (v3) date
KEY1 Value of keydata row1 in last column
also KEY2, KEY3, etc (v3)
RZ1START Value of RZ1 at first reading of season (v3, v1 1.0.232->) mm
SITEREPORT Name of site specific report (v3)
SEASONEND Value of RZ1 at first reading of season (v3)
ALLOCATIONVOL Total volume needed for entire season (v3) kL
SUPPERAMT Upper (full) RZ1 amount used for scheduling (v3) mm
SLOWERAMT Lower (refill) RZ1 amount used for scheduling (v3) mm
OWNERn Value from owner registration file (n = 1-10)  
FARMNAME All below entered on EditFarm  


Version 1 and 2

Available in version 3

Graphs reports only

(T = time graph; use D for depth graph)

Variable Value returned
TXMIN Minimum value on horizontal axis
TXMAX Maximum value on horizontal axis
TYMIN Minimum value on vertical axis
TYMAX Maximum value on vertical axis
TLEFT Left edge of graph (% paper)
TRIGHT Right edge of graph (% paper)
TTOP Top edge of graph (% paper)
TBOTTOM Bottom of graph (% paper)
TXLEG Horizontal position of legend (% paper)
TYLEG Vertical position of legend (% paper)

Export only

Variable Value returned
SORT Sort order
WHERE Where criteria
FILE Name of file used for export
PAGE Current page number
Cn Value of column n in report
JOIN Name of lookup file
Ln Value from column n in lookup file
LName Value for named field LName in lookup file
UDWU Text of dwu units e.g. ins/day
FDWU Factor to convert to user units of dwu
e.g. UserValue = EDWU/FDWU returns in ins/day
UVOL Text of dwu units e.g. AcreFt
FVOL Factor to convert to user units of volume
e.g. UserValue = AREA*EPIAMT/FAREA returns in AcreFt
UAMT Text of amount units e.g. ins
FAMT Factor to convert to user units of amounts of water
e.g. UserValue = EPIAMT/FAMT returns in ins
UAREA Text of dwu units e.g. mm/day
FAREA Factor to convert to user units of area
e.g. UserValue = AREA/FAREA returns in acres
UDEPTH Text of depth units e.g. ft
FDEPTH Factor to convert to user units of area
e.g. UserValue = AREA/FDEPTH returns in ft
UVSW Text of volumetric soil water units e.g. ins/ft
FVSW Factor to convert to user units of VSW
e.g. UserValue = R1/FVSW returns in ins/ft
UEMITRATE Text of emitter rate units e.g. gal/hour
FEMITRATE Factor to convert to user units of emitter rate
e.g. UserValue = EMITRATE/FEMITRATE returns in gal/hour

Import only

Variable Value returned
Cn Value from column n in import file
LASTDATE Last date in current readings
LOADSITE Used to load and post to a site

Readings Screen only

Entered on SiteMenu/Edit

Variable Value returned
DATE date of column
TYPE Type of column
Rn VSW row n. Eg R1 = row 1
SN Serial number
RZn Root zone n Eg RZ1 = root zone 1
PDWU Probe daily water use
EDWU Estimated daily water use
Deficit Full - current RZ1 value
Kn Keydata row n Eg K1 = keydata row 1


The following functions are available.

Function Comments Used... Example
Export, Import @DATE(\C2,\C3,\C4)
Export, Import @TIME(\C5,\C6)
@DOY(Date) Day of year since Jan 1 Export, Readings @DOY(PPIDATE)
@LKV(File) Looks up corresponding value in file
Export, Import, Readings @LKV(CLAY.RTN, RZ1/70)v1
ColIN (Optional, default=1) column in table for value
ColOUT(optional, default=2) column in file for result
Number of header lines (Optional, default=0)
Looks up corresponding value in file
0 = Interpolate between two values
1 = use Value just less than passed value
2 = use Value just greater than passed value
Export, Import, Readings @LKV(Date,,0, 1, 2, 1) v3
0=interpolate;1=Value column;2=result column;1=1 heading row
@IF(Test,Value1,Value2) If 'test' is true return 'value1', else return 'value2' Export, Import, Readings @IF(TYPE=21,RZ1,NULL)
@MAX(Value1, Value2) Maximum of Value1 or Value2 any @Max(RZ1, FULL) v3
@MIN(Value1, Value2) Maximum of Value1 or Value2 any v3
@RATE(Item) Rate of change of ‘item’ eg fruit size growth rate Readings @RATE(SIZE)
@DIFF(Item) Difference between values
e.g. water used between readings from water meter readings
Readings @DIFF(WaterMeter)
@ADD(Item) Addition of succesive values
e.g. ??
Readings @ADD(K3)
@ACC(Item) Running total
e.g. running total of rain during season
Readings @ACC(DeliveredRain)
@CUM(item) Accumulate dwu - total water used by crop Readings @CUM(EDWU)
@SM(item,factor) Smooth item using factor Readings @SM(SIZE,0.1)
@PI() 3.14159... any
@PI() 3.14159... any @PI() * 200 * 200 v3
@ABS(Value) Result is always positive any @ABS(PDWU) v3
@INT(Value) Whole number, truncated any @INT(RZ1) v3
@FIX(Value) Same as INT(), unless Value is negative (phone..) any v3
@SGN(Value) +1 if > zero; 0 if = zero ;-1 if < zero any v3
@SQR(Value) Square root of Value any v3
@LOG(Value) Log(Value) to base e: Log10 = Log(Value)/Log(10) any v3
@EXP(Value) e ^ Value (e=2.718) any v3
@SIN(Value) Value in radians any v3
@COS(Value) Value in radians any v3
@TAN(Value) Value in radians any v3
@ATAN(Value) Value in radians any v3



Constants such as COTTON.DWU * 1.2 can be used.

Date constants must be enclosed in # #. For example, a criteria for a report to only output irrigations scheduled before 1 June...

EPIDATE < #1 June 2000#


+ Add
- Subtract
* Multiply
/ Divide
AND logical AND
OR logical OR
XOR phone

Calculation of Irrigation Scheduled amounts

UPPERAMT, LOWERAMT are calculated from UPPER and LOWER formulas

'RDICorrection' is calculated from RDIFACTOR

EffectiveAmountRequired(mm) = UPPERAMT - LOWERAMT or DWU * DRIPDAYS * RDICorrection

Calculated amount left in variables EPIAMT, PPIAMT, GPIAMT.

So 'DeliverAmountRequired(mm)' = FACTOR2 * EPIAMT

V2 Note: SCHEDULEAMT uses 'schedule with', and is either... (EPIAMT or PPIAMT or GPIAMT) * FACTOR2)

So 'ScheduleAmountRequired(mm)' = SCHEDULEAMT (FACTOR2 is already included)

If these intermediate values are calculated...



The formulas in GPT, RPT or SPT files...

Caption Formula Format code
DeliveredAmount(Vol) using EDWUFACTOR2 * EPIAMT * WetArea * 10VOL
DeliveredAmount(Hours) using EDWUFACTOR2 * EPIAMT * WetArea * 10 / PumpRateLONGTIME
DeliveredAmount(Vol) using 'Schedule with'SCHEDULEAMT * WetArea * 10VOL
DeliveredAmount(Hours) using 'Schedule with'SCHEDULEAMT * WetArea * 10 / PumpRateLONGTIME