/// <summary> 由WELL文件生成内存数据 </summary>
        public WELL InitRestartWell(string wellPath, RestartInfoModelSimON model)
        {
            //  创建关键字
            WELL   well   = new WELL("WELL");
            USE_TF use_tf = new USE_TF("USE_TF");

            well.Add(use_tf);
            INCLUDE include = new INCLUDE("INCLUDE");

            include.FileName = model.FileName + "_WELL.DAT";
            include.FilePath = Path.GetDirectoryName(model.ResultFilePath) + "//" + include.FileName;;
            //model.WellPath = include.FilePath;
            well.Add(include);

            INCLUDE lastInclude = this.RefreshRestartWellLocation(wellPath);

            if (lastInclude == null)
            {
                return(well);
            }
            // Todo :将母案例中的Include信息复制到新案例中
            include.ExChangeData(lastInclude);


            return(well);
        }
Exemplo n.º 2
0
        /// <summary> 将Eclipse生产数据转换成SimON生产数据 </summary>
        public SCHEDULE ConvertToSimON(SCHEDULE sch, WELL location, DateTime startTime, BaseFile history)
        {
            // Todo :保存SCH

            SCHEDULE schedule = new SCHEDULE("SCHEDULE");

            List <string> wellNames = new List <string>();

            List <WELSPECS> ws = sch.FindAll <WELSPECS>();

            // Todo :查找所有井名
            ws.ForEach(l => wellNames.AddRange(l.Items.Select(k => k.jm0)));

            List <NAME> histNames = new List <NAME>();

            // Todo :初始化名称 生产_historyproduction.dat
            wellNames.ForEach(l => histNames.Add(new NAME("NAME")
            {
                WellName = l
            }));

            histNames.ForEach(l => history.Key.Add(l));


            // Todo :初始化完井WELL数据
            List <NAME> names = new List <NAME>();

            wellNames.ForEach(l => names.Add(new NAME("NAME")
            {
                WellName = l
            }));

            names.ForEach(l => location.Add(l));

            List <DATES> ds = sch.FindAll <DATES>();

            string format = "井名:{0} ({1},{2})";

            // Todo :添加起始信息到时间步
            DATES start = new DATES("DATES", startTime);

            sch.DeleteAll <DATES>();

            start.AddRange <BaseKey>(sch.Keys);

            ds.Insert(0, start);

            List <PERF> comAllTemp = new List <PERF>();

            foreach (DATES d in ds)
            {
                // Todo :对缓存中完井井名去重复取最后一条
                var distincts = comAllTemp.GroupBy(l => l.WellName + l.I0 + l.J1 + l.K12).ToList();
                comAllTemp.Clear();
                foreach (var item in distincts)
                {
                    comAllTemp.Add(item.Last());
                }

                //  创建SimON日期
                TIME time = new TIME("TIME");
                time.Date = d.DateTime;
                schedule.Add(time);

                var wconprod = d.FindAll <WCONPROD>();
                var wconhist = d.FindAll <WCONHIST>();
                var wconinje = d.FindAll <WCONINJE>();
                var wconinjh = d.FindAll <WCONINJH>();

                //  完井数据(考虑到排序)
                List <BaseKey> compdats = d.FindAll <BaseKey>(l => l is COMPDAT || l is WELOPEN);

                List <WPIMULT> wpimult = d.FindAll <WPIMULT>();

                List <WELOPEN> welopen = d.FindAll <WELOPEN>();

                #region - 添加没有生产信息的完井 -
                //  添加完井数据
                foreach (BaseKey c in compdats)
                {
                    if (c is COMPDAT)
                    {
                        COMPDAT com = c as COMPDAT;

                        foreach (COMPDAT.Item citem in com.Items)
                        {
                            // Todo :过滤有生产数据的,用后面方法处理
                            if (wconprod.Exists(l => l.Items.Exists(k => k.jm0 == citem.jm0)))
                            {
                                continue;
                            }
                            if (wconhist.Exists(l => l.Items.Exists(k => k.wellName0 == citem.jm0)))
                            {
                                continue;
                            }
                            if (wconinje.Exists(l => l.Items.Exists(k => k.jm0 == citem.jm0)))
                            {
                                continue;
                            }
                            if (wconinjh.Exists(l => l.Items.Exists(k => k.jm0 == citem.jm0)))
                            {
                                continue;
                            }

                            WELLCTRL well = time.Find <WELLCTRL>(l => l.WellName0 == citem.jm0);

                            if (well == null)
                            {
                                // Todo :创建一个空的生产信息
                                well           = new WELLCTRL("WELLCTRL");
                                well.ProType   = SimONProductType.NA;
                                well.WellName0 = citem.jm0;
                                time.Add(well);
                            }

                            NAME name = names.Find(l => l.WellName == well.WellName0);

                            #region - SCh数据 -

                            PERF perf = new PERF("PERF");
                            perf.WellName = well.WellName0;
                            perf.I0       = citem.i1;
                            perf.J1       = citem.j2;
                            perf.K12      = citem.swg3;
                            perf.K23      = citem.xwg4;
                            perf.Kgbs4    = citem.kgbz5;
                            perf.Jzs6     = citem.ljyz7;
                            perf.WjfxX7   = citem.skfx12 == "X" ? "DX" : "0";
                            perf.WjfxY8   = citem.skfx12 == "Y" ? "DY" : "0";
                            perf.WjfxZ9   = citem.skfx12 == "Z" ? "DZ" : "0";
                            perf.Bp10     = citem.bpxs10;

                            // Todo :查找井指数乘子
                            foreach (WPIMULT wp in wpimult)
                            {
                                var v = wp.Items.Find(l => l.jm0 == well.WellName0);

                                if (v != null)
                                {
                                    perf.Jzscz5 = v.jzscz1;
                                    break;
                                }
                            }

                            // Todo :增加前先删除存在的重复数据
                            well.DeleteAll <PERF>(l => l.I0 == perf.I0 && l.J1 == perf.J1 && l.K12 == perf.K12);
                            well.Add(perf);

                            #endregion

                            #region - WELL数据 -

                            NAME.Item nameItem = new NAME.Item();
                            nameItem.i0    = citem.i1;
                            nameItem.j1    = citem.j2;
                            nameItem.k12   = citem.swg3;
                            nameItem.k23   = citem.xwg4;
                            nameItem.kgbz4 = citem.kgbz5;
                            //nameItem.wi5 = "NA";// v.Value.skin.Value.Value.ToString();
                            //nameItem.dx6 = v.Value.wellIndex.Value.GetValue(v.Value.wellIndex.GetUnitValue(_ecl)).ToString();
                            //nameItem.dy7 = v.Value.wellDirection.Value.Value == "X" ? "0" : v.Value.wellDirection.Value.Value == "Y" ? "1" : "2";
                            nameItem.bpxs9 = citem.bpxs10;
                            nameItem.jj10  = (citem.jtnj8.ToDouble() / 2).ToString();
                            name.Items.Add(nameItem);
                            #endregion

                            comAllTemp.Add(perf);
                        }
                    }
                    else if (c is WELOPEN)
                    {
                        WELOPEN wp = c as WELOPEN;

                        foreach (var v in wp.Items)
                        {
                            // Todo :过滤有生产数据的,用后面方法处理
                            if (wconprod.Exists(l => l.Items.Exists(k => k.jm0 == v.jm0)))
                            {
                                continue;
                            }
                            if (wconhist.Exists(l => l.Items.Exists(k => k.wellName0 == v.jm0)))
                            {
                                continue;
                            }
                            if (wconinje.Exists(l => l.Items.Exists(k => k.jm0 == v.jm0)))
                            {
                                continue;
                            }
                            if (wconinjh.Exists(l => l.Items.Exists(k => k.jm0 == v.jm0)))
                            {
                                continue;
                            }
                            // WELOPEN
                            //'G13' 'SHUT' 0 0 0 2 * /
                            // /

                            // Todo :查找之前所有完井
                            var coms = comAllTemp.FindAll(l => l.WellName == v.jm0);

                            Predicate <PERF> match = l => true;

                            // Todo :0 或 *表示默认值全都取
                            if (v.i2 != KeyConfiger.EclipseDefalt && v.i2 != "0")
                            {
                                match += l => l.I0 == v.i2;
                            }

                            if (v.j3 != KeyConfiger.EclipseDefalt && v.j3 != "0")
                            {
                                match += l => l.J1 == v.j3;
                            }

                            if (v.k4 != KeyConfiger.EclipseDefalt && v.k4 != "0")
                            {
                                match += l => l.K12 == v.k4;
                            }

                            var findComs = coms.FindAll(match);

                            WELLCTRL well = time.Find <WELLCTRL>(l => l.WellName0 == v.jm0);
                            if (well == null)
                            {
                                // Todo :创建一个空的生产信息
                                well           = new WELLCTRL("WELLCTRL");
                                well.ProType   = SimONProductType.NA;
                                well.WellName0 = v.jm0;
                                time.Add(well);
                            }

                            // Todo :增加WELOPEN控制的完井
                            foreach (var fitem in findComs)
                            {
                                PERF perf = fitem.Copy();
                                perf.Kgbs4 = v.jz1;
                                // Todo :增加前先删除存在的重复数据
                                well.DeleteAll <PERF>(l => l.I0 == fitem.I0 && l.J1 == fitem.J1 && l.K12 == fitem.K12);
                                well.Add(perf);
                            }
                        }
                    }

                    //this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);
                }

                #endregion


                foreach (var item in wconprod)
                {
                    foreach (WCONPROD.ItemHY it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.jm0;

                        well = this.ConvertToSimON(it, d, histNames);

                        if (well != null)
                        {
                            this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                            time.Add(well);
                        }
                    }
                }


                foreach (var item in wconhist)
                {
                    foreach (WCONHIST.Item it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.wellName0;

                        well = this.ConvertToSimON(it, d, histNames);

                        this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                        time.Add(well);
                    }
                }


                foreach (var item in wconinje)
                {
                    foreach (WCONINJE.ItemHY it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.jm0;

                        well = this.ConvertToSimON(it, d, histNames);

                        this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                        time.Add(well);
                    }
                }

                foreach (var item in wconinjh)
                {
                    foreach (WCONINJH.Item it in item.Items)
                    {
                        //  生产数据
                        WELLCTRL well = new WELLCTRL("WELLCTRL");

                        well.WellName0 = it.jm0;

                        well = this.ConvertToSimON(it, d, histNames);

                        this.ConvertCompadat(well, names, compdats, wpimult, comAllTemp);

                        time.Add(well);
                    }
                }

                //// Todo :将之前的完井信息都加入到缓存中
                //foreach (var item in compdats)
                //{
                //    comAllTemp.AddRange(item.Items);
                //}
            }

            return(schedule);
        }
