Ejemplo n.º 1
0
        public RSSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            if (br.Length > 0)
            {
                while (br.Position < br.Length - 24)
                {
                    br.ReadHeader();

                    if (br.header.keyword == "TIME")
                    {
                        br.ReadBytes(4);
                        TIME.Add(br.ReadDouble());
                        br.ReadBytes(4);
                        continue;
                    }

                    if (br.header.keyword == "ITIME")
                    {
                        int[] ITIME = br.ReadIntList();
                        REPORT.Add(ITIME[0]);
                        TYPE_RESTART.Add(ITIME[5]);
                        if (ITIME.Length > 10)
                        {
                            DATE.Add(new DateTime(ITIME[3], ITIME[2], ITIME[1], ITIME[10], ITIME[11], (int)(ITIME[12] * 1e6)));
                        }
                        else
                        {
                            DATE.Add(new DateTime(ITIME[3], ITIME[2], ITIME[1]));
                        }

                        continue;
                    }

                    if (br.header.keyword == "NAME")
                    {
                        NAME.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "TYPE")
                    {
                        TYPE.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "UNITS")
                    {
                        UNITS.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "NUMBER")
                    {
                        NUMBER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMAX")
                    {
                        ARRAYMAX.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMIN")
                    {
                        ARRAYMIN.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "POINTER")
                    {
                        POINTER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "POINTERB")
                    {
                        POINTERB.Add(br.ReadIntList());
                        continue;
                    }

                    br.SkipEclipseData();
                }
                br.CloseBinaryFile();
            }
        }
Ejemplo n.º 2
0
        public int NTIME;                  // Количество временных шагов

        public SMSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            while (br.Position < br.Length - 24)
            {
                br.ReadHeader();

                if (br.header.keyword == "RESTART")
                {
                    var           tmp = br.ReadStringList();
                    StringBuilder str = new StringBuilder();
                    foreach (string item in tmp)
                    {
                        str.Append(item);
                    }

                    RESTART = str.ToString();
                    continue;
                }

                if (br.header.keyword == "MEASRMNT")
                {
                    var tmp    = br.ReadStringList();
                    int lenght = br.header.count / NLIST;
                    MEASRMNT = new string[NLIST];
                    StringBuilder str = new StringBuilder();
                    for (int iw = 0; iw < NLIST; ++iw)
                    {
                        str.Clear();
                        for (int ik = 0; ik < lenght; ++ik)
                        {
                            str.Append(tmp[iw * lenght + ik]);
                        }
                        MEASRMNT[iw] = str.ToString();
                    }
                    continue;
                }

                if (br.header.keyword == "DIMENS")
                {
                    br.ReadBytes(4);
                    NLIST = br.ReadInt32();
                    NDIVX = br.ReadInt32();
                    NDIVY = br.ReadInt32();
                    NDIVZ = br.ReadInt32();
                    br.ReadBytes(4);
                    ISTAR = br.ReadInt32();
                    br.ReadBytes(4);
                    continue;
                }
                if (br.header.keyword == "KEYWORDS")
                {
                    KEYWORDS = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "WGNAMES")
                {
                    WGNAMES = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "NUMS")
                {
                    NUMS = br.ReadIntList();
                    continue;
                }

                if (br.header.keyword == "UNITS")
                {
                    WGUNITS = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "STARTDAT")
                {
                    br.ReadBytes(4);
                    int SDAY   = br.ReadInt32();
                    int SMONTH = br.ReadInt32();
                    int SYEAR  = br.ReadInt32();
                    STARTDATE = new DateTime(SYEAR, SMONTH, SDAY);

                    if (br.header.count == 6)
                    {
                        int SHOUR   = br.ReadInt32();
                        int SMINUTE = br.ReadInt32();
                        int SSECOND = (int)(br.ReadInt32() * 1e6);
                        STARTDATE = new DateTime(SYEAR, SMONTH, SDAY, SHOUR, SMINUTE, SSECOND);
                    }

                    br.ReadBytes(4);
                    continue;
                }
                br.SkipEclipseData();
            }
            br.CloseBinaryFile();
        }
