コード例 #1
0
ファイル: Condition.cs プロジェクト: glareheaven/JSBSimNet
        /// <summary>
        /// This constructor is called when tests are inside an element
        /// </summary>
        /// <param name="element"></param>
        /// <param name="propertyManager"></param>
        public Condition(XmlElement element, PropertyManager propertyManager)
        {
            InitializeConditionals();

            string logic = element.GetAttribute("logic");

            if (!string.IsNullOrEmpty(logic))
            {
                if (logic.Equals("OR"))
                {
                    Logic = eLogic.eOR;
                }
                else if (logic.Equals("AND"))
                {
                    Logic = eLogic.eAND;
                }
                else
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Unrecognized LOGIC token " + logic + " in switch component.");
                    }
                    throw new Exception("Unrecognized LOGIC token " + logic + " in switch component");
                }
            }
            else
            {
                Logic = eLogic.eAND; // default
            }

            ReaderText rtxt = new ReaderText(new StringReader(element.InnerText));

            while (rtxt.Done)
            {
                string tmp = rtxt.ReadLine().Trim();
                conditions.Add(new Condition(tmp, propertyManager));
            }
            string elName = element.Name;

            foreach (XmlNode currentNode in element.ChildNodes)
            {
                if (currentNode.NodeType == XmlNodeType.Element)
                {
                    XmlElement condition_element = currentNode as XmlElement;
                    string     tagName           = condition_element.Name;

                    if (tagName != elName)
                    {
                        log.Error("Unrecognized tag <" + tagName + "> in the condition statement.");
                        throw new Exception("Illegal argument");
                    }
                    conditions.Add(new Condition(currentNode as XmlElement, propertyManager));
                }
            }
        }
