コード例 #1
0
        private void buttonReadMshe_Click(object sender, EventArgs e)
        {
            openFileDialog2.Filter       = "Known file types (*.she)|*.she";
            openFileDialog2.ShowReadOnly = true;
            openFileDialog2.Title        = "Select a .she file with MikeShe setup";

            if (openFileDialog2.ShowDialog() == DialogResult.OK)
            {
                LC.MikeSheFileName = openFileDialog2.FileName;

                if (Wells == null)
                {
                    Wells = new IWellCollection();
                    foreach (IWell W in HeadObservations.ReadInDetailedTimeSeries(LC.MShe))
                    {
                        Wells.Add(W);
                    }
                    LC.Wells = Wells;
                }

                LC.DistributeIntakesOnLayers();

                if (LC.WellsOutSideModelDomain.Count > 0)
                {
                    if (DialogResult.Yes == MessageBox.Show(LC.WellsOutSideModelDomain.Count + " wells found outside horizontal MikeShe model domain.\n Remove these wells from list?", "Wells outside model domain", MessageBoxButtons.YesNo))
                    {
                        foreach (IWell W in LC.WellsOutSideModelDomain)
                        {
                            Wells.Remove(W.ID);
                        }
                    }
                }
                UpdateListsAndListboxes();
            }
        }
コード例 #2
0
    private void buttonReadMshe_Click(object sender, EventArgs e)
    {
      openFileDialog2.Filter = "Known file types (*.she)|*.she";
      openFileDialog2.ShowReadOnly = true;
      openFileDialog2.Title = "Select a .she file with MikeShe setup";

      if (openFileDialog2.ShowDialog() == DialogResult.OK)
      {
        LC.MikeSheFileName = openFileDialog2.FileName;

        if (Wells == null)
        {
          Wells = new IWellCollection();
          foreach (IWell W in HeadObservations.ReadInDetailedTimeSeries(LC.MShe))
            Wells.Add(W);
          LC.Wells = Wells;
        }

        LC.DistributeIntakesOnLayers();

        if (LC.WellsOutSideModelDomain.Count > 0)
        {
          if (DialogResult.Yes == MessageBox.Show(LC.WellsOutSideModelDomain.Count + " wells found outside horizontal MikeShe model domain.\n Remove these wells from list?", "Wells outside model domain", MessageBoxButtons.YesNo))
          {
            foreach (IWell W in LC.WellsOutSideModelDomain)
            {
              Wells.Remove(W.ID);
            }
          }
        }
        UpdateListsAndListboxes();
      }
    }
コード例 #3
0
      /// <summary>
      /// Creates wells from DataRows based on ShapeReaderConfiguration
      /// </summary>
      /// <param name="DS"></param>
      /// <param name="SRC"></param>
      public static void FillInFromNovanaShape(DataRow[] DS, ShapeReaderConfiguration SRC, IWellCollection Wells, IPlantCollection Plants)
      {
        bool ReadPumpActivity = false;
        bool ReadPlants = false;
        bool ReadLayer = false;
        if (DS.First().Table.Columns.Contains(SRC.FraAArHeader) & DS.First().Table.Columns.Contains(SRC.TilAArHeader))
          ReadPumpActivity = true;

        if (DS.First().Table.Columns.Contains(SRC.LayerHeader))
          ReadLayer = true;


        if (Plants != null)
          if (DS.First().Table.Columns.Contains(SRC.PlantIDHeader))
            ReadPlants = true;

        IWell CurrentWell;
        IIntake CurrentIntake;
        foreach (DataRow DR in DS)
        {
          string wellID = DR[SRC.WellIDHeader].ToString();
          //Find the well in the dictionary
          if (Wells.Contains(wellID))
          {
            CurrentWell = Wells[wellID];
          }
          else
          {
            //Add a new well if it was not found
            CurrentWell = new Well(wellID);
            CurrentWell.UsedForExtraction = true;
            Wells.Add(CurrentWell);
          }

          int intakeno = Convert.ToInt32(DR[SRC.IntakeNumber]);

          CurrentIntake = CurrentWell.Intakes.FirstOrDefault(var => var.IDNumber == intakeno);

          if (CurrentIntake == null)
            CurrentIntake = CurrentWell.AddNewIntake(intakeno);

          if (ReadLayer)
            if (!Convert.IsDBNull(DR[SRC.LayerHeader]))
              CurrentIntake.Layer = Convert.ToInt32(DR[SRC.LayerHeader]);

          if (ReadPlants)
          {
            Plant CurrentPlant;
            int PlantID = Convert.ToInt32(DR[SRC.PlantIDHeader]);
            if (!Plants.TryGetValue(PlantID, out CurrentPlant))
            {
              CurrentPlant = new Plant(PlantID);
              Plants.Add(CurrentPlant);
            }
            PumpingIntake CurrentPumpingIntake = new PumpingIntake(CurrentIntake, CurrentPlant);
            CurrentPlant.PumpingIntakes.Add(CurrentPumpingIntake);
            if (ReadPumpActivity)
            {
              CurrentPumpingIntake.Start = new DateTime(Convert.ToInt32(DR[SRC.FraAArHeader]), 1, 1);
              CurrentPumpingIntake.End = new DateTime(Convert.ToInt32(DR[SRC.TilAArHeader]), 12, 31);
            }
          }
          CurrentWell.X = Convert.ToDouble(DR[SRC.XHeader]);
          CurrentWell.Y = Convert.ToDouble(DR[SRC.YHeader]);
          CurrentWell.Terrain = Convert.ToDouble(DR[SRC.TerrainHeader]);
          Screen CurrentScreen = new Screen(CurrentIntake);
          CurrentScreen.BottomAsKote = Convert.ToDouble(DR[SRC.BOTTOMHeader]);
          CurrentScreen.TopAsKote = Convert.ToDouble(DR[SRC.TOPHeader]);
        }
      }
