Probe for Windows: Example graph reports

Highlight the Latest Reading

Gain = 27 mm is the gain from the previous week, with the colour depending on gain or loss.

202 mm is last weeks reading, and 229 mm is the latest reading

Report: example_highlightlatest . details . top

Images

Image files (.jpg or .bmp) for crop type and irrigation method can be output.
The images can be un-distorted, or stretched/shrunk to any size

Report: example_images . details . top

Crop target size using a straight line

The crop size has been measured each week and entered as a keydata items 2.00, 2.50...

This report also plots an ideal crop target size tracking line (red, dash).

The minimum and maximum target size values are entered in the FULL and REFILL columns.

The target maximum value is shown as a horizontal green dash-dot line, from the graph style option

Critical Date 1 is used as the date of minimum size, and Critical Date 6 for the date of maximum size

In the example, the last measured value of 15.00 is 1.7 mm below the target (16.7 mm) - or 73.7% of the target size

These values are calculated in the .gpt file

Report: example_targetsizelinear . details . top

Crop target size with multiple points

Crop size is being entered as keydata, and this report is also plotting target size tracking lines, both high and low, with the high and low values in a season file.

The green 10.00, 85.0 are measured crop size in keydata.

The pink 30.00, 50.00, 55.00 are the high values from column 3 of example.siz file , and the blue 25.00, 40.00, 45.00 are the low values from column 2

In the example, 5.8mm below target (40.8) is a warning that the last measured value (35.00) is 5.8 mm below the calculated minimum target size of 40.8 mm at that date

The line is plotted with PlotExtra(), and values are calculated with function YValueByDate()

Report: example_targetlinesmulti . details . top

File: example.siz...

0,Variety1_Minimum,Variety1_Maximum,Variety2_Minimum,Variety2_Maximum
DATE2,2,5 'first sample
1 Jun,10,16
15 Jun,15,22
1 Jul,25,30
10 Jul,40,50
DATE6,45,55 'harvest

Allocation bucket, Fuel Gauge, Sentek Gauge, Profile changes

Various Gauges can be included in a report

The Allocation Bucket is full of water (in blue) at the beginning of the season, and then empties as irrigations are applied and used from the allocation.

The Water In Profile is like a fuel gauge - high after an irrigation or rain, and then reduces as water is used.

The Sentek is similar

The Profile Gauge is like a mini-depth graph, but shows mm changes at each depth, and not absolute values

All Gauges are configured on FileMenu/Export tab: gauge output: GPT

gpt details all examples

Schedule next irrigation when RZ1 reaches REFILL

Custom labels with irrigation recommendations can be in various colours and styles

In this example the next irrigation calculation Apply 87 mm by Sat 17 Aug (effective= 58mm delivered= 87 mm) is using 'cyclic' method (irrigate-when-rz1-reaches-refill)

The predicted RZ1 is plotted blue/dash, and includes 9mm forecast rain on day 1 and day 3.

The report is also using Alan Christie's method (Enviro-Tech Services) - how-much-in-next7days: 9mm rain forecast in next 7 days so smd=128-133mm

gpt details | all examples

Schedule by track-to-target

This report displays various messages about the latest reading and the predicted value in 7 days.

Too wet - 15 mm above Upper will only be output if the latest reading (186) is above the Upper value.

Predicted too wet - 22 mm above target will only be output if the predicted value in 7 days (185 mm on 22 Mar) is above the target value (163mm).

Target = 163 mm on 22 Mar will always be output.

Uses functions TargetAMT(), PredictedtAMT()

details all examples

All Schedule values

This report shows all variables that are available that can be used to calculate irrigation requirements.

The report can also be used as a check on calculations.

gpt details | all examples

Critical dates

In the example above the grower (potatoes, UK) is being reminded that there is only 8 days to harvest. and that RZ1 is ??mm above target ???

Report: example_critcaldate1 . details . top

Stress at Veraison

The irrigation strategy for the crop (grapes, NZ) is to stress the crop by veraison.

This report shows the predicted RZ1 at verasion, and if RZ1 will be at the strategy target by verasion.

The strategy is specified in grapes.rdi (see below).

The site is crop type = annual, so stress is constant = REFILL, so S=187mm

The graph is plotting RZ1, Upper, Lower, Refill/Stress (selected on GraphMenu/Styles), Target points, and Predicted RZ1 (set on GraphOptions/Local)
It also shows the predicted values at 14 Feb (veraison)

The last reading was 247 on 20 Jan, with Upper, Lower and Predicted values plotted for the rest of the season

At Verasion (14 Feb) the target T=183mm, stress S=187mm , which will be 4 mm of stress,

However, because of 12mm predicted rain, the predicted RZ1 is P=205 mm - 18 mm above stress.

These labels will only be shown if the latest reading is before veraison

Report: example_stressatveraison . .gpt details . top

Uses functions TargetAMT() , PredictedAMT() , StressAMT() , YDataByValue()

File: grapes.rdi is in season file format...

date, ConservativeHi, ConservativeLo, StandardHi, StandardLo 'column headers as a reminder
283,Relative,Relative,Relative,Relative 'crucial line with numeric as first item
SeasonStart, 0.70, 0.20, 0.70, 0.20 'start of season
Date1, 0.70, 0.20, 0.70, 0.20     'Bud burst
Date1+15, 0.80, 0.20, 0.80, 0.20  '15 days after Bud Burst
Date2-10, 0.90, 0.65, 1.00, 0.65  '10 days before Flowering
Date2-7, 1.00, 0.68, 1.00, 0.68   '7 days before Flowering
Date2, 1.00, 0.68, 1.00, 0.68     'Flowering
Date2+7, 0.98, 0.60, 0.98, 0.60   '7 days after Flowering
Date2+14, 0.88, 0.50, 0.88, 0.50  '14 days after Flowering
Date3, 0.45, 0.15, 0.05, -0.15    'Veraison
Date4, 0.35, 0.10, 0.02, -0.15    'Harvest
Date4+30, 0.35, 0.05, 0.15, -0.15 '30 days after Harvest
SeasonEnd, 0.35, 0.05, 0.15, -0.15 'end of season

Forecast rain, ET, etc

The graph above is showing forecats rain for this site, and also, as a compariosn, another rain forecast

The Rain (3.0 mm) is the forecast for this site.

It is is being plotted because GraphMenu/Options/Local Delivered Rainfalls:

As a comparison, Upper Wairu:Rain 17.10, 0.50, 1.50.. mm is the forecast rain for another location.
This location could be from a 'live' forecast, or from historical weather data
It is being plotted from a line in a .gpt file

The GraphStyle (Rain/Predicted/Actual[S80]) was selected on ProbeMenu/Forecast, but the colour has been set in the .gpt line

Calculate where a line (eg RZ1) will cross another line (eg LOWER)

intersect
Report: example_intersect

The graph above is showing when RZ1, at dwu=2.5mm/day, will reach LOWER

21,3,INTERSECT,1,RATE,format,align,HGGGGGGGGG,orientation,size,BLACK,CRNTDATE,CRNTAMT,3.15, 'line1: 1 point plus rate(dwu)=3.15 mm/day = SITEGDWU
21,4,INTERSECT,2,LOWER,format,align,HGGGGGGGGG,orientation,size,BLACK,TXMIN,REFILL,TXMAX,REFILL 'line2: LOWER varying
21,5,ARROW,source,arrow from LatestReading to intersect,format,align,HGGGGGGGGG,orientation,1,RED,CRNTDATE,CRNTAMT,INTERSECTX,INTERSECTY

Examples.gpt file


Group,Order,Type,Source,Alias,format,Align,Options,Orientation,Size,Colour,Left,Top,Width,Height

'time graph scales
'TXMIN= left date axis 
'TXMAX= right date axis
'TYMIN= LHS axis bottom 
'TYMAX= LHS axis top

'depth graph scales
'DXMIN= VSW axis left (minimum)
'DXMAX= VSW axis righ (maximum)
'DYMIN= depth axis bottom
'DYMAX= depth axis top

'TYRelative(), TXRelative()

'named colours: RED,GREEN, etc see https://www.rsne.com.au/prwin3/repdefs.htm#colourcodes
'other colour examples
'coral = #ff7f50 orange=#ff8c00 deep pink #ff1493 green #008000 dark green #006400 dark red #8B0000 see: https://www.w3schools.com/cssref/css_colors.php

'graph styles used in these examples for scaling to RHS axis
'hard-coded styles - ie StyleID is hardcoded 
'StyleID=45 Key1  (crop size saved in K1)
'StyleID=49 Key1  (crop size saved in K1) - AgriTech swapped
'StyleID=83 = Drip/Predicted/Effective - reserved, not used
'StyleID=84 = Drip/Predicted/Actual - reserved
'StyleID=11 = Rain/Actual - reserved
'StyleID=4 = EstimatedDWU - reserved

'User styles
'StyleID=89='TargetSize' scale for 'size'

'gpt line options: GGGGGGGGGG  [1]=border H=ON, [2]=bold H=ON, [3]=units H=ON, [4]=negative-in-red  [5]=FillStyle (G=none, H=solid, I=diagonal, J=???TODO), [6]=LineStyle (G=solid, H=dash, I=dot etc), [7]=spare
'[n] is a character options string:  HGGGGGHGGGG option  see: https://www.rsne.com.au/prwin/repdefs.htm#optioncodes

'Note: Option(n) is a site-specific user choice, although some can be local or global 
'eg Option(4) = Plot Delivererd Rain  see https://www.rsne.com.au/prwin/repdefs.htm#graphoption

'===========================
'output all examples
1,1,ReportTitle,example_all
1,2,INCLUDE,example_highlightlatest    'Highlight Latest
1,3,INCLUDE,example_images    'Images
1,4,INCLUDE,example_targetlineslinear    'Target Line
1,4,INCLUDE,example_targetlinesmulti    'Target multipl points
1,5,INCLUDE,example_gauges    'Gauges
1,6,INCLUDE,example_schedulevalues    'Schedule Values
1,7,INCLUDE,example_schedule    'Shedule
1,8,INCLUDE,example_scheduleagritech    'Schedule Agritech
1,9,INCLUDE,example_criticaldates    'Critical Dates
1,11,INCLUDE,example_forecasts    'Plot Forecasts