コード例 #2
0
        public void ReadTable(ReaderText rtxt)
        {
            int startRow = 0;
            int startCol = 0;
            int tableCtr = 0;

            if (tableType == TableType.Table1D ||
                tableType == TableType.Table3D)
            {
                startRow = 1;
            }
            if (tableType == TableType.Table3D)
            {
                startCol = 1;
            }

            try
            {
                for (int r = startRow; r <= nRows; r++)
                {
                    for (int c = startCol; c <= nCols; c++)
                    {
                        if (r != 0 || c != 0)
                        {
                            data[r, c] = rtxt.ReadDouble();
                            if (tableType == TableType.Table3D)
                            {
                                ((Table)tables[tableCtr]).ReadTable(rtxt);
                                tableCtr++;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Exception " + e + " reading Table data");
                }
            }

            if (log.IsDebugEnabled)
            {
                StringBuilder buff = new StringBuilder();
                Print(0, buff);
                log.Debug(buff);
            }
        }
コード例 #3
0
        public Condition(XmlElement element, PropertyManager propertyManager)
        {
            string logic;

            isGroup = true;

            InitializeConditionals();

            logic = element.GetAttribute("logic");
            if (logic.Equals("OR"))
            {
                Logic = eLogic.eOR;
            }
            else if (logic.Equals("AND"))
            {
                Logic = eLogic.eAND;
            }
            else
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Unrecognized LOGIC token " + logic + " in switch component.");
                }
                throw new Exception("Unrecognized LOGIC token " + logic + " in switch component");
            }

            foreach (XmlNode currentNode in element.ChildNodes)
            {
                if (currentNode.NodeType == XmlNodeType.Element)
                {
                    conditions.Add(new Condition(currentNode as XmlElement, propertyManager));
                }
            }

            ReaderText rtxt = new ReaderText(new StringReader(element.InnerText));

            while (rtxt.Done)
            {
                string tmp = rtxt.ReadLine().Trim();
                conditions.Add(new Condition(tmp, propertyManager));
            }
        }
コード例 #4
0
ファイル: Table.cs プロジェクト: glareheaven/JSBSimNet
        private void FindNumColumnsAndLines(string test_line, out int numColumns, out int numLines)
        {
            // determine number of data columns in table (first column is row lookup - don't count)
            ReaderText rtxt = new ReaderText(new StringReader(test_line));

            numLines   = 0;
            numColumns = 0;
            while (rtxt.Done)
            {
                string tmp = rtxt.ReadLine().Trim();
                if (tmp.Length != 0)
                {
                    // determine number of data columns in table (first column is row lookup - don't count)
                    if (numColumns == 0)
                    {
                        ReaderText rcnt = new ReaderText(new StringReader(tmp));
                        while (rcnt.Done)
                        {
                            rcnt.ReadDouble();
                            if (rcnt.Done)
                            {
                                numColumns++;
                            }
                        }
                    }
                    numLines++;
                }
            }

            /*
             * int position=0;
             * int nCols=0;
             * while ((position = test_line.find_first_not_of(" \t", position)) != string::npos) {
             *  nCols++;
             *  position = test_line.find_first_of(" \t", position);
             * }
             * return nCols;
             */
        }
コード例 #5
0
        public Switch(FlightControlSystem fcs, XmlElement element)
            : base(fcs, element)
        {
            string     value, logic;
            TestSwitch current_test;

            foreach (XmlNode currentNode in element.ChildNodes)
            {
                if (currentNode.NodeType == XmlNodeType.Element)
                {
                    XmlElement currentElement = (XmlElement)currentNode;

                    current_test = new TestSwitch();
                    if (currentElement.LocalName.Equals("default"))
                    {
                        tests.Add(current_test);
                        current_test.Logic = eLogic.eDefault;
                    }
                    else if (currentElement.LocalName.Equals("test"))
                    {
                        tests.Add(current_test);
                        logic = currentElement.GetAttribute("logic");
                        if (logic.Equals("OR"))
                        {
                            current_test.Logic = eLogic.eOR;
                        }
                        else if (logic.Equals("AND"))
                        {
                            current_test.Logic = eLogic.eAND;
                        }
                        else if (logic.Length == 0)
                        {
                            current_test.Logic = eLogic.eAND; // default
                        }
                        else
                        { // error
                            if (log.IsErrorEnabled)
                            {
                                log.Error("Unrecognized LOGIC token " + logic + " in switch component: " + name);
                            }
                        }

                        ReaderText rtxt = new ReaderText(new StringReader(currentElement.InnerText));
                        while (rtxt.Done)
                        {
                            string tmp = rtxt.ReadLine().Trim();
                            if (tmp.Length != 0)
                            {
                                current_test.conditions.Add(new Condition(tmp, propertyManager));
                            }
                        }

                        foreach (XmlNode currentNode2 in currentElement.ChildNodes)
                        {
                            if (currentNode2.NodeType == XmlNodeType.Element)
                            {
                                current_test.conditions.Add(new Condition(currentNode2 as XmlElement, propertyManager));
                            }
                        }
                    }

                    if (!currentElement.LocalName.Equals("output"))
                    {
                        value = currentElement.GetAttribute("value");
                        if (value.Length == 0)
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.Error("No VALUE supplied for switch component: " + name);
                            }
                        }
                        else
                        {
                            Match match = testRegex.Match(value);
                            if (match.Success)
                            {
                                if (match.Groups["prop"].Value == "") // if true (and execution falls into this block), "value" is a number.
                                {
                                    current_test.OutputVal = double.Parse(value, FormatHelper.numberFormatInfo);
                                }
                                else
                                {
                                    // "value" must be a property if execution passes to here.
                                    if (value[0] == '-')
                                    {
                                        current_test.sign = -1.0;
                                        value             = value.Remove(0, 1);
                                    }
                                    else
                                    {
                                        current_test.sign = 1.0;
                                    }
                                    current_test.OutputProp = propertyManager.GetPropertyNode(value);
                                }
                            }
                        }
                    }
                }
            }
            base.Bind();
        }