コード例 #4
0
ファイル: Reader.cs プロジェクト: JacobGudbjerg/hydronumerics
    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;
    }
コード例 #5
0
ファイル: FileWriters.cs プロジェクト: msruzy/hydronumerics
        /// <summary>
        /// Creates wells from DataRows based on ShapeReaderConfiguration
        /// </summary>
        /// <param name="DS"></param>
        /// <param name="SRC"></param>
        public static void FillInFromNovanaShape(DataRow[] DS, ShapeReaderConfiguration SRC, IWellCollection Wells, IPlantCollection Plants)
        {
            bool ReadPumpActivity = false;
            bool ReadPlants       = false;
            bool ReadLayer        = false;

            if (DS.First().Table.Columns.Contains(SRC.FraAArHeader) & DS.First().Table.Columns.Contains(SRC.TilAArHeader))
            {
                ReadPumpActivity = true;
            }

            if (DS.First().Table.Columns.Contains(SRC.LayerHeader))
            {
                ReadLayer = true;
            }


            if (Plants != null)
            {
                if (DS.First().Table.Columns.Contains(SRC.PlantIDHeader))
                {
                    ReadPlants = true;
                }
            }

            IWell   CurrentWell;
            IIntake CurrentIntake;

            foreach (DataRow DR in DS)
            {
                string wellID = DR[SRC.WellIDHeader].ToString();
                //Find the well in the dictionary
                if (Wells.Contains(wellID))
                {
                    CurrentWell = Wells[wellID];
                }
                else
                {
                    //Add a new well if it was not found
                    CurrentWell = new Well(wellID);
                    CurrentWell.UsedForExtraction = true;
                    Wells.Add(CurrentWell);
                }

                int intakeno = Convert.ToInt32(DR[SRC.IntakeNumber]);

                CurrentIntake = CurrentWell.Intakes.FirstOrDefault(var => var.IDNumber == intakeno);

                if (CurrentIntake == null)
                {
                    CurrentIntake = CurrentWell.AddNewIntake(intakeno);
                }

                if (ReadLayer)
                {
                    if (!Convert.IsDBNull(DR[SRC.LayerHeader]))
                    {
                        CurrentIntake.Layer = Convert.ToInt32(DR[SRC.LayerHeader]);
                    }
                }

                if (ReadPlants)
                {
                    Plant CurrentPlant;
                    int   PlantID = Convert.ToInt32(DR[SRC.PlantIDHeader]);
                    if (!Plants.TryGetValue(PlantID, out CurrentPlant))
                    {
                        CurrentPlant = new Plant(PlantID);
                        Plants.Add(CurrentPlant);
                    }
                    PumpingIntake CurrentPumpingIntake = new PumpingIntake(CurrentIntake, CurrentPlant);
                    CurrentPlant.PumpingIntakes.Add(CurrentPumpingIntake);
                    if (ReadPumpActivity)
                    {
                        CurrentPumpingIntake.Start = new DateTime(Convert.ToInt32(DR[SRC.FraAArHeader]), 1, 1);
                        CurrentPumpingIntake.End   = new DateTime(Convert.ToInt32(DR[SRC.TilAArHeader]), 12, 31);
                    }
                }
                CurrentWell.X       = Convert.ToDouble(DR[SRC.XHeader]);
                CurrentWell.Y       = Convert.ToDouble(DR[SRC.YHeader]);
                CurrentWell.Terrain = Convert.ToDouble(DR[SRC.TerrainHeader]);
                Screen CurrentScreen = new Screen(CurrentIntake);
                CurrentScreen.BottomAsKote = Convert.ToDouble(DR[SRC.BOTTOMHeader]);
                CurrentScreen.TopAsKote    = Convert.ToDouble(DR[SRC.TOPHeader]);
            }
        }
コード例 #6
0
ファイル: Reader.cs プロジェクト: msruzy/hydronumerics
        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);
        }