'======================================
2,1,REPORTTITLE,example_highlightlatest '

'labels and arrows pointing at last 2 readings

'latest reading, formatted in mm, [1] border, [2]=bold, [3]=units,[5]=fill. positioned 10 days after CRNTDATE and 5 mm higher
2,2,FORMULA,CRNTAMT,latest RZ1,AMT,align,HHHGHGGGGGGGG,ABOVERIGHT,100,BLACK,CRNTDATE+10,CRNTAMT+5,,

'arrow pointing from label to latest reading, 1pt, dark green
2,2,ARROW,source,1 pt black arrow pointing to latest reading,format,align,GGGGGGGGGG,orientation,1.5,DARKGREEN,CRNTDATE+10,CRNTAMT+5,CRNTDATE,CRNTAMT

'only output if previous reading RZ1 is on the graph
2,5,BEGINIF,PREVDATE>TXMIN

	'previous RZ1 is past left axis, on the graph area

	'output previous RZ1, formatted mm|ins, [1] border, [2] bold, [3] units, [5] filled, positioned 10 days before previous reading,  
	2,6,FORMULA,PREVAMT,Last weeks RZ1,AMT,Left,HHHGHGGGGGGGGGGGGG,ABOVELEFT,100,BLACK,PREVDATE-10,PREVAMT+5,,

	'1pt black arrow pointing from 2,5 FORMULA to the previous reading
	2,6,ARROW,source,1pt black arrow pointing to previous reading,format,align,GGGGGGGGGGGGG,orientation,1.5,DARKGREEN,PREVDATE-10,PREVAMT+5,PREVDATE,PREVAMT

	'show change in RZ1 half-way between Previous and Latest, and a line showing the change
	'too cluttered  !
	'2,7,FORMULA,(CRNTAMT-PREVAMT),GAIN,AMT,1,HHHHGGGGGGGGGGGG,Centre,,BLACK,(CRNTDATE+PREVDATE)/2,+10+(CRNTAMT+PREVAMT)/2,,
	'2,7,Arrow,source,Black 2pt arrow showing gain from last week,format,align,GGGGGGGGGGGG,orientation,2,BLACK,PREVDATE-20,PREVAMT+10,CRNTDATE+10,CRNTAMT+10 

	'show change in RZ1 in last week
	'Gain' or 'Loss' saved in variable 'gain_text'
	'NOTE: must use type=TEXT to save a text variable
	2,9,BEGINIF,CRNTAMT>PREVAMT 

		'RZ1 is higher than previous RZ1
		2,10,text,gain_text=Gain
		2,10,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGGGGGG,orientation,size,ORANGE

	2,11,ELSE

		2,12,text,gain_text=Loss
		2,12,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGGGGGG,orientation,size,PALEBLUE

	2,13,ENDIF

	'label with [1] border,[2] not bold,[5] FillStyle=H=solid  20 days after RZ1. 10% below top of timegraph 
	2,15,LABEL,%gain_text% = %ABS(CRNTAMT-PREVAMT):AMT:1%,There has been a gain this week,format,align,HGGGHGGGGGGGGG,ABOVERIGHT,120,BLACK,CRNTDATE+20,TYRELATIVE(10),,

	'arrow pointing from previousRZ1 to currentRZ1 [6]=linestyle = I = dot, 1pt, RED
	2,16,ARROW,source,1pt black arrow pointing from previous to current,format,align,GGGGGIGGGGGGGG,orientation,1,RED,PREVDATE,PREVAMT,CRNTDATE,RZ1

	'1pt solid line from 2,15 label to middle of arrow
	2,17,LINE,source,1pt black line pointing to middle of arrow,format,align,GGGGGGGGGGGGG,0,1,BLACK,CRNTDATE+20,TYRELATIVE(10),(CRNTDATE+PREVDATE)/2,(RZ1+PREVAMT)/2

2,18,ENDIF 'PrevDate past left axis

'==========================
3,1,REPORTTITLE,example_images '
'image files must be .jpg or .bmp, and in folder: PRWIN\reports\

'heading above all images
3,2,LABEL,Example image files,alias,format,align,GGGGGGGGGG,ABOVERIGHT,100,BLACK,80,2 

'if only X1,Y1 is specified (top,left), and X2,Y2 are blank, the image is *not* distorted
3,3,PICTURE,apple.jpg,This site is growing apples,format,align,HGGGGGGGGG,orientation,size,colour,80,4,,
3,4,LABEL,apple.jpg - size not set,alias,format,align,HGGGGGGGGGG,BELOWRIGHT,80,BLACK,85,5,, 

'if x2,y2 are also specified the image will be squeezed/stretched into the rectangle
3,5,PICTURE,apple.jpg,alias,format,align,GGGGGGGGGG,orientation,size,colour,80,15,85,20
3,6,LABEL,apple.jpg - size set,alias,format,align,HGGGGGGGGGG,BELOWRIGHT,size,BLACK,85,15

'Method(1) get the name of the image file depending on CropNum and hold in 'pic_crop'
'NOTE: must use type=TEXT for text assignment
3,15,LABEL,{CropNum=%CropNum%},alias,format,align,GGGGGGGGGGG,ABOVERIGHT,size,RED,85,25 'tempo for checking

'use Select/Case because can handles multiple values  '3,7,BEGINIF,CropNum=33
3,6,SELECT,CropNum

3,7,CASE,33

	'Crops.ID = 33 = Potato
	3,8,TEXT,pic_crop=potato.jpg

3~7~CASE~18,9,10  '~ demlimiter because using ',' in CASE list

	'Crops.ID = 8,9,10 are all Hops
	3,10,TEXT,pic_crop=hop.jpg

3,11,ELSE

	'all other crops are grapes
	3,12,TEXT,pic_crop=grape.jpg

3,7,ENDSELECT

'output the selected image, no distortion
3,14,PICTURE,%pic_crop%,Image from Crop,format,align,GGGGGGGGGGG,orientation,size,colour,80,25,,
3,15,LABEL,%pic_crop% [CropNum=%CropNum%],Image name from If/Else/EndIf,format,align,HGGGGGGGGGG,BELOWRIGHT,size,Black,85,25

'Method(2) get the name of the file entered on ProbeMenu/Crops  CROPS.CROPIMAGE
3,16,PICTURE,%CROPIMAGE%,Image from CROPS.CROPIMAGE,format,align,GGGGGGGGGGG,orientation,size,colour,80,32
3,17,LABEL,Crops.CropImage=%CropImage%,Image from CropImage,format,align,HGGGGGGGGGG,BELOWRIGHT,size,BLACK,85,32

'Irrigation Method - hold image in variable 'pic_method'
3,18,BEGINIF,MethodID=2

	'continuous (drip)
	3,7,TEXT,pic_method=dripper.jpg

3,19,ELSE

	'cyclic  
	6,7,TEXT,pic_method=pivot.jpg

	'show a micro-jet !
	6,7,TEXT,pic_method=sprinkler.jpg

3,20,ENDIF

'output image, only X1,Y1 so no distortion
3,21,PICTURE,%pic_method%,alias,format,align,HGGGGGGGGGG,orientation,size,colour,80,40
3,22,LABEL,%pic_method% {MethodID=%MethodID%},alias,format,align,HGGGGGGGGGG,BELOWRIGHT,size,BLACK,85,40 ' 

'=============================
4,1,ReportTitle,example_targetlineslinear '
'crop size has been entered in K1, and are being plotted  ' Agritech 2024 site BONES3 site=2302
'maximum and minimum size have been entered in K1_FULL and K1_REFILL
'NOTE:all K1's will need changing if size is entered in another keydata row

'CriticalDate1 used as start of straight line
'CriticalDate6 used as end of straight line eg 'Harvest'

'put GraphStyleID=89 in variable -  used for axis scale (see top)
4,24,TEXT,target_graphstyle=49
'4,24,TEXT,target_graphstyle=129 'added by user for plotting 'size'

4,2,BEGINIF,K1_FULL 'do method(1) if a maximum value has been entered

	'Method[1] - straight line using K1_FULL and K1_REFILLl
	'plot straight line showing target during the season, width=1pt, colour=#008000, [6]=LineStyle = I = dot
	'GraphStyleID=49 is the style used to plot 'size' in K1, and is required for axis scale
	4,3,LINE,source,Ideal tracking line for crop size,format,align,GGGGGIGGGGGGGGGGGG,orientation,1,LIGHTGREEN,DATE1,K1_REFILL,DATE6,K1_FULL,%target_graphstyle%

	'label at start of target line (left of start) #008000 = light green X=DATE1, Y=K1_REFILL
	4,4,LABEL,Target=%K1_REFILL:0:0% mm by %DATE1:d mmm:0% (%Date1Text%),alias,format,align,HGGGGGGGGGGGGG,LEFTPLUS,size,LIGHTGREEN,DATE1,K1_REFILL,,,%target_graphstyle%

	'label at end of target line X = DATE6  Y = K1_FULL
	4,5,LABEL,Target=%K1_FULL:0:0% mm by %DATE6:d mmm:0% (%Date6Text%),alias,format,align,HGGGGGGGGGGGGG,ABOVERIGHT,size,LIGHTGREEN,DATE6,K1_FULL,,,%target_graphstyle%

	'calculate value of target at CRNTDATE using equation of straight line 
	4,6,formula,TARGET_SIZE=K1_REFILL + (CRNTDATE-DATE1) * ((K1_FULL-K1_REFILL)/(DATE6-DATE1))

	'calculate proportion between maximum and minimum  
	4,6,formula,TARGET_PROPORTION=(K1-K1_REFILL)/(K1_FULL-K1_REFILL)

	'calculate difference between K1 (measured) and Target.  ABS() makes the value positive
	4,10,formula,TARGET_DIFFERENCE=ABS(K1-TARGET_SIZE)

	4,7,BEGINIF,K1 < TARGET_SIZE

		'size is below target, so text=below
		8,6,TEXT,TARGET_DIFFERENCETEXT=below

	4,8,ELSE

		'size is above target, so text=above
		4,8,TEXT,TARGET_DIFFERENCETEXT=above

	4,9,ENDIF

	'output label with 'difference' formatted to 1 decimal place, border, left and above latest size, StyleID=49 for axis scale
	4,11,LABEL,size is %TARGET_DIFFERENCE:0.0:0%mm %TARGET_DIFFERENCETEXT% target (%TARGET_SIZE:0.0:0% mm),alias,format,align,HGGGGGGGGG,ABOVELEFT,100,#008000,CRNTDATE-10,K1+15,,,%target_graphstyle%

	'arrow from 4,10 label pointing to latest size (K1), I=dash
	4,12,ARROW,source,arrow pointing to latest size,format,align,GGGGGHGGGGG,orientation,1,#008000,CRNTDATE-10,K1+15,CRNTDATE,K1,49 

	'show %  size / size range
	'4,13,Formula,TARGET_PROPORTION,RED,0%,Left,HHHHGGGGGGGGGG,Centre,,BLACK,70,80 'CRNTDATE,K11,,,%target_graphstyle% 'current value as % scale using style=49 

	'current value as % scale using style=49 
	4,14,Formula,TARGET_SIZE,RED,0.0%,Left,HHHHGGGGGGGGGG,AboveLeftPlus,,BLACK,LPRBDATE,K1,,,%target_graphstyle%

	'maximum and minimum values on 2 lines 
	4,16,Label,Maximum=%K1_FULL% by %DATE6:d mmm% (%Date6Text%)|Minimum=%K1_REFILL% on %DATE1:d mmm% (%Date1Text%),RED,0.0%,align,HGGGGGGGGGGG,ABOVERIGHT,size,BLACK,DATE1,K1-5,,,%target_graphstyle% 

