public override object Read(string path)
        {
            var rawData = new AblPropertiesData();
            string txt;
            using (var reader = new StreamReader(path))
            {
                txt = reader.ReadToEnd();
            }

            var grammar = new OpenFoamGrammar();
            var parser = new Parser(grammar);
            var tree = parser.Parse(txt);

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                    case "turbineArrayOn":
                        rawData.turbineArrayOn = rootEntryNode.GetBasicValBool();
                        break;
                    case "driveWindOn":
                        rawData.driveWindOn = rootEntryNode.GetBasicValBool();
                        break;
                    case "UWindSpeed":
                        rawData.UWindSpeedDim = rootEntryNode.GetDimVal();
                        break;
                    case "UWindDir":
                        rawData.UWindDir = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "hWind":
                        rawData.HWindDim = rootEntryNode.GetDimVal();
                        break;
                    case "alpha":
                        rawData.alpha = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "lowerBoundaryName":
                        rawData.lowerBoundaryName = rootEntryNode.GetBasicValString();
                        break;
                    case "upperBoundaryName":
                        rawData.upperBoundaryName = rootEntryNode.GetBasicValString();
                        break;
                    case "statisticsOn":
                        rawData.statisticsOn = rootEntryNode.GetBasicValBool();
                        break;
                    case "statisticsFrequency":
                        rawData.statisticsFrequency = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "meanAvgStartTime":
                        rawData.meanAvgStartTime = rootEntryNode.GetBasicValDecimal();
                        break;
                    case "corrAvgStartTime":
                        rawData.corrAvgStartTime = rootEntryNode.GetBasicValDecimal();
                        break;
                }
            }
            return rawData;
        }
Beispiel #2
0
        public override object Read(string path)
        {
            var    rawData = new AblPropertiesData();
            string txt;

            using (var reader = new StreamReader(path))
            {
                txt = reader.ReadToEnd();
            }

            var grammar = new OpenFoamGrammar();
            var parser  = new Parser(grammar);
            var tree    = parser.Parse(txt);

            foreach (ParseTreeNode rootEntryNode in tree.Root.FindDictEntries(null))
            {
                var identifier = rootEntryNode.GetEntryIdentifier();
                switch (identifier)
                {
                case "turbineArrayOn":
                    rawData.turbineArrayOn = rootEntryNode.GetBasicValBool();
                    break;

                case "driveWindOn":
                    rawData.driveWindOn = rootEntryNode.GetBasicValBool();
                    break;

                case "UWindSpeed":
                    rawData.UWindSpeedDim = rootEntryNode.GetDimVal();
                    break;

                case "UWindDir":
                    rawData.UWindDir = rootEntryNode.GetBasicValDecimal();
                    break;

                case "hWind":
                    rawData.HWindDim = rootEntryNode.GetDimVal();
                    break;

                case "alpha":
                    rawData.alpha = rootEntryNode.GetBasicValDecimal();
                    break;

                case "lowerBoundaryName":
                    rawData.lowerBoundaryName = rootEntryNode.GetBasicValString();
                    break;

                case "upperBoundaryName":
                    rawData.upperBoundaryName = rootEntryNode.GetBasicValString();
                    break;

                case "statisticsOn":
                    rawData.statisticsOn = rootEntryNode.GetBasicValBool();
                    break;

                case "statisticsFrequency":
                    rawData.statisticsFrequency = rootEntryNode.GetBasicValDecimal();
                    break;

                case "meanAvgStartTime":
                    rawData.meanAvgStartTime = rootEntryNode.GetBasicValDecimal();
                    break;

                case "corrAvgStartTime":
                    rawData.corrAvgStartTime = rootEntryNode.GetBasicValDecimal();
                    break;
                }
            }
            return(rawData);
        }