コード例 #6
0
ファイル: Table.cs プロジェクト: glareheaven/JSBSimNet
        public Table(PropertyManager propMan, XmlElement element, string prefix = "")
        {
            propertyManager = propMan;
            PropertyValue node;

            this.prefix = prefix;

            nTables = 0;

            // Is this an internal lookup table?

            isInternal = false;
            name       = element.GetAttribute("name"); // Allow this table to be named with a property

            string brkpt_string = null;

            dimension = 0;
            XmlElement  parent_element;
            XmlNodeList tableDataList;
            string      tableData = null;
            int         numLines = 0, numColumns = 0;

            isInternal = false;
            string call_type = element.GetAttribute("type");

            if (call_type.Equals("internal"))
            {
                parent_element = element.ParentNode as XmlElement;
                string parent_type = parent_element.Name;
                if (!operation_types.Contains(parent_type))
                {
                    isInternal = true;
                }
                else
                {
                    // internal table is a child element of a restricted type
                    if (log.IsErrorEnabled)
                    {
                        log.Error("An internal table cannot be nested within another type,");
                        log.Error("such as a function. The 'internal' keyword of table " + name + " is ignored.");
                    }
                }
            }
            else if (call_type.Length != 0)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("  An unknown table type attribute is listed: " + call_type + ". Execution cannot continue.");
                }
                throw new Exception("An unknown table type attribute is listed: " + call_type);
            }

            // Determine and store the lookup properties for this table unless this table
            // is part of a 3D table, in which case its independentVar property indexes will
            // be set by a call from the owning table during creation

            dimension = 0;

            XmlNodeList varNodes = element.GetElementsByTagName("independentVar");

            if (varNodes.Count > 0)
            {
                foreach (XmlNode currentNode in varNodes)
                {
                    // The 'internal' attribute of the table element cannot be specified
                    // at the same time that independentVars are specified.
                    if (isInternal && log.IsErrorEnabled)
                    {
                        log.Error("  This table specifies both 'internal' call type");
                        log.Error("  and specific lookup properties via the 'independentVar' element.");
                        log.Error("  These are mutually exclusive specifications. The 'internal'");
                        log.Error("  attribute will be ignored.");
                        isInternal = false;
                    }

                    if (currentNode.NodeType == XmlNodeType.Element)
                    {
                        XmlElement currentElement  = (XmlElement)currentNode;
                        string     property_string = currentElement.InnerText.Trim();
                        if (property_string.Contains("#"))
                        {
                            double n;
                            if (double.TryParse(prefix, out n))
                            {
                                property_string = property_string.Replace("#", prefix);
                            }
                        }
                        node = new PropertyValue(property_string, propertyManager);
                        if (node == null)
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.Error("IndependenVar property, " + currentElement.InnerText.Trim() + " in Table definition is not defined.");
                            }
                            throw new Exception("IndependenVar property, " + currentElement.InnerText.Trim() + " in Table definition is not defined.");
                        }

                        if (currentElement.GetAttribute("lookup").Equals("row"))
                        {
                            lookupProperty[(int)AxisType.Row] = node;
                        }
                        else if (currentElement.GetAttribute("lookup").Equals("column"))
                        {
                            lookupProperty[(int)AxisType.Column] = node;
                        }
                        else if (currentElement.GetAttribute("lookup").Equals("table"))
                        {
                            lookupProperty[(int)AxisType.Table] = node;
                        }
                        else
                        { // assumed single dimension table; row lookup
                            lookupProperty[(int)AxisType.Row] = node;
                        }
                        dimension++;
                    }
                }
            }
            else if (isInternal) // This table is an internal table
            {
                // determine how many rows, columns, and tables in this table (dimension).
                tableDataList = element.GetElementsByTagName("tableData");
                if (tableDataList.Count > 1)
                {
                    dimension = 3; // this is a 3D table
                }
                else
                {
                    tableData = tableDataList[0].InnerText;  // examine second line in table for dimension
                    FindNumColumnsAndLines(tableData, out numColumns, out numLines);
                    if (numColumns == 2)
                    {
                        dimension = 1;    // 1D table
                    }
                    else if (numColumns > 2)
                    {
                        dimension = 2; // 2D table
                    }
                    else
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.Error("Invalid number of columns in table");
                        }
                    }
                }
            }
            else
            {
                brkpt_string = element.GetAttribute("breakPoint");
                if (string.IsNullOrEmpty(brkpt_string))
                {
                    // no independentVars found, and table is not marked as internal
                    if (log.IsErrorEnabled)
                    {
                        log.Error("No independent variable found for table.");
                    }
                    throw new Exception("No independent variable found for table.");
                }
            }

            // end lookup property code

            if (string.IsNullOrEmpty(brkpt_string)) // Not a 3D table "table element"
            {
                //TODO tableData = element.GetElementsByTagName("tableData")[0] as XmlElement;
            }
            else // This is a table in a 3D table
            {
                //TODO  tableData = element;
                dimension = 2; // Currently, infers 2D table
            }

            if (tableData == null)
            {
                tableDataList = element.GetElementsByTagName("tableData");
                tableData     = tableDataList[0].InnerText; // examine second line in table for dimension
                FindNumColumnsAndLines(tableData, out numColumns, out numLines);
            }

            ReaderText rtxt = new ReaderText(new StringReader(tableData));

            switch (dimension)
            {
            case 1:
                nRows        = numLines;
                nCols        = 1;
                tableType    = TableType.Table1D;
                colCounter   = 0;
                rowCounter   = 1;
                data         = new double[nRows + 1, nCols + 1];
                lastRowIndex = lastColumnIndex = 2;
                ReadTable(rtxt);
                break;

            case 2:
                nRows = numLines - 1;
                nCols = numColumns;
                if (nCols > 1)
                {
                    tableType  = TableType.Table2D;
                    colCounter = 1;
                    rowCounter = 0;
                }
                else if (nCols == 1)
                {
                    tableType  = TableType.Table1D;
                    colCounter = 1;
                    rowCounter = 1;
                }
                else
                {
                    log.Error("Table cannot accept 'Rows=0'");
                }

                data         = new double[nRows + 1, nCols + 1];
                lastRowIndex = lastColumnIndex = 2;
                ReadTable(rtxt);
                break;

            case 3:
                nTables         = varNodes.Count;
                nRows           = nTables;
                nCols           = 1;
                tableType       = TableType.Table3D;
                colCounter      = 1;
                rowCounter      = 1;
                lastRowIndex    = lastColumnIndex = 2;
                data            = new double[nRows + 1, nCols + 1]; // this data array will contain the keys for the associated tables
                tables.Capacity = nTables;                          // necessary?
                XmlNodeList tableDataElems = element.GetElementsByTagName("tableData");
                tableData = tableDataElems[0].InnerText;
                for (int i = 0; i < nTables; i++)
                {
                    XmlElement tableDataElem = tableDataElems[i] as XmlElement;
                    tables.Add(new Table(propertyManager, tableDataElem));
                    data[i + 1, 1] = double.Parse(tableDataElem.GetAttribute("breakPoint"));
                    tables[i].lookupProperty[(int)AxisType.Row]    = lookupProperty[(int)AxisType.Row];
                    tables[i].lookupProperty[(int)AxisType.Column] = lookupProperty[(int)AxisType.Column];
                }
                break;

            default:
                log.Error("No dimension given");
                break;
            }

            // Sanity checks: lookup indices must be increasing monotonically
            int r, c, b;

            // find next xml element containing a name attribute
            // to indicate where the error occured
            XmlElement nameel = element;

            while (nameel != null && nameel.GetAttribute("name") == "")
            {
                nameel = nameel.ParentNode as XmlElement;
            }

            // check breakpoints, if applicable
            if (dimension > 2)
            {
                for (b = 2; b <= nTables; ++b)
                {
                    if (data[b, 1] <= data[b - 1, 1])
                    {
                        string errormsg = "  Table: breakpoint lookup is not monotonically increasing\n" +
                                          "  in breakpoint " + b;
                        if (nameel != null)
                        {
                            errormsg += " of table in " + nameel.GetAttribute("name");
                        }
                        errormsg += ":\n" + "  " + data[b, 1] + "<=" + data[b - 1, 1] + "\n";
                        throw new Exception(errormsg);
                    }
                }
            }

            // check columns, if applicable
            if (dimension > 1)
            {
                for (c = 2; c <= nCols; ++c)
                {
                    if (data[0, c] <= data[0, c - 1])
                    {
                        string errormsg = "  FGTable: column lookup is not monotonically increasing\n" +
                                          "  in column " + c;
                        if (nameel != null)
                        {
                            errormsg += " of table in " + nameel.GetAttribute("name");
                        }
                        errormsg += ":\n" + "  " + data[0, c] + "<=" + data[0, c - 1] + "\n";
                        throw new Exception(errormsg);
                    }
                }
            }

            // check rows
            if (dimension < 3)
            { // in 3D tables, check only rows of subtables
                for (r = 2; r <= nRows; ++r)
                {
                    if (data[r, 0] <= data[r - 1, 0])
                    {
                        string errormsg = "  FGTable: row lookup is not monotonically increasing\n" +
                                          "  in row " + r;
                        if (nameel != null)
                        {
                            errormsg += " of table in " + nameel.GetAttribute("name");
                        }
                        errormsg += ":\n" + "  " + data[r, 0] + "<=" + data[r - 1, 0] + "\n";
                        throw new Exception(errormsg);
                    }
                }
            }

            Bind(element);

            if (log.IsDebugEnabled)
            {
                log.Debug(Print());
            }
        }