4,17,ELSE

	'Method(2) - tracking values from file: example.siz 
	'plot maximum values from example.siz, values in column 1. [6]LineStyle=H=dash, 1pt, DARKBLUE, axis scale from GraphStyleID=89
	4,20,PLOTEXTRA,example.siz,Minimum tracking size for crop,0.0,align,GGGGGHGGGGGGGGGGGG,orientation,1,DARKBLUE,,,,,%target_graphstyle%
	'variable EXTRA = index of last PLOTEXTRA
	
	'get minimum at CRNTDATE
	'YValueByDate(Date,EXTRA) returns the Y value of an 'extra' line at 'date'
	'NB use ~ delimiter because ',' used in function
	4~21~formula~TARGET_MINIMUM = YValueByDate(CRNTDATE, Extra)

	'also plot maximum from example.siz, column 2
	4,22,PLOTEXTRA,example.siz:2,Maximum tracking line for crop,0.0,align,GGGGGIGGGGGGGGGGG,orientation,1,LIGHTBLUE,,,,,%target_graphstyle% 
	'get maximum value at CRNTDATE
	4~23~formula~TARGET_MAXIMUM = YValueByDate(CRNTDATE, Extra)
	
	4,25,BEGINIF,K1 > TARGET_MAXIMUM

		'above maximum target
		4,26,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,WARNING 
		4,26,LABEL,%K1-TARGET_MAXIMUM:0.0:0% mm above target (%TARGET_MAXIMUM:0.0:0%),alias,format,align,HGGGHGGGGG,ABOVERIGHT,100,BLACK,CRNTDATE+5,K1,,,%target_graphstyle%

		'vertical arrow from K1 to target maximum, StyleID=49 for axis scale
		4,26,ARROW,source,arrow pointing max to min,format,align,GGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE,TARGET_MAXIMUM,CRNTDATE,K1,%target_graphstyle%

	4,27,BEGINELSEIF,K1 < TARGET_MINIMUM

		'below minimum target
		4,28,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,WARNING 
		4,28,LABEL,%TARGET_MINIMUM-K1:0.0:0% mm below target (%TARGET_MINIMUM:0.0:0%),alias,format,align,HGGGHGGGGG,ABOVERIGHT,100,BLACK,CRNTDATE+5,K1,,,%target_graphstyle%

		'vertical arrow from target pointing to K1, StyleID=49 for axis scale
		4,28,ARROW,source,arrow pointing K1 to target,format,align,GGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE,TARGET_MINIMUM,CRNTDATE,K1,%target_graphstyle%

	4,29,ELSE

		'between max/min
		4,30,LABEL,%K1:0.0:0%mm inside target range (%TARGET_MINIMUM:0.0:0%-%TARGET_MAXIMUM:0.0:0%mm),alias,format,align,HGGGHGGGGGG,ABOVERIGHT,100,BLACK,CRNTDATE+5,K1,,,%target_graphstyle%
		'vertical arrow showing max/min range, K1, StyleID=49 for axis scale
		4,30,DOUBLEARROW,source,arrow pointing max to min,format,align,GGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE,TARGET_MINIMUM,CRNTDATE,TARGET_MAXIMUM,%target_graphstyle% 

	4,31,ENDIF

	'arrow from label pointing to latest size, StyleID=49 for axis scale
	4,32,ARROW,source,arrow pointing to latest value,format,align,GGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE+5,K1,CRNTDATE,K1,%target_graphstyle%

4,33,ENDIF

'======================================================================
5,1,ReportTitle,example_gauges '

'gauges configured on FileMenu/Export tab: Gauges, OutputTo=GraphReport

'Profile Gauge showing changes, both VSW and mm, at different depths
5,2,PROFILEGAUGE,K5,Changes,VSW,0,GHHGGGJJHGGGHGGG,0,80,Black,85,20,95,40
5,3,LABEL,Changes down profile,alias,format,align,HGGGGGGGGGG,BELOWPLUS,size,BLACK,90,40

'Sentek gauge is a diagram with arrow pointing to current state 
'vertical scale from full=100% to refill=0%. right scale mm, text size = 80%
'alias=caption above
5,7,GAUGE,RZ1,RZTEXT1,format,align,GGGGGGGGGGGG,orientation,80,colour,80,20,81,40
5,8,Label,Sentek,alias,format,align,HGGGGGGGGGG,BELOWPLUS,size,BLACK,80.5,40

'PRWIN fuel gauge shows how much water that is available to the plant remains in the profile
'left scale from full (100%) to empty (0%) right scale in  mm
'source = RZ1,FULL,REFILL  alias=caption above, 80%
5,4,GAUGE,RZ1,RZTEXT1,format,align,GGGGGGGGGGG,orientate,80,colour,70,20,73,40
5,5,Label,Water in profile,alias,format,align,HGGGGGGGGGG,BELOWPLUS,size,BLACK,71,40

'blue arrow pointing from the fuel gauge to the last RZ1 reading on the time graph
'5,6,ARROW,RZ1,Arrow pointing to last RZ1,format,align,GGGGGGGGGGGGG,orientate,1,BLUE,51.5,41,DATE_LASTP,RZ1

'Allocation - bucket of water that is full at the start of the season, and empties during the season
'assume K2 has value = @DIFF(meter), alias = caption
5,9,BUCKET,K2,Allocation (Kl/Ha),VOL,0,GGGGGGGGGGGGG,1,80,BLACK,60,20,63,40
5,10,Label,Allocation bucket,alias,format,align,HGGGGGGGGGG,BELOWPLUS,size,BLACK,61.5,40

'TODO check for Alex Virgo
'blue arrow, dash, from bottom of bucket to last point of K2 plot on time graph
'GraphStyle.ID = 49 for RHS scale
'5,11,ARROW,source,Arrow pointing to last value,0,0,GGGGGHGGGGGGGHGGGG,0,0.5,BLUE,61.5,40,DATE_LASTP,K2,49

'5,12,LINE,K15,AllocationTrack,VOL,0,GHGGKKKGGGGG,0,1,RED,DATE_FIRSTP,K15_FIRSTP,SEASONEND,K15_FULL
'5,13,LINE,K10,AllocationTrack,VOL,0,GGGGGGGGKKKGGG,0,1,RED,DATE_FIRSTP,@GSY(54, K10_FULL),SEASONEND,@GSY(54, K10_REFILL)
'TEMPO 5,14,LINE,K5,VirgoAllocationTrack,Alias,0,GGGGGGGGGGGGGG,0,1,54,DATE_C3,K5_C3,SEASONEND,K5_FULL,54

'plot keydata row 11
'5,15,PlotRow,K1,Size,0,Left,GGGGGGGGGG,orientation,size,BLACK,X1,Y1,X2,Y2 
'5,16,Label,Size: %K11% - %K11_FULL:0.0:0%,alias,format,Left,GGGGGGGGGG,orientation,110,RED,82,5,90,10
'5,17,FORMULA,(K1-K1_REFILL)/(K1_FULL-K1_REFILL),alias,0%,LEFT,GGGGGGGGGG,orientation,110,RED,90,5,98,10

'==========================================
7,0,ReportTitle,example_schedulevalues '
7,1,INCLUDE,example_check

'TODO !!! output all schedule values
'MethodID=2 = continous - colour = dark green: #006400
'MethodID=0 = cyclic - colour - dark red #8B0000

'labels at top 
7,1,LABEL,All schedule values,alias,format,CENTRE,GGGGGGGGGGG,orientation,size,BLACK,88,4,99,7
7,1,LABEL,Variable,Name of variable,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,7,88,10
7,2,LABEL,Numeric,numeric value 2 decimal places,0.00,RIGHT,GGGGGGGGGG,orientation,size,BLACK,88,7,93,10 'H=border
7,3,LABEL,Text,text version or formatted,format,RIGHT,GGGGGGGGGG,orientation,size,Black,93,7,99,10

'Forecast values. Might might not be used in the prediction calculations
6,4,LABEL,ForecastRain,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,10,88,13
6,5,FORMULA,ForecastRain,the total amount has come from a 7 day forecast in mm/ins,0.00,RIGHT,HGGGGGGGGG,orientation,size,BLACK,88,10,93,13,91 'H=border 91=Information TEMPO
6,6,TEXT,ForecastRain_T,the total amount has come from a 7 day forecast already formatted,format,RIGHT,HGGGGGGGGG,,,BLACK,93,10,99,13

