/// <summary> 用重启信息生成新重启数据(只包含主文件,初始化文件和生产文件) </summary> public SimONData ChangeRestartModel(string mainFilePath, RestartInfoModelSimON model) { // 不读取INCLUDE部分数据 只读取SCHEDLE中INCLUDE SimONData data = FileFactoryService.Instance.ThreadLoadFunc <SimONData>(() => new SimONData(mainFilePath, null, l => l.GetParentKey() is SCHEDULE)); // HTodo :传递输出参数 需要测试 OUTSCHED rptsched = data.Key.Find <OUTSCHED>(); RPTSUM rptsum = data.Key.Find <RPTSUM>(); var incs = data.Key.FindAll <INCLUDE>(); // 设置所有INCLUDE都不生成文件 incs.ForEach(l => l.IsCreateFile = false); // 保存主文件 SOLUTION sl = data.Key.Find <SOLUTION>(); SCHEDULE sc = data.Key.Find <SCHEDULE>(); WELLCTRL well = data.Key.Find <WELLCTRL>(); // 更改起始时间 SOLVECTRL tuning = data.Key.Find <SOLVECTRL>(); // Todo :主文件没有在solotion中找 if (tuning == null) { tuning = sl.Find <SOLVECTRL>(); } tuning.Date = model.RestartTime; model.Solution.Add(tuning); // 替换数据 sl.ExChangeData(model.Solution); sc.ExChangeData(model.Schedule); well.ExChangeData(model.Well); // // 设置保存部分数据 List <INCLUDE> slIncludes = sl.FindAll <INCLUDE>(); slIncludes.ForEach(l => l.IsCreateFile = true); List <INCLUDE> scIncludes = sc.FindAll <INCLUDE>(); scIncludes.ForEach(l => l.IsCreateFile = true); List <INCLUDE> wellIncludes = well.FindAll <INCLUDE>(); wellIncludes.ForEach(l => l.IsCreateFile = true); // 保存主文件(目前没用) //model.MainData = data; if (rptsched != null) { data.Key.Add(rptsched); } if (rptsum != null) { data.Key.Add(rptsum); } //// Todo :插入标识到第二个关键字 //HeBianGu.Product.SimalorManager.RegisterKeys.SimON.STEPRST restart = new HeBianGu.Product.SimalorManager.RegisterKeys.SimON.STEPRST("STEPRST"); //data.Key.InsertKey(1, restart); return(data); }
/// <summary> 清理父节点 </summary> public void InitParentKey(bool isCoal = false) { this.Key.Clear(); this.Key.CreateSingle <SIMSET>("SIMSET"); GRID grid = this.Key.CreateSingle <GRID>("GRID"); if (grid != null) { // 增加屏显 ECHO_OFF echo_off = new ECHO_OFF("ECHO_OFF"); grid.Add(echo_off); INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_REG.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GPRO.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GGO.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_GOTH.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; grid.Add(include); // 关闭屏显 ECHO_ON echo_on = new ECHO_ON("ECHO_ON"); grid.Add(echo_on); } this.Key.CreateSingle <MODIFY>("MODIFY"); WELL well = this.Key.CreateSingle <WELL>("WELL"); USE_TF use_tf = new USE_TF("USE_TF"); if (well != null) { well.Add(use_tf); INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_WELL.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; well.Add(include); } PROPS props = this.Key.CreateSingle <PROPS>("PROPS"); if (props != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_SAT.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; props.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_PVT.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; props.Add(include); } if (isCoal) { ADSORB adsorb = this.Key.CreateSingle <ADSORB>("ADSORB"); INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_ADS.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; adsorb.Add(include); } SOLUTION solution = this.Key.CreateSingle <SOLUTION>("SOLUTION"); if (solution != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_INI.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; solution.Add(include); include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_AQU.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; solution.Add(include); } TUNESET tuneset = this.Key.CreateSingle <TUNESET>("TUNESET"); SOLVECTRL solvectrl = new SOLVECTRL("SOLVECTRL"); tuneset.Add(solvectrl); //if (solvectrl != null) //{ // INCLUDE include = new INCLUDE("INCLUDE"); // include.FileName = this.FileName.GetFileNameWithoutExtension() + "_TUN.DAT"; // include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; // solvectrl.Add(include); //} //SUMMARY summary = this.Key.CreateSingle<SUMMARY>("SUMMARY"); //if (summary != null) //{ // INCLUDE include = new INCLUDE("INCLUDE"); // include.FileName = this.FileName.GetFileNameWithoutExtension() + "_sum.inc"; // include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; // summary.Add(include); // //if (include.Keys.Count == 0) // //{ // // ALL all = new ALL("ALL"); // // include.Add(all); // //} //} SCHEDULE schedule = this.Key.CreateSingle <SCHEDULE>("SCHEDULE"); if (schedule != null) { INCLUDE include = new INCLUDE("INCLUDE"); include.FileName = this.FileName.GetFileNameWithoutExtension() + "_SCH.DAT"; include.FilePath = this.FilePath.GetDirectoryName() + "\\" + include.FileName; schedule.Add(include); } //END end = this.Key.CreateSingle<END>("END"); // 输出关键字 OUTSCHED rptsched = new OUTSCHED("RPTSCHED"); this.Key.Add(rptsched); }