예제 #1
0
        public override void Evaporate(double Volume)
        {
            Chemical iso = ChemicalFactory.Instance.GetChemical(ChemicalNames.IsotopeFraction);

            base.Evaporate(Volume);

            this.Chemicals[iso] -= Volume * _currentEvaporationConcentration;
        }
예제 #2
0
 /// <summary>
 /// Creates a time series for the chemical
 /// </summary>
 /// <param name="Chem"></param>
 /// <returns></returns>
 public TimestampSeries AddChemicalTimeSeries(Chemical Chem)
 {
   TimestampSeries ts = new TimestampSeries();
   ts.Name = Chem.Name;
   ts.Unit = UnitFactory.Instance.GetUnit(NamedUnits.molespercubicmeter);
   Items.Add(ts);
   ChemicalConcentrations.Add(Chem, ts);
   return ts;
 }
예제 #3
0
 public void GetChemicalTest()
 {
     HydroNumerics.HydroNet.Core.Chemicals ChemicalName = new HydroNumerics.HydroNet.Core.Chemicals(); // TODO: Initialize to an appropriate value
     HydroNumerics.HydroNet.Core.Chemical  expected     = null;                                        // TODO: Initialize to an appropriate value
     HydroNumerics.HydroNet.Core.Chemical  actual;
     actual = HydroNumerics.HydroNet.Core.ChemicalFactory.GetChemical(ChemicalName);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
예제 #4
0
 /// <summary>
 /// Creates a time series for the chemical
 /// </summary>
 /// <param name="Chem"></param>
 /// <returns></returns>
 private TimestampSeries CreateChemicalSeries(Chemical Chem)
 {
   TimestampSeries ts = new TimestampSeries();
   ts.Name = Chem.Name;
   ts.Unit = UnitFactory.Instance.GetUnit(NamedUnits.molespercubicmeter);
   Items.Add(ts);
   ChemicalsToLog.Add(Chem, ts);
   return ts;
 }
예제 #5
0
        /// <summary>
        /// Creates a time series for the chemical
        /// </summary>
        /// <param name="Chem"></param>
        /// <returns></returns>
        public TimestampSeries AddChemicalTimeSeries(Chemical Chem)
        {
            TimestampSeries ts = new TimestampSeries();

            ts.Name = Chem.Name;
            ts.Unit = UnitFactory.Instance.GetUnit(NamedUnits.molespercubicmeter);
            Items.Add(ts);
            ChemicalConcentrations.Add(Chem, ts);
            return(ts);
        }
예제 #6
0
        /// <summary>
        /// Creates a time series for the chemical
        /// </summary>
        /// <param name="Chem"></param>
        /// <returns></returns>
        private TimestampSeries CreateChemicalSeries(Chemical Chem)
        {
            TimestampSeries ts = new TimestampSeries();

            ts.Name = Chem.Name;
            ts.Unit = UnitFactory.Instance.GetUnit(NamedUnits.molespercubicmeter);
            Items.Add(ts);
            ChemicalsToLog.Add(Chem, ts);
            return(ts);
        }
 /// <summary>
 /// Adds a chemical to the water
 /// </summary>
 /// <param name="Chemical"></param>
 /// <param name="Amount"></param>
 public void AddChemical(Chemical Chemical, double Amount)
 {
   double d;
   if (_chemicals.TryGetValue(Chemical, out d))
   {
     d += Amount;
     _chemicals[Chemical] = d;
   }
   else
     _chemicals.Add(Chemical, Amount);
 }
예제 #8
0
 /// <summary>
 /// Sets the concentration in Moles/m3
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="Concentration"></param>
 public void SetConcentration(Chemical Name, double Concentration)
 {
     if (_chemicals.ContainsKey(Name) & Volume != 0)
     {
         _chemicals[Name] = Concentration * Volume;
     }
     else
     {
         _chemicals.Add(Name, Concentration * Volume);
     }
 }
    public void MyTestInitialize()
    {
      ChemicalFactory cn = ChemicalFactory.Instance;
      Na = cn.GetChemical(ChemicalNames.Na);
      Cl = cn.GetChemical(ChemicalNames.Cl);

      WWC = new WaterPacket(100);
      WWC.AddChemical(Na, 3);
      WWC.AddChemical(Cl, 2);

    }
예제 #10
0
        /// <summary>
        /// Gets the concentration in Moles/m3;
        /// </summary>
        /// <param name="ChemicalName"></param>
        /// <returns></returns>
        public double GetConcentration(Chemical Name)
        {
            double m;

            if (_chemicals.TryGetValue(Name, out m) & Volume != 0)
            {
                return(m / Volume);
            }
            else
            {
                return(0);
            }
        }
예제 #11
0
        /// <summary>
        /// Adds a chemical to the water
        /// </summary>
        /// <param name="Chemical"></param>
        /// <param name="Amount"></param>
        public void AddChemical(Chemical Chemical, double Amount)
        {
            double d;

            if (_chemicals.TryGetValue(Chemical, out d))
            {
                d += Amount;
                _chemicals[Chemical] = d;
            }
            else
            {
                _chemicals.Add(Chemical, Amount);
            }
        }
예제 #12
0
 /// <summary>
 /// Sets the concentration in Moles/m3
 /// </summary>
 /// <param name="Name"></param>
 /// <param name="Concentration"></param>
 public void SetConcentration(Chemical Name, double Concentration)
 {
   if (_chemicals.ContainsKey(Name) & Volume != 0)
   {
     _chemicals[Name] = Concentration * Volume;
   }
   else
     _chemicals.Add(Name, Concentration * Volume);
 }
예제 #13
0
 public void AddChemicalConcentrationSeries(Chemical C, TimestampSeries Concentration)
 {
   _concentrations.Add(C, Concentration);
 }
예제 #14
0
 /// <summary>
 /// Gets the concentration in Moles/m3;
 /// </summary>
 /// <param name="ChemicalName"></param>
 /// <returns></returns>
 public double GetConcentration(Chemical Name)
 {
   double m;
   if (_chemicals.TryGetValue(Name, out m) & Volume != 0)
     return m / Volume;
   else
     return 0;
 }
예제 #15
0
        public void SetIsotopeRatio(double ratio)
        {
            Chemical iso = ChemicalFactory.Instance.GetChemical(ChemicalNames.IsotopeFraction);

            AddChemical(iso, ratio * Volume);
        }
예제 #16
0
    public void TestMethod1()
    {
      Lake Gjeller = LakeFactory.GetLake("Gjeller Sø");
      Gjeller.Depth = 1.2;
      Gjeller.WaterLevel = 0.4;

      WaterPacket GjellerWater = new WaterPacket(1, 1);
      GjellerWater.AddChemical(ChemicalFactory.Instance.GetChemical(ChemicalNames.Cl), 1);

      TimeSeriesGroup climate = TimeSeriesGroupFactory.Create("climate.xts");

      foreach (var I in climate.Items)
      {
        I.ExtrapolationMethod = ExtrapolationMethods.RecycleYear;
        I.AllowExtrapolation = true;
      }

      EvaporationRateBoundary evap = new EvaporationRateBoundary((TimespanSeries)climate.Items[1]);
      evap.ContactGeometry = Gjeller.Geometry;
      Gjeller.EvaporationBoundaries.Add(evap);

      SinkSourceBoundary precip = new SinkSourceBoundary(climate.Items[0]);
      precip.ContactGeometry = Gjeller.Geometry;
      Gjeller.Precipitation.Add(precip);
      precip.ID = 2;
      precip.WaterSample = GjellerWater.DeepClone();
      precip.WaterSample.IDForComposition = precip.ID; ;

      GroundWaterBoundary GWIN = new GroundWaterBoundary(Gjeller, 1e-5, 2, 0.45, XYPolygon.GetSquare(Gjeller.Area / 2));
      GWIN.WaterSample = GjellerWater.DeepClone();
      GWIN.ID = 3;
      GWIN.WaterSample.IDForComposition = GWIN.ID;
      GWIN.Name = "Inflow";
      Gjeller.GroundwaterBoundaries.Add(GWIN);

      GroundWaterBoundary GWout = new GroundWaterBoundary(Gjeller, 1e-5, 2, 0.35, XYPolygon.GetSquare(Gjeller.Area / 2));
      GWout.Name = "Outflow";
      Gjeller.GroundwaterBoundaries.Add(GWout);


      TimespanSeries pumping = new TimespanSeries();
      pumping.AddSiValue(new DateTime(1990, 01, 01), new DateTime(2010, 01, 01), 0);
      pumping.AddSiValue(new DateTime(2010, 01, 01), new DateTime(2010, 05, 01), 0.05);
      pumping.AddSiValue(new DateTime(2010, 05, 01), DateTime.Now, 0);


      SinkSourceBoundary DrainageWater = new SinkSourceBoundary(pumping);
      DrainageWater.ID = 4;
      DrainageWater.WaterSample = GjellerWater.DeepClone();
      DrainageWater.WaterSample.IDForComposition = DrainageWater.ID;
      DrainageWater.Name = "Indpumpet Drænvand";
      Gjeller.Sources.Add(DrainageWater);


      var tsg = TimeSeriesGroupFactory.Create(@"..\..\..\TestData\GjellerObservations.xts");

      foreach (var ts in tsg.Items)
      {
        Chemical c = new Chemical(ts.Name, 1);
        Gjeller.RealData.AddChemicalTimeSeries(c);
        Gjeller.RealData.ChemicalConcentrations[c] = (TimestampSeries) ts;


      }

      Model M = new Model();
      M._waterBodies.Add(Gjeller);
      Gjeller.Output.LogAllChemicals = true;
      Gjeller.Output.LogComposition = true;

      M.SetState("Initial", new DateTime(1995, 1, 1), GjellerWater);


      M.MoveInTime(DateTime.Now, TimeSpan.FromDays(10));
      M.Save(@"..\..\..\TestData\Gjeller.xml");

    }
예제 #17
0
 /// <summary>
 /// Logs a particular chemical. Only has an effect when not all chemicals are being logged.
 /// </summary>
 /// <param name="Chem"></param>
 public void LogChemicalConcentration(Chemical Chem)
 {
     CreateChemicalSeries(Chem);
 }
예제 #18
0
 /// <summary>
 /// Logs a particular chemical. Only has an effect when not all chemicals are being logged.
 /// </summary>
 /// <param name="Chem"></param>
 public void LogChemicalConcentration(Chemical Chem)
 {
   CreateChemicalSeries(Chem);
 }
예제 #19
0
 public void AddChemicalConcentrationSeries(Chemical C, TimestampSeries Concentration)
 {
     _concentrations.Add(C, Concentration);
 }