Esempio n. 1
0
        /// <summary>
        /// 在数据库中查询源强
        /// </summary>
        /// <param name="speed">速度</param>
        /// <param name="type">车辆类型</param>
        /// <returns>铁路源强</returns>
        public double getSpurce(double speed, String type)
        {
            double source = 0;
            String sql    = "select v" + speed + " from TRAINSOURCE where TRAINTYPE ='" + type + "'";

            NoiseAnalysis.DataBase.Access access = new NoiseAnalysis.DataBase.Access();
            OleDbConnection connection           = access.getConn();
            OleDbCommand    command = new OleDbCommand(sql, connection);
            OleDbDataReader reader  = command.ExecuteReader(); //执行command并得到相应的DataReader

            while (reader.Read())
            {
                source = Convert.ToDouble(reader["v" + speed]);
            }
            reader.Close();
            access.Close();
            return(source);
        }
Esempio n. 2
0
        /*!
         * 功能 空气效应衰减
         * 参数 temperature 温度
         *      humidity 湿度
         *      frequency 频率
         * 返回值 空气效应衰减值
         * 版本号 1.0
         * 作者 樊晓剑
         * 创建时间  2016年7月14日
         * 修改时间
         */
        private float getAirAttenuation(float temperature, float humidity, float frequency)
        {
            float  source = 0;
            String sql    = "select f" + frequency + " from 1/3ATM where T ='" + temperature + "',and HM=" + humidity + "'";

            NoiseAnalysis.DataBase.Access access = new NoiseAnalysis.DataBase.Access();
            OleDbConnection connection           = access.getConn();


            OleDbCommand    command = new OleDbCommand(sql, connection);
            OleDbDataReader reader  = command.ExecuteReader(); //执行command并得到相应的DataReader

            while (reader.Read())
            {
                source = (float)(reader["v" + frequency]);
            }
            reader.Close();
            access.Close();

            return(source);
        }