Пример #1
0
        public void GetSiValue02()  //GetValue(DateTime fromTime, DateTime toTime, bool toSIUnit)
        {
            TimestampSeries timestampSeries = new TimestampSeries();

            timestampSeries.Items.Add(new TimestampValue(new DateTime(2010, 1, 1, 0, 0, 0), 3000.0));
            timestampSeries.Unit = new HydroNumerics.Core.Unit("Liters pr. second", 0.001, 0.0);
            Assert.AreEqual(3.0, timestampSeries.GetSiValue(new DateTime(2010, 1, 2, 0, 0, 0), new DateTime(2010, 1, 2, 0, 0, 0)));
        }
Пример #2
0
        public void GetSiValue02()  //GetSiValues(DateTime startTimem, DateTime endTime)
        {
            TimestampSeries ts = new TimestampSeries();

            ts.Unit = new HydroNumerics.Core.Unit("cm/sec", 0.01, 0.0);
            ts.Items.Add(new TimestampValue(new DateTime(2010, 1, 1, 0, 0, 0), 3));
            ts.Items.Add(new TimestampValue(new DateTime(2010, 1, 2, 0, 0, 0), 3));
            Assert.AreEqual(0.03, ts.GetSiValue(new DateTime(2010, 1, 1, 0, 0, 0), new DateTime(2010, 1, 2, 0, 0, 0)));
        }
Пример #3
0
        /// <summary>
        /// Gets the average storage time for the time period. Calculated as mean volume divide by mean (sinks + outflow + evaporation)
        /// </summary>
        /// <param name="Start"></param>
        /// <param name="End"></param>
        /// <returns></returns>
        public TimeSpan GetStorageTime(DateTime Start, DateTime End)
        {
            if (!IsEmpty)
            {
                if (EndTime < End || StartTime > Start)
                {
                    throw new Exception("Cannot calculate storage time outside of the simulated period");
                }

                //Find the total outflow
                double d = Sinks.GetSiValue(Start, End);
                d += Outflow.GetSiValue(Start, End);
                //Evaporation is negative
                d += Evaporation.GetSiValue(Start, End);
                d += GroundwaterOutflow.GetSiValue(Start, End);

                return(TimeSpan.FromSeconds(StoredVolume.GetSiValue(Start, End) / d));
            }
            return(TimeSpan.Zero);
        }