Beispiel #1
0
        /// <summary>
        /// 从下位机获取燃气压力修正
        /// </summary>
        /// <param name="io"></param>
        /// <returns></returns>
        internal static Models.Settings.PressCorrectionSet GetGasPressCorrectionSettings(this SerialPortsUtils.Agents.Agent io)
        {
            var data1 = io.SendAndRead(InstructionSet.GasPressCorrectionSettings, InstructionSet.GasPressCorrectionValue).PacketData(2).ToArray();
            var data2 = io.SendAndRead(InstructionSet.GasPressCorrectionSettings, InstructionSet.GasPressCorrectionPer).PacketData(2).ToArray();

            Models.Settings.PressCorrectionSet model = new Models.Settings.PressCorrectionSet();
            model.Items       = new float[15];
            model.Corrections = new float[15];
            int a = 0, b = 1;

            for (int i = 0; i < 15; i++)
            {
                model.Items[i]       = ValueConvert.CorrectionPressFrom(data1[a], data1[b]);
                model.Corrections[i] = ValueConvert.PressCorrectionFrom(data2[a], data2[b]);
                a = a + 2;
                b = b + 2;
            }
            return(model);
        }