forked from holos-aafc/Holos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoreConstants.cs
217 lines (166 loc) · 5.93 KB
/
CoreConstants.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#region Imports
using System;
using System.Security.RightsManagement;
using System.Transactions;
using H.Infrastructure;
#endregion
namespace H.Core
{
/// <summary>
/// </summary>
public class CoreConstants
{
#region Constants
/// <summary>
/// Converts from N2O-N to N2O
/// </summary>
private const double ConvertN2ONToN2O = 44.0 / 28.0;
/// <summary>
/// Converts from NO-N to NO
/// </summary>
private const double ConvertNONToNO = 30.0 / 14.0;
/// <summary>
/// Converts from NO3-N to NO3
/// </summary>
private const double ConvertNO3NToNO3 = 62.0 / 14.0;
/// <summary>
/// Converts from NH3-N to NH3
/// </summary>
private const double ConvertNH3NToNH3 = 17.0 / 14.0;
/// <summary>
/// Converts from N2N to N2
/// </summary>
private const double ConvertN2NToN2 = 14.0 / 28.0;
/// <summary>
/// Converts from NH3 to NH3-N
/// </summary>
private const double ConvertNH3ToNH3N = 14.0 / 17.0;
private const double ConvertN2OToN = 28.0 / 44.0;
private const double ConvertNH3ToN = 14.0 / 17.0;
private const double ConvertCH4ToC = 12.0 / 16.0;
#endregion
#region Constructors
static CoreConstants()
{
DefaultMaximumYear = DateTime.Now.Year;
}
#endregion
#region Fields
#endregion
#region Properties
public static int GrowingSeasonJulianStartDay { get; } = 121;
public static int GrowingSeasonJulianEndDayOctober { get; } = 305;
public static int GrowingSeasonJulianEndDaySeptember { get; } = 273;
public static double EntericManureCH4UncertaintyEstimate = 1;
public static double ManureCH4UncertaintyEstimate = 1;
public static double DirectN2OUncertaintyEstimate = 2;
public static double IndirectN2OUncertaintyEstimate = 4;
public static double EnergyCO2UncertaintyEstimate = 2;
/// <summary>
/// (kg kg^-1)
/// </summary>
public static double CarbonConcentration = 0.45;
/// <summary>
/// Carbon concentration of trees used in shelterbelt component
/// </summary>
public static double CarbonConcentrationOfTrees = 0.5;
public static int ShelterbeltCarbonTablesMaximumAge = 60;
public static int IcbmProjectionPeriod = 30;
public static int IcbmEquilibriumYear = 1985;
public static double ValueNotDetermined = 0;
public static double NotApplicable = -100000;
public static double DaysInYear = 365.0;
/// <summary>
/// A sensible default for inputs that require a minimum allowable year (i.e. year of tillage change, year of seeding, etc.).
///
/// Note: use a double since rad controls can't use an int.
/// </summary>
public static double DefaultMinimumYear = 1800;
/// <summary>
/// Carbon calculations are not made for land use changes (conversions) prior to 1910.
///
/// Note: use a double since rad controls can't use an int.
/// </summary>
public static double MinimumCarbonModellingYear = 1910;
/// <summary>
/// Note that this value must account for any projected components that the user adds to the farm.
/// </summary>
public static double DefaultMaximumYear { get; }
/// <summary>
/// Converts from CO2 to CO2e
/// </summary>
public static double CO2ToCO2eConversionFactor = 1;
/// <summary>
/// Converts from CH4 to CO2e
/// </summary>
public static double CH4ToCO2eConversionFactor = 28;
/// <summary>
/// Converts N2O to CO2e
/// </summary>
public static double N2OToCO2eConversionFactor = 273;
/// <summary>
/// Converts from C to CO2
/// </summary>
public static double ConvertFromCToCO2 = 44.0 / 12.0;
public static string NotApplicableOutputString
{
get { return H.Core.Properties.Resources.NotApplicable; } // Don't use a '-' character as it confuses when there are negative numbers in a grid cell
}
#endregion
#region Public Methods
/// <summary>
/// Equation 2.6.9-27
/// Equation 4.9.6-1 (verify)
/// </summary>
public static double ConvertToN2O(double amountOfN2ON)
{
return amountOfN2ON * ConvertN2ONToN2O;
}
/// <summary>
/// Equation 2.6.9-28
/// </summary>
/// <param name="amountOfNON"></param>
/// <returns></returns>
public static double ConvertToNO(double amountOfNON)
{
return amountOfNON * ConvertNONToNO;
}
/// <summary>
/// Equation 2.6.9-29
/// Equation 4.9.6-3 (verify)
/// </summary>
public static double ConvertToNO3(double amountOfNO3N)
{
return amountOfNO3N * ConvertNO3NToNO3;
}
/// <summary>
/// Equation 2.6.9-30
/// Equation 4.9.6-2 (verify)
/// </summary>
public static double ConvertToNH3(double amountOfNH3N)
{
return amountOfNH3N * ConvertNH3NToNH3;
}
public static double ConvertToNH3N(double amountOfNH3)
{
return amountOfNH3 * ConvertNH3ToNH3N;
}
/// <summary>
/// Equation 2.6.9-31
/// Equation 4.8.6-1
/// </summary>
public static double ConvertToN(double amountOfN2O)
{
return amountOfN2O * ConvertN2OToN;
}
public static double ConvertToC(double amountOfCH4)
{
return amountOfCH4 * ConvertCH4ToC;
}
#endregion
#region Private Methods
#endregion
#region Event Handlers
#endregion
}
}