public Dictionary<string, IWell> WellsForNovana(bool Lithology, bool WaterLevel, bool Chemistry, bool OnlyRo) { 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"}; Dictionary<string, IWell> Wells = new Dictionary<string, IWell>(); //Construct the data set if (WaterLevel) JXL.ReadWaterLevels(OnlyRo); if (Lithology) JXL.ReadInLithology(); if (Chemistry) JXL.ReadInChemistrySamples(); JXL.ReadWells(false, WaterLevel); JupiterWell CurrentWell; IIntake CurrentIntake; //Loop the wells foreach (var Boring in JXL.BOREHOLE) { CurrentWell = new JupiterWell(Boring.BOREHOLENO); Wells.Add(Boring.BOREHOLENO, 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; CurrentWell.Terrain = Boring.ELEVATION; CurrentWell.UsedForExtraction = true; //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; //Loop the lithology foreach (var Lith in Boring.GetLITHSAMPRows()) { Lithology L = new Lithology(); L.Bottom = Lith.BOTTOM; L.Top = Lith.TOP; L.RockSymbol = Lith.ROCKSYMBOL; L.RockType = Lith.ROCKTYPE; L.TotalDescription = Lith.TOTALDESCR; CurrentWell.LithSamples.Add(L); } //Reads in chemistry foreach (var Chem in Boring.GetGRWCHEMSAMPLERows()) { foreach (var analysis in Chem.GetGRWCHEMANALYSISRows()) { ChemistrySample C = new ChemistrySample(); C.SampleDate = Chem.SAMPLEDATE; C.CompoundNo = analysis.COMPOUNDNO; C.Amount = analysis.AMOUNT; C.Unit = analysis.UNIT; C.CompoundName = JXL.COMPOUNDLIST.FindByCOMPOUNDNO(C.CompoundNo).LONG_TEXT; CurrentWell.ChemSamples.Add(C); } } //Loop the intakes foreach (var Intake in Boring.GetINTAKERows()) { CurrentIntake = CurrentWell.AddNewIntake(Intake.INTAKENO); //Loop the screens. One intake can in special cases have multiple screens foreach (var ScreenData in Intake.GetSCREENRows()) { Screen CurrentScreen = new Screen(CurrentIntake); CurrentScreen.DepthToTop = ScreenData.TOP; CurrentScreen.DepthToBottom = ScreenData.BOTTOM; CurrentScreen.Number = ScreenData.SCREENNO; }//Screen loop //Read in the water levels foreach (var WatLev in Intake.GetWATLEVELRows()) { ((JupiterIntake)CurrentIntake).RefPoint = WatLev.REFPOINT; FillInWaterLevel(CurrentIntake, WatLev); } }//Intake loop }//Bore loop JXL.WATLEVEL.Clear(); return Wells; }
public IEnumerable<JupiterIntake> AddDataForNovanaExtraction(IEnumerable<Plant> Plants, DateTime StartDate, DateTime EndDate) { NovanaTables.IntakeCommonDataTable DT2 = new NovanaTables.IntakeCommonDataTable(); NovanaTables.IndvindingerDataTable DT1 = new NovanaTables.IndvindingerDataTable(); NovanaTables.IndvindingerRow CurrentRow; List<JupiterIntake> _intakes = new List<JupiterIntake>(); //Make sure all the necessary data have been read. if (JXL.ReducedRead) JXL.ReadWells(false, false); //Loop the plants foreach (Plant P in Plants) { var anlaeg = JXL.DRWPLANT.FindByPLANTID(P.IDNumber); //Loop the wells foreach (IWell IW in P.PumpingWells) { var wellData=JXL.BOREHOLE.FindByBOREHOLENO(IW.ID); //Construct a JupiterWell JupiterWell Jw = new JupiterWell(IW); //Loop the intakes foreach (IIntake I in Jw.Intakes) { //If the plant does not use all intakes in a well we should not print it if (null!=P.PumpingIntakes.FirstOrDefault(var=> var.Intake.IDNumber.Equals(I.IDNumber) & var.Intake.well.ID.Equals(Jw.ID))) { var intakedata = wellData.GetINTAKERows().FirstOrDefault(var => var.INTAKENO == I.IDNumber); JupiterIntake CurrentIntake = I as JupiterIntake; CurrentIntake.Data = DT2.NewIntakeCommonRow(); //Read generic data AddCommonDataForNovana(CurrentIntake); DT2.Rows.Add(CurrentIntake.Data); CurrentRow = DT1.NewIndvindingerRow(); //Construct novana id string NovanaID = P.IDNumber + "_" + CurrentIntake.well.ID.Replace(" ", "") + "_" + CurrentIntake.IDNumber; CurrentRow.NOVANAID = NovanaID; CurrentIntake.Data["NOVANAID"] = NovanaID; CurrentRow.JUPDTMK = -999; FillPlantDataIntoDataRow(CurrentRow, anlaeg, P, StartDate, EndDate); //Aktiv periode var plantintake = anlaeg.GetDRWPLANTINTAKERows().FirstOrDefault(var => var.BOREHOLENO == Jw.ID & var.INTAKENO == I.IDNumber); NovanaTables.IntakeCommonRow TIC = CurrentIntake.Data as NovanaTables.IntakeCommonRow; CurrentRow.FRAAAR = 1000; int nextyear; if (!plantintake.IsSTARTDATENull()) { CurrentRow.INTSTDATE = plantintake.STARTDATE; CurrentRow.FRAAAR = Math.Max(CurrentRow.FRAAAR, GetFraAar(plantintake.STARTDATE)); } if (!wellData.IsDRILENDATENull()) CurrentRow.FRAAAR = Math.Max(CurrentRow.FRAAAR, GetFraAar(wellData.DRILENDATE)); if (!TIC.IsINTSTDATE2Null()) CurrentRow.FRAAAR = Math.Max(CurrentRow.FRAAAR, GetFraAar(TIC.INTSTDATE2)); CurrentRow.TILAAR = 9999; if (!plantintake.IsENDDATENull()) { CurrentRow.INTENDDATE = plantintake.ENDDATE; CurrentRow.TILAAR = Math.Min(CurrentRow.TILAAR, GetTilAar(plantintake.ENDDATE)); } if (!wellData.IsABANDONDATNull()) CurrentRow.TILAAR = Math.Min(CurrentRow.TILAAR, GetTilAar(wellData.ABANDONDAT)); if (!TIC.IsINTENDATE2Null()) CurrentRow.TILAAR = Math.Min(CurrentRow.TILAAR, GetTilAar(TIC.INTENDATE2)); //Do not include the intake if it is not active within the given period. if (CurrentRow.FRAAAR > EndDate.Year || CurrentRow.TILAAR < StartDate.Year) DT2.Rows.Remove(CurrentIntake.Data); else { DT1.Rows.Add(CurrentRow); _intakes.Add(CurrentIntake); } } } } } //Add a blank string to ensure length of column DT2.Rows[0]["Comment"] = " "; DT2.Rows[0]["OK_KOMMENT"] = " "; DT2.Merge(DT1); return _intakes; }