예제 #1
0
        // ------------------------------------------------------
        //public void SetMeanDischarge_CalcEstMeanVars()
        //{
        //    // Calculate MeanDischarge and MeanEstVel for Estuaries
        //    double N;
        //    double DateIndex;
        //    double SumEstVel;
        //    double SumDisch;
        //    double TTPres;
        //    TSalinity TS;
        //    N = 0;
        //    TTPres = TPresent;
        //    TS = GetStatePointer(AllVariables.Salinity, T_SVType.StV, T_SVLayer.WaterCol);
        //    SumEstVel = 0;
        //    SumDisch = 0;
        //    DateIndex = TimeIndex - 1;
        //    do
        //    {
        //        DateIndex = DateIndex + 1;
        //        N = N + 1;
        //        TPresent = DateIndex;
        //        CalculateLoad(DateIndex);
        //        TS.CalculateLoad(DateIndex);
        //        Location.Discharge[VerticalSegments.Epilimnion] = UpperOutflow();
        //        SumEstVel = SumEstVel + Velocity(0, 0, false);
        //        SumDisch = SumDisch + Location.Discharge[VerticalSegments.Epilimnion];
        //    } while (!(((DateIndex - 365) >= TimeIndex) || (DateIndex >= SetupRec.LastDay)));
        //    MeanDischarge = SumDisch / N;
        //    MeanEstVel = SumEstVel / N;
        //    TPresent = TTPres;
        //    CalculateLoad(TimeIndex);
        //    // reset TVolume values
        //    TS.CalculateLoad(TimeIndex);
        //    Location.Discharge[VerticalSegments.Epilimnion] = UpperOutflow();
        //}

        // ------------------------------------------------------
        public double SetMeanDischarge_CalcDynamicMV(ref DateTime TimeIndex)
        {
            double result;
            // Calculates the volume for every time step then averages over a year
            DateTime DateIndex;
            double   N;
            double   DynamVol;
            double   SumVol;

            SumVol    = 0;
            DynamVol  = State;
            N         = 0;
            DateIndex = TimeIndex.AddDays(-1);
            do
            {
                DateIndex.AddDays(1);
                N = N + 1;
                CalculateLoad(DateIndex);
                DynamVol = DynamVol + InflowLoad - DischargeLoad - Evaporation();
                // handle dynamic evaporation properly
                SumVol = SumVol + DynamVol;
            } while (!((DateIndex.AddDays(-365) >= TimeIndex) || (DateIndex >= AQTSeg.PSetup.LastDay)));
            result = SumVol / N;
            if (result < 0)
            {
                result = 0;
            }
            CalculateLoad(TimeIndex);
            // reset TVolume values

            return(result);
        }
예제 #2
0
        } //TVolume.Derivative

        // ------------------------------------------------------
        public void SetMeanDischarge_AverageVolumeLoads(ref DateTime TimeIndex, ref double AverageDischargeLoad, ref double AverageInflowLoad)
        {
            DateTime DateIndex;
            double   N;
            double   Sum_Dl;
            double   Sum_IL;

            Sum_Dl    = 0;
            Sum_IL    = 0;
            N         = 0;
            DateIndex = TimeIndex.AddDays(-1);
            do
            {
                DateIndex = DateIndex.AddDays(1);
                N         = N + 1;
                CalculateLoad(DateIndex);
                Sum_Dl = Sum_Dl + DischargeLoad;
                Sum_IL = Sum_IL + InflowLoad;
            } while (!((DateIndex.AddDays(-365) >= TimeIndex) || (DateIndex >= AQTSeg.PSetup.LastDay)));

            AverageDischargeLoad = Sum_Dl / N;
            AverageInflowLoad    = Sum_IL / N;
            CalculateLoad(TimeIndex);
            // reset TVolume values
        }
예제 #3
0
        // ------------------------------------------------------
        public double SetMeanDischarge_CalcKnownValueMD(ref DateTime TimeIndex, ref double MV)
        {
            double result;
            // Calculates the discharge for every time step then averages over a year
            // Given that KnownValLoad - State = Inflow - Discharge - Evap
            // and that for each day, State should = KnownValLoad(T-1) then
            // Discharge = Inflow - KnownValLoad + KnownValLoad(T-1) - Evap
            DateTime DateIndex;
            double   N;
            double   KnownVal_Tminus1;
            double   Sum_Disch;
            double   SumVol;

            Sum_Disch        = 0;
            SumVol           = 0;
            KnownVal_Tminus1 = InitialCond;
            N         = 0;
            DateIndex = TimeIndex.AddDays(-1);
            do
            {
                DateIndex = DateIndex.AddDays(1);
                N         = N + 1;
                CalculateLoad(DateIndex);
                Sum_Disch = Sum_Disch + InflowLoad - KnownValueLoad + KnownVal_Tminus1 - Evaporation();
                // handle dynamic evaporation properly
                KnownVal_Tminus1 = KnownValueLoad;
                SumVol           = SumVol + KnownValueLoad;
            } while (!(((DateIndex.AddDays(-365)) >= TimeIndex) || (DateIndex >= AQTSeg.PSetup.LastDay)));
            result = Sum_Disch / N;
            MV     = SumVol / N;
            if (result < 0)
            {
                result = 0;
            }
            CalculateLoad(TimeIndex);
            // reset TVolume values

            return(result);
        }