Example #1
0
        internal JupiterIntake(JupiterWell Well, IIntake Intake) : this(Well, Intake.IDNumber)
        {
            HeadObservations = new HydroNumerics.Time.Core.TimestampSeries(Intake.HeadObservations);
            Extractions      = new Time.Core.TimespanSeries(Intake.Extractions);

            foreach (Screen SB in Intake.Screens)
            {
                Screen SBClone = new Screen(this);
                SBClone.DepthToBottom = SB.DepthToBottom;
                SBClone.DepthToTop    = SB.DepthToTop;
                SBClone.Number        = SB.Number;
            }

            if (Intake is JupiterIntake)
            {
                Data = ((JupiterIntake)Intake).Data;
            }
        }
Example #2
0
    public IWellCollection ReadWellsInSteps()
    {
      string[] NotExtractionPurpose = new string[] { "A", "G", "I", "J", "L", "R", "U", "M", "P"};
      string[] ExtractionUse = new string[]{"C","V","VA","VD","VH","VI","VM","VP","VV"};
      string[] NotExtractionUse = new string[] { "A", "G", "I", "J", "L", "R", "U", "M", "P"};

      IWellCollection Wells = new IWellCollection();
      JupiterWell CurrentWell;
      JupiterIntake CurrentIntake;

      #region Borehole
      JXL.ReadWellsOnly();
      //Loop the wells
      foreach (var Boring in JXL.BOREHOLE)
      {
        CurrentWell = new JupiterWell(Boring.BOREHOLENO);
        Wells.Add(CurrentWell);

        if (!Boring.IsXUTMNull())
            CurrentWell.X = Boring.XUTM;
          else //If no x set x to 0!
            CurrentWell.X = 0;

          if (!Boring.IsYUTMNull())
            CurrentWell.Y = Boring.YUTM;
          else
            CurrentWell.Y = 0;

          CurrentWell.Description = Boring.LOCATION;
          if (Boring.ELEVATION ==-999 & Boring.CTRPELEVA!=-999)
            CurrentWell.Terrain = Boring.CTRPELEVA;
          else
            CurrentWell.Terrain = Boring.ELEVATION;

        if (!Boring.IsDRILLDEPTHNull())
          CurrentWell.Depth = Boring.DRILLDEPTH;

          CurrentWell.UsedForExtraction = true;

          CurrentWell.Use = Boring.USE;
          CurrentWell.Purpose = Boring.PURPOSE;

        //Hvis USE er noget andet end indvinding
          if (NotExtractionUse.Contains(Boring.USE.ToUpper()))
            CurrentWell.UsedForExtraction = false;

        //Hvis den er oprettet med et andet formål og USE ikke er sat til indvinding er det ikke en indvindingsboring
          if (NotExtractionPurpose.Contains(Boring.PURPOSE.ToUpper()) & !ExtractionUse.Contains(Boring.USE.ToUpper()))
            CurrentWell.UsedForExtraction = false;

          if (!Boring.IsDRILENDATENull())
            CurrentWell.StartDate = Boring.DRILENDATE;
          if (!Boring.IsABANDONDATNull())
            CurrentWell.EndDate = Boring.ABANDONDAT;

      }
      JXL.BOREHOLE.Clear();
      #endregion

      #region Intakes
      //Intakes
      JXL.ReadIntakes();
      foreach (var Intake in JXL.INTAKE)
      {
        if (Wells.Contains(Intake.BOREHOLENO))
        {
          JupiterIntake I = Wells[Intake.BOREHOLENO].AddNewIntake(Intake.INTAKENO) as JupiterIntake;
          if (I != null)
          {
            if (!Intake.IsSTRINGNONull())
            {
              I.StringNo = Intake.STRINGNO;
              I.ResRock = Intake.RESERVOIRROCK;
            }
          }
        }
      }

      foreach( var Casing in JXL.CASING)
      {
        if (Wells.Contains(Casing.BOREHOLENO))
        {
          if (!Casing.IsSTRINGNONull())
          {
            IIntake I = Wells[Casing.BOREHOLENO].Intakes.FirstOrDefault(var => ((JupiterIntake)var).StringNo == Casing.STRINGNO);
            if (I != null)
              if (!Casing.IsBOTTOMNull())
                I.Depth = Casing.BOTTOM;
          }
        }
      }
      JXL.INTAKE.Clear();
      JXL.CASING.Clear();
#endregion

      #region Screens
      //Screens
      JXL.ReadScreens();
      foreach (var screen in JXL.SCREEN)
      {
        if (Wells.Contains(screen.BOREHOLENO))
        {
          CurrentIntake = Wells[screen.BOREHOLENO].Intakes.FirstOrDefault(var => var.IDNumber == screen.INTAKENO) as JupiterIntake;
          if (CurrentIntake != null)
          {
            Screen CurrentScreen = new Screen(CurrentIntake);
            if (!screen.IsTOPNull())
              CurrentScreen.DepthToTop = screen.TOP;
            if (!screen.IsBOTTOMNull())
              CurrentScreen.DepthToBottom = screen.BOTTOM;
            CurrentScreen.Number = screen.SCREENNO;

            if (!screen.IsSTARTDATENull())
              CurrentScreen.StartDate = screen.STARTDATE;

            if (!screen.IsENDDATENull())
              CurrentScreen.EndDate = screen.ENDDATE;
          }
        }
      }
      JXL.SCREEN.Clear();
      #endregion

      return Wells;
    }
