public SnowAuxiliary(SnowAuxiliary toCopy, bool copyAll) // copy constructor
 {
     if (copyAll)
     {
         _jul    = toCopy._jul;
         _tmin   = toCopy._tmin;
         _tmax   = toCopy._tmax;
         _precip = toCopy._precip;
         _tavg   = toCopy._tavg;
     }
 }
Exemplo n.º 2
0
 private void EstimateOfAssociatedClasses(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
 {
     _Tavg.Estimate(s, s1, r, a, ex);
     _Refreezing.Estimate(s, s1, r, a, ex);
     _Melting.Estimate(s, s1, r, a, ex);
     _SnowDensity.Estimate(s, s1, r, a, ex);
     _SnowMelt.Estimate(s, s1, r, a, ex);
     _SnowAccumulation.Estimate(s, s1, r, a, ex);
     _SnowDry.Estimate(s, s1, r, a, ex);
     _SnowWet.Estimate(s, s1, r, a, ex);
     _SnowDepth.Estimate(s, s1, r, a, ex);
     _Preciprec.Estimate(s, s1, r, a, ex);
     _SnowDepthTrans.Estimate(s, s1, r, a, ex);
     _TempMax.Estimate(s, s1, r, a, ex);
     _TempMin.Estimate(s, s1, r, a, ex);
 }
Exemplo n.º 3
0
 private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
 {
     EstimateOfAssociatedClasses(s, s1, r, a, ex);
 }
Exemplo n.º 4
0
        public string TestPreConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
        {
            try
            {
                //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
                SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.jul.CurrentValue    = a.jul;
                SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmin.CurrentValue   = a.tmin;
                SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmax.CurrentValue   = a.tmax;
                SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.CurrentValue = a.precip;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.CurrentValue       = s.Sdry;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue     = s.Sdepth;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.CurrentValue       = s.Swet;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps.CurrentValue         = s.ps;
                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();
                RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.jul);
                if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.jul.ValueType))
                {
                    prc.AddCondition(r1);
                }
                RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmin);
                if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmin.ValueType))
                {
                    prc.AddCondition(r2);
                }
                RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmax);
                if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tmax.ValueType))
                {
                    prc.AddCondition(r3);
                }
                RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip);
                if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.ValueType))
                {
                    prc.AddCondition(r4);
                }
                RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry);
                if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.ValueType))
                {
                    prc.AddCondition(r5);
                }
                RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth);
                if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType))
                {
                    prc.AddCondition(r6);
                }
                RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet);
                if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.ValueType))
                {
                    prc.AddCondition(r7);
                }
                RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps);
                if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps.ValueType))
                {
                    prc.AddCondition(r8);
                }

                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tmaxseuil")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tminseuil")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("prof")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("E")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("rho")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Pns")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Kmin")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Tmf")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("SWrf")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("tsmax")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("DKmax")));
                prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("trmax")));
                string ret = "";
                ret += _Melting.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _Refreezing.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowAccumulation.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDensity.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDepth.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDepthTrans.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDry.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowMelt.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowWet.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _Tavg.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _TempMax.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _TempMin.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _Preciprec.TestPreConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   preconditions tests of associated classes");
                }

                string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
                {
                    pre.TestsOut(preConditionsResult, true, "PreConditions errors in component " + this.GetType().Name);
                }
                return(preConditionsResult);
            }
            catch (Exception exception)
            {
                string msg = "Component SiriusQuality.Snow, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
                throw new Exception(msg, exception);
            }
        }
Exemplo n.º 5
0
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Sdry_t1  = s1.Sdry;
            double Snowaccu = s.Snowaccu;
            double Mrf      = s.Mrf;
            double M        = s.M;
            double Sdry;
            double tmp_sdry;

            Sdry = 0.0d;
            if (M * 1 <= Sdry_t1)
            {
                tmp_sdry = Snowaccu + Mrf - M + Sdry_t1;
                if (tmp_sdry < 0.0d)
                {
                    Sdry = 0.001d;
                }
                else
                {
                    Sdry = tmp_sdry;
                }
            }
            s.Sdry = Sdry;
        }
