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.

V3 Note: Individual entry of Formula, Name and Format


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

Each line in the gpt 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 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)  
MethodID Irrigation method. 0=cyclic,1=spare,2=drip/continuous (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 (but see DATE_LASTP) 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
RZ1START Value of RZ1 at first reading of season (v3, v1 1.0.232->) mm
RZ1Top Value of top of Root Zone (eg: 20 for 0-70cm) (v3) cm
RZ1Bottom Value of bottom of Root Zone 1 (eg: 70 for 0-70cm) (v3) cm
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 a Crop Factor (Kc) value.
PLANTSPACE Spacing between plants cm
WETWIDTH Width of wetted zone. If value=0 assume wetted over entire area cm
New for ver 3...
DATE1 Critical date 1 (e.g. 'Bud burst') date entered on: SitesMenu/Edit text (eg Bud burst) on: ProbeMenu/Crops date
DATE2 Critical date 2 date
DATE3 Critical date 3 date
DATE4 Critical date 4 date
DATE5 Critical date 5 date
DATE6 Critical date 6 date
KSOILFILE name of file with dwu correction factors depending water content realative to refill/full
SCHEDULEDWU Value of CDWU used to calculate 'scheduled' irrigation
Average Crop Daily Water Use (CDWU) in next 7 days (DripDays)
SCHEDULEAMT Amount required using schedule DWU
Continuous: mm required to reach target in 7 days
Cyclic: UPPER - STRESS (stress= LOWER or REFILL, depending on CropType)
SCHEDULEDATE Date of irrigation using schedule DWU
Continuous: date 7 (DripDays) days ahead
Cyclic: date hit stress (either LOWER or REFILL, depending on CropType)
Value of keydata row 1 in last column
also KEY2, KEY3,...KEY16
SITEREPORT Name of site specific report (v3)
SEASONEND Value of RZ1 at first reading of season (v3)
ALLOCATIONVOL Total volume needed for entire season kL
SUPPERAMT Upper (full) RZ1 amount used for scheduling (v3) mm
SLOWERAMT Lower (refill) RZ1 amount used for scheduling (v3) mm
Any value on the readings screen can used (v3)
The row and column need to specified eg K3_FULL will give the value of K3 in the FULL column
Specify the row with...
DATEdate row
TYPEType row
R1 - R16a VSW row
RZ1, RZ2, RZ3an RZ row
PDWUProbe DWU row
EDWUEstimated DWU row
DEFICITthe deficit row
K1 - K16a KeyData row
Specify the column with...
FULLFULL (or maximum) column
REFILLREFILL (or minimum) column
PWPPWP column
C1, number eg C1 = column 1
FIRSTPthe first probe reading
LASTPthe last probe reading
PREVPthe reading before the last reading
PREVIOUSPthe reading before the current column
Previousthe previous column (reading, estimate or gain)
Other examples...
R1_FULL Value of FULL VSW at depth 1 %
KEY1_LASTP Latest value of K1
DATE_LASTP the date of the last reading (but see CRNTDATE)
RZ1_PREVP last week's RZ1 value mm
RZ3_FIRSTP Value of RZ3 in week 1 mm
RZ1_LASTP - RZ1_FIRSTP Change in RZ1 over the season mm
K3_PREVIOUS Value of K3 in previous week
K3 - K3_PREVIOUS Change in value of K3
DATE_FULL The date the FULL readings were read
Predicted values - see ReadingsMenu/Scheduling (v3)
These values are calculated for each site, but not saved in [SITES] table.
The period will start from the last date on readings screen
The number of days (eg 7) set for each site.
PredictedRain Total predicted rain eg 3.8724
PredictedRain_T as above, but formatted eg 3.8 mm
'-' if forecast location has not been set
PredictedET Average ET in this period eg 12.372 mm/day
PredictedET_T as above, but in text eg 12.4 mm/day
PredictedKc Average Kcrop (Kc) in the period eg 0.3729 factor
PredictedKC_T as above, but formatted eg 0.37
PredictedKs Average Ksoil (Ks) in the period eg 0.8724 mm/day
PredictedKs_T as above, but formatted eg 0.87
PredictedDWU Average soil depletion rate eg 2.8724 mm/day
PredictedDWU_T as above, but formatted eg 2.9 mm/day
Forecast values - see ProbeMenu/Forecast (v3)
Only available if a Weather location has been set for the site, and the location has Rain and ET active
The period will start today
The number of days (eg 7), and Total or Average is set on ProbeMenu/Forecast tab: values
ForecastRain Rain in next 7 days eg 12.372 mm
ForecastRain_T as above, but formatted eg 12.4 mm
ForecastET Average et/day in next 7 days eg 3.56 mm
ForecastET_T as above, but formatted eg 12.4 mm
All below entered on FarmsMenu/Edit
All below entered on FileMenu/Register
OWNER1 normally Company name  
OWNER2 normally Address  
... (1-10)    


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 a file
Export, Import, Readings @LKV(CLAY.RTN, RZ1/70)v1
@LKV(Value, File, Style, ColIn, ColOut, Headers)
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 = style = interpolate
1 = Value column
2 = Result column
1 = 1 heading (skipped)
@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() * 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