Beispiel #1
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);
            }
        }
Beispiel #2
0
        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;
             */
        }
Beispiel #3
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;
        }