'arrow pointing to forecast rain
6,7,BEGINIF,(ForecastRain>0) AND Option(2) 'Option(2) = plot-delivered-rain. see https://www.rsne.com.au/prwin/repdefs.htm#optioncodes  (4=Plot-delivered-Irrigation)

	'delivered rain is being plotted
	'rain(s) will be somewhere in drip period, StyleID=80 for axis scale
	6,8,ARROW,source,point to forecast rain,format,align,GGGGGIGGGGG,orientation,1,#006400,88,11.5,CRNTDATE+dripdays/2,ForecastRain,80

6,10,ENDIF 'ForecastRain > 0

'forecast ET
6,11,LABEL,ForecastET,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,13,88,16
6,12,FORMULA,ForecastET,numeric with format=dwu,0.00,RIGHT,HGGGGGGGGG,orientation,size,BLACK,88,13,93,16,90 'Style=90=Warning
6,13,TEXT,ForecastET_T,ForecastET_T,format,RIGHT,HGGGGGGGGG,orientation,size,BLACK,93,13,99,16

'blue line to separate values actually used to calculate predicted schedule
6,14,LINE,source,Values used to calculate predicted schedule,format,align,GGGGGGGGGGG,orientation,1,blue,84,16.5,99,16.5

'Rain used in schedule calculation - where is this used ???
6,15,LABEL,PredictedRain,,,RIGHT,GGGGGGGGGGG,,,BLACK,78,17,88,20
6,16,FORMULA,PredictedRain,,0.00,RIGHT,HGGGGGGGGG,,,BLACK,88,17,93,20
6,17,TEXT,PredictedRain_T,,,RIGHT,HGGGGGGGGG,,,BLACK,93,17,99,20

'ET used ???
6,18,LABEL,PredictedET,,,RIGHT,GGGGGGGGGGG,,,BLACK,78,20,88,23

6,99,BEGINIF,PredictedET<0.5

	6,16,TEXT,predicted_colour=warning

6,99,ELSE

	6,16,TEXT,predicted_colour=PaleGreen

6,99,ENDIF  'PredictedET>0.5

6,19,FORMULA,PredictedET,,0.00,RIGHT,HGGGGGGGG,,,BLACK,88,20,93,23
6,20,TEXT,PredictedET_T,,,RIGHT,HGGGGGGGGG,,,BLACK,93,20,99,23

'average Kcrop used in schedule calculation.  Enabled on ReadingsMenu/Scheduling tab: ???
6,21,LABEL,PredictedKc,,,RIGHT,GGGGGGGGGGG,,,BLACK,78,23,88,26
6,22,FORMULA,PredictedKC,alias,0.00,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,23,93,26
6,23,TEXT,PredictedKC_T,alias,format,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,93,23,99,26

'average Ksoil used in schedule calculation.  Enabled on ReadingsMenu/Scheduling tab: ???
6,24,LABEL,PredictedKs,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,26,88,29
6,25,FORMULA,PredictedKs,alias,0.00,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,26,93,29
6,26,TEXT,PredictedKs_T,alias,format,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,93,26,99,29

'ET used in schedule calculation.  Selected on ReadingsMenu/Scheduling
6,27,LABEL,ScheduleDWU,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,29,88,32
6,28,FORMULA,ScheduleDWU,alias,0.00,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,29,93,32
6,29,FORMULA,ScheduleDWU,alias,DWU,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,93,29,99,32

'arrow pointing to middle of predicted RZ line
'too confusing
6,30,BEGINIF,Option(11) '(11) = 'Plot Schedule' on GraphMenu/Options/Local tab: time graph

	6,31,BEGINIF,MethodID=2

		'continuous - point to middle of predicted RZ1 line
		'6,32,ARROW,source,Continuous: This is SCHEDULEDATE,format,align,GGGGGIGGGGG,,1,#006400,88,30.5,(CRNTDATE+SCHEDULEDATE)/2,(SUPPERAMT+SLOWERAMT)/2

	6,33,ELSE

		'cyclic
		'6,34,ARROW,source,Cyclic this is SCHEDULEDATE,format,align,GGGGGIGGGGG,orientation,1,#8B0000,88,30.5,SCHEDULEDATE,SUPPERAMT

	6,35,ENDIF

6,36,ENDIF 'plot schedule

'delivery factor Deliver = Effective * Factor  Set on ReadingsMenu/Schedule tab: Deliver
6,37,LABEL,Factor2,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,32,88,35
6,38,FORMULA,FACTOR2,alias,0.00,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,32,93,35
6,39,LABEL,del=effective*factor2,alias,format,RIGHT,GGGGGGGGGGG,BELOWRIGHT,size,BLACK,93,32,,

'see https:///rsne.com.au/prwin/formulas.htm#stressamt
6,40,LABEL,StressAMT(CrntDate),alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,35,88,38
'output calculated stress amount, and hold value in 'stress_rz1'
6,41,FORMULA,stress_rz1=StressAMT(CRNTDATE),alias,0.00,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,88,35,93,38
6,42,LABEL,annual|permanent,alias,format,RIGHT,GGHGGGGGGGG,BELOWRIGHT,size,BLACK,93,35,, 'reminder 

'arrow point to ???
6,43,ARROW,source,alias,format,align,GGGGGIGGGGG,orientation,1,#8B0000,88,36.5,CRNTDATE,STRESS_RZ1

'ScheduleAMT = EfectiveAmount * FACTOR2
'show how FACTOR2 is used

'calculate 'extra' due to FACTOR2
'6,7,FORMULA,extra=(SUPPERAMT - SLOWERAMT) * (FACTOR2 - 1)  
6,44,FORMULA,extra=SCHEDULEAMT - (SCHEDULEAMT/FACTOR2)

'calculate mid point between SUPPERAMT and top of irrigation (SLOWERAMT+SHEDULEAMT) for cyclic
6,45,FORMULA,midpoint=SUPPERAMT+extra/2  

'6,46,LABEL,Predictions plotted [%Option(11)%],alias,format,align,GGGGGGGGGGG,BELOWRIGHT,size,BLUE,3,3

5,7,BEGINIF,Option(11) '11='plot predictions' GraphMenu/Options/Local tab: Time Graph  see https:www.rsne.com.au/prwin3/repdefs.htm#optioncodes

	5,7,LABEL,Predictions plotted [%Option(11)%],alias,format,align,GGGGGGGGGGG,BELOWRIGHT,size,BLUE,0,0

	5,7,BEGINIF,MethodID=2

		'continous StyleID=84 (DripPredict)
		'5,7,ARROW,source,Extra amount from FACTOR2,format,align,GGGGGIGGGGG,orientation,size,#006400,SCHEDULEDATE,SUPPERAMT,SCHEDULEDATE,SUPPERAMT+extra,84

		'arrow pointing to drip block
		'5,7,ARROW,source,Continuous:Point to ScheduleAMT at ScheduleDate,format,align,GGGGGIGGGGG,orientation,size,#006400,88,39.5,SCHEDULEDATE,SCHEDULEAMT,84

	5,7,ELSE
		'cyclic - vertical line showing predicted gain
		5,7,ARROW,source,Extra amount from FACTOR2,format,align,GGGGGIGGGGG,orientation,size,#8B0000D,SCHEDULEDATE,SUPPERAMT,SCHEDULEDATE,SUPPERAMT+extra
		5,7,FORMULA,temp=SUPPERAMT+((SUPPERAMT - SLOWERAMT) * (FACTOR2 - 1)) * 0.5  

		'plot line to mid-point
		5,7,LINE,,Point to Extra from FACTOR2,format,align,GGGGGIGGGGG,orientation,size,#8B0000,88,39.5,SCHEDULEDATE,midpoint
		'TEMPO 5,7,LABEL,ScheduleAmt=Required*Factor2,,FRM,RIGHT,GGHGGGGGGGG,BelowRight,,BLACK,93,38,,
	
		5,7,FORMULA,temp,alias,0.00,RIGHT,GGHGGGGGGGG,BelowRight,size,BLACK,93,38,,

	5,7,ENDIF

5,7,ELSE

	5,7,LABEL,Predictions not plotted [%Option(11)%],alias,format,align,GGGGGGGGGGG,BELOWRIGHT,size,RED,0,0
	
5,7,ENDIF 'plot  predictions

'Crop Type and Irrigation Method
'CropType 0 = Permanent(stress=refill), 1 = Annual(stress=lower)

'label with 'stress'
5,7,LABEL,stress,alias,format,align,HGGGGGGGGGG,BelowLeft,size,RED,88,42,,

5,7,BEGINIF,CropType=0

	'save 'permanent'
	5,7,TEXT,temp=Permanent 

	'1 pt dot red arrow, pointing to REFIll at the latest reading
	5,7,ARROW,source,Point to REFILL(stress),format,align,GGGGGIGGGGG,orientation,1,RED,85,43.5,CRNTDATE,REFILL

5,7,ELSE

	'save 'annual'
	5,7,TEXT,temp=Annual 

	'1 pt dot red arrow, pointing to calculated LOWER at the latest reading
	5,7,ARROW,source,Point to LOWER(stress),format,align,GGGGGIGGGGG,orientation,1,RED,85,43.5,CRNTDATE,LOWERAMT

5,7,ENDIF 'CropType

'show 'annual' or 'permanent', no border, not bold
5,7,LABEL,%temp%,alias,format,LEFT,GGGGGGGGGGG,orientation,size,BLACK,88,42,93,45 

'MethodID 0 = Cyclic(flood), 2 = Continous(drip)
5,7,BEGINIF, METHODID=2

	'5,7,TEXT,temp=Continous 'save text
	5,7,LABEL,Continous irrigation (every day),alias,format,LEFT,GGGGGGGGGGG,orientation,size,BLACK,78,42,99,45 'no border, bold

5,7,ELSE

	'5,7,TEXT,temp=Cyclic 'save text
	'show text, border
	5,7,LABEL,Cyclic irrigation,alias,format,LEFT,GGGGGGGGGGG,orientation,size,BLACK,78,42,99,45 'no border, bold

