public double WP(ParametersOfTheDay POTD) { double WaterPenitrate = 0; double Ewaporate = 0.283 * POTD.Temperature - 1.648; string S = string.Format("{0:MM}", POTD.Date); if (S != "12" || S != "01" || S != "02") { WaterPenitrate = POTD.EfectPrecip - WaterPenitrate; } else if (S == "12" || S == "01" || S == "02") { WaterPenitrate = POTD.EfectPrecip; } return(WaterPenitrate); }
public void AddEntryFromFileLine(string line) { string[] fields = line.Split(' '); try { ParametersOfTheDay POTD = new ParametersOfTheDay(); POTD.Date = Convert.ToDateTime(fields[0]); POTD.Temperature = Double.Parse(fields[1]); POTD.Precip = Double.Parse(fields[2]); double K = POTD.Temperature * 5; if (POTD.Temperature <= 0) { _snow += POTD.Precip; POTD.Snow = _snow; } else if (POTD.Temperature > 0) { if (_snow < K) { POTD.EfectPrecip = POTD.Precip + _snow; _snow = 0; } else if (_snow > K) { _snow -= K; POTD.EfectPrecip = POTD.Precip + K; } } POTD.Snow = _snow; POTD.WaterPenitr = WP(POTD); POTD.IncrPart = _incrPart + POTD.WaterPenitr; _incrPart += POTD.WaterPenitr; AddEntry(POTD); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void AddEntry(ParametersOfTheDay Day) { _entries.Add(Day); }