示例#1
0
        /// <summary>
        /// Checks for data requirements for an AQTNutrientsModel including state variable requirements and parameter values.
        /// </summary>
        /// <returns>string: Error message that is non blank if the simulation json structure does not have the required data </returns>
        public string CheckDataRequirements()
        {
            AQTVolumeModel AQTVM    = new AQTVolumeModel(AQSim);
            string         checkvol = AQTVM.CheckDataRequirements();

            if (checkvol != "")
            {
                return(checkvol);
            }

            TO2Obj TO2 = (TO2Obj)AQSim.AQTSeg.GetStatePointer(AllVariables.Oxygen, T_SVType.StV, T_SVLayer.WaterCol);

            if (TO2 == null)
            {
                return("An Oxygen state variable or driving variable must be included in the simulation. ");
            }

            TNH4Obj PNH4 = (TNH4Obj)AQSim.AQTSeg.GetStatePointer(AllVariables.Ammonia, T_SVType.StV, T_SVLayer.WaterCol);
            TNO3Obj PNO3 = (TNO3Obj)AQSim.AQTSeg.GetStatePointer(AllVariables.Nitrate, T_SVType.StV, T_SVLayer.WaterCol);
            TPO4Obj PPO4 = (TPO4Obj)AQSim.AQTSeg.GetStatePointer(AllVariables.Phosphate, T_SVType.StV, T_SVLayer.WaterCol);

            if ((PNH4 == null) && (PPO4 == null) && (TO2 == null))
            {
                return("Either phosphorus (TPO4Obj) or nitrogen (TNH4Obj and TNO3Obj) or Oxygen (TO2Obj) must be included in a nutrients simulation.");
            }
            if (((PNH4 != null) && (PNO3 == null)) || ((PNH4 == null) && (PNO3 != null)))
            {
                return("To model nitrogen both ammonia and nitrate (TNH4Obj and TNO3Obj) must be included.");
            }

            TTemperature TTemp = (TTemperature)AQSim.AQTSeg.GetStatePointer(AllVariables.Temperature, T_SVType.StV, T_SVLayer.WaterCol);

            if (TTemp == null)
            {
                return("A Temperature state variable or driving variable must be included in the simulation. ");
            }

            TpHObj TpH = (TpHObj)AQSim.AQTSeg.GetStatePointer(AllVariables.pH, T_SVType.StV, T_SVLayer.WaterCol);

            if ((!TpH.UseLoadsRecAsDriver) && (TpH.LoadsRec.Loadings.NoUserLoad))  // pH calculation, not a driving variable, check pH model data requirements
            {
                TCO2Obj TCO2 = (TCO2Obj)AQSim.AQTSeg.GetStatePointer(AllVariables.CO2, T_SVType.StV, T_SVLayer.WaterCol);
                if (TCO2 == null)
                {
                    return("A CO2 state variable or driving variable must be included in the simulation to calculate pH. ");
                }
            }

            return("");
        }
示例#2
0
        /// <summary>
        /// Checks for data requirements for an AQTOrganicMatter including state variable requirements and parameter values.
        /// </summary>
        /// <returns>string: Error message that is non blank if the simulation json structure does not have the required data </returns>
        public string CheckDataRequirements()
        {
            AQTVolumeModel AQTVM    = new AQTVolumeModel(AQSim);
            string         checkvol = AQTVM.CheckDataRequirements();

            if (checkvol != "")
            {
                return(checkvol);
            }

            TDissRefrDetr  PDRD  = (TDissRefrDetr)AQSim.AQTSeg.GetStatePointer(AllVariables.DissRefrDetr, T_SVType.StV, T_SVLayer.WaterCol);
            TDissLabDetr   PDLD  = (TDissLabDetr)AQSim.AQTSeg.GetStatePointer(AllVariables.DissLabDetr, T_SVType.StV, T_SVLayer.WaterCol);
            TSuspRefrDetr  PSRD  = (TSuspRefrDetr)AQSim.AQTSeg.GetStatePointer(AllVariables.SuspRefrDetr, T_SVType.StV, T_SVLayer.WaterCol);
            TSuspLabDetr   PSLD  = (TSuspLabDetr)AQSim.AQTSeg.GetStatePointer(AllVariables.SuspLabDetr, T_SVType.StV, T_SVLayer.WaterCol);
            TSedRefrDetr   PSdRD = (TSedRefrDetr)AQSim.AQTSeg.GetStatePointer(AllVariables.SedmRefrDetr, T_SVType.StV, T_SVLayer.WaterCol);
            TSedLabileDetr PSdLD = (TSedLabileDetr)AQSim.AQTSeg.GetStatePointer(AllVariables.SedmLabDetr, T_SVType.StV, T_SVLayer.WaterCol);

            if ((PDRD == null) || (PDLD == null) || (PSRD == null) || (PSLD == null) || (PSdRD == null) || (PSdLD == null))
            {
                return("All six organic matter state variables must be included in an organic-matter simulation.");
            }

            TpHObj PpH = (TpHObj)AQSim.AQTSeg.GetStatePointer(AllVariables.pH, T_SVType.StV, T_SVLayer.WaterCol);

            if ((PpH == null))
            {
                return("A pH state variable (or driving variable) must be included in an organic-matter simulation.");
            }

            TO2Obj PO2 = (TO2Obj)AQSim.AQTSeg.GetStatePointer(AllVariables.Oxygen, T_SVType.StV, T_SVLayer.WaterCol);

            if ((PO2 == null))
            {
                return("An oxygen state variable (or driving variable) must be included in an organic-matter simulation.");
            }



            return("");
        }