コード例 #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="File">the config file instance</param>
        /// <param name="exec">the parent executive object</param>
        /// <param name="number"></param>
        public LGear(string str, FDMExecutive exec, int number)
        {
            FDMExec = exec;

            GearNumber = number;

            StringReader sr     = new StringReader(str);
            ReaderText   reader = new ReaderText(sr);

            reader.ReadWord();
            name = reader.ReadWord();

            vXYZ = new Vector3D(reader.ReadDouble(), reader.ReadDouble(), reader.ReadDouble());

            kSpring       = reader.ReadDouble();
            bDamp         = reader.ReadDouble();
            dynamicFCoeff = reader.ReadDouble();
            staticFCoeff  = reader.ReadDouble();
            rollingFCoeff = reader.ReadDouble();

            sSteerType    = reader.ReadWord();
            sBrakeGroup   = reader.ReadWord();
            maxSteerAngle = reader.ReadInt();
            string sRetractable = reader.ReadWord();

            if (log.IsDebugEnabled)
            {
                log.Debug("name " + name);

                log.Debug("vXYZ(1) " + vXYZ.X);
                log.Debug("vXYZ(2) " + vXYZ.Y);
                log.Debug("vXYZ(3) " + vXYZ.Z);

                log.Debug("kSpring " + kSpring);
                log.Debug("bDamp " + bDamp);
                log.Debug("dynamicFCoeff " + dynamicFCoeff);
                log.Debug("staticFCoeff " + staticFCoeff);
                log.Debug("rollingFCoeff " + rollingFCoeff);

                log.Debug("sSteerType " + sSteerType);
                log.Debug("sBrakeGroup " + sBrakeGroup);
                log.Debug("maxSteerAngle " + maxSteerAngle);
                log.Debug("sRetractable " + sRetractable);
            }

            if (sBrakeGroup == "LEFT")
            {
                eBrakeGrp = BrakeGroup.Left;
            }
            else if (sBrakeGroup == "RIGHT")
            {
                eBrakeGrp = BrakeGroup.Right;
            }
            else if (sBrakeGroup == "CENTER")
            {
                eBrakeGrp = BrakeGroup.Center;
            }
            else if (sBrakeGroup == "NOSE")
            {
                eBrakeGrp = BrakeGroup.Nose;
            }
            else if (sBrakeGroup == "TAIL")
            {
                eBrakeGrp = BrakeGroup.Tail;
            }
            else if (sBrakeGroup == "NONE")
            {
                eBrakeGrp = BrakeGroup.None;
            }
            else
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Improper braking group specification in config file: "
                              + sBrakeGroup + " is undefined.");
                }
            }

            if (sSteerType == "STEERABLE")
            {
                eSteerType = SteerType.Steer;
            }
            else if (sSteerType == "FIXED")
            {
                eSteerType = SteerType.Fixed;
            }
            else if (sSteerType == "CASTERED")
            {
                eSteerType = SteerType.Caster;
            }
            else
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Improper steering type specification in config file: "
                              + sSteerType + " is undefined.");
                }
            }

            if (sRetractable == "RETRACT")
            {
                isRetractable = true;
            }
            else
            {
                isRetractable = false;
            }
            vWhlBodyVec = FDMExec.MassBalance.StructuralToBody(vXYZ);

            vLocalGear = FDMExec.Propagate.GetTb2l() * vWhlBodyVec;
        }