Exemplo n.º 3
0
        /// <summary> 将Eclipse数模文件转换成SimON数模文件 </summary>
        public SimONData ConvertToSimON(EclipseData ecl)
        {
            // Todo :Eclipse里面的修改参数没有解析成SimON中修改参数
            ecl.RunModify();

            RUNSPEC  runspec  = ecl.Key.Find <RUNSPEC>();
            GRID     grid     = ecl.Key.Find <GRID>();
            SOLUTION solution = ecl.Key.Find <SOLUTION>();
            SUMMARY  summary  = ecl.Key.Find <SUMMARY>();
            SCHEDULE schedule = ecl.Key.Find <SCHEDULE>();
            REGIONS  regions  = ecl.Key.Find <REGIONS>();
            PROPS    props    = ecl.Key.Find <PROPS>();

            SimONData simon = new SimONData();

            simon.FileName   = ecl.FileName;
            simon.FilePath   = ecl.FilePath;
            simon.MmfDirPath = ecl.MmfDirPath;
            simon.InitConstruct();

            simon.X = ecl.X;
            simon.Y = ecl.Y;
            simon.Z = ecl.Z;

            //  模型定义

            #region - 起始时间 -

            SOLVECTRL tuning = new SOLVECTRL("TUNING");

            tuning.Date = ecl.Key.Find <START>().StartTime;

            simon.Key.Add(tuning);

            #endregion

            #region - 维数定义 -

            RSVSIZE rsvsize = new RSVSIZE("RSVSIZE");

            DIMENS dimens = ecl.Key.Find <DIMENS>();

            rsvsize.X = dimens.X;
            rsvsize.Y = dimens.Y;
            rsvsize.Z = dimens.Z;



            simon.Key.Add(rsvsize);

            #endregion

            #region - 单位类型 -

            UnitType unitType = UnitType.METRIC;

            //  读到METRIC公制单位
            METRIC metric = ecl.Key.Find <METRIC>();

            if (metric != null)
            {
                simon.Key.Add(metric);
                unitType = UnitType.METRIC;
            }

            //  单位类型
            FIELD field = ecl.Key.Find <FIELD>();

            if (field != null)
            {
                simon.Key.Add(field);
                unitType = UnitType.FIELD;
            }

            #endregion

            #region - 流体类型 -

            MODELTYPE modeltype = new MODELTYPE("MODELTYPE");

            //  流体类型
            OIL    oil    = runspec.Find <OIL>();
            WATER  water  = runspec.Find <WATER>();
            GAS    gas    = runspec.Find <GAS>();
            DISGAS disgas = runspec.Find <DISGAS>();
            VAPOIL vapoil = runspec.Find <VAPOIL>();

            //  黑油
            if (oil != null && water != null && gas != null && disgas != null && vapoil == null)
            {
                modeltype.MetricType = MetricType.BLACKOIL;
            }
            //  油水
            else if (oil != null && water != null && gas == null && disgas == null && vapoil == null)
            {
                modeltype.MetricType = MetricType.OILWATER;
            }
            //  气水
            else if (oil == null && water != null && gas != null && disgas == null && vapoil == null)
            {
                modeltype.MetricType = MetricType.GASWATER;
            }
            //  挥发油
            else if (oil != null && water != null && gas != null && disgas != null && vapoil != null)
            {
                modeltype.MetricType = MetricType.HFOIL;
            }
            else
            {
                modeltype.MetricType = MetricType.BLACKOIL;
            }
            simon.Key.Add(modeltype);
            #endregion

            #region - 分区维数 -

            EQUILREG equilreg = new EQUILREG("EQUILREG");
            FIPREG   fipreg   = new FIPREG("FIPREG");
            ROCKREG  rockreg  = new ROCKREG("ROCKREG");
            SATREG   satreg   = new SATREG("SATREG");
            PVTREG   pvtreg   = new PVTREG("PVTREG");

            simon.Key.Add(equilreg);
            simon.Key.Add(fipreg);
            simon.Key.Add(rockreg);
            simon.Key.Add(satreg);
            simon.Key.Add(pvtreg);

            TABDIMS tabdims = runspec.Find <TABDIMS>();

            if (tabdims != null)
            {
                fipreg.X  = tabdims.Fipfqzds4.ToString();
                rockreg.X = tabdims.Yslxgs12.ToString();
                satreg.X  = tabdims.Bhdbs0.ToString();
                pvtreg.X  = tabdims.Pvtbs1.ToString();

                //fipreg.X = "1";
                //rockreg.X = "1";
                //satreg.X = "1";
                //pvtreg.X = "1";
            }

            EQLDIMS eqldims = runspec.Find <EQLDIMS>();

            if (eqldims != null)
            {
                //equilreg.X = "1";
                equilreg.X = eqldims.Phfqs0.ToString();
            }

            OVERBURD overburd = props.Find <OVERBURD>();
            if (overburd != null)
            {
                //rockreg.X = overburd.Regions.Count.ToString();
            }

            EQUILMAP equilmap = new EQUILMAP("EQUILMAP");
            FIPMAP   fipmap   = new FIPMAP("FIPMAP");
            ROCKMAP  rockmap  = new ROCKMAP("ROCKMAP");
            SATMAP   satmap   = new SATMAP("SATMAP");
            PVTMAP   pvtmap   = new PVTMAP("PVTMAP");

            if (regions != null)
            {
                EQLNUM eqlnum = regions.Find <EQLNUM>();

                if (eqlnum != null)
                {
                    equilmap = eqlnum.ToTableKey <EQUILMAP>();
                    solution.Add(equilmap);
                    eqlnum.Delete();
                    eqlnum.Dispose();
                }

                // Todo :非平衡初始化压力需要转换
                var pressure = solution.Find <PRESSURE>();
                if (pressure != null)
                {
                    POIL poil = pressure.ToTableKey <POIL>();
                    solution.Add(poil);
                    pressure.Delete();
                    pressure.Dispose();
                }

                if (regions != null)
                {
                    FIPNUM fipnum = regions.Find <FIPNUM>();

                    if (fipnum != null)
                    {
                        fipmap = fipnum.ToTableKey <FIPMAP>();
                        grid.Add(fipmap);
                        fipnum.Delete();
                        fipnum.Dispose();
                    }
                    ROCKNUM rocknum = regions.Find <ROCKNUM>();

                    if (rocknum != null)
                    {
                        rockmap = rocknum.TransToTableKeyByName("ROCKMAP", true) as ROCKMAP;
                        grid.Add(rockmap);
                        rocknum.Delete();
                        rocknum.Dispose();
                    }

                    SATNUM satnum = regions.Find <SATNUM>();

                    if (satnum != null)
                    {
                        satmap = satnum.ToTableKey <SATMAP>();
                        grid.Add(satmap);
                        satnum.Delete();
                        satnum.Dispose();
                    }


                    PVTNUM pvtnum = regions.Find <PVTNUM>();

                    if (pvtnum != null)
                    {
                        pvtmap = pvtnum.ToTableKey <PVTMAP>();
                        grid.Add(pvtmap);
                        pvtnum.Delete();
                        pvtnum.Dispose();
                    }
                }
            }



            #endregion

            #region - 地质模型 -

            simon.Key.Add(grid);

            #endregion

            #region - 断层 -
            //var eclFaults = grid.FindAll<OPT.Product.SimalorManager.RegisterKeys.Eclipse.FAULTS>();

            //foreach (var v in eclFaults)
            //{
            //grid.AddRange(this.ConvertToSimON(v));

            //v.Delete();
            //}
            #endregion

            #region - 水体 -

            //AQUFETP AQUFETP=

            // Todo :Fetkovich水体数据转换
            var ct = solution.Find <OPT.Product.SimalorManager.RegisterKeys.Eclipse.AQUCT>();

            if (ct != null)
            {
                var newFetp = this.ConvertToSimON(ct);

                solution.Add(newFetp);

                ct.Delete();
            }

            // Todo :Fetkovich水体数据转换
            var fetp = solution.Find <OPT.Product.SimalorManager.RegisterKeys.Eclipse.AQUFETP>();

            if (fetp != null)
            {
                var newFetp = this.ConvertToSimON(fetp);

                solution.Add(newFetp);

                fetp.Delete();
            }

            // Todo :水体连接数据转换
            var aquancon = solution.Find <OPT.Product.SimalorManager.RegisterKeys.Eclipse.AQUANCON>();

            if (aquancon != null)
            {
                var newFetp = this.ConvertToSimON(aquancon);

                solution.Add(newFetp);

                aquancon.Delete();
            }

            #endregion

            #region - 流体模型 岩石模型-

            GRAVITY gravity = ecl.Key.Find <GRAVITY>();

            if (gravity != null)
            {
                // Todo :SimON只解析绝对密度
                DENSITY density = this.ConvertTo(gravity, unitType);

                gravity.ParentKey.Add(density);

                gravity.Delete();
            }

            List <IRegionInterface> regSoltionKeys = solution.FindAll <IRegionInterface>();

            regSoltionKeys.ForEach(l => l.TransToSimONRegion());
            simon.Key.Add(solution);
            //
            List <IRegionInterface> regPropsKeys = props.FindAll <IRegionInterface>();
            regPropsKeys.ForEach(l => l.TransToSimONRegion());

            //// Todo :SGWFN 需要特殊转换为 SWGF
            //SGWFN sgwfn = props.Find<SGWFN>();
            //if (sgwfn != null)
            //{
            //    //props.AddRange(sgwfn.ConvertTo());

            //    simon.Key.AddRange<SWGF>(sgwfn.ConvertTo());
            //}

            simon.Key.Add(props);



            #endregion

            #region - 初始化模型 -

            List <EQUIL> equil = solution.FindAll <EQUIL>();
            foreach (var item in equil)
            {
                EQUILPAR   equilpar = new EQUILPAR("EQUILPAR");
                EQUIL.Item it       = item.GetSingleRegion().GetSingleItem();

                equilpar.Szstzdhs0   = it.cksd0;
                equilpar.Szstljs1    = it.ckyl1;
                equilpar.Ctstyxhs2   = it.ysjmsd2;
                equilpar.Ctstyxzdhs3 = it.ysjmcmgyl3.ToDefalt("0");
                //equilpar.Jxstzds4 = it.yqjmsd4;
                equilpar.E100wgzds5   = it.yqjmsd4;
                equilpar.E300jxstzds6 = it.yqjmcmgyl5;

                item.ParentKey.Add(equilpar);
                item.Delete();
            }

            #endregion

            #region - 生产模型 -

            WELL well = new WELL("WELL");


            // Todo :添加完井数据 (注意要放到生产模型前面)
            simon.Key.Add(well);

            //  生产模型
            simon.Key.Add(this.ConvertToSimON(schedule, well, ecl.Key.Find <START>().StartTime, simon.HistoryData));


            #endregion

            // Todo :转换修正关键字
            List <ModifyKey> modifys = ecl.Key.FindAll <ModifyKey>();

            grid.AddRange(modifys);

            return(simon);
        }
        /// <summary> 用重启信息生成新重启数据(只包含主文件,初始化文件和生产文件) </summary>
        public SimONData ChangeRestartModel(SimONData mainData, RestartInfoModelSimON model)
        {
            //  不读取INCLUDE部分数据
            SimONData data = FileFactoryService.Instance.ThreadLoadFunc <SimONData>(() => new SimONData(mainData.FilePath, null, l => false));

            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>();

            WELL well = data.Key.Find <WELL>();

            //  更改起始时间
            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;


            //// Todo :插入关键字到最后
            //RPTSCHED rptsched = new RPTSCHED("RPTSCHED");

            //data.Key.Add(rptsched);

            OUTSCHED rptsched = mainData.Key.Find <OUTSCHED>();

            RPTSUM rptsum = mainData.Key.Find <RPTSUM>();

            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);
        }
Exemplo n.º 5
0
        /// <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);
        }