5,7,ENDIF 

'show text, border
5,7,LABEL,%temp%,alias,format,LEFT,GGGGGGGGGGG,orientation,size,BLACK,93,42,99,45 'no border, bold

'deliver amount
5,7,LABEL,ScheduleAMT,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,46,88,49
5,7,FORMULA,ScheduleAMT,alias,0.00,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,46,93,49
5,7,FORMULA,ScheduleAMT,alias,IRR,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,93,46,99,49

'effective amount
5,7,LABEL,Effective,alias,format,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,49,88,52
5,7,FORMULA,ScheduleEffectiveAmount,alias,0.00,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,88,49,93,52 '2 decimal places
5,7,FORMULA,ScheduleEffectiveAmount,alias,AMT,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,93,49,99,52 'formatted by ProbeMenu/DisplayUnits 

'scheduled date
5,7,LABEL,ScheduleDate,alias,,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,52,88,55
5,7,Formula,ScheduleDate,alias,0.0,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,88,52,93,55
5,7,Formula,ScheduleDate,alias,d mmm yyyy HH:MM,LEFT,HGGGGGGGGGG,orientation,size,BLACK,93,52,99,55

'arrow from FACTOR2 to ScheduleAMT to show how FACTOR2 is used
5,7,ARROW,source,point to ScheduleAMT,format,align,GGGGGIGGGGG,orientation,1,RED,93,39.5,93,47

'plot arrows to predicted irrigation
5,7,BEGINIF,MethodID=2

	'continuous
	'small vertical line 
	5,7,FORMULA,target=(SUPPERAMT+SLOWERAMT)/2
	5,7,LINE,source,alias,format,align,GGGGGIGGGGG,orientation,1,#006400,SCHEDULEDATE,target-5,SCHEDULEDATE,target+5

	'arrow pointing at target - assume target = (UPPER+LOWER)/2 
	5,7,Arrow,source,Continuous:Point to target,format,align,GGGGGIGGGGGG,orientation,1,#006400,88,50.5,SCHEDULEDATE,target

	'point from ScheduleAMT to top/end of drip block
	5,7,Arrow,source,Continuous Point to top of drip block,format,align,GGGGGIGGGGG,orientation,1,#006400,88,47.5,SCHEDULEDATE,SCHEDULEAMT/DRIPDAYS,84

	'point to  EffectiveAMT at end of drip block
	5,7,Arrow,source,Continuous Point to top of drip block,format,align,GGGGGIGGGGG,orientation,1,#006400,88,50.5,SCHEDULEDATE,(SCHEDULEAMT/FACTOR2)/DRIPDAYS,84

	'5,7,BEGINIF,SCHEDULEAMT=0
	'5,7,ELSE
	'5,7,Arrow,source,Continuous Point to top of drip block,format,align,GGGGGGGGGGG,orientation,2,#006400,88,39.5,(CRNTDATE+SCHEDULEDATE)/2,SCHEDULEAMT/DRIPDAYS,84
	'5,7,ENDIF


5,7,ELSE

	'cyclic=
	'highlight how FACTOR2 is used
	'5,7,ARROW,source,Extra amount from FACTOR2,format,align,GGGGGIGGGGG,orientation,size,RED,SCHEDULEDATE,SUPPERAMT,SCHEDULEDATE,SUPPERAMT+temp
	'5,7,FORMULA,temp=SUPPERAMT+((SUPPERAMT - SLOWERAMT) * (FACTOR2 - 1)) * 0.5  

	'plot line to mid-point
	'5,7,LINE,source,Point to Extra from FACTOR2,format,align,GGGGGIGGGGG,orientation,size,RED,88,39.5,SCHEDULEDATE,temp2
	'TEMPO 5,7,LABEL,ScheduleAmt=Required*Factor2,,FRM,RIGHT,GGHGGGGGGGG,BelowRight,,BLACK,93,38,,


	5,7,Arrow,,Point to SCHEDULEAMT above UPPER on time graph,,,GGGGGIGGGGG,,1,#8B0000,88,47.5,SCHEDULEDATE,SLOWERAMT+SCHEDULEAMT
	5,7,ARROW,,Point to SUPPERAMT,,,GGGGGIGGGGG,,1,RED,88,50.5,SCHEDULEDATE,SUPPERAMT

5,7,ENDIF


'5,7,Label,Deliver,,0.00,RIGHT,GGGGGGGGGGG,,,BLACK,78,38,88,41
'5,7,Formula,ScheduleAMT,ScheduleAMT*FACTOR2,0.00,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,38,93,41
'5,7,Formula,ScheduleAMT*FACTOR2,,IRR,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,93,38,98,41

'UPPER at ScheduleDate 55-58
5,7,LABEL,SUPPERAMT,alias,0.00,RIGHT,GGGGGGGGGGG,orientation,size,BLACK,78,55,88,58
5,7,FORMULA,SUPPERAMT,Value of UPPER at Schedule Date,0.00,RIGHT,HGGGGGGGGGG,,,BLACK,88,55,93,58
'1pt, dotted red arrow
5,7,ARROW,source,Pointing to UPPERAMT at schedule date,orientation,size,GGGGGIGGGGG,orientation,1,RED,88,56.5,SCHEDULEDATE,SUPPERAMT
5,7,FORMULA,SUPPERAMT,alias,AMT,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,93,55,99,58

'LOWER at ScheduleDate 58-61
5,7,LABEL,SLOWERAMT,,0.00,RIGHT,GGGGGGGGGGG,,,BLACK,78,58,88,61
5,7,FORMULA,SLOWERAMT,Value of LOWER at Schedule Date,0.00,RIGHT,HGGGGGGGGGG,,,BLACK,88,58,93,61
5,7,ARROW,,Pointing to LOWER at SheduleDate,,,GGGGGIGGGGG,,1,RED,88,59.5,SCHEDULEDATE,SLOWERAMT
5,7,FORMULA,SLOWERAMT,alias,AMT,RIGHT,HGHGGGGGGGG,orientation,size,BLACK,93,58,99,61

'schedule amount calculations
'see https://www.rsne.com.au/prwin/formulas.htm#scheduleamounts
'If these intermediate values are calculated... 78,88,93,99

'continous in dark green #006400
'cyclic in dark red #8B0000

11,27,BEGINIF,MethodID=2 'continous 
	
	11,27,LABEL,WetArea,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,size,#006400,78,61,88,64
	11,27,FORMULA,WetArea,Calculated Wet Area,0.00,RIGHT,HGHGGGGGGGGGGGG,orientation,size,BLACK,88,61,93,64 '2 dec places
	11,27,FORMULA,WetArea,Calculated Wet Area,AREA,RIGHT,HGHGGGGGGGGGGGG,orientation,size,BLACK,93,61,99,64 'format with ProbeMenu/DisplayUnits

	11,27,LABEL,MaxApplicationRate:,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,100,#006400,78,64,88,67
	11,27,FORMULA,MaxApplicationRate,alias,0.00,RIGHT,HGHGGGGGGGGGGGG,orientation,size,BLACK,88,64,93,67
	11,27,FORMULA,MaxApplicationRate,alias,DWU,RIGHT,HGHGGGGGGGGGGG,orientation,size,BLACK,93,64,99,67'ProbeMenu/DisplayUnits
	11,27,Arrow,source,Point to MaxApplicationRate,format,align,GGGGGIGGGGG,orientation,1,#006400,88,65.5,TXMAX,MaxApplicationRate,84'arrow pointing to maximum application rate on RHS axis(StyleID=84)

	11,27,BEGINIF,(ScheduleAMT/DripDays) > (MaxApplicationRate-0.5) 'label if ScheduleAmt above or near MaxApplicationRate

		11,27,LABEL,Limited by Max Rate (%MaxApplicationRate:DWU:1%) !,alias,format,align,HGGGGGGGGGGGGG,Right,100,RED,ScheduleDate,ScheduleAMT/DripDays,,,84

	11,27,ENDIF


11,27,ELSE 'cyclic

	11,27,LABEL,PumpRate:,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,size,#8B0000,78,61,88,64
	11,27,FORMULA,WATERVOL/WATERTIME/1000,alias,0.00,LEFT,GGGGGGGGGGGGGG,orientation,size,BLACK,88,61,93,64
	11,27,LABEL,%WATERVOL/WATERTIME/1000:0% Ml/day,alias,format,RIGHT,HGGGGGGGGGGGGG,orientation,size,BLACK,93,61,99,64

	11,27,LABEL,Deliver(volume):,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,100,#8B0000,78,64,88,67
	11,27,FORMULA,DeliverAmountVOL = SCHEDULEAMT * WetArea * 10,alias,VOL,RIGHT,HGGGGGGGGGG,orientation,size,BLACK,88,64,93,67
	11,27,LABEL,SCHEDULEAMT*WetArea*10,alias,format,LEFT,GGGGGGGGGGGGGG,orientation,size,BLACK,93,64,99,67

	'point from Deliver to top/middle of drip block (StyleID=84)
	11,27,Arrow,source,Cyclic - point to top of drip block,format,align,GGGGGGIGGGG,orientation,1,#8B0000,88,65.5,(CRNTDATE+SCHEDULEDATE)/2,SCHEDULEAMT/DRIPDAYS,84


11,27,ENDIF

11,27,LABEL,Deliver(Hours):,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,100,BLACK,78,67,88,70
11,27,FORMULA,ScheduleTime,alias,0.000,RIGHT,HGHGGGGGGGGGG,orientation,size,BLACK,88,67,93,70
'11,27,FORMULA,ScheduleTime,alias,HH:MM,RIGHT,HGGGGGGGGGGGGG,orientation,size,BLACK,93,67,99,70

11,27,LABEL,ScheduleVolume:,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,100,BLACK,78,70,88,73
11,27,FORMULA,ScheduleVolume,alias,0.00,RIGHT,HGHGGGGGGGGGG,orientation,size,BLACK,88,70,93,73
11,27,FORMULA,ScheduleVolume,alias,VOL,RIGHT,HGHGGGGGGGGGGGG,orientation,size,BLACK,93,70,99,73