Example #3
0
        public IWellCollection ReadWellsInSteps()
        {
            string[] NotExtractionPurpose = new string[] { "A", "G", "I", "J", "L", "R", "U", "M", "P" };
            string[] ExtractionUse        = new string[] { "C", "V", "VA", "VD", "VH", "VI", "VM", "VP", "VV" };
            string[] NotExtractionUse     = new string[] { "A", "G", "I", "J", "L", "R", "U", "M", "P" };

            IWellCollection Wells = new IWellCollection();
            JupiterWell     CurrentWell;
            JupiterIntake   CurrentIntake;

            #region Borehole
            JXL.ReadWellsOnly();
            //Loop the wells
            foreach (var Boring in JXL.BOREHOLE)
            {
                CurrentWell = new JupiterWell(Boring.BOREHOLENO);
                Wells.Add(CurrentWell);

                if (!Boring.IsXUTMNull())
                {
                    CurrentWell.X = Boring.XUTM;
                }
                else //If no x set x to 0!
                {
                    CurrentWell.X = 0;
                }

                if (!Boring.IsYUTMNull())
                {
                    CurrentWell.Y = Boring.YUTM;
                }
                else
                {
                    CurrentWell.Y = 0;
                }

                CurrentWell.Description = Boring.LOCATION;
                if (Boring.ELEVATION == -999 & Boring.CTRPELEVA != -999)
                {
                    CurrentWell.Terrain = Boring.CTRPELEVA;
                }
                else
                {
                    CurrentWell.Terrain = Boring.ELEVATION;
                }

                if (!Boring.IsDRILLDEPTHNull())
                {
                    CurrentWell.Depth = Boring.DRILLDEPTH;
                }

                CurrentWell.UsedForExtraction = true;

                CurrentWell.Use     = Boring.USE;
                CurrentWell.Purpose = Boring.PURPOSE;

                //Hvis USE er noget andet end indvinding
                if (NotExtractionUse.Contains(Boring.USE.ToUpper()))
                {
                    CurrentWell.UsedForExtraction = false;
                }

                //Hvis den er oprettet med et andet formål og USE ikke er sat til indvinding er det ikke en indvindingsboring
                if (NotExtractionPurpose.Contains(Boring.PURPOSE.ToUpper()) & !ExtractionUse.Contains(Boring.USE.ToUpper()))
                {
                    CurrentWell.UsedForExtraction = false;
                }

                if (!Boring.IsDRILENDATENull())
                {
                    CurrentWell.StartDate = Boring.DRILENDATE;
                }
                if (!Boring.IsABANDONDATNull())
                {
                    CurrentWell.EndDate = Boring.ABANDONDAT;
                }
            }
            JXL.BOREHOLE.Clear();
            #endregion

            #region Intakes
            //Intakes
            JXL.ReadIntakes();
            foreach (var Intake in JXL.INTAKE)
            {
                if (Wells.Contains(Intake.BOREHOLENO))
                {
                    JupiterIntake I = Wells[Intake.BOREHOLENO].AddNewIntake(Intake.INTAKENO) as JupiterIntake;
                    if (I != null)
                    {
                        if (!Intake.IsSTRINGNONull())
                        {
                            I.StringNo = Intake.STRINGNO;
                            I.ResRock  = Intake.RESERVOIRROCK;
                        }
                    }
                }
            }

            foreach (var Casing in JXL.CASING)
            {
                if (Wells.Contains(Casing.BOREHOLENO))
                {
                    if (!Casing.IsSTRINGNONull())
                    {
                        IIntake I = Wells[Casing.BOREHOLENO].Intakes.FirstOrDefault(var => ((JupiterIntake)var).StringNo == Casing.STRINGNO);
                        if (I != null)
                        {
                            if (!Casing.IsBOTTOMNull())
                            {
                                I.Depth = Casing.BOTTOM;
                            }
                        }
                    }
                }
            }
            JXL.INTAKE.Clear();
            JXL.CASING.Clear();
            #endregion

            #region Screens
            //Screens
            JXL.ReadScreens();
            foreach (var screen in JXL.SCREEN)
            {
                if (Wells.Contains(screen.BOREHOLENO))
                {
                    CurrentIntake = Wells[screen.BOREHOLENO].Intakes.FirstOrDefault(var => var.IDNumber == screen.INTAKENO) as JupiterIntake;
                    if (CurrentIntake != null)
                    {
                        Screen CurrentScreen = new Screen(CurrentIntake);
                        if (!screen.IsTOPNull())
                        {
                            CurrentScreen.DepthToTop = screen.TOP;
                        }
                        if (!screen.IsBOTTOMNull())
                        {
                            CurrentScreen.DepthToBottom = screen.BOTTOM;
                        }
                        CurrentScreen.Number = screen.SCREENNO;

                        if (!screen.IsSTARTDATENull())
                        {
                            CurrentScreen.StartDate = screen.STARTDATE;
                        }

                        if (!screen.IsENDDATENull())
                        {
                            CurrentScreen.EndDate = screen.ENDDATE;
                        }
                    }
                }
            }
            JXL.SCREEN.Clear();
            #endregion

            return(Wells);
        }