Exemplo n.º 6
0
 public void Estimate(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
 {
     try
     {
         CalculateModel(s, s1, r, a, ex);
     }
     catch (Exception exception)
     {
         string msg = "Error in component SiriusQualitySnow, strategy: " + this.GetType().Name + ": Unhandled exception running model. " + exception.GetType().FullName + " - " + exception.Message;
         throw new Exception(msg, exception);
     }
 }
Exemplo n.º 7
0
 public string TestPostConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
 {
     try
     {
         //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm.CurrentValue = s.Sdepth_cm;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r3  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm.ValueType))
         {
             prc.AddCondition(r3);
         }
         string postConditionsResult = pre.VerifyPostconditions(prc, callID); if (!string.IsNullOrEmpty(postConditionsResult))
         {
             pre.TestsOut(postConditionsResult, true, "PostConditions errors in strategy " + this.GetType().Name);
         }
         return(postConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Snow, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
         throw new Exception(msg, exception);
     }
 }
Exemplo n.º 8
0
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double tmin = a.tmin;
            double tmax = a.tmax;
            double tavg;

            tavg   = (tmin + tmax) / 2;
            a.tavg = tavg;
        }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Sdry_t1   = s1.Sdry;
            double Sdry      = s.Sdry;
            double Swet      = s.Swet;
            double Swet_t1   = s1.Swet;
            double Sdepth_t1 = s1.Sdepth;
            double Sdepth    = s.Sdepth;
            double Mrf       = r.Mrf;
            double precip    = a.precip;
            double Snowaccu  = r.Snowaccu;
            double preciprec;

            preciprec = precip;
            if (Sdry + Swet < Sdry_t1 + Swet_t1)
            {
                preciprec = preciprec + ((Sdepth_t1 - Sdepth) * rho) - Mrf;
            }
            preciprec   = preciprec - Snowaccu;
            s.preciprec = preciprec;
        }
 public string TestPreConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.CurrentValue       = s.Sdry;
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.CurrentValue       = s.Sdry;
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.CurrentValue       = s.Swet;
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.CurrentValue       = s.Swet;
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue     = s.Sdepth;
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue     = s.Sdepth;
         SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf.CurrentValue         = r.Mrf;
         SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.CurrentValue = a.precip;
         SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu.CurrentValue    = r.Snowaccu;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.ValueType))
         {
             prc.AddCondition(r1);
         }
         RangeBasedCondition r2 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry);
         if (r2.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.ValueType))
         {
             prc.AddCondition(r2);
         }
         RangeBasedCondition r3 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet);
         if (r3.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.ValueType))
         {
             prc.AddCondition(r3);
         }
         RangeBasedCondition r4 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet);
         if (r4.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.ValueType))
         {
             prc.AddCondition(r4);
         }
         RangeBasedCondition r5 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth);
         if (r5.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType))
         {
             prc.AddCondition(r5);
         }
         RangeBasedCondition r6 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth);
         if (r6.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType))
         {
             prc.AddCondition(r6);
         }
         RangeBasedCondition r7 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf);
         if (r7.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf.ValueType))
         {
             prc.AddCondition(r7);
         }
         RangeBasedCondition r8 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip);
         if (r8.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.precip.ValueType))
         {
             prc.AddCondition(r8);
         }
         RangeBasedCondition r9 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu);
         if (r9.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu.ValueType))
         {
             prc.AddCondition(r9);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("rho")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Snow, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Snowmelt  = s.Snowmelt;
            double Sdepth_t1 = s1.Sdepth;
            double Snowaccu  = r.Snowaccu;
            double Sdepth;

            Sdepth = 0.0d;
            if (Snowmelt <= Sdepth_t1 + (Snowaccu / rho))
            {
                Sdepth = Snowaccu / rho + Sdepth_t1 - Snowmelt - (Sdepth_t1 * E);
            }
            s.Sdepth = Sdepth;
        }
Exemplo n.º 12
0
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Sdepth_cm = s.Sdepth_cm;
            double tmax      = a.tmax;
            double tmaxrec;

            tmaxrec = tmax;
            if (Sdepth_cm > prof)
            {
                if (tmax < tminseuil)
                {
                    tmaxrec = tminseuil;
                }
                else
                {
                    if (tmax > tmaxseuil)
                    {
                        tmaxrec = tmaxseuil;
                    }
                }
            }
            else
            {
                if (Sdepth_cm > 0.0d)
                {
                    if (tmax <= 0.0d)
                    {
                        tmaxrec = tmaxseuil - ((1 - (Sdepth_cm / prof)) * -tmax);
                    }
                    else
                    {
                        tmaxrec = 0.0d;
                    }
                }
            }
            s.tmaxrec = tmaxrec;
        }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Swet_t1  = s1.Swet;
            double precip   = a.precip;
            double Snowaccu = r.Snowaccu;
            double Mrf      = r.Mrf;
            double M        = r.M;
            double Sdry     = s.Sdry;
            double Swet;
            double frac_sdry;
            double tmp_swet;

            Swet = 0.0d;
            if (Mrf <= Swet_t1)
            {
                tmp_swet  = Swet_t1 + precip - Snowaccu + M - Mrf;
                frac_sdry = 0.1d * Sdry;
                if (tmp_swet < frac_sdry)
                {
                    Swet = tmp_swet;
                }
                else
                {
                    Swet = frac_sdry;
                }
            }
            s.Swet = Swet;
        }
