/// <summary> 通过模型创建初始化文件 </summary>
        public SOLUTION InitRestartSolutionRestartCase(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;

            // HTodo  :保存生产文件 
            include.Save();

            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
        }