コード例 #1
0
        public IDisplayGroup Build()
        {
            var ksmGroup = new GroupParamViewModel("КСМ");
            //const string reply03GroupName = "МУК 8, заслонка зима лето";
            // setting group of settable params

            var setParamsGroup = new GroupParamViewModel("Параметры КСМ");

            #region param39

            var recvParam39 = new RecvParam <int, IList <BytesPair> >("39: Обеззараживатель, почасовой счетчик работы (CounterCleaner)", _cmdListenerKsmParams, data => data[39].LowFirstUnsignedValue);
            var setParam39  = new SettParamViewModel <int>(recvParam39.ReceiveName, _uiNotifier, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(39, (ushort)val, callback));

            var dispsetParameter39 = new DispParamSettableViewModel <int, int, int>(recvParam39.ReceiveName, recvParam39, _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(39, (ushort)val, callback));

            var aggSetParam39 = new ChartParamViewModel <int, int>(recvParam39, dispsetParameter39, i => i, ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam39);

            #endregion

            ksmGroup.AddParameterOrGroup(setParamsGroup);
            return(ksmGroup);
        }
コード例 #2
0
        private void Set()
        {
            if (!UshortValue.HasValue)
            {
                return;
            }

            IsEnabled          = false;
            LastOperationColor = Colors.RoyalBlue;
            _parameterSetter.SetParameterAsync(ParamIndex, UshortValue.Value.HighFirstUnsignedValue, exception =>
            {
                _uiNotifier.Notify(() =>
                {
                    try
                    {
                        if (exception != null)
                        {
                            throw new Exception("Произошла ошибка во время установки параметра", exception);
                        }
                        // if all ok:
                        LastOperationColor = Colors.Green;
                    }
                    catch (Exception ex)
                    {
                        // TODO: log exception to console
                        LastOperationColor = Colors.OrangeRed;
                    }
                    finally
                    {
                        IsEnabled = true;
                    }
                });
            });
        }
コード例 #3
0
        public ParameterSetterViewModelSimple(IParameterSetter parameterSetter, IThreadNotifier uiNotifier,
                                              IParameterInjectionConfiguration injectionConfiguration)
        {
            _uiNotifier     = uiNotifier;
            CustomValueList = injectionConfiguration.PreselectedValueList;

            _lastSet = LastSetStateResult.Unknown;

            // TODO: follow https://reactiveui.net/docs/guidelines/framework/prefer-oaph-over-properties
            var x = this.WhenAnyValue(vm => vm.SelectedValue).Subscribe(val => Value = val.Value);

            _setValue = ReactiveCommand.Create(() =>
            {
                Console.WriteLine($"Setting for param {injectionConfiguration.ZeroBasedParameterNumber} value " +
                                  injectionConfiguration.GetValue(_value));
                parameterSetter.SetParameterAsync(injectionConfiguration.ZeroBasedParameterNumber,
                                                  injectionConfiguration.GetValue(_value), ex =>
                {
                    _uiNotifier.Notify(() =>
                    {
                        if (ex != null)
                        {
                            LastSet = LastSetStateResult.Unsuccess;
                        }
                        else
                        {
                            LastSet = LastSetStateResult.Success;
                        }
                    });
                });
            });
        }
コード例 #4
0
        public void BeginTest(Action testHasBegun, Action <double, TestSysStepResult, string> progressChanged, Action <TestSysResult> testComplete)
        {
            _sharedTestsWorker.AddWork(() =>
            {
                testHasBegun.Invoke();
                BeginTime       = DateTime.Now;
                ProgressChanged = progressChanged;
                TestComplete    = testComplete;
                IsTestRunning   = true;

                _parameterSetter.SetParameterAsync(48, 1, exc => { });
                ProgressChanged.Invoke(100, TestSysStepResult.Good, "48 параметр КСМ установлен в режим Охлаждение 100%");
            });
        }
コード例 #5
0
        private void Set()
        {
            try
            {
                var valueToSend = _sendConverter.Build(FormattedValue.RawValue);
                IsEnabled          = false;
                LastOperationColor = Colors.RoyalBlue;
                _parameterSetter.SetParameterAsync(_paramIndex, valueToSend.HighFirstUnsignedValue, exception =>
                {
                    _uiNotifier.Notify(() =>
                    {
                        try
                        {
                            if (exception != null)
                            {
                                throw new Exception("Произошла ошибка во время установки параметра", exception);
                            }

                            LastOperationColor = Colors.Green;
                        }
                        catch //(Exception ex) {
                        {
                            // TODO: log exception to console
                            //Console.WriteLine(ex);
                            LastOperationColor = Colors.OrangeRed;
                        }
                        finally
                        {
                            IsEnabled = true;
                        }
                    });
                });
            }
            catch
            {
                LastOperationColor = Colors.IndianRed;
                IsEnabled          = true;
            }
        }
