public void SortTest() { Well W =new Well("TestDummy"); IIntake OW = W.AddNewIntake(1); OW.Observations.Add(new ObservationEntry(new DateTime(2000, 1, 1), 10)); OW.Observations.Add(new ObservationEntry(new DateTime(1999, 1, 1), 15)); Assert.AreEqual(10, OW.Observations[0].Value); OW.Observations.Sort(); Assert.AreEqual(15, OW.Observations[0].Value); DateTime start = new DateTime(1999, 1, 1); DateTime end = new DateTime(2000, 1, 1); Func<ObservationEntry, bool> InBetween = a => a.Time >= start & a.Time <= end; var query = OW.Observations.Where(a => InBetween(a)); foreach (ObservationEntry tse in query) Console.WriteLine(tse.Time); var query2 = from entry in OW.Observations where entry.Time >= start & entry.Time <= end select entry; double d = query2.Sum(new Func<ObservationEntry, double>(a => a.Value)); foreach (ObservationEntry tse in query2) Console.WriteLine(tse.Time); }
public static void drift() { double Nf=1e4; double MutationRatio=3e-10; //int seed =1; double tauKill=10; double tauGrowNormal=20; double tauGrowResistent=tauGrowNormal; double N0mutation = 5e3; double N0normal=5e3; string FileName = "drift.txt";//Simulation"+ MutationRate.ToString("0.##E+0") +".txt"; System.IO.FileInfo myFile = new FileInfo(FileName); myFile.Delete(); StreamWriter SR = new StreamWriter(FileName,false); int sims=10; Well[] myTest=new Well[sims] ; Simulation[] mySimulation = new Simulation[sims]; SimulationParameters SP= new SimulationParameters( Nf,Nf, MutationRatio, tauKill, tauKill , tauGrowNormal, tauGrowResistent , 0,200); for (int sim=0;sim<sims;sim++) { myTest[sim] = new Well(N0normal,0,N0mutation); mySimulation[sim]= new Simulation(myTest[sim], sim+90, SP); } int rounds=200; for(int round=0;round<rounds;round++) { double gen=round*Math.Log(100,2); SR.Write("{0}\t",gen); for (int sim=0;sim<sims;sim++) { myTest[sim]=mySimulation[sim].DoGrowing(myTest[sim]); SR.Write("{0}\t",myTest[sim].NumberOfResistant); myTest[sim]=mySimulation[sim].DoDilution(myTest[sim],100); } SR.Write("\n"); PrintPresentege(round,rounds); } SR.Close(); }
public Well DoDilution(Well _SimulatedWall,double Ratio) { _SimulatedWall.NumberOfNormal = Utils.RandBinomial(_SimulatedWall.NumberOfNormal,(double)1/Ratio); _SimulatedWall.NumberOfResistant= Utils.RandBinomial(_SimulatedWall.NumberOfResistant,(double)1/Ratio); SimulatedWall = _SimulatedWall; if (_SimulatedWall.NumberOfNormal + _SimulatedWall.NumberOfResistant ==0) { System.Diagnostics.Debug.WriteLine(""); } return _SimulatedWall; }
public Simulation(Well _SimulatedWall, int seed, SimulationParameters _SP) { Utils.Init(seed); SimulatedWall = _SimulatedWall; SP = _SP; Cycle=0; }
public Well DoAMPKilling(Well _SimulatedWall,double Time) { double PNormalLive = Math.Pow(2,-Time/SP.tauNormalKill); double PPersisterLive = Math.Pow(2,-Time/SP.tauPersisterKill); double NumberOfNormalLive = Utils.RandBinomial(_SimulatedWall.NumberOfNormal,PNormalLive); double NumberOfPersisterLive = Utils.RandBinomial(_SimulatedWall.NumberOfPersistent,PPersisterLive); _SimulatedWall.NumberOfNormal =NumberOfNormalLive; _SimulatedWall.NumberOfPersistent = NumberOfPersisterLive; _SimulatedWall.NumberOfResistant = Utils.NLogistic(Time,SP.tauGrowResistant, _SimulatedWall.NumberOfResistant,SP.NfKill - (NumberOfNormalLive + NumberOfPersisterLive)); SimulatedWall = _SimulatedWall; return _SimulatedWall; }
internal void DeleteWell(Well well) { if (!hasInternet) return; var update = "DELETE FROM \"Wells\" WHERE \"WellID\" = @wellId;"; using (var pgsqlConnection = new NpgsqlConnection(connectionString)) { pgsqlConnection.Open(); using (var command = new NpgsqlCommand(update, pgsqlConnection)) { command.Parameters.AddWithValue("@wellId", well.WellId); command.ExecuteNonQuery(); } } }
public WellDetailPopup(Form parent, BSE.Windows.Forms.Panel leftPanel, Well well, GPoint markerLocationOnParent, string dataConnString, Action<Well> updateMarkerPosition, Action<Well> deleteMarker) { this.FormClosing += Close_clicked; this.leftPanel = leftPanel; deleteMarkerAction = deleteMarker; updateMarkerPositionAction = updateMarkerPosition; connectionString = dataConnString; Owner = parent; StartPosition = FormStartPosition.Manual; Location = markerLocationOnParent; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; InitializeComponent(); this.well = well; editLngBox.Text = well.Latitude; editLatBox.Text = well.Longitude; imageEditBackup = well.WellImage; wellImage.Image = well.WellImage; wellImage.SizeMode = PictureBoxSizeMode.Zoom; }
public void GroupByTest() { Well WW = new Well("TestDummy"); IIntake OW = WW.AddNewIntake(1); OW.Observations.Add(new ObservationEntry(new DateTime(2000, 1, 1), 10)); OW.Observations.Add(new ObservationEntry(new DateTime(1999, 1, 1), 10)); OW.Observations.Add(new ObservationEntry(new DateTime(1999, 1, 1), 5)); OW.Observations.Add(new ObservationEntry(new DateTime(1999, 1, 1), 15)); OW.Observations.Sort(); Assert.IsTrue(OW.Observations[1].Equals(OW.Observations[2])); int kk = OW.Observations.Distinct().Count(W => InBetween(W, DateTime.MinValue, DateTime.MaxValue)); ; // group obs by obs.Time into g Assert.AreEqual(2, OW.Observations.Distinct().Count()); //foreach (var W in grouped) //{ // foreach (TimeSeriesEntry TSE in W) // Console.WriteLine(TSE.ToString()); //} foreach (var W in OW.Observations.Where(v => InBetween(v, new DateTime(1998,2,2), DateTime.MaxValue)).GroupBy(o => o.Time)) { Console.WriteLine("newline"); int k = 0; foreach (ObservationEntry TSE in W) { if(k==0) Console.WriteLine(TSE.ToString()); k++; } } }
void LoadGame(string directory) { // Load from json here // Heroes foreach (Hero hero in heroes) { hero.Load(directory); } // Cells CellStates Cells = FileManager.Load <CellStates>(directory + "/Cells.json"); foreach (CellState cellstate in Cells.cellStates) { foreach (string token in cellstate.inventory) { Type type = Type.GetType(token); if (type == typeof(Farmer)) { farmers.Add(Farmer.Factory(cellstate.index)); } else if (type == typeof(Gor)) { gors.Add(Gor.Factory(cellstate.index)); } else if (type == typeof(Skral)) { skrals.Add(Skral.Factory(cellstate.index)); } else if (type == typeof(Wardrak)) { wardraks.Add(Wardrak.Factory(cellstate.index)); } else if (type == typeof(TowerSkral)) { towerskrals.Add(TowerSkral.Factory(cellstate.index, players.Count)); } else if (type.IsSubclassOf(typeof(Fog))) { string id = type.ToString().Replace("Fog", ""); Fog.Load(id, type, cellstate.index); } else if (type == typeof(Well)) { wells.Add(Well.Factory(cellstate.index)); } // Items in cells if (PhotonNetwork.IsMasterClient) { if (type == typeof(GoldCoin)) { GoldCoin.Factory(cellstate.index); } else if (type.IsSubclassOf(typeof(SmallToken))) { type.GetMethod("Factory", new[] { typeof(int) }).Invoke(type, new object[] { cellstate.index }); } else if (type.IsSubclassOf(typeof(BigToken))) { type.GetMethod("Factory", new[] { typeof(int) }).Invoke(type, new object[] { cellstate.index }); } } } } // Narrator NarratorState narratorState = FileManager.Load <NarratorState>(directory + "/Narrator.json"); narrator.Load(narratorState); // Wells WellsState wellsState = FileManager.Load <WellsState>(directory + "/Wells.json"); foreach (int cellId in wellsState.wellsCellId) { bool found = false; foreach (Well well in wells) { if (well.Cell.Index == cellId) { found = true; break; } } // If not found, the well is empty if (!found) { wells.Add(Well.Factory(cellId, false)); } } }
public void AddWellEntry(WellEntry wellEntry, Guid targetProjectId) { using (var seismosContext = new seismosEntities()) { var targetProject = seismosContext.SeismosProjects.FirstOrDefault(sp => sp.Id == targetProjectId); if (targetProject == null) { return; } var insertWell = new Well { Id = Guid.NewGuid(), WellName = wellEntry.Name, SeismosProject = targetProject, WellBore = new WellBore { Id = Guid.NewGuid(), Name = wellEntry.Name, SurfaceVolume = wellEntry.SurfaceVolume, TotalVolume = wellEntry.TotalVolume } }; foreach (var wellEntryCylinderEntry in wellEntry.CylinderEntries) { var wellBoreCylinder = new Cylinder { Id = Guid.NewGuid(), CalculatedVolume = wellEntryCylinderEntry.CalculatedVolume, CasingOrderType = (CasingOrderTypeEnum)Enum.Parse(typeof(CasingOrderTypeEnum), wellEntryCylinderEntry.CasingOrderType), Grade = wellEntryCylinderEntry.Grade, InnerDiameter = wellEntryCylinderEntry.InnerDiameter, MeasuredDepth = wellEntryCylinderEntry.MeasuredDepth, OuterDiameter = wellEntryCylinderEntry.OuterDiameter, TopOfLiner = wellEntryCylinderEntry.TopOfLiner, Weight = wellEntryCylinderEntry.Weight, InnerInterfaceState = InterfaceStateTypeEnum.NoSlip, OuterInterfaceState = InterfaceStateTypeEnum.NoSlip }; insertWell.WellBore.Cylinders.Add(wellBoreCylinder); } // var hfTreatment = new HydraulicFracturingTreatment() // { // Id = Guid.NewGuid(), // Name = insertWell + " HF", // Type = TreatmentTypeEnum.HydraulicFracturing, // Stages = new List<Stage>() // }; // // // for (int index = 0; index < wellEntry.NumberOfStages; index++) // { // hfTreatment.Stages.Add(new Stage(){Id = Guid.NewGuid(), Number = index, StartTime = DateTime.Now, StopTime = DateTime.Now}); // } // // insertWell.Treatments.Add(hfTreatment); seismosContext.Wells.Add(insertWell); seismosContext.SaveChanges(); } }
/// <summary> /// Grow well in the Well /// </summary> /// <param name="_SimulatedWall">Thew Well parameters to grow</param> /// <returns>Well after growing stage</returns> public Well DoGrowing(Well _SimulatedWall) { //TODO: Change to persisters exponantial statistics. //TODO: The result number is not an Integer. _SimulatedWall.NumberOfNormal += _SimulatedWall.NumberOfPersistent; _SimulatedWall.NumberOfPersistent = 0; double maxNumberOfNormalDivitions = (SP.NfGrow - _SimulatedWall.NumberOfBacteria); //TODO: add random generation of the generation of Each Persister -> Normal state convertion. int maxNumberOfMutations = Convert.ToInt32(Utils.RandBinomial(maxNumberOfNormalDivitions,SP.MutationRatio)); double[] genOfMutation ; genOfMutation = new double[maxNumberOfMutations] ; for(int i=0;i<maxNumberOfMutations;i++) { //find the actual generation of the mutation. genOfMutation[i] = Utils.RandExponantial(SP.NfGrow,_SimulatedWall.NumberOfNormal); } Array.Sort(genOfMutation); double[] genOfMutationDiff ; genOfMutationDiff = new double[maxNumberOfMutations] ; if(maxNumberOfMutations>0) { genOfMutationDiff[0]=genOfMutation[0]; } for(int i=1;i<maxNumberOfMutations;i++) { genOfMutationDiff[i]=genOfMutation[i]-genOfMutation[i-1]; } double ResistantgenRatio = SP.tauGrowResistant/SP.tauGrowNormal ; int j=0; do { double gen; // Can not grow (to menny bacteria) if (_SimulatedWall.NumberOfNormal + _SimulatedWall.NumberOfResistant > SP.NfGrow) { gen=0; } else { Solver.N1 = _SimulatedWall.NumberOfNormal; Solver.N2 = _SimulatedWall.NumberOfResistant; Solver.Nf = SP.NfGrow; Solver.gen2retio = ResistantgenRatio; gen=(Solver.rtsafe(Solver.Function,Solver.dFunction,0,30,0.0001)); } //Console.WriteLine("gen={0} F(gen={0})={1}",gen,Solver.Function(gen)); if( j>=maxNumberOfMutations || genOfMutation[j]>=gen) { _SimulatedWall.NumberOfNormal = Utils.NExponantial(gen,_SimulatedWall.NumberOfNormal); _SimulatedWall.NumberOfResistant = Utils.NExponantial(gen*ResistantgenRatio,_SimulatedWall.NumberOfResistant); } else { _SimulatedWall.NumberOfNormal = Utils.NExponantial(genOfMutationDiff[j],_SimulatedWall.NumberOfNormal)-1; _SimulatedWall.NumberOfResistant = Utils.NExponantial(genOfMutationDiff[j]*ResistantgenRatio,_SimulatedWall.NumberOfResistant)+1; } j++; } while(_SimulatedWall.NumberOfBacteria<SP.NfGrow); // for(int i=0;i<maxNumberOfMutations;i++) // { // Well PostMutation; // PostMutation.NumberOfNormal = Utils.NExponantial(genOfMutationDiff[i],_SimulatedWall.NumberOfNormal)-1; // PostMutation.NumberOfResistant = Utils.NExponantial(genOfMutationDiff[i]*ResistantgenRatio,_SimulatedWall.NumberOfResistant)+1; // if (PostMutation.NumberOfBacteria < Nf) // { // _SimulatedWall = PostMutation; // } // else // { // Solver.N1 = _SimulatedWall.NumberOfNormal; // Solver.N2 = _SimulatedWall.NumberOfResistant; // Solver.Nf = Nf; // Solver.gen2retio = ResistantgenRatio; // // double gen=(Solver.rtsafe(Solver.Function,Solver.dFunction,1,30,0.0001)); // Console.WriteLine("gen={0} F(gen={0})={1}",gen,Solver.Function(gen)); // // _SimulatedWall.NumberOfNormal = Utils.NExponantial(gen,_SimulatedWall.NumberOfNormal); // _SimulatedWall.NumberOfResistant = Utils.NExponantial(gen*ResistantgenRatio,_SimulatedWall.NumberOfResistant); // break; // } // } //init the number of persisters from the known fraction. _SimulatedWall.NumberOfPersistent = Math.Round(SP.Persistersfraction*_SimulatedWall.NumberOfNormal); _SimulatedWall.NumberOfNormal -=Math.Round(_SimulatedWall.NumberOfPersistent); SimulatedWall = _SimulatedWall; return _SimulatedWall; }
public ActionResult EditWell(Well well) { ModelState.Clear(); ViewBag.LoadStatus = "0"; try { if (Session["_well"] == null) { well.Error = "Session has expired"; well.ErrorCode = 0; return(Json(well, JsonRequestBehavior.AllowGet)); } var oldWell = Session["_well"] as Well; if (oldWell == null || oldWell.WellId < 1) { well.Error = "Session has expired"; well.ErrorCode = -1; return(Json(well, JsonRequestBehavior.AllowGet)); } if (!ModelState.IsValid) { well.Error = "Please supply all required wells and try again"; well.ErrorCode = -1; return(Json(well, JsonRequestBehavior.AllowGet)); } var wx = ValidateControl(well); if (wx.Code < 1) { well.Error = wx.Error; well.ErrorCode = -1; return(Json(well, JsonRequestBehavior.AllowGet)); } oldWell.SpudDate = well.SpudDate; oldWell.Name = well.Name; oldWell.TechnicalAllowable = well.TechnicalAllowable; oldWell.WellTypeId = well.WellTypeId; oldWell.TotalDept = well.TotalDept; oldWell.Remarks = well.Remarks; if (well.SpudDate != null) { well.Date = ((DateTime)well.SpudDate).ToString("yyyy/MM/dd"); } var k = new WellServices().UpdateWellCheckDuplicate(oldWell); if (k < 1) { if (k == -3) { well.Error = "Well already exists"; well.ErrorCode = 0; return(Json(well, JsonRequestBehavior.AllowGet)); } well.Error = "Process Failed! Please contact the Admin or try again later"; well.ErrorCode = 0; return(Json(well, JsonRequestBehavior.AllowGet)); } well.Error = "Well Information was successfully updated"; well.ErrorCode = 1; return(Json(well, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); well.Error = "An unknown error was encountered. Request could not be serviced. Please try again later."; well.ErrorCode = 0; return(Json(well, JsonRequestBehavior.AllowGet)); } }
public Well DoSycle() { Cycle++; SimulatedWall=DoDilution(SimulatedWall,SP.Dilution); SimulatedWall=DoAMPKilling(SimulatedWall,260); SimulatedWall=DoGrowing(SimulatedWall); //SimulatedWall=DoDilution(SimulatedWall,200); //SimulatedWall=DoGrowing(SimulatedWall); return SimulatedWall; }
/// <summary> /// Sets additional default values for the specified data object and URI. /// </summary> /// <param name="dataObject">The data object.</param> /// <param name="uri">The data object URI.</param> partial void SetAdditionalDefaultValues(Well dataObject, EtpUri uri) { dataObject.TimeZone = GetTimeZoneOffset(); }
private static void DeferentDilutionCyclesSimulation(double MutationRatio,double Dilution,double N0Persisters) { double Nf=1e9; int seed; double tauNormalKill=10; double tauPersisterKill=100; double tauGrowNormal=20; double tauGrowResistant=tauGrowNormal; //double N0Persisters = 1e6; double N0normal=Nf - N0Persisters; double N0Resisters = 0; double NormalPersistersFraction = N0Persisters/N0normal; //string FileName = "CyclesSimulation"+ MutationRatio.ToString("0.##E+0") +".txt"; string FileName = "DeferentDilutionCycleOfFixation_" + MutationRatio.ToString("0.00E+000") +"_"+Dilution.ToString()+ "_" +N0Persisters.ToString("0.##E+000")+".txt"; System.IO.FileInfo myFile = new FileInfo(FileName); myFile.Delete(); StreamWriter SR = new StreamWriter(FileName,false); int Simulations = 10000; for (int sim=0;sim < Simulations;sim++) { seed = sim; SimulationParameters SP = new SimulationParameters(Nf,10*Nf,MutationRatio,tauNormalKill,tauPersisterKill ,tauGrowNormal,tauGrowResistant ,NormalPersistersFraction,Dilution); Well NormalWell = new Well(N0normal,N0Persisters,N0Resisters); Simulation NormalSimulation= new Simulation(NormalWell,seed,SP); int cycle=0; do { cycle++; NormalWell = NormalSimulation.DoSycle(); } while (NormalWell.NumberOfResistant<Nf); SR.WriteLine(cycle); } SR.Close(); }
public string ToXml(Well well) { return(string.Empty); }
protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); modelBuilder.ApplyConfiguration(new CompanyMap()); modelBuilder.ApplyConfiguration(new ShopMap()); modelBuilder.ApplyConfiguration(new FieldMap()); modelBuilder.ApplyConfiguration(new WellMap()); modelBuilder.ApplyConfiguration(new WellTypeMap()); var company1 = new Company { Id = 1, Name = "ПАО \"Газпром\"", ShortName = "ГПН" }; var company2 = new Company { Id = 2, Name = "ПАО \"Лукойл\"", ShortName = "ЛК" }; var company3 = new Company { Id = 3, Name = "ПАО \"БашНефть\"", ShortName = "БН" }; var company4 = new Company { Id = 4, Name = "ЗАО \"Турсунт\"", ShortName = "ТУР" }; modelBuilder.Entity <Company>().HasData(company1, company2, company3, company4); var shop1 = new Shop { Id = 1, CompanyId = company2.Id, Name = "ЦДНГ-1" }; var shop2 = new Shop { Id = 2, CompanyId = company2.Id, Name = "ЦДНГ-2" }; var shop3 = new Shop { Id = 3, CompanyId = company1.Id, Name = "ЦДНГ-10" }; var shop4 = new Shop { Id = 4, CompanyId = company1.Id, Name = "ЦДНГ-11" }; var shop5 = new Shop { Id = 5, CompanyId = company3.Id, Name = "ЦДНГ-1" }; var shop6 = new Shop { Id = 6, CompanyId = company4.Id, Name = "ЦДНГ-1" }; modelBuilder.Entity <Shop>().HasData(shop1, shop2, shop3, shop4, shop5, shop6); var field1 = new Field { Id = 1, CompanyId = company1.Id, Name = "Яхлинское м." }; var field2 = new Field { Id = 2, CompanyId = company1.Id, Name = "Тальниковое м." }; var field3 = new Field { Id = 3, CompanyId = company1.Id, Name = "Шушминское м." }; var field4 = new Field { Id = 4, CompanyId = company2.Id, Name = "Тугровское м." }; var field5 = new Field { Id = 5, CompanyId = company2.Id, Name = "Шаимское м." }; var field6 = new Field { Id = 6, CompanyId = company2.Id, Name = "Сыморьяхское м." }; var field7 = new Field { Id = 7, CompanyId = company4.Id, Name = "Толумское м." }; var field8 = new Field { Id = 8, CompanyId = company4.Id, Name = "Ловинское м." }; modelBuilder.Entity <Field>().HasData(field1, field2, field3, field4, field5, field6, field7, field8); var wellType1 = new WellType { Id = 1, Name = "Нефтяная" }; var wellType2 = new WellType { Id = 2, Name = "Нагнетательная" }; var wellType3 = new WellType { Id = 3, Name = "Водозаборная" }; modelBuilder.Entity <WellType>().HasData(wellType1, wellType2, wellType3); //var well1 = new Well { Id = 1, FieldId = field1.Id, Name = "10010", ShopId = shop3.Id }; //var well2 = new Well { Id = 2, FieldId = field1.Id, Name = "100Р", ShopId = shop3.Id }; //var well3 = new Well { Id = 3, FieldId = field2.Id, Name = "101Р", ShopId = shop4.Id }; //var well4 = new Well { Id = 4, FieldId = field4.Id, Name = "1В", ShopId = shop1.Id }; //var well5 = new Well { Id = 5, FieldId = field4.Id, Name = "456", ShopId = shop2.Id }; //var well6 = new Well { Id = 6, FieldId = field5.Id, Name = "111", ShopId = shop1.Id }; //var well7 = new Well { Id = 7, FieldId = field5.Id, Name = "20089", ShopId = shop1.Id }; //var well8 = new Well { Id = 8, FieldId = field6.Id, Name = "49", ShopId = shop2.Id }; //var well9 = new Well { Id = 9, FieldId = field7.Id, Name = "1011", ShopId = shop6.Id }; //var well10 = new Well { Id = 10, FieldId = field8.Id, Name = "2345", ShopId = shop6.Id }; //var well11 = new Well { Id = 11, FieldId = field8.Id, Name = "99Н", ShopId = shop6.Id }; var well1 = new Well { Id = 1, FieldId = field1.Id, Name = "10010", CompanyId = company1.Id, ShopId = shop3.Id, Altitude = 100, ZabI = 1300, ZabF = 1315, WellTypeId = wellType1.Id }; var well2 = new Well { Id = 2, FieldId = field1.Id, Name = "100Р", CompanyId = company1.Id, ShopId = shop3.Id, Altitude = 55, ZabI = 1988, ZabF = 2002, WellTypeId = wellType2.Id }; var well3 = new Well { Id = 3, FieldId = field2.Id, Name = "101Р", CompanyId = company1.Id, ShopId = shop4.Id, Altitude = 232, ZabI = 1911, ZabF = 2002, WellTypeId = wellType2.Id }; var well4 = new Well { Id = 4, FieldId = field4.Id, Name = "1В", CompanyId = company2.Id, ShopId = shop1.Id, Altitude = 1, ZabI = 1911, ZabF = 2002, WellTypeId = wellType2.Id }; var well5 = new Well { Id = 5, FieldId = field4.Id, Name = "456", CompanyId = company2.Id, ShopId = shop2.Id, Altitude = 23, ZabI = 1922, ZabF = 2002, WellTypeId = wellType2.Id }; var well6 = new Well { Id = 6, FieldId = field5.Id, Name = "111", CompanyId = company2.Id, ShopId = shop1.Id, Altitude = 33, ZabI = 1933, ZabF = 2002, WellTypeId = wellType2.Id }; var well7 = new Well { Id = 7, FieldId = field5.Id, Name = "20089", CompanyId = company2.Id, ShopId = shop1.Id, Altitude = 44, ZabI = 1944, ZabF = 2002, WellTypeId = wellType2.Id }; var well8 = new Well { Id = 8, FieldId = field6.Id, Name = "49", CompanyId = company2.Id, ShopId = shop2.Id, Altitude = 55, ZabI = 1955, ZabF = 2002, WellTypeId = wellType2.Id }; var well9 = new Well { Id = 9, FieldId = field7.Id, Name = "1011", CompanyId = company4.Id, ShopId = shop6.Id, Altitude = 66, ZabI = 1966, ZabF = 2002, WellTypeId = wellType2.Id }; var well10 = new Well { Id = 10, FieldId = field8.Id, Name = "2345", CompanyId = company4.Id, ShopId = shop6.Id, Altitude = 77, ZabI = 1966, ZabF = 2002, WellTypeId = wellType2.Id }; var well11 = new Well { Id = 11, FieldId = field8.Id, Name = "99Н", CompanyId = company4.Id, ShopId = shop6.Id, Altitude = 88, ZabI = 1977, ZabF = 2002, WellTypeId = wellType2.Id }; modelBuilder.Entity <Well>().HasData(well1, well2, well3, well4, well5, well6, well7, well8, well9, well10, well11); }
//From GMap Demo example END #region -- some functions -- //Passing in a reference from well.cs and also passing in all wells info void AddLocation(Well well) { //mapOverLay.markers. add markers objects.Markers.AddDefaultGoogleMarker(well.CalculatedPoint, loadedMarkerStyle, well.WellId); }
public void Set644(uint PollutionID, Well well) { _644 = PollutionBase_Class.AllValueNorm.FirstOrDefault(x => x.PollutionID == PollutionID && x.ResolutionClarify.Resolution.CurtName.Contains("644")); }
public static Well <THelper> SetSize <THelper>(this Well <THelper> well, WellSize size) where THelper : BootstrapHelper <THelper> { return(well.ToggleCss(size)); }
public Opportunity CombineActionImpacts(Well well, List <ActionFinancialEstimate> costReduction, List <ActionFinancialEstimate> revenueGains, CancellationToken cancellationToken) { var incrementalRevenueSum = revenueGains.Aggregate(0D, (accumulator, actionFinancialEstimate) => { var impact = actionFinancialEstimate.impact; return(accumulator + impact); }); var costReductionSum = costReduction.Aggregate(0D, (accumulator, actionFinancialEstimate) => { var impact = actionFinancialEstimate.impact; return(accumulator + impact); }); var costOfRevenueGains = revenueGains.Aggregate(0D, (accumulator, actionFinancialEstimate) => { var cost = actionFinancialEstimate.cost; return(accumulator + cost); }); var potentialCostOfSkippingTests = costReduction.Aggregate(0D, (accumulator, actionFinancialEstimate) => { var cost = actionFinancialEstimate.cost; return(accumulator + cost); }); var manHoursOfRevGains = revenueGains.Aggregate(0D, (accumulator, actionFinancialEstimate) => { var hours = actionFinancialEstimate.manHours; return(accumulator + hours); }); if (incrementalRevenueSum - costOfRevenueGains >= 0 && costReductionSum - potentialCostOfSkippingTests > 0) { // Both revenue gain and cost Reduction return(new Opportunity { id = Guid.NewGuid().ToString(), well = well, name = "Opportunity for " + well.name, createdAt = new DateTime(), actions = revenueGains.Concat(costReduction).Select(x => x.action).ToList(), incrementalRevenue = incrementalRevenueSum, costReduction = costReductionSum - potentialCostOfSkippingTests, cost = costOfRevenueGains, manHours = manHoursOfRevGains }); } else if (incrementalRevenueSum - costOfRevenueGains >= 0) { // Only revenue gains return(new Opportunity { id = Guid.NewGuid().ToString(), well = well, name = "Opportunity for " + well.name, createdAt = new DateTime(), actions = revenueGains.Select(x => x.action).ToList(), incrementalRevenue = incrementalRevenueSum, costReduction = 0, cost = costOfRevenueGains, manHours = manHoursOfRevGains }); } else { // Only cost reduction? Unreachable, always has a no-intervention gain of 0! return(new Opportunity { id = Guid.NewGuid().ToString(), well = well, name = "Opportunity for " + well.name, createdAt = new DateTime(), actions = costReduction.Select(x => x.action).ToList(), incrementalRevenue = 0, costReduction = costReductionSum - potentialCostOfSkippingTests, cost = 0, manHours = 0 }); } }
public async Task CascadedDelete141Tests_Can_Parallel_Delete_Well_With_Populated_Wellbores() { // Number of objects to generate var numOfObjects = 5; var wellList = new List <Well>(); for (var i = 0; i < numOfObjects; i++) { wellList.Add(new Well() { Uid = DevKit.Uid(), Name = DevKit.Name(), TimeZone = "-06:00" }); } // Add wells wellList.ForEach(x => DevKit.AddAndAssert(x)); foreach (var well in wellList) { // Create logs var logs = DevKit.GenerateLogs(well.Uid, well.Name, LogIndexType.measureddepth, numOfObjects); // Create trajectories var trajectories = DevKit.GenerateTrajectories(well.Uid, well.Name, numOfObjects); // Add 5 wellbores with data objects for (var i = 0; i < numOfObjects; i++) { var wellbore = new Wellbore() { Uid = DevKit.Uid(), UidWell = well.Uid, Name = DevKit.Name(), NameWell = well.Name }; DevKit.AddAndAssert(wellbore); DevKit.AddListOfLogsToWellbore(logs, wellbore); DevKit.AddListOfTrajectoriesToWellbore(trajectories, wellbore); } } // Delete each well in parallel var taskList = new List <Task>(); wellList.ForEach(x => { taskList.Add(new Task(() => { var deleteWell = new Well { Uid = x.Uid }; var result = DevKit.Delete <WellList, Well>(deleteWell, ObjectTypes.Well, string.Empty, OptionsIn.CascadedDelete.True); Assert.IsNotNull(result); Assert.AreEqual(result.Result, 1); // Ensure well does not exist anymore DevKit.GetAndAssert(deleteWell, false); })); }); taskList.ForEach(x => x.Start()); await Task.WhenAll(taskList); wellList.ForEach(x => { var wells = DevKit.Get <WellList, Well>(DevKit.List(new Well() { Uid = x.Uid })); Assert.IsNotNull(wells); var result = EnergisticsConverter.XmlToObject <WellList>(wells.XMLout); Assert.IsNotNull(wells); Assert.AreEqual(0, result.Well.Count); }); }
private static void CyclesSimulation() { double Nf=1e9; double MutationRatio=1e-8 ; int seed ; double tauNormalKill=10; double tauPersisterKill=100; double tauGrowNormal=20; double tauGrowResistant=tauGrowNormal; double N0Persisters ; double N0normal; double N0Resisters; double NormalPersistersFraction; double HighPersistersFraction; string FileName = "CyclesSimulation"+ MutationRatio.ToString("0.##E+0") +".txt"; System.IO.FileInfo myFile = new FileInfo(FileName); myFile.Delete(); StreamWriter SR = new StreamWriter(FileName,false); int Simulations = 10000; for (int sim=0;sim < Simulations;sim++) { seed = sim; N0Persisters = 1e6; N0normal=Nf - N0Persisters; N0Resisters = 0; NormalPersistersFraction = N0Persisters/N0normal; SimulationParameters SP ; SP= new SimulationParameters(Nf,Nf,MutationRatio,tauNormalKill,tauPersisterKill ,tauGrowNormal,tauGrowResistant ,NormalPersistersFraction,200); Well NormalWell = new Well(N0normal,N0Persisters,N0Resisters); Simulation NormalSimulation= new Simulation(NormalWell,seed,SP); do { NormalWell = NormalSimulation.DoSycle(); } while (NormalWell.NumberOfResistant<Nf); N0Persisters = 1e8; N0normal=Nf - N0Persisters; N0Resisters = 0; HighPersistersFraction = N0Persisters/N0normal; SP = new SimulationParameters(Nf,Nf,MutationRatio,tauNormalKill,tauPersisterKill ,tauGrowNormal,tauGrowResistant,HighPersistersFraction ,200); Well HighPersistenceWell = new Well(N0normal,N0Persisters,N0Resisters); Simulation HighPersistenceSimulation = new Simulation(HighPersistenceWell,seed,SP); do { HighPersistenceWell = HighPersistenceSimulation.DoSycle(); } while (HighPersistenceWell.NumberOfResistant<Nf); SR.WriteLine("{0}\t{1}",NormalSimulation.Cycle,HighPersistenceSimulation.Cycle); NormalSimulation = null; HighPersistenceSimulation = null; PrintPresentege(sim,Simulations); } SR.Close(); }
public WellViewModel(Well well) { this.Well = well; }
public void Update(Well well) { db.Wells.Update(well); db.SaveChanges(); }
/// <summary> /// Adds well object and test the return code /// </summary> /// <param name="well">the well</param> /// <param name="errorCode">the errorCode</param> public WMLS_AddToStoreResponse AddAndAssert(Well well, ErrorCodes errorCode = ErrorCodes.Success) { return(AddAndAssert <WellList, Well>(well, errorCode)); }
public bool Contains(Well well) { return(Contains(well.X, well.Y)); }
/// <summary> /// Does get query for single well object and test for result count equal to 1 and is not null /// </summary> /// <param name="well">the well</param> /// <param name="isNotNull">if set to <c>true</c> the result should not be null.</param> /// <param name="optionsIn">The options in.</param> /// <param name="queryByExample">if set to <c>true</c> query by example.</param> /// <returns>The first well from the response</returns> public Well GetAndAssert(Well well, bool isNotNull = true, string optionsIn = null, bool queryByExample = false) { return(GetAndAssert <WellList, Well>(well, isNotNull, optionsIn, queryByExample)); }
public CustomPushpin(Well well, ControlTemplate template) : this(template) { Name = well.Name; Label = well.Name; Location = new Location(well.Latitude, well.Longitude); }
/// <summary> /// Does UpdateInStore on well object and test the return code /// </summary> /// <param name="well">the well</param> /// <param name="errorCode">The error code.</param> public void UpdateAndAssert(Well well, ErrorCodes errorCode = ErrorCodes.Success) { UpdateAndAssert <WellList, Well>(well, errorCode); }
public ActionResult AddWell(Well well) { ModelState.Clear(); ViewBag.LoadStatus = "0"; try { if (!ModelState.IsValid) { well.Error = "Please supply all required fields and try again"; well.ErrorCode = -1; return(Json(well, JsonRequestBehavior.AllowGet)); } var wx = ValidateControl(well); if (wx.Code < 1) { well.Error = wx.Error; well.ErrorCode = -1; return(Json(well, JsonRequestBehavior.AllowGet)); } var k = new WellServices().AddWellCheckDuplicate(well); if (k < 1) { if (k == -3) { well.Error = "Well already exists"; well.ErrorCode = -3; return(Json(well, JsonRequestBehavior.AllowGet)); } if (k == -4) { well.Error = "Well has already been classified"; well.ErrorCode = -3; return(Json(well, JsonRequestBehavior.AllowGet)); } well.Error = "Process Failed! Please contact the Admin or try again later"; well.ErrorCode = 0; return(Json(well, JsonRequestBehavior.AllowGet)); } if (well.SpudDate != null) { well.Date = ((DateTime)well.SpudDate).ToString("yyyy/MM/dd"); } well.Error = "Record was added successfully"; well.ErrorCode = 1; well.WellId = k; return(Json(well, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); well.Error = "An unknown error was encountered. Request could not be serviced. Please try again later."; well.ErrorCode = 0; return(Json(well, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// Deletes the well and test the return code /// </summary> /// <param name="well">The well.</param> /// <param name="errorCode">The error code.</param> /// <param name="partialDelete">if set to <c>true</c> is partial delete.</param> public void DeleteAndAssert(Well well, ErrorCodes errorCode = ErrorCodes.Success, bool partialDelete = false) { DeleteAndAssert <WellList, Well>(well, errorCode, partialDelete); }
public void AddWells(KeyValueEntity wells, Guid targetProjectId) { SeismosProject targetProject; using (var seismosContext = new seismosEntities()) { targetProject = seismosContext.SeismosProjects.FirstOrDefault(sp => sp.Id == targetProjectId); if (targetProject == null) { return; } var currWells = targetProject.Wells.ToList(); foreach (var wellsKeyValuePair in wells.KeyValuePairs) { if (wellsKeyValuePair == null) { continue; } var existingWell = currWells.FirstOrDefault(cw => cw.WellName == wellsKeyValuePair.Id); if (existingWell != null) { continue; } if (!Int32.TryParse(wellsKeyValuePair.Text.ToString(), out var iStagesToCreate)) { iStagesToCreate = 0; } var insertWell = new Well { Id = Guid.NewGuid(), WellName = wellsKeyValuePair.Id, SeismosProject = targetProject }; var hfTreatment = new HydraulicFracturingTreatment() { Id = Guid.NewGuid(), Name = insertWell.WellName + " HF", Type = TreatmentTypeEnum.HydraulicFracturing, Stages = new List <Stage>() }; for (int index = 0; index < iStagesToCreate; index++) { hfTreatment.Stages.Add(new Stage() { Id = Guid.NewGuid(), Number = index, StartTime = DateTime.Now, StopTime = DateTime.Now }); } insertWell.Treatments.Add(hfTreatment); seismosContext.Wells.Add(insertWell); } seismosContext.SaveChanges(); } }
/// <summary> /// Считывает WELSPECS для определения скважин и COMPDAT для задания конекшенов /// </summary> /// <param name="fileName"></param> public void ReadSchedule(ref StreamReader sr, string filePath) { string curStr; string[] splitted; int counter = 0; bool WS = false; bool CD = false; if (Wells == null) { Wells = new List<Well>(); Wells.Capacity = 0; } curStr = sr.ReadLine(); do { splitted = Splitter(curStr); if (splitted == null) { curStr = sr.ReadLine(); continue; } // skipping comments #region Include processing if (splitted[0] == "include") { //recall self curStr = sr.ReadLine(); splitted = Splitter(curStr); while (splitted == null) { curStr = sr.ReadLine(); splitted = Splitter(curStr); // looking for value } if (splitted[0][splitted[0].Length - 1] == '/') splitted[0] = splitted[0].Substring(0, splitted[0].Length - 1); if (splitted[0].Contains("'")) splitted[0] = splitted[0].Substring(1, splitted[0].Length - 2); splitted[0] = splitted[0].Replace('/', '\\'); StreamReader subsr = new StreamReader(filePath + splitted[0]); ReadSchedule(ref subsr, filePath); subsr.Dispose(); curStr = sr.ReadLine(); } #endregion #region connections if (CD) { if (splitted[0] == "/") { CD = false; curStr = sr.ReadLine(); continue; } Well well = new Well(); foreach (Well well_ in Wells) if (well_.Name == splitted[0]) { well = well_; int ii = Convert.ToInt32(splitted[1]); int jj = Convert.ToInt32(splitted[2]); int kk1 = Convert.ToInt32(splitted[3]); int kk2 = Convert.ToInt32(splitted[4]); foreach (Well.Connection con in well.Connections) if (con.I == ii && con.J == jj && con.K1 == kk1 && con.K2 == kk2) counter++; if (counter == 0) { //well.Connections.Capacity = well.Connections.Capacity + 1; well.Connections.Add(new Well.Connection(ii - 1, jj - 1, kk1 - 1, kk2 - 1)); } break; } counter = 0; curStr = sr.ReadLine(); continue; } #endregion #region wells if (WS) { if (splitted[0] == "/") { WS = false; curStr = sr.ReadLine(); continue; } Wells.Capacity = Wells.Capacity + 1; Well well = new Well(); well.Connections = new List<Well.Connection>(); well.Name = splitted[0]; well.WellHead[0] = Convert.ToInt32(splitted[2]) - 1; well.WellHead[1] = Convert.ToInt32(splitted[3]) - 1; Wells.Add(well); curStr = sr.ReadLine(); continue; } #endregion if (splitted[0] == "welspecs") WS = true; if (splitted[0] == "compdat") CD = true; curStr = sr.ReadLine(); } while (curStr != null); foreach (Well well in Wells) if (well.Name.Contains("'")) // Name well.Name = well.Name.Substring(1, well.Name.Length - 2); }
public static WellboresRootGridViewModel GetWellboreRootGridViewModel(Well wellDataModel) { return(new WellboresRootGridViewModel(wellDataModel)); }
internal void UpdateWellData(Well well) { if (!hasInternet) return; var update = "UPDATE \"Wells\" SET \"WellLng\" = @wellLng, \"WellLat\" = @wellLat, \"WellImage\" = @wellPhoto, " + "\"WellDepth\" = @welldepth, \"Description\" = @description, \"WaterLevel\" = @waterlevel, " + "\"Village\" = @village, \"ValveReplacedBy\" = @valvereplacedby"; if(!string.IsNullOrWhiteSpace(well.ValveReplacementDate)) { update += ", \"ValveReplacementDate\" = to_date(@valvereplacedate, 'DD/MM/YYYY')"; } update += " WHERE \"WellID\" = @wellId;"; using (var pgsqlConnection = new NpgsqlConnection(connectionString)) { pgsqlConnection.Open(); using (var command = new NpgsqlCommand(update, pgsqlConnection)) { command.Parameters.AddWithValue("@wellid", well.WellId); command.Parameters.AddWithValue("@wellLng", well.Longitude); command.Parameters.AddWithValue("@wellLat", well.Latitude); command.Parameters.AddWithValue("@wellPhoto", well.HasValidImage ? ImageToDatabaseConverter.ImageToBase64(well.WellImage, well.WellImage.RawFormat) : null); command.Parameters.AddWithValue("@welldepth", well.Depth); command.Parameters.AddWithValue("@waterlevel", well.WaterLevel); command.Parameters.AddWithValue("@description", well.Description); command.Parameters.AddWithValue("@village", well.Village); command.Parameters.AddWithValue("@valvereplacedby", well.ValveReplacedBy); command.Parameters.AddWithValue("@valvereplacedate", well.ValveReplacementDate); command.ExecuteNonQuery(); } } }
public void Well141DataAdapter_UpdateInStore_Can_Update_CustomData_Elements() { DevKit.AddAndAssert <WellList, Well>(Well); // Update with New Data var doc = new XmlDocument(); var element1 = doc.CreateElement("FirstItem", "http://www.witsml.org/schemas/1series"); element1.InnerText = "123.45"; var element2 = doc.CreateElement("LastItem", element1.NamespaceURI); element2.InnerText = "987.65"; Well.CustomData = new CustomData { Any = DevKit.List(element1, element2) }; DevKit.UpdateAndAssert <WellList, Well>(Well); // Query var query = new Well { Uid = Well.Uid }; var result = DevKit.Query <WellList, Well>(query, ObjectTypes.Well, null, optionsIn: OptionsIn.ReturnElements.All); var well = result.FirstOrDefault(); Assert.IsNotNull(well?.CustomData); Assert.AreEqual(2, well.CustomData.Any.Count); Assert.AreEqual(element1.LocalName, well.CustomData.Any[0].LocalName); Assert.AreEqual(element1.InnerText, well.CustomData.Any[0].InnerText); Assert.AreEqual(element2.LocalName, well.CustomData.Any[1].LocalName); Assert.AreEqual(element2.InnerText, well.CustomData.Any[1].InnerText); // Partial Update well.CustomData.Any[1].InnerText = "0.0"; var element3 = doc.CreateElement("NewItem", element1.NamespaceURI); element3.InnerText = "abc"; well.CustomData.Any.Add(element3); DevKit.UpdateAndAssert <WellList, Well>(well); // Query result = DevKit.Query <WellList, Well>(query, ObjectTypes.Well, null, optionsIn: OptionsIn.ReturnElements.All); well = result.FirstOrDefault(); Assert.IsNotNull(well?.CustomData); Assert.AreEqual(3, well.CustomData.Any.Count); Assert.AreEqual(element1.LocalName, well.CustomData.Any[0].LocalName); Assert.AreEqual(element1.InnerText, well.CustomData.Any[0].InnerText); Assert.AreEqual(element2.LocalName, well.CustomData.Any[1].LocalName); Assert.AreEqual("0.0", well.CustomData.Any[1].InnerText); Assert.AreEqual(element3.LocalName, well.CustomData.Any[2].LocalName); Assert.AreEqual(element3.InnerText, well.CustomData.Any[2].InnerText); }
/// <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]); } }
public async Task Well131_PutObject_Can_Update_Well() { AddParents(); await RequestSessionAndAssert(); var handler = _client.Handler <IStoreCustomer>(); var uri = Well.GetUri(); // Add a Comment to Data Object Well.CommonData = new CommonData() { Comments = "Test PutObject" }; var dataObject = CreateDataObject <WellList, Well>(uri, Well); // Get Object var args = await GetAndAssert(handler, uri); // Check for message flag indicating No Data Assert.IsNotNull(args?.Header); Assert.AreEqual((int)MessageFlags.NoData, args.Header.MessageFlags); // Put Object for Add await PutAndAssert(handler, dataObject); // Get Added Object args = await GetAndAssert(handler, uri); // Check Added Data Object XML Assert.IsNotNull(args?.Message.DataObject); var xml = args.Message.DataObject.GetString(); var result = Parse <WellList, Well>(xml); Assert.IsNotNull(result); Assert.IsNotNull(result.CommonData.Comments); // Remove Comment from Data Object result.CommonData.Comments = null; var updateDataObject = CreateDataObject <WellList, Well>(uri, result); // Put Object for Update await PutAndAssert(handler, updateDataObject); // Get Updated Object args = await GetAndAssert(handler, uri); // Check Added Data Object XML Assert.IsNotNull(args?.Message.DataObject); var updateXml = args.Message.DataObject.GetString(); result = Parse <WellList, Well>(updateXml); Assert.IsNotNull(result); // Test Data Object overwrite Assert.IsNull(result.CommonData.Comments); }
/// <summary> /// Reads in all wells from a Jupiter database. /// Only reads geographical information and location of Intakes and screen /// </summary> /// <param name="DataBaseFile"></param> public Dictionary<string, IWell> Wells() { Dictionary<string, IWell> Wells = new Dictionary<string, IWell>(); //Construct the data set JXL.ReadWells(true, false); Well CurrentWell; IIntake CurrentIntake; //Loop the wells foreach (var Boring in JXL.BOREHOLE) { CurrentWell = new Well(Boring.BOREHOLENO); Wells.Add(CurrentWell.ID, CurrentWell); if (!Boring.IsXUTMNull()) CurrentWell.X = Boring.XUTM; if (!Boring.IsYUTMNull()) CurrentWell.Y = Boring.YUTM; CurrentWell.Description = Boring.LOCATION; if (!Boring.IsELEVATIONNull()) CurrentWell.Terrain = Boring.ELEVATION; //Loop the intakes foreach (var IntakeData in Boring.GetINTAKERows()) { CurrentIntake = CurrentWell.Intakes.FirstOrDefault(var => var.IDNumber == IntakeData.INTAKENO); if (CurrentIntake == null) CurrentIntake = CurrentWell.AddNewIntake(IntakeData.INTAKENO); //Loop the screens. One intake can in special cases have multiple screens foreach (var ScreenData in IntakeData.GetSCREENRows()) { Screen CurrentScreen = new Screen(CurrentIntake); CurrentScreen.DepthToTop = ScreenData.TOP; CurrentScreen.DepthToBottom = ScreenData.BOTTOM; CurrentScreen.Number = ScreenData.SCREENNO; }//Screen loop }//Intake loop }//Bore loop return Wells; }
private static void DeferentDilutionCycleSimulation(double MutationRatio,double Dilution,double N0Persisters) { double Nf=1e9; int seed=1; double tauNormalKill=10; double tauPersisterKill=100; double tauGrowNormal=20; double tauGrowResistant=tauGrowNormal; //double N0Persisters = 1e8; double N0normal=Nf - N0Persisters; double N0Resisters = 0; double NormalPersistersFraction = N0Persisters/N0normal; string FileName = "OneExp_" + MutationRatio.ToString("0.##E+000") +"_"+Dilution.ToString() + "_" +N0Persisters.ToString("0.##E+000") +".txt"; System.IO.FileInfo myFile = new FileInfo(FileName); myFile.Delete(); StreamWriter SR = new StreamWriter(FileName,false); SimulationParameters SP = new SimulationParameters(Nf,10*Nf,MutationRatio,tauNormalKill,tauPersisterKill ,tauGrowNormal,tauGrowResistant ,NormalPersistersFraction,Dilution); Well NormalWell = new Well(N0normal,N0Persisters,N0Resisters); Simulation NormalSimulation= new Simulation(NormalWell,seed,SP); int cycle=0; do { cycle++; NormalWell = NormalSimulation.DoSycle(); SR.WriteLine("{0}\t{1}\t{2}\t{3}",cycle,NormalWell.NumberOfNormal,NormalWell.NumberOfPersistent,NormalWell.NumberOfResistant); } while (NormalWell.NumberOfResistant<Nf); SR.Close(); }
protected override void OnConstruct() { well = transform.parent.GetComponentStrict <Well>(); }
private Well ProcessRecord(DataRowView dv, ref string msg) { if (dv == null) { return(null); } try { var mInfo = new Well { Name = dv.Row["Well_Name"].ToString().Trim(), }; var spuDate = dv.Row["SPud_Date"].ToString().Trim(); DateTime d1; if (!string.IsNullOrEmpty(spuDate)) { var realDate = DateTime.TryParse(spuDate, out d1); if (!realDate) { mInfo.SpudDate = DateTime.Now; } mInfo.SpudDate = d1; } else { mInfo.SpudDate = DateTime.Now; } double dept = 0; if (!string.IsNullOrEmpty(dv.Row["Total_Dept"].ToString().Trim())) { var totalDeptStr = dv.Row["Total_Dept"].ToString().Trim(); var deptResult = double.TryParse(totalDeptStr, out dept); if (!deptResult || dept < 1) { dept = 0; } } mInfo.TotalDept = dept; var remarks = dv.Row["Remarks"].ToString().Trim(); if (!string.IsNullOrEmpty(remarks)) { mInfo.Remarks = remarks.Trim(); } var wellTypeName = dv.Row["WellType_Name"].ToString().Trim(); if (!string.IsNullOrEmpty(wellTypeName)) { var wellTypeId = new WellTypeServices().GetWellTypeId(wellTypeName); mInfo.WellTypeId = wellTypeId; } else { mInfo.WellTypeId = (int)OtherNotAvailable.Not_Available; } var techAllowed = dv.Row["Technical_Allowed"].ToString().Trim(); if (!string.IsNullOrEmpty(techAllowed)) { double outRes; var techAllowedResult = double.TryParse(techAllowed, out outRes); if (techAllowedResult && outRes > 0) { mInfo.TechnicalAllowable = outRes; } } //var blockName = dv.Row["Field_Name"].ToString().Trim(); //if (!string.IsNullOrEmpty(blockName)) //{ // var blockId = new WellTypeServices().GetWellTypeId(wellTypeName); // if (blockId < 1) // { // mInfo.WellTypeId = (int)OtherNotAvailable.Not_Available; // } // else // { // mInfo.BlockId = blockId; // } //} //else //{ // mInfo.WellTypeId = (int)OtherNotAvailable.Not_Available; //} var wellId = new WellServices().AddWellCheckDuplicate2(mInfo); if (wellId > 0) { var wellClassName = dv.Row["WellClass_Name"].ToString().Trim(); if (!string.IsNullOrEmpty(wellClassName)) { var status = new WellClasServices().CreateWellClassAddClassification(wellClassName, wellId); if (status < 1) { msg = "Well could not be classified"; return(null); } } } mInfo.WellId = wellId; return(mInfo); } catch (Exception ex) { ErrorLogger.LogEror(ex.StackTrace, ex.Source, ex.Message); return(null); } }
public void Add(Well well) { db.Wells.Add(well); db.SaveChanges(); }
/// <summary> /// Sets additional default values for the specified data object and URI. /// </summary> /// <param name="dataObject">The data object.</param> /// <param name="uri">The data object URI.</param> partial void SetAdditionalDefaultValues(Well dataObject, EtpUri uri) { dataObject.TimeZone = "Z"; }
public override string ToString() { return(string.Concat(Well.ToString(), " ", Position)); }
public static IDisposable UxWell(this HtmlHelper htmlHelper, WellSize size = null, string clientId = null) { var well = new Well(size, clientId); return RenderUxDispoableWebControl(htmlHelper, well); }
public void Attach(GameObject wellGameObject) { attachedToScript = wellGameObject.GetComponent <Well>(); attachedToScript.AttachBucket(this.gameObject); attached = true; }