Exemplo n.º 14
0
 public void Init(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
 {
     s.preciprec = a.precip;
     s.tminrec   = a.tmin;
     s.tmaxrec   = a.tmax;
 }
Exemplo n.º 15
0
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double tmax   = a.tmax;
            double precip = a.precip;
            double Snowaccu;
            double fs = 0.0d;

            if (tmax < tsmax)
            {
                fs = 1.0d;
            }
            if (tmax >= tsmax && tmax <= trmax)
            {
                fs = (trmax - tmax) / (trmax - tsmax);
            }
            Snowaccu   = fs * precip * 1;
            r.Snowaccu = Snowaccu;
        }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double ps_t1     = s1.ps;
            double Sdepth_t1 = s1.Sdepth;
            double Sdry_t1   = s1.Sdry;
            double Swet_t1   = s1.Swet;
            double ps;

            ps = 0.0d;
            if (Math.Abs(Sdepth_t1) > 0.0d)
            {
                if (Math.Abs(Sdry_t1 + Swet_t1) > 0.0d)
                {
                    ps = (Sdry_t1 + Swet_t1) / Sdepth_t1;
                }
                else
                {
                    ps = ps_t1;
                }
            }
            s.ps = ps;
        }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double ps = s.ps;
            double M  = r.M;
            double Snowmelt;

            Snowmelt = 0.0d;
            if (ps > 1e-8d)
            {
                Snowmelt = M / ps;
            }
            s.Snowmelt = Snowmelt;
        }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            int    jul  = a.jul;
            double tavg = a.tavg;
            double M;
            double K;

            M = 0.0d;
            K = DKmax / 2.0d * -Math.Sin((2.0d * Math.PI * (double)(jul) / 366.0d + (9.0d / 16.0d * Math.PI))) + Kmin + (DKmax / 2.0d);
            if (tavg > Tmf)
            {
                M = K * (tavg - Tmf);
            }
            r.M = M;
        }
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Sdepth_cm = s.Sdepth_cm;
            double tmin      = a.tmin;
            double tminrec;

            tminrec = tmin;
            if (Sdepth_cm > prof)
            {
                if (tmin < tminseuil)
                {
                    tminrec = tminseuil;
                }
                else
                {
                    if (tmin > tmaxseuil)
                    {
                        tminrec = tmaxseuil;
                    }
                }
            }
            else
            {
                if (Sdepth_cm > 0.0d)
                {
                    tminrec = tminseuil - ((1 - (Sdepth_cm / prof)) * (Math.Abs(tmin) + tminseuil));
                }
            }
            s.tminrec = tminrec;
        }
Exemplo n.º 20
0
 public string TestPreConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
 {
     try
     {
         //Set current values of the inputs to the static VarInfo representing the inputs properties of the domain classes
         SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue = s.Sdepth;
         ConditionsCollection prc = new ConditionsCollection();
         Preconditions        pre = new Preconditions();
         RangeBasedCondition  r1  = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth);
         if (r1.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType))
         {
             prc.AddCondition(r1);
         }
         prc.AddCondition(new RangeBasedCondition(_modellingOptionsManager.GetParameterByName("Pns")));
         string preConditionsResult = pre.VerifyPreconditions(prc, callID); if (!string.IsNullOrEmpty(preConditionsResult))
         {
             pre.TestsOut(preConditionsResult, true, "PreConditions errors in strategy " + this.GetType().Name);
         }
         return(preConditionsResult);
     }
     catch (Exception exception)
     {
         string msg = "SiriusQuality.Snow, " + this.GetType().Name + ": Unhandled exception running pre-condition test. ";
         throw new Exception(msg, exception);
     }
 }