11,27,LABEL,GainStatus:,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,100,BLACK,78,73,88,76
11,27,FORMULA,GainStatus,alias,0,RIGHT,HGHGGGGGGGGGG,orientation,size,BLACK,88,73,93,76
11,27,LABEL,0=0k:1=ChopToFull,alias,HH:MM,RIGHT,HGGGGGGGGGGGGG,orientation,size,BLACK,93,73,99,76

2,10,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGGGGGG,orientation,size,YELLOW
'11,27,LABEL,GainInformation:,alias,format,RIGHT,GGGGGGGGGGGGGG,orientation,100,BLACK,78,76,88,79
11,27,TEXT,GainInformation,alias,0.00,LEFTWRAP,HGGGHGGGGGGGGG,BELOWRIGHT,size,BLACK,78,76 ',99,88
'11,27,FORMULA,ScheduleVolume,alias,VOL,RIGHT,HGHGGGGGGGGGGGG,orientation,size,BLACK,93,76,99,79


'debug
'11,27,LABEL,AREA=%AREA:0.00% WETWIDTH=%WETWIDTH% PLANTSPACE=%PLANTSPACE% WetArea=%WetArea:0.00% WATERVOL=%WATERVOL% WATERTIME=%WATERTIME%,alias,format,RIGHT,HGGGGGGGGGGGGG,orientation,size,BLACK,58,58,99,60

'================================
6,0,ReportTitle,example_schedule '
'suggestions for schedule messages
7,1,INCLUDE,example_check 'TEMPO just for checking

'recommendation text in rectangle, multiple lines. [1]=border H=ON [5]=FillStyle H=solid 
'set border 1 pt RED
5,22,BORDER,source,alias,format,align,GGGGGGGGGGGGG,orientation,1,PALERED
5,22,TEXT,SITES.COMMENT,alias,format,LEFTWRAP,HGGGHGGGGGGGG,orientation,100,BLACK,82,8,99,43

'can also do recommendation using X,Y, multiple lines.[1]=border=H [5]=FillStyle H=solid 
'but cannot handle tabs
5,22,TEXT,SITES.COMMENT,alias,format,align,HGGGHGGGGGGGG,BELOW,100,BLACK,TXMAX,TYMAX-10,,

'back to standard
5,22,BORDER,source,alias,format,align,GGGGGGGGGGGGG,orientation,1,BLACK


'schedule message examples

'hold X1,Y1 position of main label
11,27,FORMULA,X1=(CRNTDATE+TXMAX)/2
11,27,FORMULA,Y1=TYRELATIVE(10)

11,27,BEGINIF,SCHEDULEAMT > 0

	'Recommendation [1]=H=border=H, [2]=H=Bold, [5]=FillStyle H=Solid, [6]=LineStyle G=Solid
	'done below 11,28,LABEL,Apply %SCHEDULEAMT:AMT:1% by %SCHEDULEDATE:ddd D MMM%,Calculated Schedule,format,align,HHGGHGGGGGGGGGGG,ABOVERIGHT,120,BLACK,X1,Y1,,

	11,29,BEGINIF,MethodID=2
		'continuous
		11,30,FORMULA,DRIP_TOP=SCHEDULEAMT/DripDays   
		11,30,TEXT,DATE_TEXT=by %SCHEDULEDATE:ddd D MMM%

		'also point to top/middle of PRGraph drip block. needs StyleID=84 for axis scale
		11,31,BEGINIF,Option(4) AND Option(11) '4 = plot delivered gains, 11 = plot prediction

			'use StyleID=84=drip
			'StyleID scaling must use either numeric (%SCREEN), or a formula that returns main LHS axis (mm)
			12,32,ARROW,source,Amount=%SCHEDULEAMT:AMT:1% needs applying,format,align,GGGGGGGGGG,orientation,1,DARKGREEN,X1,20,(CRNTDATE+SCHEDULEDATE)/2,ScheduleAMT/DripDays,84

		11,33,ELSE

			'thick line showing extent of drip block 
			11,34,LINE,source,apply over %DRIPDAYS% days,format,align,GGGGGGGGGG,orientation,2,WETTING,CRNTDATE,RZ1,SCHEDULEDATE,RZ1

			'point from label 11, 27 to top/middle of double arrow
			12,34,ARROW,source,Amount=%SCHEDULEAMT:AMT:1% needs applying,format,align,GGGGGGGGGG,orientation,1,DARKGREEN,X1,Y1,(CRNTDATE+SCHEDULEDATE)/2,RZ1

		11,99,ENDIF

	11,27,ELSE

		'cyclic

		11,27,TEXT,DATE_TEXT=on %SCHEDULEDATE:ddd D MMM YYYY%

		'delivered amount
		'12,54,LINE,source,Amount=%SCHEDULEAMT:AMT:1% needs applying,format,align,GGGGGGGGGGGGG,orientation,3,GREEN,SCHEDULEDATE,SLOWERAMT,SCHEDULEDATE,SLOWERAMT+SCHEDULEAMT

		'arrow pointing to top of delivered gain
		'SLOWERAMT = RZ1 trip value.  SCHEDULEAMT = mm needed = height of gain bar
		12,54,ARROW,source,Deliver = %FULL:AMT:1% - %REFILL:AMT:1% * %FACTOR2:0.0% ,format,align,GGGGGGGGGG,orientation,1,BLACK,X1,Y1,SCHEDULEDATE,SLOWERAMT+SCHEDULEAMT

	11,27,ENDIF

	'do label last so arrows are hiden by FillColour
	'Recommendation [1]=H=border=H, [2]=H=Bold, [5]=FillStyle H=Solid, [6]=LineStyle G=Solid
	11,27,LABEL,Apply %SCHEDULEAMT:AMT:1% %date_text%,Calculated Schedule,format,align,HHGGHGGGGGGGGGGG,ABOVERIGHT,120,BLACK,X1,Y1,,

11,27,ELSE

	'scheduled amount = zero [1]=border [2]=bold [5]=filled
	11,27,LABEL,No irrigation required this week,Calculated Schedule,format,ABOVERIGHT,HHGGHGGGGGGGGGG,0,120,BLACK,X1,Y1,,

11,27,ENDIF

'=======================================
11,1,REPORTTITLE,example_scheduleAgriTech '

'Alan Christie calculations - cyclic, but DripDays comes in to it

11,2,INCLUDE,example_check 'TEMPO just for checking

'testing 11,27,LABEL,full=%FULL%  rz1=%RZ1:0.00%  estdwu=%EstDWU:0.00:1% DripDays=%DripDays%,testing,format,align,HGGGGGGGGG,BELOWRIGHT,80,BLACK,10,10

'calculate predicted deficit in 7 days. include rain
11,5,FORMULA,PREDICTED_DATE=CRNTDATE+DRIPDAYS   
11,3,FORMULA,PREDICTED_RZ1=(CRNTAMT - (ESTDWU * DRIPDAYS)) + ForecastRain 'is this what Alan does ???
11,4,FORMULA,PREDICTED_SMD=FULL-PREDICTED_RZ1   
11,6,TEXT,PREDICTED_SMDRANGE=%PREDICTED_SMD:AMT:0%-%PREDICTED_SMD+5:AMT:1%  

'just for checking
11,7,LABEL,Option(59)=%Option(59)% :FULL=%FULL:0.00:1% :REFILL=%REFILL:0.00:1% :CRNTAMT=%CRNTAMT:0.00:1% :EstDWU=%EstDWU:0.00:1% :PREDICTED_RZ1=%predicted_rz1:0.00:1% :PREDICTED_SMD=%predicted_smd:0.00:1% :PREDICTED_DATE=%predicted_date:d mmm yyyy% :ForecastRain=%FORECASTRAIN:0.00:1% :PredictedRain=%PredictedRAIN:0.00:1%,alias,format,align,HGGGGGGGGGGGGGG,BELOWRIGHT,80,BLACK,0,2
11,7,LABEL,PREDICTED_RZ1=CRNTAMT - (EstDWU * DripDays) + ForecastRain|PREDICTED_SMD = FULL-PREDICTED_RZ1,alias,format,align,HGGGHGGGGGG,BELOWRIGHT,80,BLACK,0,4

'arrow darkgreen line from current RZ1 to predicted RZ1
11,7,ARROW,source,Predicted RZ1 in %DripDays% days with EstDWU=%EstDWU:DWU:1% and forecast rain=%FORECASTRAIN:AMT:1%,format,align,GGGGGGGGGG,orientation,1,DARKBLUE,CRNTDATE,CRNTAMT,PREDICTED_DATE,PREDICTED_RZ1

'double arrow from FULL to predicted RZ1
11,54,DOUBLEARROW,source,SMD=%PREDICTED_SMD:AMT:1% - needs applying,format,align,GGGGGGGGGGGG,orientation,1.5,DARKBLUE,PREDICTED_DATE,PREDICTED_RZ1,PREDICTED_DATE,FULL

11,27,BEGINIF,Option(59) '59 = uc_UseForecastRain  

	'Example[1]
	'plot line from text to midlle of vertical line
	11,54,LINE,source,SMD = %predicted_smd:AMT:1% - needs applying,format,align,GGGGGGGGGGGG,orientation,1,DARKGREEN,PREDICTED_DATE+8,FULL+10,PREDICTED_DATE,(FULL+PREDICTED_RZ1)/2
	'label
	11,27,LABEL,%FORECASTRAIN:AMT:1% rain forecast in next %DripDays% days| so smd = %predicted_smdrange%,Predicted deficit at end of next 7 days,format,align,HGGGHGGGGGGG,ABOVERIGHT,110,BLUE,predicted_date+8,FULL+10,,

11,27,ELSE

	'Example[2]
	'line from text to middle of vertical line
	12,54,LINE,source,SMD = %predicted_smd:AMT:1% that needs applying,format,align,GGGGGGGGGGGG,orientation,1,DARKGREEN,PREDICTED_DATE+10,FULL-2,PREDICTED_DATE,(FULL+PREDICTED_RZ1)/2
	'label
	11,27,LABEL,If no rain in next %DripDays:0% days| at %EstDWU:DWU:1% SMD=%predicted_smdrange%,Predicted deficit at end of next 7 days (%PREDICTED_DATE:ddd D MMM YYYY%),format,align,HGGGHGGGGGG,ABOVERIGHT,110,BLACK,PREDICTED_DATE+10,FULL-2,,


