private void CreateEmptyObservedData(ObservedDataSetForWell odsFw, Template template, string versionDataName) { foreach (ObservedDataVersionSelection odvs in odsFw.GetObservedDataVersionSelections(template)) { if (odvs.Name == versionDataName) { odsFw.CreateObservedData(odvs, new List <double>()); } } }
private void ImportObservedDataForWell(Borehole bh, List <WellAllocation> wellAllocations, ObservedDataSet observedDataSet) { ObservedDataSetForWell odsFw = ObservedDataSetForWell.NullObject; DeleteExistentDataSetForWell(bh, observedDataSet); string opIdName = "Oil production rate"; string gpIdName = "Gas production rate"; string wpIdName = "Water production rate"; string wiIdName = "Water injection rate"; string ufIdName = "Uptime fraction"; FlowType flow = FlowType.Default; var timeSteps = new List <DateTime>(); using (ITransaction tr = DataManager.NewTransaction()) { Template opt = PetrelProject.WellKnownTemplates.ProductionGroup.ProductionRateOil; Template gpt = PetrelProject.WellKnownTemplates.ProductionGroup.ProductionRateGas; Template wpt = PetrelProject.WellKnownTemplates.ProductionGroup.ProductionRateWater; Template wit = PetrelProject.WellKnownTemplates.ProductionGroup.InjectionRateWater; Template utf = PetrelProject.WellKnownTemplates.ProductionGroup.UptimeFraction; tr.Lock(observedDataSet); odsFw = observedDataSet.CreateObservedDataSetForWell(bh, flow, timeSteps); // Create each data version (columns) CreateEmptyObservedData(odsFw, opt, opIdName); CreateEmptyObservedData(odsFw, gpt, gpIdName); CreateEmptyObservedData(odsFw, wpt, wpIdName); CreateEmptyObservedData(odsFw, wit, wiIdName); CreateEmptyObservedData(odsFw, utf, ufIdName); // Append data foreach (WellAllocation allocation in wellAllocations) { odsFw.Append( allocation.OperativeDate, odsFw.ObservedDatas, new List <double> { ProductionRate(allocation.Oil, allocation.EffectiveTime), ProductionRate(allocation.Gas, allocation.EffectiveTime), ProductionRate(allocation.Water, allocation.EffectiveTime), ProductionRate(allocation.WaterInjection, allocation.EffectiveTime), allocation.EffectiveTime }); } tr.Commit(); } }