Ejemplo n.º 3
0
        public void ReadRestart(string filename, int step)
        {
            FILENAME     = filename;
            RESTART_STEP = step;

            FileReader br = new FileReader();

            Action <string> SetPosition = (name) =>
            {
                int  index    = Array.IndexOf(NAME[step], name);
                long pointer  = POINTER[step][index];
                long pointerb = POINTERB[step][index];
                br.SetPosition(pointerb * 2147483648 + pointer);
            };


            WELLS = new List <WELLDATA>();
            br.OpenBinaryFile(filename);
            SetPosition("INTEHEAD");
            br.ReadHeader();
            int[] INTH = br.ReadIntList();
            NX     = INTH[8];
            NY     = INTH[9];
            NZ     = INTH[10];
            NACTIV = INTH[11];
            IPHS   = INTH[14];
            NWELLS = INTH[16];
            NCWMAX = INTH[17];
            NIWELZ = INTH[24];
            NSWELZ = INTH[25];
            NXWELZ = INTH[26];
            NZWELZ = INTH[27];
            NICONZ = INTH[32];
            NSCONZ = INTH[33];
            NXCONZ = INTH[34];

            SetPosition("IWEL");
            br.ReadHeader();
            int[] IWEL = br.ReadIntList();

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS.Add(new WELLDATA
                {
                    I          = IWEL[iw * NIWELZ + 0],
                    J          = IWEL[iw * NIWELZ + 1],
                    K          = IWEL[iw * NIWELZ + 2],
                    COMPLNUM   = IWEL[iw * NIWELZ + 4],
                    GROUPNUM   = IWEL[iw * NIWELZ + 5],
                    WELLTYPE   = IWEL[iw * NIWELZ + 6],
                    WELLSTATUS = IWEL[iw * NIWELZ + 10]
                });
            }

            SetPosition("SWEL");
            br.ReadHeader();

            float[] SWEL = br.ReadFloatList(br.header.count);

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS[iw].WOPRH     = SWEL[0];
                WELLS[iw].WWPRH     = SWEL[1];
                WELLS[iw].WGPRH     = SWEL[2];
                WELLS[iw].WLPRH     = SWEL[3];
                WELLS[iw].REF_DEPTH = SWEL[9];
                WELLS[iw].WEFA      = SWEL[24];
                WELLS[iw].BHPH      = SWEL[68];
            }

            SetPosition("XWEL");
            br.ReadHeader();

            double[] XWEL = br.ReadDoubleList();

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS[iw].WOPR  = XWEL[0];
                WELLS[iw].WWPR  = XWEL[1];
                WELLS[iw].WLPR  = XWEL[3];
                WELLS[iw].WBHP  = XWEL[6];
                WELLS[iw].WWCT  = XWEL[7];
                WELLS[iw].WOPT  = XWEL[18];
                WELLS[iw].WWPT  = XWEL[19];
                WELLS[iw].WWIT  = XWEL[23];
                WELLS[iw].WPI   = XWEL[55];
                WELLS[iw].WOPTH = XWEL[75];
                WELLS[iw].WWPTH = XWEL[76];
                WELLS[iw].WWITH = XWEL[81];
                WELLS[iw].WOPTH = XWEL[75];
            }

            SetPosition("ZWEL");
            br.ReadHeader();

            string[] ZWEL = br.ReadStringList();

            for (int iw = 0; iw < NWELLS; ++iw)
            {
                WELLS[iw].WELLNAME = ZWEL[iw * NZWELZ + 0];
            }
            br.CloseBinaryFile();
        }
Ejemplo n.º 4
0
        public INSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            if (br.Length > 0)
            {
                while (br.Position < br.Length - 24)
                {
                    br.ReadHeader();

                    if (br.header.keyword == "NAME")
                    {
                        NAME.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "TYPE")
                    {
                        TYPE.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "UNITS")
                    {
                        UNITS.Add(br.ReadStringList());
                        continue;
                    }

                    if (br.header.keyword == "NUMBER")
                    {
                        NUMBER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMAX")
                    {
                        ARRAYMAX.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "ARRAYMIN")
                    {
                        ARRAYMIN.Add(br.ReadFloatList(br.header.count));
                        continue;
                    }

                    if (br.header.keyword == "POINTER")
                    {
                        POINTER.Add(br.ReadIntList());
                        continue;
                    }

                    if (br.header.keyword == "POINTERB")
                    {
                        POINTERB.Add(br.ReadIntList());
                        continue;
                    }

                    br.SkipEclipseData();
                }
                br.CloseBinaryFile();
            }
        }