Beispiel #1
0
        /// <summary>
        /// 换算类型选择
        /// </summary>
        /// <param name="value"></param>
        /// <param name="helper"></param>
        /// <returns></returns>
        public static double ADAMConvertValue(int value, Config.ADAM4017Converter helper)
        {
            switch (helper)
            {
            case Config.ADAM4017Converter.Temperature:
                return(HalperConverter.ADAMConvertValue(value, -10, 60));

            case Config.ADAM4017Converter.Humidity:
                return(HalperConverter.ADAMConvertValue(value, 50, 100));

            case Config.ADAM4017Converter.Light:
                return(HalperConverter.ADAMConvertValue(value, 0, 20000));

            case Config.ADAM4017Converter.Wind:
                return(HalperConverter.ADAMConvertValue(value, 0, 70));

            case Config.ADAM4017Converter.AirPressure:
                return(HalperConverter.ADAMConvertValue(value, 0, 110));

            case Config.ADAM4017Converter.CO2:
                return(HalperConverter.ADAMConvertValue(value, 0, 5000));

            case Config.ADAM4017Converter.AirQuality:
                return(value / 100.0);

            default:
                throw new Exception(nameof(ADAMConvertValue) + "Error");
            }
        }
Beispiel #2
0
 /// <summary>
 /// 传入数据模型获得值
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public double GetValue(ADAM4017Model model) =>
 HalperConverter.ADAMConvertValue(GetData(model.PortValue), model.Converter);
Beispiel #3
0
 /// <summary>
 /// 传入范围接口获得值
 /// </summary>
 /// <param name="port"></param>
 /// <param name="min"></param>
 /// <param name="max"></param>
 /// <returns></returns>
 public double GetValue(int port, int min, int max) =>
 HalperConverter.ADAMConvertValue(port, min, max);