| | 1 | | namespace Morpho25.Settings |
| | 2 | | { |
| | 3 | | /// <summary> |
| | 4 | | /// Sources settings class. |
| | 5 | | /// </summary> |
| | 6 | | public class Sources : Configuration |
| | 7 | | { |
| | 8 | | /// <summary> |
| | 9 | | /// Isoprene index. |
| | 10 | | /// </summary> |
| | 11 | | public const string ISOPRENE = "0"; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// User pollutant name. |
| | 15 | | /// </summary> |
| 4 | 16 | | public string UserPolluName { get; set; } |
| | 17 | |
|
| | 18 | | /// <summary> |
| | 19 | | /// User pollutant type. |
| | 20 | | /// </summary> |
| 5 | 21 | | public Pollutant UserPolluType { get; set; } |
| | 22 | |
|
| | 23 | | /// <summary> |
| | 24 | | /// Dispersion and active chemistry |
| | 25 | | /// </summary> |
| 3 | 26 | | public Active ActiveChem { get; set; } |
| | 27 | |
|
| | 28 | | private double _userPartDiameter; |
| | 29 | | private double _userPartDensity; |
| | 30 | | /// <summary> |
| | 31 | | /// Multiple source types. |
| | 32 | | /// </summary> |
| 3 | 33 | | public Active MultipleSources { get; set; } |
| | 34 | | /// <summary> |
| | 35 | | /// Particle diameter (μm). |
| | 36 | | /// </summary> |
| | 37 | | public double UserPartDiameter |
| | 38 | | { |
| 3 | 39 | | get { return _userPartDiameter; } |
| | 40 | | set |
| 2 | 41 | | { |
| 2 | 42 | | ItIsPositive(value); |
| 2 | 43 | | _userPartDiameter = value; |
| 2 | 44 | | } |
| | 45 | | } |
| | 46 | | /// <summary> |
| | 47 | | /// Particle density (g/cm3). |
| | 48 | | /// </summary> |
| | 49 | | public double UserPartDensity |
| | 50 | | { |
| 3 | 51 | | get { return _userPartDensity; } |
| | 52 | | set |
| 2 | 53 | | { |
| 2 | 54 | | ItIsPositive(value); |
| 2 | 55 | | _userPartDensity = value; |
| 2 | 56 | | } |
| | 57 | | } |
| | 58 | | /// <summary> |
| | 59 | | /// Create new Pollutant. |
| | 60 | | /// </summary> |
| 2 | 61 | | public Sources() |
| 2 | 62 | | { |
| 2 | 63 | | UserPolluName = "My Pollutant"; |
| 2 | 64 | | UserPolluType = Pollutant.CO2; |
| 2 | 65 | | UserPartDiameter = 10.0; |
| 2 | 66 | | UserPartDensity = 1.0; |
| 2 | 67 | | MultipleSources = Active.YES; |
| 2 | 68 | | ActiveChem = Active.YES; |
| 2 | 69 | | } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Title of the XML section |
| | 73 | | /// </summary> |
| 1 | 74 | | public string Title => "Sources"; |
| | 75 | |
|
| | 76 | | /// <summary> |
| | 77 | | /// Values of the XML section |
| | 78 | | /// </summary> |
| 1 | 79 | | public string[] Values => new[] { |
| 1 | 80 | | UserPolluName, |
| 1 | 81 | | ((int)UserPolluType).ToString(), |
| 1 | 82 | | UserPartDiameter.ToString("n5"), |
| 1 | 83 | | UserPartDensity.ToString("n5"), |
| 1 | 84 | | ((int)MultipleSources).ToString(), |
| 1 | 85 | | ((int)ActiveChem).ToString(), |
| 1 | 86 | | ISOPRENE |
| 1 | 87 | | }; |
| | 88 | |
|
| | 89 | | /// <summary> |
| | 90 | | /// Tags of the XML section |
| | 91 | | /// </summary> |
| 1 | 92 | | public string[] Tags => new[] { |
| 1 | 93 | | "userPolluName", |
| 1 | 94 | | "userPolluType", |
| 1 | 95 | | "userPartDiameter", |
| 1 | 96 | | "userPartDensity", |
| 1 | 97 | | "multipleSources", |
| 1 | 98 | | "activeChem", |
| 1 | 99 | | "isoprene" |
| 1 | 100 | | }; |
| | 101 | |
|
| | 102 | | /// <summary> |
| | 103 | | /// String representation of Pollutant object. |
| | 104 | | /// </summary> |
| | 105 | | /// <returns>String representation.</returns> |
| 0 | 106 | | public override string ToString() => $"Config::Sources::{UserPolluName}"; |
| | 107 | | } |
| | 108 | |
|
| | 109 | | } |