• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

andrewmovic Nov 14th, 2019 (edited) 101 in 8 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. <?php
2. /* -------------------------------------------
3. * Realtime Evapotranspiration Calculation
4. * Based on Penman-Monteith 56
5. * Author: andrew@ugm.ac.id
6. * Smart Agriculture Research Group
7. * Department of Agricultural and Biosystems Engineering
9. * Created: 15 November 2019
10. * ---------------------------------------------*/
11.
12.
13. echo ("Realtime Evapotranspiration<br />");
14.
15. \$Temp = 25.35;
16. \$Rh = 89;
17. //\$Rs = 12.67;      // Watt/m2
18. \$Rs = 16.3;         // Mj
19.
20. // Call the function
21. \$hitEto = ETo(\$Temp, \$Rh, \$Rs);
22.
23. echo "ETo : " . \$hitEto;
24.
25. // ETO Function
26. function ETo(\$Th, \$Rh, \$Rs){
27.     /*
28.     Input
29.     Th - Temperature
30.     Rh - Relative Humidity
32.     */
33.
34.     // Initial condition and assumption
35.     \$Gsc = 0.0820;  // Solar time angle at midpoint
36.     \$U2 = 0.73;     // Windspeed, asmp. 2m/s
37.     \$dz = 25;       // Elevation
38.     \$dlz = 250;     // Center of timezone (UTC+7) bangkok
39.
40.     #conversion Rs from Watt/m2 to MJ/m2 h
41.     //\$Rs = \$Rs * 0.0036;
42.     \$Rs = \$Rs * 1; // if already in MJ/m2
43.
44.     // Saturation vapor pressure (kPa)
45.     \$eoa = 0.6108*exp((17.27*\$Th)/(\$Th+237.3));
46.
47.     print("eoa: ". \$eoa. "<br />");
48.
49.     // Actual vapor pressure
50.     \$ea = \$eoa * (\$Rh/100);
51.
52.     // Vapor pressure deficit
53.     \$VPD = \$eoa - \$ea;
54.
56.
57.     // Soil heat flux
58.     if(\$Rn > 0) {
59.         // day
60.         \$G = 0.1*\$Rn;
61.     } else {
62.         // night
63.         \$G = 0.5 * \$Rn;
64.     }
65.
66.     // Calculate Delta and Lambda and Gamma
67.     // =4098*M2/((I2+273,3)^2)
68.
69.     //\$Delta = 4098*0.6108*exp((17.27*\$Th)/(\$Th+237.3))/pow((\$Th+237.3),2);
70.     \$Delta = 4098*exp((17.27*\$Th)/(\$Th+237.3))/pow((\$Th+237.3),2);
71.
72.     print("delta: ". \$Delta. "<br />");
73.
74.     \$Tk = \$Th + 273.16;
75.     \$Lambda = 2.501-(pow((2.361*10),-3))*\$Th;
76.
77.     print("lambda: ". \$Lambda. "<br />");
78.
79.     // Excel bu Tining
80.     // =101,3*(((293-0,0065*G2)/293)^5,26)
81.     \$P = 101.3*pow(((\$Tk - 0.0065*\$dz)/\$Tk),5.26) ;
82.
83.     \$Gamma =  0.00163*(\$P/\$Lambda);
84.     print("Gamma: ". \$Gamma. "<br />");
85.     \$ETo = ( 0.408* \$Delta*(\$Rn-\$G) + (\$Gamma*(37/(\$Th +273.16))*\$U2*\$VPD ))/(\$Delta + (\$Gamma*(1+(0.34*\$U2))));
86.     print("P : ". \$P. "<br />");
87.     return \$ETo;
88.
89. }
90.
91. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top