11,27,ENDIF 'Option(59)

'details about predicted gain

'arrow darkgreen line from GainInformation label to middle vertical line
11,28,ARROW,source,alias,format,align,GGGGGGGGGG,orientation,1,DARKBLUE,TXMAX-2,(TYMAX+TYMIN)/2,SCHEDULEDATE,PREDICTED_RZ1

'information about gain
11,28,TEXT,GainInformation,alias,0.00,LEFTWRAP,HGGGHGGGGGGGGG,RIGHT,size,BLACK,TXMAX-2,(TYMAX+TYMIN)/2

'gain status
11,28,BEGINIF,GainStatus>0

	11,28,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGGGGGG,orientation,size,ORANGE
	11,28,TEXT,GainStatusInformation,alias,0.00,LEFTWRAP,HGGGHGGGGGGGGG,RIGHT,size,BLACK,TXMAX+2,MaxApplicationRate,,,84 '84=drip style for scaling
	11,28,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGGGGGG,orientation,size,YELLOW

11,28,ENDIF 'GainStatus>0

'================================
12,0,ReportTitle,example_targetrz1 '

'messages about RZ1 relative to UPPER and LOWER

'calculate RZ1 and difference
11,27,FORMULA,currenttarget_rz1=TargetAMT(CRNTDATE)
11,27,FORMULA,target_rz1=TargetAMT(SCHEDULEDATE)
11,27,FORMULA,predicted_rz1=PredictedAMT(SCHEDULEDATE)
11,27,FORMULA,target_difference=TargetAMT(SCHEDULEDATE)

'debug top left
11,27,LABEL,ScheduleAMT=%ScheduleAMT:0.00:1% TargetRZ1=%target_rz1:0.00:1% predicted_rz1=%predicted_rz1:0.00:1% CurrentTarget=%currenttarget_rz1:0.00:1%,alias,format,align,GGGGGGGGGGG,BELOWRIGHT,80,BLACK,0,3,,

'do current RZ1
11,27,BEGINIF,RZ1 > UPPERAMT 

	'too high
	'arrow and warning label
	7,2,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE+5,RZ1+5,CRNTDATE,RZ1 
	11,27,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGGGG,orientation,size,WARNING
	11,27,LABEL,Too wet - %RZ1-UPPERAMT:AMT:1% above upper|RZ1=%RZ1:AMT:1% Upper=%UPPERAMT:AMT:1%,alias,format,align,HGGGHGGGGGG,RIGHT,100,BLACK,CRNTDATE+5,RZ1+5,,

11,27,BEGINELSEIF,RZ1 < LOWERAMT 

	'too low
	'arrow and warning label
	11,27,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE+10,RZ1-5,CRNTDATE,RZ1 
	11,27,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,WARNING
	11,27,LABEL,Too dry - (%LOWERAMT-RZ1:AMT:1%) %RZ1:AMT:1% below lower|RZ1=%RZ1:AMT:1% Lower=%LOWERAMT:AMT:1%,alias,format,align,HGGGHGGGGGG,RIGHT,100,BLACK,CRNTDATE+10,RZ1-5,,

11,27,ELSE 

	'in range
	'arrow and ok label
	11,27,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE+10,RZ1,CRNTDATE,RZ1 
	11,27,TEXT,%RZ1:AMT:1% is in range (%LOWERAMT:AMT:0%-%UPPERAMT:AMT:1%),alias,format,align,GGGGGGGGGGGGGGGG,RIGHT,1,BLACK,CRNTDATE+10,RZ1 

11,27,ENDIF 

'reset fillcolour
11,28,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,YELLOW

'target RZ1
'11,29,BEGINIF,predicted_rz1 > SUPPERAMT
	'could do extra heavy warning if above UPPER ???

11,29,BEGINIF,predicted_rz1 > target_rz1 

	'above target

	'label and arrow pointing to predicted RZ1
	11,2,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,SCHEDULEDATE+5,predicted_rz1+2,SCHEDULEDATE,predicted_rz1 
	11,27,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,WARNING
	11,27,LABEL,Predicted too wet - %predicted_rz1-target_rz1:AMT:1% above target|Predicted RZ1=%predicted_rz1:AMT:1% on %SCHEDULEDATE:d mmm:% dwu=%ScheduleDWU:DWU:1%,alias,format,align,HGGGHGGGGGG,RIGHT,100,BLACK,SCHEDULEDATE+5,predicted_rz1+2,,

	'vertical arrow showing difference
	7,2,DOUBLEARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,SCHEDULEDATE,predicted_rz1,SCHEDULEDATE,target_rz1 
	
	'set too-high
	11,27,FORMULA,ontarget=1 

11,27,BEGINELSEIF,predicted_rz1 < target_rz1 

	'below target

	'label and arrow pointing to predicted RZ1
	7,2,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,SCHEDULEDATE+5,predicted_rz1-2,SCHEDULEDATE,predicted_rz1 
	11,27,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,WARNING
	11,27,LABEL,Predicted too dry - %predicted_rz1-target_rz1:AMT:1% below target|Predicted RZ1=%predicted_rz1:AMT:1% on %SCHEDULEDATE:d mmm:% dwu=%ScheduleDWU:DWU:1%,alias,format,align,HGGGHGGGGGG,RIGHT,100,BLACK,SCHEDULEDATE+5,predicted_rz1-2,,

	'vertical arrow showing difference
	7,2,DOUBLEARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,SCHEDULEDATE,predicted_rz1,SCHEDULEDATE,target_rz1 

	'set too-low 
	11,27,FORMULA,ontarget=2 

11,27,ELSE 

	'will hit target
	7,2,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,SCHEDULEDATE+5,predicted_rz1,SCHEDULEDATE,predicted_rz1 
	11,27,TEXT,Predicted to hit target (%target_rz1:AMT:0%),alias,format,align,GGGGGGGGGGGGGGGG,RIGHT,80,BLACK,SCHEDULEDATE+5,predicted_rz1,, 

	'set just-right
	11,27,FORMULA,ontarget=0 

11,27,ENDIF 

'reset fillcolour
11,27,FILLCOLOUR,source,alias,format,align,HGGGHGGGGGG,orientation,size,YELLOW

'show arrow from RZ1 to TargetRZ1
11,27,BEGINIF,ontarget>0 
	'only if will hit target
	'arrow, 1p, dot, from RZ1 to RZTarget to show what *should* happen 
	11,27,ARROW,source,alias,format,align,GGGGGIGGGGGGGGGGG,orientation,1,DARKGREEN,CRNTDATE,RZ1,SCHEDULEDATE,target_rz1
11,27,ENDIF 

'label and arrow pointing to target RZ1
7,2,ARROW,source,alias,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,SCHEDULEDATE+5,target_rz1,SCHEDULEDATE,target_rz1,,
11,27,LABEL,Target=%target_rz1:AMT:1% on %SCHEDULEDATE:d mmm:%,alias,format,align,HGGGHGGGGGG,RIGHT,100,BLACK,SCHEDULEDATE+5,target_rz1,,


'========================== use: Site 2, Western Block, Rows 78/79 (ALVINE VINEAYRD) Lynette 2023/24
7,1,REPORTTITLE,example_criticaldates '
7,1,INCLUDE,example_check 'Method/CropType top left 

'use CriticalDate6
'2 pt blue vertical line at CriticalDate6 
'(but might already be plotted)
7,2,LINE,source,Vertical line at CriticalDate4,format,align,GGGGGGGGGGGGGGGG,orientation,1,BLUE,DATE6,TYMIN,DATE6,TYMAX 

7,2,FORMULA,days_togo=DATE4-CRNTDATE

'tempo check
'7,3,LABEL,days-togo=%days_togo:0%,alias,format,align,HGGGGGGGGG,BELOWRIGHT,80,BLACK,10,0,,

'message about season end, top centre of time graph
'7,5,LABEL,%SEASONEND-CRNTDATE:0% days to end of season (%SEASONEND:d mmm:0%),alias,format,align,HHGGHGGGGG,BELOWPLUS,120,BLACK,(TXMIN+TXMAX)/2,TYMAX,,

7,2,BEGINIF,days_togo<20
	7,11,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGG,orientation,size,WARNING
7,2,ENDIF

'message about critical date 6, border, bold, size=150
7,3,LABEL,Only %days_togo:0% days to %Date6Text% (%DATE6:d mmm:0%),alias,format,align,HGGGHGGGGG,LEFT,100,BLACK,DATE6-10,TYMAX-12,,

7,11,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGG,orientation,size,YELLOW 'back to normal

'1 pt DarkGreen arrow from 7,3 label to CriticalDate line
7,4,ARROW,source,Arrow pointing at top of CriticalDate1,format,align,GGGGGGGGGGGGGGGG,orientation,1,DARKGREEN,DATE6-10,TYMAX-12,DATE6,TYMAX-12

'====================
7,1,REPORTTITLE,example_criticaldate3 ''
7,1,INCLUDE,example_check 'Method/CropType top left 

'details about target and stress at DATE3 (veraison Estimate) Site 2, Western Block Lynette 2023/24'
'set value of plotdate
11,27,FORMULA,plotdate=DATE3

'explain what example does...
7,11,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGG,orientation,size,PALEGREEN
11,27,LABEL,{detail of all RZ values at any date},alias,format,align,HGGGHGGGGG,BELOW,100,BLACK,plotdate,TYMAX-5,,
7,11,FILLCOLOUR,source,alias,format,align,GGGGGGGGGGG,orientation,size,YELLOW

'if not plotting CriticalDates, plot vertical line and label
6,30,BEGINIF,Option(17)=0 '(17) = plot CriticalDates OFF  GraphMenu/Options/Local tab: time graph see: /prwin3/repdefs.htm#optioncodes

	13,27,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,2,RED,plotdate,TYMIN,plotdate,TYMAX

	'label centred on PlotDate
	11,27,LABEL,%DATE3TEXT% (%plotdate:d mmm%),alias,format,align,HGGGHGGGGG,BELOWPLUS,100,BLACK,plotdate,TYMAX,,

