/// <summary> 通过模型创建初始化文件 </summary> public SOLUTION InitRestartSolution(string parentFileName, RestartInfoModelSimON mode, DateTime time, int index) { SOLUTION solution = new SOLUTION("SOLUTION"); INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = mode.FileName + "_INIT.DAT"; include.FilePath = mode.FilePath + "\\" + include.FileName; solution.Add(include); RegisterKeys.SimON.RESTART r = new RegisterKeys.SimON.RESTART("RESTART"); r.Filename = parentFileName; r.StepCount = index.ToString(); include.Add(r); mode.InitPath = include.FilePath; return solution; }
/// <summary> 通过模型创建初始化文件 </summary> public SOLUTION InitRestartSolution(RestartInfoModel parent, RestartInfoModel mode, string name, DateTime time, int index) { SOLUTION solution = new SOLUTION("SOLUTION"); INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = name + "_init.inc"; include.FilePath = parent.FilePath + "\\" + include.FileName; solution.Add(include); RESTART restart = new RESTART("RESTART"); RESTART.Item item = new RESTART.Item(); item.fwjm0 = parent.FileName; item.cqss1 = (index).ToString(); restart.Items.Add(item); include.Add(restart); mode.InitPath = include.FilePath; return(solution); }
/// <summary> 通关生产数据创建生产数据(目前只应用在FieldGoal案例重启) </summary> public SCHEDULE InitRestartSchduleRestartCase(SCHEDULE sch, RestartInfoModelSimON model, string name, DateTime time, DateTime endtime, Dictionary <string, double> wellProducts, int datype) { // 创建关键字 SCHEDULE schedule = new SCHEDULE("SCHEDULE"); INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = name + "_SCH.DAT"; include.FilePath = Path.GetDirectoryName(model.ResultFilePath) + "//" + include.FileName; model.SchPath = include.FilePath; schedule.Add(include); include.Add(new USESTARTTIME("USESTARTTIME")); include.Add(new RECURRENT("WELLSCHED")); TIME start = new TIME("TIME", time); foreach (var item in wellProducts) { WELLCTRL well = new WELLCTRL("WELLCTRL"); well.WellName0 = item.Key; well.ProType = datype == 0 ? SimONProductType.GRAT : datype == 1? SimONProductType.ORAT: SimONProductType.LRAT; well.Jcyblxz2 = item.Value.ToString(); start.Add(well); } TIME startAdd = new TIME("TIME", time.AddDays(1)); TIME end = new TIME("TIME", endtime); end.Add(new RegisterKeys.SimON.STEPRST("STEPRST")); List <VFPINJ> Vins = sch.FindAll <VFPINJ>(); List <VFPPROD> Vpns = sch.FindAll <VFPPROD>(); if (Vins.Count > 0) { include.AddRange(Vins); } if (Vpns.Count > 0) { include.AddRange(Vpns); } include.Add(start); if (startAdd.Date < end.Date) { include.Add(startAdd); } if (end.Date.Date == start.Date.Date) { include.Add(startAdd); } else { include.Add(end); } // HTodo :保存生产文件 include.Save(); return(schedule); // HTodo :示例如下 //USESTARTTIME //WELLSCHED //TIME 20140209D // WELL 'PROD1' 4 9000 1500 // WELL 'INIJ1' 5 6000 NA //TIME 20140210D //TIME 20140309D //RESTART }
/// <summary> 格式化文件 </summary> public void Format() { RUNSPEC runspec = this.Key.CreateSingle <RUNSPEC>("RUNSPEC"); REGIONS region = this.Key.CreateSingle <REGIONS>("REGIONS"); if (region != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_REG.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; region.Add(include); } GRID grid = this.Key.CreateSingle <GRID>("GRID"); var includesOld = grid.FindAll <INCLUDE>(); if (grid != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOPP.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GGO.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); #region - ggo - var echo = this.Key.FindAll <ECHO>(); if (echo != null) { grid.DeleteAll <ECHO>(); include.AddRange(echo); } var mapaxes = this.Key.FindAll <MAPAXES>(); if (mapaxes != null) { grid.DeleteAll <MAPAXES>(); include.AddRange(mapaxes); } var gridunit = this.Key.FindAll <GRIDUNIT>(); if (gridunit != null) { grid.DeleteAll <GRIDUNIT>(); include.AddRange(gridunit); } var coordsys = this.Key.FindAll <COORDSYS>(); if (coordsys != null) { grid.DeleteAll <COORDSYS>(); include.AddRange(coordsys); } var mapunits = this.Key.FindAll <MAPUNITS>(); if (mapunits != null) { grid.DeleteAll <MAPUNITS>(); include.AddRange(mapunits); } var noecho = this.Key.FindAll <NOECHO>(); if (noecho != null) { grid.DeleteAll <NOECHO>(); include.AddRange(noecho); } var coord = this.Key.FindAll <COORD>(); if (coord != null) { grid.DeleteAll <COORD>(); include.AddRange(coord); } var zcorn = this.Key.FindAll <ZCORN>(); if (zcorn != null) { grid.DeleteAll <ZCORN>(); include.AddRange(zcorn); } // 清空原有INCLUDE foreach (var v in includesOld) { grid.Delete(v); } #endregion include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GPRO.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOTH.INC"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); ECHO echo1 = grid.Find <ECHO>(); if (echo1 != null) { grid.DeleteAll <ECHO>(); include.Add(echo1); } List <FAULTS> faults = grid.FindAll <FAULTS>(); if (faults != null) { grid.DeleteAll <FAULTS>(); foreach (var v in faults) { include.Add(v); } } MULTFLT multflt = grid.Find <MULTFLT>(); if (multflt != null) { grid.DeleteAll <MULTFLT>(); include.Add(multflt); } } END end = this.Key.CreateSingle <END>("END"); }