/
BandiCropAnalyzer-vpd_check.cs
55 lines (46 loc) · 2.06 KB
/
BandiCropAnalyzer-vpd_check.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MathWorks.MATLAB.NET.Arrays;
using BandiCropAnalyzer;
namespace ConsoleApplication1
{
class Moisture_Checker
{
static void Main(string[] args)
{
CropAnalyzer crop = new CropAnalyzer();
// Initialize required input: temp_c_in, rh_in
MWNumericArray temp_c_in = null;
MWNumericArray rh_in = null;
// Initialize optional input (by pair): verbose, TRUE/FALSE, vpd_min, vpd_min_val, vpd_max, vpd_max_val
MWCharArray verbose = "verbose", vpd_min = "vpd_min", vpd_max = "vpd_max";
MWLogicalArray TRUE = new MWLogicalArray(true), FALSE = new MWLogicalArray(false);
MWNumericArray vpd_min_val = 0.5, vpd_max_val = 1.2;
// initialize output struct fields
String[] result_fields = { "type", "code", "state", "vpd", "vpd_min", "vpd_max", "hum_adj", "adjust_unit"};
MWStructArray result = new MWStructArray(1, result_fields.Count(), result_fields);
//MWStructArray result = new MWStructArray();
//MWNumericArray result_code = null;
try
{
// Full usage: moisture.vpd_check(temp_c_in, rh_in, verbose, FALSE, vpd_min, vpd_min_val, vpd_max, vpd_max_val);
temp_c_in = 25; // deg Celsius
rh_in = 70; // %
vpd_min_val = 0.5; // kPa
vpd_max_val = 1.2; // kPa
result = (MWStructArray) crop.vpd_check(temp_c_in, rh_in, verbose, TRUE, vpd_min, vpd_min_val, vpd_max, vpd_max_val);
result_code = (MWNumericArray) result.GetField("code");
Console.WriteLine("RESULT CODE: " + result_code);
Console.Write("\nPress any key to exit.");
Console.ReadKey();
}
catch
{
throw;
}
}
}
}