コード例 #1
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);
        }