Exemplo n.º 21
0
        public string TestPostConditions(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex, string callID)
        {
            try
            {
                //Set current values of the outputs to the static VarInfo representing the output properties of the domain classes
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.tmaxrec.CurrentValue   = s.tmaxrec;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps.CurrentValue        = s.ps;
                SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf.CurrentValue        = r.Mrf;
                SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tavg.CurrentValue  = a.tavg;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.CurrentValue      = s.Swet;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Snowmelt.CurrentValue  = s.Snowmelt;
                SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu.CurrentValue   = r.Snowaccu;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.CurrentValue      = s.Sdry;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.CurrentValue    = s.Sdepth;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.tminrec.CurrentValue   = s.tminrec;
                SiriusQualitySnow.DomainClass.SnowRateVarInfo.M.CurrentValue          = r.M;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.preciprec.CurrentValue = s.preciprec;
                SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm.CurrentValue = s.Sdepth_cm;

                ConditionsCollection prc = new ConditionsCollection();
                Preconditions        pre = new Preconditions();

                RangeBasedCondition r21 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.tmaxrec);
                if (r21.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.tmaxrec.ValueType))
                {
                    prc.AddCondition(r21);
                }
                RangeBasedCondition r22 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps);
                if (r22.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.ps.ValueType))
                {
                    prc.AddCondition(r22);
                }
                RangeBasedCondition r23 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf);
                if (r23.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Mrf.ValueType))
                {
                    prc.AddCondition(r23);
                }
                RangeBasedCondition r24 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tavg);
                if (r24.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowAuxiliaryVarInfo.tavg.ValueType))
                {
                    prc.AddCondition(r24);
                }
                RangeBasedCondition r25 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet);
                if (r25.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Swet.ValueType))
                {
                    prc.AddCondition(r25);
                }
                RangeBasedCondition r26 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Snowmelt);
                if (r26.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Snowmelt.ValueType))
                {
                    prc.AddCondition(r26);
                }
                RangeBasedCondition r27 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu);
                if (r27.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.Snowaccu.ValueType))
                {
                    prc.AddCondition(r27);
                }
                RangeBasedCondition r28 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry);
                if (r28.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdry.ValueType))
                {
                    prc.AddCondition(r28);
                }
                RangeBasedCondition r29 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth);
                if (r29.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth.ValueType))
                {
                    prc.AddCondition(r29);
                }
                RangeBasedCondition r30 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.tminrec);
                if (r30.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.tminrec.ValueType))
                {
                    prc.AddCondition(r30);
                }
                RangeBasedCondition r31 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowRateVarInfo.M);
                if (r31.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowRateVarInfo.M.ValueType))
                {
                    prc.AddCondition(r31);
                }
                RangeBasedCondition r32 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.preciprec);
                if (r32.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.preciprec.ValueType))
                {
                    prc.AddCondition(r32);
                }
                RangeBasedCondition r33 = new RangeBasedCondition(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm);
                if (r33.ApplicableVarInfoValueTypes.Contains(SiriusQualitySnow.DomainClass.SnowStateVarInfo.Sdepth_cm.ValueType))
                {
                    prc.AddCondition(r33);
                }

                string ret = "";
                ret += _Melting.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _Refreezing.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowAccumulation.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDensity.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDepth.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDepthTrans.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowDry.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowMelt.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _SnowWet.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _Tavg.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _TempMax.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _TempMin.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                ret += _Preciprec.TestPostConditions(s, s1, r, a, ex, " strategy SiriusQualitySnow.Strategies.Snow");
                if (ret != "")
                {
                    pre.TestsOut(ret, true, "   postconditions tests of associated classes");
                }

                string postConditionsResult = pre.VerifyPostconditions(prc, callID); if (!string.IsNullOrEmpty(postConditionsResult))
                {
                    pre.TestsOut(postConditionsResult, true, "PostConditions errors in strategy " + this.GetType().Name);
                }
                return(postConditionsResult);
            }
            catch (Exception exception)
            {
                string msg = "Component SiriusQuality.Snow, " + this.GetType().Name + ": Unhandled exception running post-condition test. ";
                throw new Exception(msg, exception);
            }
        }
Exemplo n.º 22
0
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double Sdepth = s.Sdepth;
            double Sdepth_cm;

            Sdepth_cm   = Sdepth * Pns;
            s.Sdepth_cm = Sdepth_cm;
        }
Exemplo n.º 23
0
        private void CalculateModel(SiriusQualitySnow.DomainClass.SnowState s, SiriusQualitySnow.DomainClass.SnowState s1, SiriusQualitySnow.DomainClass.SnowRate r, SiriusQualitySnow.DomainClass.SnowAuxiliary a, SiriusQualitySnow.DomainClass.SnowExogenous ex)
        {
            double tavg = a.tavg;
            double Mrf;

            Mrf = 0.0d;
            if (tavg < Tmf)
            {
                Mrf = SWrf * (Tmf - tavg);
            }
            r.Mrf = Mrf;
        }