6,30,ENDIF

'call report: example_plotdate
11,27,INCLUDE,example_plotdate

'could also do other critical dates, SeasonEnd, etc
11,27,FORMULA,plotdate=DATE2
'11,27,INCLUDE,example_plotdate
11,27,FORMULA,plotdate=DATE5
'11,27,INCLUDE,example_plotdate

'================ subroutine()
13,1,ReportTitle,example_plotdate ' CRNTDATE

	'can only plot PREDICTED if in future
	13,3,FORMULA,plotdate_predicted=PredictedAMT(plotdate) 'predicted RZ1 on right because will overlap
	13,4,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate+1,plotdate_predicted,plotdate,plotdate_predicted
	13,5,LABEL,P=%plotdate_predicted:AMT:1%,alias,format,align,HGGGHGGGGG,RIGHT,80,BLACK,plotdate+1,plotdate_predicted,,

13,6,ENDIF

13~7~FORMULA~plotdate_upper=YValueByDate(plotdate,0) '0=upper
13,8,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,BLACK,plotdate-1,plotdate_upper,plotdate,plotdate_upper
13,9,LABEL,U=%plotdate_upper:AMT:1%,alias,format,align,HGGGHGGGGG,LEFT,80,BLACK,plotdate-1,plotdate_upper,,

13~10~FORMULA~plotdate_lower=YValueByDate(plotdate,1) '1=lower
13,11,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,BLACK,plotdate-1,plotdate_lower,plotdate,plotdate_lower
13,12,LABEL,L=%plotdate_lower:AMT:1%,alias,format,align,HGGGHGGGGG,LEFT,80,BLACK,plotdate-1,plotdate_lower,,

13,13,FORMULA,plotdate_target=TargetAMT(plotdate)
13,14,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate-1,plotdate_target,plotdate,plotdate_target
13,15,LABEL,T=%plotdate_target:AMT:1%,alias,format,align,HGGGHGGGGG,LEFT,80,BLACK,plotdate-1,plotdate_target,,

13,16,FORMULA,plotdate_stress=StressAMT(plotdate)
13,17,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate+1,plotdate_stress,plotdate,plotdate_stress
13,18,LABEL,S=%plotdate_stress:AMT:1%,alias,format,align,HGGGHGGGGG,RIGHT,80,BLUE,plotdate+1,plotdate_stress,,

'debug
13,19,LABEL,%plotdate:d mmm:0% P=%plotdate_predicted:0.00:1% T=%plotdate_target:0.00:1%  S=%plotdate_stress:0.00:1%,alias,format,align,HGGGGGGGGG,BELOWRIGHT,80,BLACK,20,0,,

'calculate target stress
13,20,FORMULA,plotdate_difference=plotdate_stress - plotdate_target 
13,21,FORMULA,plotdate_middle=(plotdate_stress+plotdate_target)/2
13,22,BEGINIF,plotdate_target < plotdate_stress

	'target below stress, so stressed

	13,23,FILLCOLOUR,source,alias,format,align,GGGGGGIGGGG,orientation,size,WARNING
	13,24,LABEL,Target stress = %plotdate_difference:AMT:1%,alias,format,align,HGGGHGGGGG,RIGHT,110,WHITE,plotdate+5,plotdate_middle,,  'at %plotdate:d mmm:0%

	'vertical line at plotdate, from target to stress
	13,25,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,4,DARKRED,plotdate,plotdate_stress,plotdate,plotdate_target

	'arrow pointing from label to middle of line
	13,26,ARROW,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate+5,plotdate_middle,plotdate,plotdate_middle

13,27,ELSE

	'not stressed
	13,28,LABEL,Target not stressed,alias,format,align,HGGGHGGGGG,RIGHT,80,BLACK,plotdate+5,plotdate_middle,,  'at %plotdate:d mmm:0% (%plotdate_difference:AMT:1%)

	'vertical line at plotdate, from target to stress
	13,29,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate,plotdate_stress,plotdate,plotdate_target

	'arrow pointing from label to middle of line
	13,30,ARROW,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate+2,plotdate_stress+5,plotdate,plotdate_middle

13,31,ENDIF

13,32,FILLCOLOUR,source,alias,format,align,GGGGGGIGGGG,orientation,size,YELLOW 'back to normal

'calculate predicted stress only if PLOTDATE is in future
13,33,BEGINIF,PLOTDATE > CRNTDATE 

	13,34,FORMULA,plotdate_difference=plotdate_stress - plotdate_predicted
	13,35,FORMULA,plotdate_middle=(plotdate_stress + plotdate_predicted)/2
	13,36,BEGINIF,plotdate_predicted < plotdate_stress

		'predicted below stress
		13,37,FILLCOLOUR,source,alias,format,align,GGGGGGIGGGG,orientation,size,WARNING
		13,38,LABEL,Predicted stress = %plotdate_differen10:31 AM 09-Oct-24ce:AMT:1% ,alias,format,align,HGGGHGGGGG,ABOVERIGHT,100,WHITE,plotdate+5,plotdate_middle,, 'at %plotdate:d mmm:0%

		'vertical line at plotdate, from predicted to stress
		13,39,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,4,DARKRED,plotdate,plotdate_predicted,plotdate,plotdate_stress

		'arrow pointing from label to middle of line
		13,49,ARROW,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate+2,plotdate_predicted+5,plotdate,plotdate_middle

	13,41,ELSE

		'not stressed
		'is a label needed ?
		13,42,LABEL,Predicted not stressed,alias,format,align,HGGGHGGGGG,RIGHT,80,BLACK,plotdate+5,plotdate_middle,, ' at %plotdate:d mmm:0% (%plotdate_difference:AMT:1%)

		'vertical line at plotdate, from predicted to stress
		13,43,LINE,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate,plotdate_stress,plotdate,plotdate_predicted

		'arrow pointing from label to middle of line
		13,44,ARROW,source,alias,format,align,GGGGGGIGGGG,orientation,1,DARKGREEN,plotdate+5,plotdate_middle,plotdate,plotdate_middle

	13,45,ENDIF

	13,46,FILLCOLOUR,source,alias,format,align,GGGGGGIGGGG,orientation,size,YELLOW 'back to normal

13,47,ENDIF 'PLOTDATE > CRNTDATE

'============================
12,1,REPORTTITLE,example_spares	'

'testing variables
'5,7,LABEL,Option(60)=%Option(60)% CropType=%CropType% TargetOnTop=%TargetOnTop%,alias,format,LEFT,HGGGGGGGGGG,orientation,size,BLACK,78,60,99,65

'crop stage
'16,2,LINE,RED,,,,0,0,1,0,DATE2,TYMAX,DATE2,TYMIN
'16,2,TEXT,Date2Text,,,,0,AbovePlus,100,1,DATE2,TYMAX,,
'16,2,FORMULA,Date2,,d mmm,,0,BelowPlus,100,1,DATE2,TYMAX,,

'Alan Christie
'11,14,Formula,RZ2FULL-RZ2,,AMT,Left,JJGGGGGGGG,0,110,RED,73,34,84,37
'11,14,Formula,RZ2FULL-RZ2-200,,AMT,Left,JJGHGGGGGG,0,110,RED,73,34,84,37
'11,27,Label,Size=    >,,,Left,JJGGGGGGGG,0,110,RED,62,37,98,40


'7,7,Label,Variable,Alias,Format,RIGHT,HHGGGGGGGGG,,,BLACK,50,2,60,5
'7,7,Label,Value,Alias,,LEFT,HHGGGGGGGGG,,,BLACK,60,2,70,5
'7,7,Label,Text,Alias,,LEFT,HHGGGGGGGG,,,BLACK,70,2,80,5

'7,7,Label,SeasonEnd:,,,RIGHT,HGGGGGGGGGG,,,BLACK,50,5,60,8
'7,7,Formula,SeasonEnd,,0.000,LEFT,HGGGGGGGGGG,,,BLACK,60,5,70,8
'7,7,Formula,SeasonEnd,,d mmm yyyy,LEFT,HGGGGGGGGGG,,,BLACK,70,5,80,8

'7,7,Label,CurrentDate:,,,RIGHT,HGGGGGGGGGG,,,BLACK,50,8,60,11
'7,7,Formula,CRNTDATE,,0.000,LEFT,HGGGGGGGGGG,,,BLACK,60,8,70,11
'7,7,Formula,CRNTDATE,,d mmm yyyy HH:MM,LEFT,HGGGGGGGGGG,,,BLACK,70,8,80,11

'=============
11,1,REPORTTITLE,example_forecasts ' 0
	'lines intersect
	21,4,ARROW,source,arrow from LatestReading to intersect,format,align,HGGGGGGGGG,orientation,1,RED,CRNTDATE,CRNTAMT,INTERSECTX,INTERSECTY
	21,5,LABEL,%INTERSECTY:AMT:1% on %INTERSECTX:d mmm:0%,alias,format,align,HGGGHGGGGG,ABOVERIGHTPLUS,100,BLACK,INTERSECTX,INTERSECTY
	21,5,LABEL,Rate=%(CRNTAMT-INTERSECTY)/(INTERSECTX-CRNTDATE):DWU:1%,alias,format,align,HGGGHGGGGG,ABOVERIGHTPLUS,100,BLACK,(CRNTDATE+INTERSECTX)/2,(CRNTAMT+INTERSECTY)/2

21,4,ELSE

	'does not intersect, so put (debug) label at Latest Reading
	21,5,LABEL,No intersect,alias,format,align,HGGGHGGGGG,ABOVERIGHTPLUS,100,BLACK,CRNTDATE,CRNTAMT

11,6,ENDIF

21,5,LINE,checking,alias,format,align,HGGGHGGGGG,orientation,1,BLUE,CRNTDATE,CRNTAMT,CRNTDATE+60,CRNTAMT-3.15*60




'=============
11,1,REPORTTITLE,example_check '