コード例 #8
0
        public Table(PropertyManager propMan, XmlElement element)
        {
            propertyManager = propMan;
            PropertyNode node;

            dimension = 0;
            XmlElement  parent_element;
            XmlNodeList tableDataList;
            string      tableData = null;
            int         numLines = 0, numColumns = 0;

            isInternal = false;
            string call_type = element.GetAttribute("type");

            if (call_type.Equals("internal"))
            {
                parent_element = element.ParentNode as XmlElement;
                string parent_type = parent_element.Name;
                if (!operation_types.Contains(parent_type))
                {
                    isInternal = true;
                }
                else
                {
                    // internal table is a child element of a restricted type
                    if (log.IsErrorEnabled)
                    {
                        log.Error("An internal table cannot be nested within another type,");
                        log.Error("  such as a function. The 'internal' keyword is ignored.");
                    }
                }
            }
            else if (call_type.Length != 0)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("  An unknown table type attribute is listed: " + call_type + ". Execution cannot continue.");
                }
                throw new Exception("An unknown table type attribute is listed: " + call_type);
            }


            // Determine and store the lookup properties for this table unless this table
            // is part of a 3D table, in which case its independentVar property indexes will
            // be set by a call from the owning table during creation

            XmlNodeList varNodes = element.GetElementsByTagName("independentVar");

            if (varNodes.Count > 0)
            {
                foreach (XmlNode currentNode in varNodes)
                {
                    // The 'internal' attribute of the table element cannot be specified
                    // at the same time that independentVars are specified.
                    if (isInternal && log.IsErrorEnabled)
                    {
                        log.Error("  This table specifies both 'internal' call type");
                        log.Error("  and specific lookup properties via the 'independentVar' element.");
                        log.Error("  These are mutually exclusive specifications. The 'internal'");
                        log.Error("  attribute will be ignored.");
                        isInternal = false;
                    }

                    if (currentNode.NodeType == XmlNodeType.Element)
                    {
                        XmlElement currentElement = (XmlElement)currentNode;

                        node = propertyManager.GetPropertyNode(currentElement.InnerText.Trim());
                        if (node == null)
                        {
                            if (log.IsErrorEnabled)
                            {
                                log.Error("IndependenVar property, " + currentElement.InnerText.Trim() + " in Table definition is not defined.");
                            }
                            throw new Exception("IndependenVar property, " + currentElement.InnerText.Trim() + " in Table definition is not defined.");
                        }

                        if (currentElement.GetAttribute("lookup").Equals("row"))
                        {
                            lookupProperty[(int)AxisType.Row] = node.GetDoubleDelegate;
                        }
                        else if (currentElement.GetAttribute("lookup").Equals("column"))
                        {
                            lookupProperty[(int)AxisType.Column] = node.GetDoubleDelegate;
                        }
                        else if (currentElement.GetAttribute("lookup").Equals("table"))
                        {
                            lookupProperty[(int)AxisType.Table] = node.GetDoubleDelegate;
                        }
                        else
                        { // assumed single dimension table; row lookup
                            lookupProperty[(int)AxisType.Row] = node.GetDoubleDelegate;
                        }
                        dimension++;
                    }
                }
            }
            else if (isInternal) // This table is an internal table
            {
                // determine how many rows, columns, and tables in this table (dimension).
                tableDataList = element.GetElementsByTagName("tableData");
                if (tableDataList.Count > 1)
                {
                    dimension = 3; // this is a 3D table
                }
                else
                {
                    tableData = tableDataList[0].InnerText;  // examine second line in table for dimension
                    FindNumColumnsAndLines(tableData, out numColumns, out numLines);
                    if (numColumns == 2)
                    {
                        dimension = 1;    // 1D table
                    }
                    else if (numColumns > 2)
                    {
                        dimension = 2; // 2D table
                    }
                    else
                    {
                        if (log.IsErrorEnabled)
                        {
                            log.Error("Invalid number of columns in table");
                        }
                    }
                }
            }
            else
            {
                // no independentVars found, and table is not marked as internal
                if (log.IsErrorEnabled)
                {
                    log.Error("No independent variable found for table.");
                }
                throw new Exception("No independent variable found for table.");
            }

            /* Obsolete
             * for (int i = 0; i < 3; i++)
             *  if (lookupProperty[i] != null) dimension++;
             */

            if (tableData == null)
            {
                tableDataList = element.GetElementsByTagName("tableData");
                tableData     = tableDataList[0].InnerText; // examine second line in table for dimension
                FindNumColumnsAndLines(tableData, out numColumns, out numLines);
            }

            ReaderText rtxt = new ReaderText(new StringReader(tableData));

            switch (dimension)
            {
            case 1:
                nRows        = numLines;
                nCols        = 1;
                tableType    = TableType.Table1D;
                data         = new double[nRows + 1, nCols + 1];
                lastRowIndex = lastColumnIndex = 2;
                ReadTable(rtxt);
                break;

            case 2:
                nRows = numLines - 1;
                nCols = numColumns;
                if (nCols > 1)
                {
                    tableType = TableType.Table2D;
                }
                else if (nCols == 1)
                {
                    tableType = TableType.Table1D;
                }
                else
                {
                    log.Error("Table cannot accept 'Rows=0'");
                }

                data         = new double[nRows + 1, nCols + 1];
                lastRowIndex = lastColumnIndex = 2;
                ReadTable(rtxt);
                break;

            case 3:
                nTables   = varNodes.Count;
                nRows     = nTables;
                nCols     = 1;
                tableType = TableType.Table3D;

                /*
                 * Data = Allocate(); // this data array will contain the keys for the associated tables
                 * Tables.reserve(nTables); // necessary?
                 * tableData = el->FindElement("tableData");
                 * for (i = 0; i < nTables; i++)
                 * {
                 *  Tables.push_back(new FGTable(PropertyManager, tableData));
                 *  Data[i + 1][1] = tableData->GetAttributeValueAsNumber("breakPoint");
                 *  Tables[i]->SetRowIndexProperty(lookupProperty[eRow]);
                 *  Tables[i]->SetColumnIndexProperty(lookupProperty[eColumn]);
                 *  tableData = el->FindNextElement("tableData");
                 * }
                 */
                break;

            default:
                log.Error("No dimension given");
                break;
            }
        }