Example #4
0
        /// <summary>
        /// Read Extractions.
        /// The boolean set dates indicates whether the dates read from the DRWPLANTINTAKE table should be used as Pumpingstart
        /// and pumpingstop.
        /// </summary>
        /// <param name="Plants"></param>
        /// <param name="Wells"></param>
        public IPlantCollection ReadPlants(IWellCollection Wells)
        {
            List <Plant>     Plants  = new List <Plant>();
            IPlantCollection DPlants = new IPlantCollection();

            JXL.ReadPlantData();

            IIntake CurrentIntake = null;
            Plant   CurrentPlant;

            List <Tuple <int, Plant> > SubPlants = new List <Tuple <int, Plant> >();


            foreach (var Anlaeg in JXL.DRWPLANT)
            {
                CurrentPlant = new Plant(Anlaeg.PLANTID);
                DPlants.Add(CurrentPlant);

                if (Anlaeg.IsPLANTNAMENull())
                {
                    CurrentPlant.Name = "<no name in database>";
                }
                else
                {
                    CurrentPlant.Name = Anlaeg.PLANTNAME;
                }

                CurrentPlant.Address = Anlaeg.PLANTADDRESS;

                CurrentPlant.PostalCode = Anlaeg.PLANTPOSTALCODE;

                if (!Anlaeg.IsSUPPLANTNull())
                {
                    CurrentPlant.SuperiorPlantNumber = Anlaeg.SUPPLANT;
                }

                CurrentPlant.NewCommuneNumber = Anlaeg.MUNICIPALITYNO2007;
                CurrentPlant.OldCommuneNumber = Anlaeg.MUNICIPALITYNO;


                var cmp = Anlaeg.GetDRWPLANTCOMPANYTYPERows().LastOrDefault();
                if (cmp != null)
                {
                    CurrentPlant.CompanyType = cmp.COMPANYTYPE;
                }

                if (!Anlaeg.IsPERMITDATENull())
                {
                    CurrentPlant.PermitDate = Anlaeg.PERMITDATE;
                }

                if (!Anlaeg.IsPERMITEXPIREDATENull())
                {
                    CurrentPlant.PermitExpiryDate = Anlaeg.PERMITEXPIREDATE;
                }

                if (Anlaeg.IsPERMITAMOUNTNull())
                {
                    CurrentPlant.Permit = 0;
                }
                else
                {
                    CurrentPlant.Permit = Anlaeg.PERMITAMOUNT;
                }

                if (!Anlaeg.IsSUPPLANTNull())
                {
                    SubPlants.Add(new Tuple <int, Plant>(Anlaeg.SUPPLANT, CurrentPlant));
                }

                if (!Anlaeg.IsXUTMNull())
                {
                    CurrentPlant.X = Anlaeg.XUTM;
                }

                if (!Anlaeg.IsYUTMNull())
                {
                    CurrentPlant.Y = Anlaeg.YUTM;
                }


                //Loop the intakes. Only add intakes from wells already in table
                foreach (var IntakeData in Anlaeg.GetDRWPLANTINTAKERows())
                {
                    if (Wells.Contains(IntakeData.BOREHOLENO))
                    {
                        JupiterWell jw = Wells[IntakeData.BOREHOLENO] as JupiterWell;
                        CurrentIntake = jw.Intakes.FirstOrDefault(var => var.IDNumber == IntakeData.INTAKENO);
                        if (CurrentIntake != null)
                        {
                            PumpingIntake CurrentPumpingIntake = new PumpingIntake(CurrentIntake, CurrentPlant);
                            CurrentPlant.PumpingIntakes.Add(CurrentPumpingIntake);

                            if (!IntakeData.IsSTARTDATENull())
                            {
                                CurrentPumpingIntake.StartNullable = IntakeData.STARTDATE;
                            }
                            else if (jw.StartDate.HasValue)
                            {
                                CurrentPumpingIntake.StartNullable = jw.StartDate;
                            }
                            else if (CurrentIntake.Screens.Where(var => var.StartDate.HasValue).Count() != 0)
                            {
                                CurrentPumpingIntake.StartNullable = CurrentIntake.Screens.Where(var => var.StartDate.HasValue).Min(var => var.StartDate);
                            }

                            if (!IntakeData.IsENDDATENull())
                            {
                                CurrentPumpingIntake.EndNullable = IntakeData.ENDDATE;
                            }
                            else if (jw.EndDate.HasValue)
                            {
                                CurrentPumpingIntake.EndNullable = jw.EndDate;
                            }
                            else if (CurrentIntake.Screens.Where(var => var.EndDate.HasValue).Count() != 0)
                            {
                                CurrentPumpingIntake.EndNullable = CurrentIntake.Screens.Where(var => var.EndDate.HasValue).Max(var => var.EndDate);
                            }
                        }
                    }
                }
            }
            //Now attach the subplants
            foreach (Tuple <int, Plant> KVP in SubPlants)
            {
                Plant Upper;
                if (DPlants.TryGetValue(KVP.Item1, out Upper))
                {
                    if (Upper == KVP.Item2)
                    {
                        string l = "what";
                    }
                    else
                    {
                        Upper.SubPlants.Add(KVP.Item2);
                        foreach (PumpingIntake PI in KVP.Item2.PumpingIntakes)
                        {
                            PumpingIntake d = Upper.PumpingIntakes.FirstOrDefault(var => var.Intake.well.ID == PI.Intake.well.ID);
                            //Remove pumping intakes from upper plant if they are attached to lower plants.
                            if (d != null)
                            {
                                Upper.PumpingIntakes.Remove(d);
                            }
                        }
                    }
                }
            }

            JXL.DRWPLANT.Dispose();
            JXL.DRWPLANTINTAKE.Dispose();
            return(DPlants);
        }