コード例 #6
0
        public IDisplayGroup Build()
        {
            var timeCountersGroup = new GroupParamViewModel("Моточасы: ");
            //const string reply03GroupName = "МУК 8, заслонка зима лето";



            // setting group of settable params
            //var setParamsGroup = new GroupParamViewModel("Параметры КСМ");

            var recvParam39 = new RecvParam <int, IList <BytesPair> >("39: Обеззараживатель, почасовой счетчик работы №1", _cmdListenerKsmParams, data => data[39].HighFirstUnsignedValue);
            var setParam39  = new SettParamViewModel <int>(recvParam39.ReceiveName, _uiNotifier, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(39, (ushort)val, callback));

            var dispsetParameter39 = new DispParamSettableViewModel <int, int, int>(recvParam39.ReceiveName, recvParam39, _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(39, (ushort)val, callback));


            var recvParam50 = new RecvParam <int, IList <BytesPair> >("50: Обеззараживатель, почасовой счетчик работы №2", _cmdListenerKsmParams, data => data[50].HighFirstUnsignedValue);
            var setParam50  = new SettParamViewModel <int>(recvParam50.ReceiveName, _uiNotifier, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(50, (ushort)val, callback));

            var dispsetParameter50 = new DispParamSettableViewModel <int, int, int>(recvParam50.ReceiveName, recvParam50, _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(50, (ushort)val, callback));

            var recvParam51 = new RecvParam <int, IList <BytesPair> >("51: Обеззараживатель, почасовой счетчик работы №3", _cmdListenerKsmParams, data => data[51].HighFirstUnsignedValue);
            var setParam51  = new SettParamViewModel <int>(recvParam51.ReceiveName, _uiNotifier, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(51, (ushort)val, callback));

            var dispsetParameter51 = new DispParamSettableViewModel <int, int, int>(recvParam51.ReceiveName, recvParam51, _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(51, (ushort)val, callback));

            var recvParam52 = new RecvParam <int, IList <BytesPair> >("52: Обеззараживатель, почасовой счетчик работы №4", _cmdListenerKsmParams, data => data[52].HighFirstUnsignedValue);
            var setParam52  = new SettParamViewModel <int>(recvParam52.ReceiveName, _uiNotifier, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(52, (ushort)val, callback));

            var dispsetParameter52 = new DispParamSettableViewModel <int, int, int>(recvParam52.ReceiveName, recvParam52, _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(52, (ushort)val, callback));


            // defining version of app, if full then using checkboxVm, else without checkbox:
            IDisplayParameter setParam39Vm = _version == AppVersion.Full ? (IDisplayParameter) new ChartParamViewModel <int, int>(recvParam39, dispsetParameter39, i => i, ParameterLogType.Analogue, _parameterLogger, timeCountersGroup.DisplayName) : new AggregateParamViewModel <int>(dispsetParameter39, timeCountersGroup.DisplayName);
            IDisplayParameter setParam50Vm = _version == AppVersion.Full ? (IDisplayParameter) new ChartParamViewModel <int, int>(recvParam50, dispsetParameter50, i => i, ParameterLogType.Analogue, _parameterLogger, timeCountersGroup.DisplayName) : new AggregateParamViewModel <int>(dispsetParameter50, timeCountersGroup.DisplayName);
            IDisplayParameter setParam51Vm = _version == AppVersion.Full ? (IDisplayParameter) new ChartParamViewModel <int, int>(recvParam51, dispsetParameter51, i => i, ParameterLogType.Analogue, _parameterLogger, timeCountersGroup.DisplayName) : new AggregateParamViewModel <int>(dispsetParameter51, timeCountersGroup.DisplayName);
            IDisplayParameter setParam52Vm = _version == AppVersion.Full ? (IDisplayParameter) new ChartParamViewModel <int, int>(recvParam52, dispsetParameter52, i => i, ParameterLogType.Analogue, _parameterLogger, timeCountersGroup.DisplayName) : new AggregateParamViewModel <int>(dispsetParameter52, timeCountersGroup.DisplayName);


            timeCountersGroup.AddParameterOrGroup(setParam39Vm);
            timeCountersGroup.AddParameterOrGroup(setParam50Vm);
            timeCountersGroup.AddParameterOrGroup(setParam51Vm);
            timeCountersGroup.AddParameterOrGroup(setParam52Vm);

            //timeCountersGroup.AddParameterOrGroup(timeCountersGroup);
            return(timeCountersGroup);
        }
