| | 1 | | using Morpho25.Utility; |
| | 2 | |
|
| | 3 | |
|
| | 4 | | namespace Morpho25.Settings |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Soil settings class. |
| | 8 | | /// </summary> |
| | 9 | | public class SoilSettings : Configuration |
| | 10 | | { |
| | 11 | | private double _tempUpperlayer; |
| | 12 | | private double _tempMiddlelayer; |
| | 13 | | private double _tempDeeplayer; |
| | 14 | | private double _tempBedrockLayer; |
| | 15 | | private double _waterUpperlayer; |
| | 16 | | private double _waterMiddlelayer; |
| | 17 | | private double _waterDeeplayer; |
| | 18 | | private double _waterBedrockLayer; |
| | 19 | |
|
| | 20 | | private double ToKelvin(double value) |
| 9 | 21 | | { |
| 9 | 22 | | return value + Util.TO_KELVIN; |
| 9 | 23 | | } |
| | 24 | | /// <summary> |
| | 25 | | /// Initial Temperature Upper Layer (0-20 cm) [°C]. |
| | 26 | | /// </summary> |
| | 27 | | public double TempUpperlayer |
| | 28 | | { |
| 9 | 29 | | get { return _tempUpperlayer; } |
| | 30 | | set |
| 3 | 31 | | { |
| 3 | 32 | | _tempUpperlayer = ToKelvin(value); |
| 3 | 33 | | } |
| | 34 | | } |
| | 35 | | /// <summary> |
| | 36 | | /// Initial Temperature Middle Layer (20-50 cm) [°C]. |
| | 37 | | /// </summary> |
| | 38 | | public double TempMiddlelayer |
| | 39 | | { |
| 3 | 40 | | get { return _tempMiddlelayer; } |
| | 41 | | set |
| 2 | 42 | | { |
| 2 | 43 | | _tempMiddlelayer = ToKelvin(value); |
| 2 | 44 | | } |
| | 45 | | } |
| | 46 | | /// <summary> |
| | 47 | | /// Initial Temperature Deep Layer (below 50-200 cm) [°C]. |
| | 48 | | /// </summary> |
| | 49 | | public double TempDeeplayer |
| | 50 | | { |
| 3 | 51 | | get { return _tempDeeplayer; } |
| | 52 | | set |
| 2 | 53 | | { |
| 2 | 54 | | _tempDeeplayer = ToKelvin(value); |
| 2 | 55 | | } |
| | 56 | | } |
| | 57 | | /// <summary> |
| | 58 | | /// Initial Temperature Bedrock Layer (200 cm) [°C]. |
| | 59 | | /// </summary> |
| | 60 | | public double TempBedrockLayer |
| | 61 | | { |
| 3 | 62 | | get { return _tempBedrockLayer; } |
| | 63 | | set |
| 2 | 64 | | { |
| 2 | 65 | | _tempBedrockLayer = ToKelvin(value); |
| 2 | 66 | | } |
| | 67 | | } |
| | 68 | | /// <summary> |
| | 69 | | /// Relative Humidity Upper Layer (0-20 cm). |
| | 70 | | /// </summary> |
| | 71 | | public double WaterUpperlayer |
| | 72 | | { |
| 3 | 73 | | get { return _waterUpperlayer; } |
| | 74 | | set |
| 2 | 75 | | { |
| 2 | 76 | | IsHumidityOk(value); |
| 2 | 77 | | _waterUpperlayer = value; |
| 2 | 78 | | } |
| | 79 | | } |
| | 80 | | /// <summary> |
| | 81 | | /// Relative Humidity Middle Layer (20-50 cm). |
| | 82 | | /// </summary> |
| | 83 | | public double WaterMiddlelayer |
| | 84 | | { |
| 3 | 85 | | get { return _waterMiddlelayer; } |
| | 86 | | set |
| 2 | 87 | | { |
| 2 | 88 | | IsHumidityOk(value); |
| 2 | 89 | | _waterMiddlelayer = value; |
| 2 | 90 | | } |
| | 91 | | } |
| | 92 | | /// <summary> |
| | 93 | | /// Relative Humidity Deep Layer (50-200 cm). |
| | 94 | | /// </summary> |
| | 95 | | public double WaterDeeplayer |
| | 96 | | { |
| 3 | 97 | | get { return _waterDeeplayer; } |
| | 98 | | set |
| 3 | 99 | | { |
| 3 | 100 | | IsHumidityOk(value); |
| 2 | 101 | | _waterDeeplayer = value; |
| 2 | 102 | | } |
| | 103 | | } |
| | 104 | | /// <summary> |
| | 105 | | /// Relative Humidity Bedrock (below 200 cm). |
| | 106 | | /// </summary> |
| | 107 | | public double WaterBedrockLayer |
| | 108 | | { |
| 3 | 109 | | get { return _waterBedrockLayer; } |
| | 110 | | set |
| 2 | 111 | | { |
| 2 | 112 | | IsHumidityOk(value); |
| 2 | 113 | | _waterBedrockLayer = value; |
| 2 | 114 | | } |
| | 115 | | } |
| | 116 | | /// <summary> |
| | 117 | | /// Create soil settings object. |
| | 118 | | /// </summary> |
| 2 | 119 | | public SoilSettings() |
| 2 | 120 | | { |
| 2 | 121 | | TempUpperlayer = 19.85; |
| 2 | 122 | | TempMiddlelayer = 19.85; |
| 2 | 123 | | TempDeeplayer = 19.85; |
| 2 | 124 | | TempBedrockLayer = 19.85; |
| 2 | 125 | | WaterUpperlayer = 70.0; |
| 2 | 126 | | WaterMiddlelayer = 75.0; |
| 2 | 127 | | WaterDeeplayer = 75.0; |
| 2 | 128 | | WaterBedrockLayer = 75.0; |
| 2 | 129 | | } |
| | 130 | |
|
| | 131 | | /// <summary> |
| | 132 | | /// Title of the XML section |
| | 133 | | /// </summary> |
| 1 | 134 | | public string Title => "Soil"; |
| | 135 | |
|
| | 136 | | /// <summary> |
| | 137 | | /// Values of the XML section |
| | 138 | | /// </summary> |
| 1 | 139 | | public string[] Values => new[] { |
| 1 | 140 | | TempUpperlayer.ToString("n5"), |
| 1 | 141 | | TempMiddlelayer.ToString("n5"), |
| 1 | 142 | | TempDeeplayer.ToString("n5"), |
| 1 | 143 | | TempBedrockLayer.ToString("n5"), |
| 1 | 144 | | WaterUpperlayer.ToString("n5"), |
| 1 | 145 | | WaterMiddlelayer.ToString("n5"), |
| 1 | 146 | | WaterDeeplayer.ToString("n5"), |
| 1 | 147 | | WaterBedrockLayer.ToString("n5") |
| 1 | 148 | | }; |
| | 149 | |
|
| | 150 | | /// <summary> |
| | 151 | | /// Tags of the XML section |
| | 152 | | /// </summary> |
| 1 | 153 | | public string[] Tags => new[] { |
| 1 | 154 | | "tempUpperlayer", |
| 1 | 155 | | "tempMiddlelayer", |
| 1 | 156 | | "tempDeeplayer", |
| 1 | 157 | | "tempBedrockLayer", |
| 1 | 158 | | "waterUpperlayer", |
| 1 | 159 | | "waterMiddlelayer", |
| 1 | 160 | | "waterDeeplayer", |
| 1 | 161 | | "waterBedrockLayer" |
| 1 | 162 | | }; |
| | 163 | |
|
| | 164 | | /// <summary> |
| | 165 | | /// String representation of SoilSettings object. |
| | 166 | | /// </summary> |
| | 167 | | /// <returns>String representation.</returns> |
| 0 | 168 | | public override string ToString() => "Config::SoilSettings"; |
| | 169 | | } |
| | 170 | |
|
| | 171 | | } |