コード例 #7
0
        public IDisplayGroup Build()
        {
            var muk08Group = new GroupParamViewModel("МУК 8, заслонка зима лето");
            //const string reply03GroupName = "МУК 8, заслонка зима лето";
            var reply03Group = new GroupParamViewModel("Ответ на команду 3");


            IRecvParam <IList <byte> > mukFlapWinterSummerPwm = new RecvParam <IList <byte>, IList <byte> >("PWM", _cmdListenerWinSum03Reply, bytes => bytes.Skip(1).Take(2).ToList());
            var mukFlapWinterSummerPwmDisplay = new DispParamViewModel <int, IList <byte> >("Уставка ШИМ на клапан", mukFlapWinterSummerPwm, _uiNotifier, bytes => bytes[0] * 256 + bytes[1], 0, -1);
            var mukFlapWinterSummerPwmChart   = new ChartParamViewModel <IList <byte>, int>(mukFlapWinterSummerPwm, mukFlapWinterSummerPwmDisplay, data => data[0] * 256.0 + data[1], ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterSummerPwmChart);


            IRecvParam <IList <byte> > mukFlapWinterTemperatureOneWireAddr1 = new RecvParam <IList <byte>, IList <byte> >("T1W1", _cmdListenerWinSum03Reply, bytes => bytes.Skip(3).Take(2).ToList());
            var mukFlapWinterTemperatureOneWireAddr1Display = new DispParamViewModel <string, IList <byte> >("Температура 1w адрес 1", mukFlapWinterTemperatureOneWireAddr1, _uiNotifier, bytes => new SensorIndicationDoubleBasedOnBytesPair(new BytesPair(bytes[0], bytes[1]), 0.01, 0.0, new BytesPair(0x85, 0x00)).ToString(d => d.ToString("f2")), "ER", "??");
            var mukFlapWinterTemperatureOneWireAddr1Chart   = new ChartParamViewModel <IList <byte>, string>(mukFlapWinterTemperatureOneWireAddr1, mukFlapWinterTemperatureOneWireAddr1Display, data => new SensorIndicationDoubleBasedOnBytesPair(new BytesPair(data[0], data[1]), 0.01, 0.0, new BytesPair(0x85, 0x00)).Indication, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterTemperatureOneWireAddr1Chart);


            IRecvParam <IList <byte> > mukFlapWinterTemperatureOneWireAddr2 = new RecvParam <IList <byte>, IList <byte> >("T1W2", _cmdListenerWinSum03Reply, bytes => bytes.Skip(5).Take(2).ToList());
            var mukFlapWinterTemperatureOneWireAddr2Display = new DispParamViewModel <string, IList <byte> >("Температура 1w адрес 2", mukFlapWinterTemperatureOneWireAddr2, _uiNotifier, bytes => new SensorIndicationDoubleBasedOnBytesPair(new BytesPair(bytes[0], bytes[1]), 0.01, 0.0, new BytesPair(0x85, 0x00)).ToString(d => d.ToString("f2")), "ER", "??");
            var mukFlapWinterTemperatureOneWireAddr2Chart   = new ChartParamViewModel <IList <byte>, string>(mukFlapWinterTemperatureOneWireAddr2, mukFlapWinterTemperatureOneWireAddr2Display, data => new SensorIndicationDoubleBasedOnBytesPair(new BytesPair(data[0], data[1]), 0.01, 0.0, new BytesPair(0x85, 0x00)).Indication, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterTemperatureOneWireAddr2Chart);


            IRecvParam <IList <byte> > mukFlapWinterIncomingSignals = new RecvParam <IList <byte>, IList <byte> >("Байт входных сигналов", _cmdListenerWinSum03Reply, bytes => bytes.Skip(7).Take(1).ToList());
            var groupIncomingSignals = new GroupParamViewModel(mukFlapWinterIncomingSignals.ReceiveName);

            reply03Group.AddParameterOrGroup(groupIncomingSignals);

            var mukFlapWinterIsigTurnEmrson1OnDisplay = new DispParamViewModel <bool, IList <byte> >("Сигнал на включение Emersion1", mukFlapWinterIncomingSignals, _uiNotifier, bytes => bytes[0].GetBit(6), false, false);
            var mukFlapWinterIsigTurnEmrson1OnChart   = new ChartParamViewModel <IList <byte>, bool>(mukFlapWinterIncomingSignals, mukFlapWinterIsigTurnEmrson1OnDisplay, data => data[0].GetBit(6) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupIncomingSignals.DisplayName);

            groupIncomingSignals.AddParameterOrGroup(mukFlapWinterIsigTurnEmrson1OnChart);


            var mukFlapWinterIsigTurnEmrson2OnDisplay = new DispParamViewModel <bool, IList <byte> >("Сигнал на включение Emersion2", mukFlapWinterIncomingSignals, _uiNotifier, bytes => bytes[0].GetBit(7), false, false);
            var mukFlapWinterIsigTurnEmrson2OnChart   = new ChartParamViewModel <IList <byte>, bool>(mukFlapWinterIncomingSignals, mukFlapWinterIsigTurnEmrson2OnDisplay, data => data[0].GetBit(7) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupIncomingSignals.DisplayName);

            groupIncomingSignals.AddParameterOrGroup(mukFlapWinterIsigTurnEmrson2OnChart);


            IRecvParam <IList <byte> > mukFlapWinterOutgoingSignals = new RecvParam <IList <byte>, IList <byte> >("Байт выходных сигналов", _cmdListenerWinSum03Reply, bytes => bytes.Skip(9).Take(1).ToList());
            var mukFlapWinterOutgoingSignalsDisplay = new DispParamViewModel <int, IList <byte> >(mukFlapWinterOutgoingSignals.ReceiveName, mukFlapWinterOutgoingSignals, _uiNotifier, bytes => bytes[0], 0, -1);
            var mukFlapWinterOutgoingSignalsChart   = new ChartParamViewModel <IList <byte>, int>(mukFlapWinterOutgoingSignals, mukFlapWinterOutgoingSignalsDisplay, data => data[0], ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterOutgoingSignalsChart);


            IRecvParam <IList <byte> > mukFlapWinterSummerAnalogueInput = new RecvParam <IList <byte>, IList <byte> >("Аналоговый вход от заслонки", _cmdListenerWinSum03Reply, bytes => bytes.Skip(11).Take(2).ToList());
            var mukFlapWinterSummerAnalogueInputDisplay = new DispParamViewModel <string, IList <byte> >(mukFlapWinterSummerAnalogueInput.ReceiveName, mukFlapWinterSummerAnalogueInput, _uiNotifier, data => ((data[0] * 256 + data[1]) * 0.1).ToString("f1"), "ER", "??");
            var mukFlapWinterSummerAnalogueInputChart   = new ChartParamViewModel <IList <byte>, string>(mukFlapWinterSummerAnalogueInput, mukFlapWinterSummerAnalogueInputDisplay, data => (data[0] * 256 + data[1]) * 0.1, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterSummerAnalogueInputChart);


            IRecvParam <IList <byte> > mukFlapWinterSummerAutomaticModeStage = new RecvParam <IList <byte>, IList <byte> >("Этап работы", _cmdListenerWinSum03Reply, bytes => bytes.Skip(13).Take(2).ToList());
            var mukFlapWinterSummerAutomaticModeStageDisplay = new DispParamViewModel <string, IList <byte> >(mukFlapWinterSummerAutomaticModeStage.ReceiveName, mukFlapWinterSummerAutomaticModeStage, _uiNotifier, data => new MukFlapWorkmodeStageBuilder(data[0] * 256 + data[1]).Build().ToText(), "ER", "??");
            var mukFlapWinterSummerAutomaticModeStageChart   = new ChartParamViewModel <IList <byte>, string>(mukFlapWinterSummerAutomaticModeStage, mukFlapWinterSummerAutomaticModeStageDisplay, data => data[0] * 256 + data[1], ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterSummerAutomaticModeStageChart);


            var groupDiagnostic1 = new GroupParamViewModel("Диагностика 1");

            reply03Group.AddParameterOrGroup(groupDiagnostic1);
            IRecvParam <IList <byte> > mukFlapWinterSummerDiagnostic1 = new RecvParam <IList <byte>, IList <byte> >(groupDiagnostic1.DisplayName, _cmdListenerWinSum03Reply, bytes => bytes.Skip(15).Take(2).ToList());

            /*var diagnostic1NoConnectionToEmersonDisplay = new DispParamViewModel<bool, IList<byte>>("Нет связи с Emerson", mukFlapWinterSummerDiagnostic1, _uiNotifier, bytes => bytes[1].GetBit(4), false, false);
             * var diagnostic1NoConnectionToEmersonChart = new ChartParamViewModel<IList<byte>, bool>(mukFlapWinterSummerDiagnostic1, diagnostic1NoConnectionToEmersonDisplay, data => data[1].GetBit(4) ? 1.0 : 0.0, ParameterLogType.Discrete, ParameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName);
             * groupDiagnostic1.ParametersAndGroups.Add(diagnostic1NoConnectionToEmersonChart);
             */


            var diagnostic1OneWire1ErrorDisplay = new DispParamViewModel <bool, IList <byte> >("Ошибка датчика 1w №1", mukFlapWinterSummerDiagnostic1, _uiNotifier, bytes => bytes[1].GetBit(6), false, false);
            var diagnostic1OneWire1ErrorChart   = new ChartParamViewModel <IList <byte>, bool>(mukFlapWinterSummerDiagnostic1, diagnostic1OneWire1ErrorDisplay, data => data[1].GetBit(6) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName);

            groupDiagnostic1.ParametersAndGroups.Add(diagnostic1OneWire1ErrorChart);


            var diagnostic1OneWire2ErrorDisplay = new DispParamViewModel <bool, IList <byte> >("Ошибка датчика 1w №2", mukFlapWinterSummerDiagnostic1, _uiNotifier, bytes => bytes[1].GetBit(7), false, false);
            var diagnostic1OneWire2ErrorChart   = new ChartParamViewModel <IList <byte>, bool>(mukFlapWinterSummerDiagnostic1, diagnostic1OneWire2ErrorDisplay, data => data[1].GetBit(7) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName);

            groupDiagnostic1.ParametersAndGroups.Add(diagnostic1OneWire2ErrorChart);


            IRecvParam <IList <byte> > diagnostic2Recv = new RecvParam <IList <byte>, IList <byte> >("Диагностика 2", _cmdListenerWinSum03Reply, bytes => bytes.Skip(17).Take(2).ToList());
            var groupDiagnostic2 = new GroupParamViewModel(diagnostic2Recv.ReceiveName);

            reply03Group.AddParameterOrGroup(groupDiagnostic2);

            var diagnostic2NotReachingLimitDisp  = new DispParamViewModel <bool, IList <byte> >("Заслонка не встает в крайние положения", diagnostic2Recv, _uiNotifier, bytes => bytes[1].GetBit(5), false, false);
            var diagnostic2NotReachingLimitChart = new ChartParamViewModel <IList <byte>, bool>(diagnostic2Recv, diagnostic2NotReachingLimitDisp, data => data[1].GetBit(5) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic2.DisplayName);

            groupDiagnostic2.AddParameterOrGroup(diagnostic2NotReachingLimitChart);

            var diagnostic2NotCoveringHalfOfTheRangeDisp  = new DispParamViewModel <bool, IList <byte> >("Заслонка не проходит 50% диапазона", diagnostic2Recv, _uiNotifier, bytes => bytes[1].GetBit(6), false, false);
            var diagnostic2NotCoveringHalfOfTheRangeChart = new ChartParamViewModel <IList <byte>, bool>(diagnostic2Recv, diagnostic2NotCoveringHalfOfTheRangeDisp, data => data[1].GetBit(6) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic2.DisplayName);

            groupDiagnostic2.AddParameterOrGroup(diagnostic2NotCoveringHalfOfTheRangeChart);


            IRecvParam <IMukFlapDiagnosticOneWireSensor> diagnostic3Recv = new RecvParam <IMukFlapDiagnosticOneWireSensor, IList <byte> >("Диагностика 3, 1w адрес 1", _cmdListenerWinSum03Reply, bytes => new MukFlapDiagnosticOneWireSensorBuilder(bytes[20]).Build());
            var groupDiagnostic3 = new GroupParamViewModel(diagnostic3Recv.ReceiveName);

            reply03Group.AddParameterOrGroup(groupDiagnostic3);
            var diagnostic3SensorErrorDisp  = new DispParamViewModel <bool, IMukFlapDiagnosticOneWireSensor>("Ошибка датчика", diagnostic3Recv, _uiNotifier, d => d.OneWireSensorError, false, false);
            var diagnostic3SensorErrorChart = new ChartParamViewModel <IMukFlapDiagnosticOneWireSensor, bool>(diagnostic3Recv, diagnostic3SensorErrorDisp, diag => diag.OneWireSensorError ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic3.DisplayName);

            groupDiagnostic3.AddParameterOrGroup(diagnostic3SensorErrorChart);


            var diagnostic3SensorErrorCodeDisp  = new DispParamViewModel <string, IMukFlapDiagnosticOneWireSensor>("Код ошибки датчика", diagnostic3Recv, _uiNotifier, diag => diag.ErrorCode.AbsoluteValue + " - " + diag.ErrorCode.KnownValue.ToText(), "ER", "?");
            var diagnostic3SensorErrorCodeChart = new ChartParamViewModel <IMukFlapDiagnosticOneWireSensor, string>(diagnostic3Recv, diagnostic3SensorErrorCodeDisp, diag => diag.ErrorCode.AbsoluteValue, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic3.DisplayName);

            groupDiagnostic3.AddParameterOrGroup(diagnostic3SensorErrorCodeChart);


            var diagnostic3SensorErrorsCountDisp  = new DispParamViewModel <string, IMukFlapDiagnosticOneWireSensor>("Количество ошибок связи", diagnostic3Recv, _uiNotifier, diag => diag.LinkErrorCount.Value.ToString(), "ER", "?");
            var diagnostic3SensorErrorsCountChart = new ChartParamViewModel <IMukFlapDiagnosticOneWireSensor, string>(diagnostic3Recv, diagnostic3SensorErrorsCountDisp, diag => diag.LinkErrorCount.Value, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName);

            groupDiagnostic3.AddParameterOrGroup(diagnostic3SensorErrorsCountChart);


            IRecvParam <IMukFlapDiagnosticOneWireSensor> diagnostic4Recv = new RecvParam <IMukFlapDiagnosticOneWireSensor, IList <byte> >("Диагностика 4, 1w адрес 2", _cmdListenerWinSum03Reply, bytes => new MukFlapDiagnosticOneWireSensorBuilder(bytes[22]).Build());
            var groupDiagnostic4 = new GroupParamViewModel(diagnostic4Recv.ReceiveName);

            reply03Group.AddParameterOrGroup(groupDiagnostic4);
            var diagnostic4SensorErrorDisp  = new DispParamViewModel <bool, IMukFlapDiagnosticOneWireSensor>("Ошибка датчика", diagnostic4Recv, _uiNotifier, d => d.OneWireSensorError, false, false);
            var diagnostic4SensorErrorChart = new ChartParamViewModel <IMukFlapDiagnosticOneWireSensor, bool>(diagnostic4Recv, diagnostic4SensorErrorDisp, diag => diag.OneWireSensorError ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic4.DisplayName);

            groupDiagnostic4.AddParameterOrGroup(diagnostic4SensorErrorChart);


            var diagnostic4SensorErrorCodeDisp  = new DispParamViewModel <string, IMukFlapDiagnosticOneWireSensor>("Код ошибки датчика", diagnostic4Recv, _uiNotifier, diag => diag.ErrorCode.AbsoluteValue + " - " + diag.ErrorCode.KnownValue.ToText(), "ER", "?");
            var diagnostic4SensorErrorCodeChart = new ChartParamViewModel <IMukFlapDiagnosticOneWireSensor, string>(diagnostic4Recv, diagnostic4SensorErrorCodeDisp, diag => diag.ErrorCode.AbsoluteValue, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic4.DisplayName);

            groupDiagnostic4.AddParameterOrGroup(diagnostic4SensorErrorCodeChart);


            var diagnostic4SensorErrorsCountDisp  = new DispParamViewModel <string, IMukFlapDiagnosticOneWireSensor>("Количество ошибок связи", diagnostic4Recv, _uiNotifier, diag => diag.LinkErrorCount.Value.ToString(), "ER", "?");
            var diagnostic4SensorErrorsCountChart = new ChartParamViewModel <IMukFlapDiagnosticOneWireSensor, string>(diagnostic4Recv, diagnostic4SensorErrorsCountDisp, diag => diag.LinkErrorCount.Value, ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName, groupDiagnostic4.DisplayName);

            groupDiagnostic4.AddParameterOrGroup(diagnostic4SensorErrorsCountChart);


            IRecvParam <IList <byte> > mukFlapWinterSummerFwVer = new RecvParam <IList <byte>, IList <byte> >("Версия ПО МУК заслонки", _cmdListenerWinSum03Reply, bytes => bytes.Skip(39).Take(2).ToList());
            var mukFlapWinterSummerFwVerDisplay = new DispParamViewModel <int, IList <byte> >(mukFlapWinterSummerFwVer.ReceiveName, mukFlapWinterSummerFwVer, _uiNotifier, bytes => bytes[0] * 256 + bytes[1], 0, -1);
            var mukFlapWinterSummerFwVerChart   = new ChartParamViewModel <IList <byte>, int>(mukFlapWinterSummerFwVer, mukFlapWinterSummerFwVerDisplay, data => data[0] * 256.0 + data[1], ParameterLogType.Analogue, _parameterLogger, muk08Group.DisplayName, reply03Group.DisplayName);

            reply03Group.AddParameterOrGroup(mukFlapWinterSummerFwVerChart);


            // setting group of settable params
            var setParamsGroup = new GroupParamViewModel("Уставка параметров");

            var setParam827    = new SettParamViewModel <bool>("827: Ручной/Автоматический режим", _uiNotifier, val => { }, false, false, (val, callback) => _parameterSetter.SetParameterAsync(827, (ushort)(val ? 1 : 0), callback));
            var aggSetParam827 = new AggregateParamViewModel <bool>(setParam827, muk08Group.DisplayName, setParamsGroup.DisplayName);


            var setParam828 = new SettParamViewModel <int>("828: Уставка ШИМ на заслонку в ручном режиме", _uiNotifier, val =>
            {
                if (val < 0 || val > 255)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(828, (ushort)val, callback));
            var aggSetParam828 = new AggregateParamViewModel <int>(setParam828, muk08Group.DisplayName, setParamsGroup.DisplayName);


            setParamsGroup.AddParameterOrGroup(aggSetParam827);
            setParamsGroup.AddParameterOrGroup(aggSetParam828);


            muk08Group.AddParameterOrGroup(reply03Group);
            muk08Group.AddParameterOrGroup(setParamsGroup);
            return(muk08Group);
        }
コード例 #8
0
        public IDisplayGroup Build()
        {
            var ksmGroup = new GroupParamViewModel("КСМ");


            // setting group of settable params
            var setParamsGroup = new GroupParamViewModel("Параметры КСМ");


            #region Param00

            var recvParam00 = new RecvParam <int, IList <BytesPair> >("00: Датчик в кабине машиниста",
                                                                      _cmdListenerKsmParams, data => data[00].HighFirstUnsignedValue);

            var dispParam00 =
                new DispParamViewModel <string, int>(recvParam00.ReceiveName, recvParam00,
                                                     _uiNotifier, data => (data * 0.01).ToString("f2"), "ER", "?");
            var chartParam00 = new ChartParamViewModel <int, string>(recvParam00,
                                                                     dispParam00, data => data * 0.01, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam00);

            #endregion

            #region Param01

            var recvParam01 = new RecvParam <int, IList <BytesPair> >("01: Датчик на трубке выхода испарителя",
                                                                      _cmdListenerKsmParams, data => data[01].HighFirstUnsignedValue);

            var dispParam01 =
                new DispParamViewModel <string, int>(recvParam01.ReceiveName, recvParam01,
                                                     _uiNotifier, data => (data * 0.01).ToString("f2"), "ER", "?");
            var chartParam01 = new ChartParamViewModel <int, string>(recvParam01,
                                                                     dispParam01, data => data * 0.01, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam01);

            #endregion

            #region Param02

            var recvParam02 = new RecvParam <int, IList <BytesPair> >("02: Датчик на трубке выхода конденсатора",
                                                                      _cmdListenerKsmParams, data => data[02].HighFirstUnsignedValue);

            var dispParam02 =
                new DispParamViewModel <string, int>(recvParam02.ReceiveName, recvParam02,
                                                     _uiNotifier, data => (data * 0.01).ToString("f2"), "ER", "?");
            var chartParam02 = new ChartParamViewModel <int, string>(recvParam02,
                                                                     dispParam02, data => data * 0.01, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam02);

            #endregion

            #region Param03

            var recvParam03 = new RecvParam <int, IList <BytesPair> >("03: Уставка температуры в кабине",
                                                                      _cmdListenerKsmParams, data => data[03].HighFirstUnsignedValue);

            var dispParam03 =
                new DispParamViewModel <string, int>(recvParam03.ReceiveName, recvParam03,
                                                     _uiNotifier, data => (data * 0.01).ToString("f2"), "ER", "?");
            var chartParam03 = new ChartParamViewModel <int, string>(recvParam03,
                                                                     dispParam03, data => data * 0.01, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam03);

            #endregion

            #region Param04

            var recvParam04 = new RecvParam <int, IList <BytesPair> >("04: Уставка объема подачи воздуха в кабину",
                                                                      _cmdListenerKsmParams, data => data[04].HighFirstUnsignedValue);

            var dispParam04 =
                new DispParamViewModel <string, int>(recvParam04.ReceiveName, recvParam04,
                                                     _uiNotifier, data => data.ToString(), "ER", "?");
            var chartParam04 = new ChartParamViewModel <int, string>(recvParam04,
                                                                     dispParam04, data => data, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam04);

            #endregion

            #region Param05

            var recvParam05 = new RecvParam <int, IList <BytesPair> >("05: PIC порт A",
                                                                      _cmdListenerKsmParams, data => data[05].HighFirstUnsignedValue);

            var groupParam05 = new GroupParamViewModel(recvParam05.ReceiveName);
            setParamsGroup.AddParameterOrGroup(groupParam05);


            var dispParam0504 = new DispParamViewModel <bool, int>(
                "PA.4=0 – включение 3ст.", recvParam05,
                _uiNotifier, incomingByte => !incomingByte.GetBit(4),
                false, false);
            var chartParam0504 = new ChartParamViewModel <int, bool>(
                recvParam05, dispParam0504,
                data => !data.GetBit(4) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam05.DisplayName);
            groupParam05.AddParameterOrGroup(chartParam0504);


            var dispParam0505 = new DispParamViewModel <bool, int>(
                "PA.5=0 – включение 4ст.", recvParam05,
                _uiNotifier, incomingByte => !incomingByte.GetBit(5),
                false, false);
            var chartParam0505 = new ChartParamViewModel <int, bool>(
                recvParam05, dispParam0505,
                data => !data.GetBit(5) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam05.DisplayName);
            groupParam05.AddParameterOrGroup(chartParam0505);

            #endregion


            #region Param06

            var recvParam06 = new RecvParam <int, IList <BytesPair> >("06: PIC порт C",
                                                                      _cmdListenerKsmParams, data => data[06].HighFirstUnsignedValue);

            var groupParam06 = new GroupParamViewModel(recvParam06.ReceiveName);
            setParamsGroup.AddParameterOrGroup(groupParam06);


            var dispParam0600 = new DispParamViewModel <bool, int>(
                "PС.0=0 – включение 1ст.", recvParam06,
                _uiNotifier, incomingByte => !incomingByte.GetBit(0),
                false, false);
            var chartParam0600 = new ChartParamViewModel <int, bool>(
                recvParam06, dispParam0600,
                data => !data.GetBit(0) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam06.DisplayName);
            groupParam06.AddParameterOrGroup(chartParam0600);


            var dispParam0601 = new DispParamViewModel <bool, int>(
                "PС.1=0 – включение клапана ЭРВ", recvParam06,
                _uiNotifier, incomingByte => !incomingByte.GetBit(1),
                false, false);
            var chartParam0601 = new ChartParamViewModel <int, bool>(
                recvParam06, dispParam0601,
                data => !data.GetBit(1) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam06.DisplayName);
            groupParam06.AddParameterOrGroup(chartParam0601);

            var dispParam0606 = new DispParamViewModel <bool, int>(
                "PС.6=1 – выключение реле разрешения запуска контактора компрессора", recvParam06,
                _uiNotifier, incomingByte => incomingByte.GetBit(6),
                false, false);
            var chartParam0606 = new ChartParamViewModel <int, bool>(
                recvParam06, dispParam0606,
                data => data.GetBit(6) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam06.DisplayName);
            groupParam06.AddParameterOrGroup(chartParam0606);


            var dispParam0607 = new DispParamViewModel <bool, int>(
                "PС.7=0 – включение 2ст.", recvParam06,
                _uiNotifier, incomingByte => !incomingByte.GetBit(7),
                false, false);
            var chartParam0607 = new ChartParamViewModel <int, bool>(
                recvParam06, dispParam0607,
                data => !data.GetBit(7) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam06.DisplayName);
            groupParam06.AddParameterOrGroup(chartParam0607);

            #endregion


            #region Param10

            var recvParam10 = new RecvParam <int, IList <BytesPair> >("10: PIC порт B",
                                                                      _cmdListenerKsmParams, data => data[10].HighFirstUnsignedValue);

            var groupParam10 = new GroupParamViewModel(recvParam10.ReceiveName);
            setParamsGroup.AddParameterOrGroup(groupParam10);


            var dispParam1000 = new DispParamViewModel <bool, int>(
                "PB.0=1 – авария компрессора по максимальному давлению", recvParam10,
                _uiNotifier, incomingByte => incomingByte.GetBit(0),
                false, false);
            var chartParam1000 = new ChartParamViewModel <int, bool>(
                recvParam10, dispParam1000,
                data => data.GetBit(0) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam10.DisplayName);
            groupParam10.AddParameterOrGroup(chartParam1000);


            var dispParam1001 = new DispParamViewModel <bool, int>(
                "PB.1=1 – авария компрессора по максимальному давлению", recvParam10,
                _uiNotifier, incomingByte => incomingByte.GetBit(1),
                false, false);
            var chartParam1001 = new ChartParamViewModel <int, bool>(
                recvParam10, dispParam1001,
                data => data.GetBit(1) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam10.DisplayName);
            groupParam10.AddParameterOrGroup(chartParam1001);


            var dispParam1002 = new DispParamViewModel <bool, int>(
                "PB.2=1 – авария двигателя компрессора", recvParam10,
                _uiNotifier, incomingByte => incomingByte.GetBit(2),
                false, false);
            var chartParam1002 = new ChartParamViewModel <int, bool>(
                recvParam10, dispParam1002,
                data => data.GetBit(2) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam10.DisplayName);
            groupParam10.AddParameterOrGroup(chartParam1002);

            var dispParam1003 = new DispParamViewModel <bool, int>(
                "PB.3=0 – команда на включение кондиционера", recvParam10,
                _uiNotifier, incomingByte => !incomingByte.GetBit(3),
                false, false);
            var chartParam1003 = new ChartParamViewModel <int, bool>(
                recvParam10, dispParam1003,
                data => !data.GetBit(3) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam10.DisplayName);
            groupParam10.AddParameterOrGroup(chartParam1003);

            var dispParam1004 = new DispParamViewModel <bool, int>(
                "PB.4=0 – команда на включение кондиционера в режиме обогрев/охлаждение", recvParam10,
                _uiNotifier, incomingByte => !incomingByte.GetBit(4),
                false, false);
            var chartParam1004 = new ChartParamViewModel <int, bool>(
                recvParam10, dispParam1004,
                data => !data.GetBit(4) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam10.DisplayName);
            groupParam10.AddParameterOrGroup(chartParam1004);

            var dispParam1005 = new DispParamViewModel <bool, int>(
                "PB.5=0 – компрессор включен", recvParam10,
                _uiNotifier, incomingByte => !incomingByte.GetBit(5),
                false, false);
            var chartParam1005 = new ChartParamViewModel <int, bool>(
                recvParam10, dispParam1005,
                data => !data.GetBit(5) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger,
                setParamsGroup.DisplayName, groupParam10.DisplayName);
            groupParam10.AddParameterOrGroup(chartParam1005);

            #endregion

            #region Param11

            var recvParam11 = new RecvParam <int, IList <BytesPair> >("11: Давление в контуре низкого давления, бар",
                                                                      _cmdListenerKsmParams, data => data[11].HighFirstSignedValue);

            var dispParam11 =
                new DispParamViewModel <string, int>(recvParam11.ReceiveName, recvParam11,
                                                     _uiNotifier, data => (data * 0.1).ToString("f1"), "ER", "?");
            var chartParam11 = new ChartParamViewModel <int, string>(recvParam11,
                                                                     dispParam11, data => data * 0.1, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam11);

            #endregion

            #region Param12

            var recvParam12 = new RecvParam <int, IList <BytesPair> >("12: Давление в контуре высокого давления, бар",
                                                                      _cmdListenerKsmParams, data => data[12].HighFirstSignedValue);

            var dispParam12 =
                new DispParamViewModel <string, int>(recvParam12.ReceiveName, recvParam12,
                                                     _uiNotifier, data => (data * 0.1).ToString("f1"), "ER", "?");
            var chartParam12 = new ChartParamViewModel <int, string>(recvParam12,
                                                                     dispParam12, data => data * 0.1, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam12);

            #endregion

            #region Param13

            var recvParam13 = new RecvParam <int, IList <BytesPair> >("13: Температура в контуре низкого давления, град",
                                                                      _cmdListenerKsmParams, data => (sbyte)data[13].Second);

            var dispParam13 =
                new DispParamViewModel <string, int>(recvParam13.ReceiveName, recvParam13,
                                                     _uiNotifier, data => (data * 0.1).ToString("f1"), "ER", "?");
            var chartParam13 = new ChartParamViewModel <int, string>(recvParam13,
                                                                     dispParam13, data => data * 0.1, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam13);

            #endregion

            #region Param14

            var recvParam14 = new RecvParam <int, IList <BytesPair> >("14: Перегрев хладагента, град",
                                                                      _cmdListenerKsmParams, data => (sbyte)data[14].Second);

            var dispParam14 =
                new DispParamViewModel <string, int>(recvParam14.ReceiveName, recvParam14,
                                                     _uiNotifier, data => data.ToString(), "ER", "?");
            var chartParam14 = new ChartParamViewModel <int, string>(recvParam14,
                                                                     dispParam14, data => data, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam14);

            #endregion

            #region Param16_0

            var recvParam16_0 = new RecvParam <bool, IList <BytesPair> >("16: Состояние обмена 1: b.0- вычитка текущих данных из МУК3",
                                                                         _cmdListenerKsmParams, data => data[16].Second.GetBit(0));

            var dispParam16_0 =
                new DispParamViewModel <bool, bool>(recvParam16_0.ReceiveName, recvParam16_0,
                                                    _uiNotifier, data => data, false, false);

            var chartParam16_0 = new ChartParamViewModel <bool, bool>(recvParam16_0,
                                                                      dispParam16_0, data => data ? 1 : 0, ParameterLogType.Discrete, _parameterLogger,
                                                                      setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam16_0);

            #endregion

            #region Param16_1

            var recvParam16_1 = new RecvParam <bool, IList <BytesPair> >("16: Состояние обмена 1: b.1- запись команд в МУК3",
                                                                         _cmdListenerKsmParams, data => data[16].Second.GetBit(1));

            var dispParam16_1 =
                new DispParamViewModel <bool, bool>(recvParam16_1.ReceiveName, recvParam16_1,
                                                    _uiNotifier, data => data, false, false);

            var chartParam16_1 = new ChartParamViewModel <bool, bool>(recvParam16_1,
                                                                      dispParam16_1, data => data ? 1 : 0, ParameterLogType.Discrete, _parameterLogger,
                                                                      setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam16_1);

            #endregion

            #region Param16_2

            var recvParam16_2 = new RecvParam <bool, IList <BytesPair> >("16: Состояние обмена 1: b.2- обмен с ПЧ",
                                                                         _cmdListenerKsmParams, data => data[16].Second.GetBit(2));

            var dispParam16_2 =
                new DispParamViewModel <bool, bool>(recvParam16_2.ReceiveName, recvParam16_2,
                                                    _uiNotifier, data => data, false, false);

            var chartParam16_2 = new ChartParamViewModel <bool, bool>(recvParam16_2,
                                                                      dispParam16_2, data => data ? 1 : 0, ParameterLogType.Discrete, _parameterLogger,
                                                                      setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam16_2);

            #endregion

            #region Param16_3

            var recvParam16_3 = new RecvParam <bool, IList <BytesPair> >("16: Состояние обмена 1: b.3- запись данных в РПД",
                                                                         _cmdListenerKsmParams, data => data[16].Second.GetBit(3));

            var dispParam16_3 =
                new DispParamViewModel <bool, bool>(recvParam16_3.ReceiveName, recvParam16_3,
                                                    _uiNotifier, data => data, false, false);

            var chartParam16_3 = new ChartParamViewModel <bool, bool>(recvParam16_3,
                                                                      dispParam16_3, data => data ? 1 : 0, ParameterLogType.Discrete, _parameterLogger,
                                                                      setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam16_3);

            #endregion

            #region Param16_4

            var recvParam16_4 = new RecvParam <bool, IList <BytesPair> >("16: Состояние обмена 1: b.4- вычитка корректируемого параметра из программы технического абонента",
                                                                         _cmdListenerKsmParams, data => data[16].Second.GetBit(4));

            var dispParam16_4 =
                new DispParamViewModel <bool, bool>(recvParam16_4.ReceiveName, recvParam16_4,
                                                    _uiNotifier, data => data, false, false);

            var chartParam16_4 = new ChartParamViewModel <bool, bool>(recvParam16_4,
                                                                      dispParam16_4, data => data ? 1 : 0, ParameterLogType.Discrete, _parameterLogger,
                                                                      setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam16_4);

            #endregion


            #region Param16_5

            var recvParam16_5 = new RecvParam <bool, IList <BytesPair> >("16: Состояние обмена 1: b.5- отсылка текущих данных техническому абоненту",
                                                                         _cmdListenerKsmParams, data => data[16].Second.GetBit(5));

            var dispParam16_5 =
                new DispParamViewModel <bool, bool>(recvParam16_5.ReceiveName, recvParam16_5,
                                                    _uiNotifier, data => data, false, false);

            var chartParam16_5 = new ChartParamViewModel <bool, bool>(recvParam16_5,
                                                                      dispParam16_5, data => data ? 1 : 0, ParameterLogType.Discrete, _parameterLogger,
                                                                      setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam16_5);

            #endregion


            #region Param18

            var recvParam18 = new RecvParam <int, IList <BytesPair> >("18: Уставка ПЧ",
                                                                      _cmdListenerKsmParams, data => data[18].HighFirstSignedValue);

            var dispParam18 =
                new DispParamViewModel <string, int>(recvParam18.ReceiveName, recvParam18,
                                                     _uiNotifier, data => data.ToString(), "ER", "?");
            var chartParam18 = new ChartParamViewModel <int, string>(recvParam18,
                                                                     dispParam18, data => data, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam18);

            #endregion

            #region Param19

            var recvParam19 = new RecvParam <int, IList <BytesPair> >("19: ШИМ клапана перегрева",
                                                                      _cmdListenerKsmParams, data => data[19].Second);

            var dispParam19 =
                new DispParamViewModel <string, int>(recvParam19.ReceiveName, recvParam19,
                                                     _uiNotifier, data => data.ToString(), "ER", "?");
            var chartParam19 = new ChartParamViewModel <int, string>(recvParam19,
                                                                     dispParam19, data => data, ParameterLogType.Analogue, _parameterLogger,
                                                                     setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(chartParam19);

            #endregion


            #region Param28

            var recvParam28 = new RecvParam <int, IList <BytesPair> >(
                "28: Максимальный ШИМ (PWMmax_cool)", _cmdListenerKsmParams,
                data => data[28].HighFirstUnsignedValue);
            var dispsetParam28 = new DispParamSettableViewModel <int, int, int>(recvParam28.ReceiveName, recvParam28,
                                                                                _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 255)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(28, (ushort)val, callback));
            var aggSetParam28 = new ChartParamViewModel <int, int>(recvParam28, dispsetParam28, i => i,
                                                                   ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam28);

            #endregion

            #region Param29

            var recvParam29 = new RecvParam <int, IList <BytesPair> >(
                "29: Минимальный ШИМ (PWMmin_cool)", _cmdListenerKsmParams,
                data => data[29].HighFirstUnsignedValue);
            var dispsetParam29 = new DispParamSettableViewModel <int, int, int>(recvParam29.ReceiveName, recvParam29,
                                                                                _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 255)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(29, (ushort)val, callback));
            var aggSetParam29 = new ChartParamViewModel <int, int>(recvParam29, dispsetParam29, i => i,
                                                                   ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam29);

            #endregion

            #region Param30

            var recvParam30 = new RecvParam <int, IList <BytesPair> >(
                "30: Дельта +  (plus_cool)", _cmdListenerKsmParams,
                data => data[30].HighFirstUnsignedValue);
            var dispsetParam30 = new DispParamSettableViewModel <int, int, int>(recvParam30.ReceiveName, recvParam30,
                                                                                _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(30, (ushort)val, callback));
            var aggSetParam30 = new ChartParamViewModel <int, int>(recvParam30, dispsetParam30, i => i,
                                                                   ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam30);

            #endregion

            #region Param31

            var recvParam31 = new RecvParam <int, IList <BytesPair> >(
                "31: Дельта - (minus_cool)", _cmdListenerKsmParams,
                data => data[31].HighFirstUnsignedValue);
            var dispsetParam31 = new DispParamSettableViewModel <int, int, int>(recvParam31.ReceiveName, recvParam31,
                                                                                _uiNotifier, i => i, 0, 0, val =>
            {
                if (val < 0 || val > 65535)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(31, (ushort)val, callback));
            var aggSetParam31 = new ChartParamViewModel <int, int>(recvParam31, dispsetParam31, i => i,
                                                                   ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam31);

            #endregion


            #region Param36

            var recvParam36 = new RecvParam <int, IList <BytesPair> >(
                "36: Дельта уставки температуры, отладка", _cmdListenerKsmParams,
                data => data[36].HighFirstUnsignedValue);
            var dispsetParam36 = new DispParamSettableViewModel <string, int, double>(recvParam36.ReceiveName, recvParam36,
                                                                                      _uiNotifier, i => (i * 0.1 - 2.5).ToString("f1"), "ER", "?", val =>
            {
                if (val < -2.5 || val > 2.5)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(36, (ushort)((val + 2.5) * 10), callback));
            var aggSetParam36 = new ChartParamViewModel <int, string>(recvParam36, dispsetParam36, i => i,
                                                                      ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam36);

            #endregion


            #region Param37

            var recvParam37 = new RecvParam <int, IList <BytesPair> >(
                "37: Принудительный режим обогрев/охлаждение", _cmdListenerKsmParams,
                data => data[37].HighFirstUnsignedValue);
            var dispsetParam37 = new DispParamSettableViewModel <string, int, int>(recvParam37.ReceiveName, recvParam37,
                                                                                   _uiNotifier, i => new WarmOrCoolForcedModeToStringConverter().Build((WarmOrCoolForcedMode)i), "ER",
                                                                                   "?", val =>
            {
                if (val < 0 || val > 10)
                {
                    throw new ArgumentOutOfRangeException();
                }
            }, 0, 0, (val, callback) => _parameterSetter.SetParameterAsync(37, (ushort)val, callback));
            var aggSetParam37 = new ChartParamViewModel <int, string>(recvParam37, dispsetParam37, i => i,
                                                                      ParameterLogType.Analogue, _parameterLogger, setParamsGroup.DisplayName);
            setParamsGroup.AddParameterOrGroup(aggSetParam37);

            #endregion


            ksmGroup.AddParameterOrGroup(setParamsGroup);
            return(ksmGroup);
        }