public IDisplayGroup Build() { var muk03Group = new GroupParamViewModel("МУК 3, вентилятор испарителя"); var reply03Group = new GroupParamViewModel("Ответ на команду 3"); IRecvParam <int> cmd03ReplyPwm = new RecvParam <int, IMukFanVaporizerDataReply03>("PWM", _cmd03ReplyListener, data => data.FanPwm); var cmd03ReplyPwmDisp = new DispParamViewModel <int, int>("Уставка ШИМ на вентилятор", cmd03ReplyPwm, _uiNotifier, pwmValue => pwmValue, 0, -1); var cmd03ReplyPwmChart = new ChartParamViewModel <int, int>( cmd03ReplyPwm, cmd03ReplyPwmDisp, data => data, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(cmd03ReplyPwmChart); IRecvParam <ISensorIndication <double> > cmd03ReplyT1W1 = new RecvParam <ISensorIndication <double>, IMukFanVaporizerDataReply03>("PWM", _cmd03ReplyListener, data => data.TemperatureAddress1); var cmd03ReplyT1W1Disp = new DispParamViewModel <string, ISensorIndication <double> >("Температура 1w адрес 1", cmd03ReplyT1W1, _uiNotifier, t1W1 => t1W1.ToText("f2"), "Ошибка", "Неизвестно"); var cmd03ReplyT1W1Chart = new ChartParamViewModel <ISensorIndication <double>, string>( cmd03ReplyT1W1, cmd03ReplyT1W1Disp, data => data.Indication, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(cmd03ReplyT1W1Chart); muk03Group.AddParameterOrGroup(reply03Group); return(muk03Group); }
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); }
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); }
public IDisplayGroup Build() { var muk03Group = new GroupParamViewModel("МУК 3, вентилятор испарителя"); //const string reply03GroupName = "МУК 8, заслонка зима лето"; var reply03Group = new GroupParamViewModel("Ответ на команду 3"); IRecvParam <IMukFanVaporizerDataReply03> mukFanData = new RecvParam <IMukFanVaporizerDataReply03, IMukFanVaporizerDataReply03>("Muk0303Rp", _cmdListenerEvaporator03Reply, data => data); var mukFlapWinterSummerPwmDisplay = new DispParamViewModel <int, IMukFanVaporizerDataReply03>("Уставка ШИМ на клапан", mukFanData, _uiNotifier, data => data.FanPwm, 0, -1); var mukFlapWinterSummerPwmChart = new ChartParamViewModel <IMukFanVaporizerDataReply03, int>(mukFanData, mukFlapWinterSummerPwmDisplay, data => data.FanPwm, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(mukFlapWinterSummerPwmChart); //IRecvParam<IList<byte>> mukFlapWinterTemperatureOneWireAddr1 = new RecvParam<IList<byte>, IList<byte>>("T1W1", _cmdListenerEvaporator03Reply, bytes => bytes.Skip(3).Take(2).ToList()); var mukFlapWinterTemperatureOneWireAddr1Display = new DispParamViewModel <string, IMukFanVaporizerDataReply03>( "Температура 1w адрес 1", mukFanData, _uiNotifier, data => data.TemperatureAddress1.ToString(d => d.ToString("f2")), "ER", "??"); var mukFlapWinterTemperatureOneWireAddr1Chart = new ChartParamViewModel <IMukFanVaporizerDataReply03, string>( mukFanData, mukFlapWinterTemperatureOneWireAddr1Display, data => data.TemperatureAddress1.Indication, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(mukFlapWinterTemperatureOneWireAddr1Chart); var mukFlapWinterTemperatureOneWireAddr2Display = new DispParamViewModel <string, IMukFanVaporizerDataReply03>( "Температура 1w адрес 2", mukFanData, _uiNotifier, data => data.TemperatureAddress2.ToString(d => d.ToString("f2")), "ER", "??"); var mukFlapWinterTemperatureOneWireAddr2Chart = new ChartParamViewModel <IMukFanVaporizerDataReply03, string>(mukFanData, mukFlapWinterTemperatureOneWireAddr2Display, data => data.TemperatureAddress2.Indication, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(mukFlapWinterTemperatureOneWireAddr2Chart); IRecvParam <byte> mukFlapWinterIncomingSignals = new RecvParam <byte, IMukFanVaporizerDataReply03>( "Байт входных сигналов", _cmdListenerEvaporator03Reply, data => data.IncomingSignals); var groupIncomingSignals = new GroupParamViewModel(mukFlapWinterIncomingSignals.ReceiveName); reply03Group.AddParameterOrGroup(groupIncomingSignals); var mukFanVaporizerIsFaultFuse = new DispParamViewModel <bool, byte>( "Нарушение целостности предохранителя вентилятора испарителя", mukFlapWinterIncomingSignals, _uiNotifier, incomingByte => incomingByte.GetBit(0), false, false); var mukFanVaporizerIsFaultFuseChart = new ChartParamViewModel <byte, bool>( mukFlapWinterIncomingSignals, mukFanVaporizerIsFaultFuse, data => data.GetBit(0) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupIncomingSignals.DisplayName); groupIncomingSignals.AddParameterOrGroup(mukFanVaporizerIsFaultFuseChart); var mukFanVaporizerIsFaultTemp = new DispParamViewModel <bool, byte>( "Превышение по температуре", mukFlapWinterIncomingSignals, _uiNotifier, incomingByte => incomingByte.GetBit(1), false, false); var mukFanVaporizerIsFaultTempChart = new ChartParamViewModel <byte, bool>( mukFlapWinterIncomingSignals, mukFanVaporizerIsFaultTemp, data => data.GetBit(1) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupIncomingSignals.DisplayName); groupIncomingSignals.AddParameterOrGroup(mukFanVaporizerIsFaultTempChart); var mukFanVaporizerIsFaultHeaterOn = new DispParamViewModel <bool, byte>( "Калорифер включен", mukFlapWinterIncomingSignals, _uiNotifier, incomingByte => incomingByte.GetBit(2), false, false); var mukFanVaporizerIsFaultHeaterOnChart = new ChartParamViewModel <byte, bool>( mukFlapWinterIncomingSignals, mukFanVaporizerIsFaultHeaterOn, data => data.GetBit(2) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupIncomingSignals.DisplayName); groupIncomingSignals.AddParameterOrGroup(mukFanVaporizerIsFaultHeaterOnChart); IRecvParam <byte> mukFlapWinterOutgoingSignals = new RecvParam <byte, IMukFanVaporizerDataReply03>( "Байт выходных сигналов", _cmdListenerEvaporator03Reply, data => data.IncomingSignals); var groupOutgoingSignals = new GroupParamViewModel(mukFlapWinterOutgoingSignals.ReceiveName); reply03Group.AddParameterOrGroup(groupOutgoingSignals); var mukFanVaporizerOsFaultHeaterOn = new DispParamViewModel <bool, byte>( "Включение калорифера", mukFlapWinterIncomingSignals, _uiNotifier, incomingByte => incomingByte.GetBit(0), false, false); var mukFanVaporizerOsFaultHeaterOnChart = new ChartParamViewModel <byte, bool>( mukFlapWinterOutgoingSignals, mukFanVaporizerOsFaultHeaterOn, data => data.GetBit(0) ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupOutgoingSignals.DisplayName); groupOutgoingSignals.AddParameterOrGroup(mukFanVaporizerOsFaultHeaterOnChart); IRecvParam <ushort> analogueInputRecvParam = new RecvParam <ushort, IMukFanVaporizerDataReply03>("Аналоговый вход от заслонки", _cmdListenerEvaporator03Reply, data => data.AnalogInput); var analogueInputDispParam = new DispParamViewModel <string, ushort>( analogueInputRecvParam.ReceiveName, analogueInputRecvParam, _uiNotifier, data => (data * 0.1).ToString("f1"), "ER", "??"); var analogueInputChartParam = new ChartParamViewModel <ushort, string>(analogueInputRecvParam, analogueInputDispParam, data => data * 0.1, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(analogueInputChartParam); IRecvParam <ushort> flapPwmRecvParam = new RecvParam <ushort, IMukFanVaporizerDataReply03>("Уставка ШИМ на заслонку", _cmdListenerEvaporator03Reply, data => data.FlapPwm); var flapPwmDispParam = new DispParamViewModel <string, ushort>( flapPwmRecvParam.ReceiveName, flapPwmRecvParam, _uiNotifier, data => data.ToString(), "ER", "??"); var flapPwmChartParam = new ChartParamViewModel <ushort, string>(flapPwmRecvParam, flapPwmDispParam, data => data, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(flapPwmChartParam); /*IRecvParam<MukFanEvaporatorWorkstage> autoModeStageRecvParam = * new RecvParam<MukFanEvaporatorWorkstage, IMukFanVaporizerDataReply03>("Этап работы", * _cmdListenerEvaporator03Reply, data => data.AutomaticModeStageParsed);*/ var automaticModeStageDispParam = new DispParamViewModel <string, IMukFanVaporizerDataReply03>( "Этап работы", mukFanData, _uiNotifier, data => data.AutomaticModeStageParsed.ToText(), "ER", "??"); var automaticModeStageChartParam = new ChartParamViewModel <IMukFanVaporizerDataReply03, string>( mukFanData, automaticModeStageDispParam, data => data.AutomaticModeStage, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(automaticModeStageChartParam); IRecvParam <ushort> fanSpeedRecvParam = new RecvParam <ushort, IMukFanVaporizerDataReply03>("Обороты вентилятора", _cmdListenerEvaporator03Reply, data => data.FanSpeed); var fanSpeedDispParam = new DispParamViewModel <string, ushort>( fanSpeedRecvParam.ReceiveName, fanSpeedRecvParam, _uiNotifier, data => data.ToString(), "ER", "??"); var fanSpeedChartParam = new ChartParamViewModel <ushort, string>(fanSpeedRecvParam, fanSpeedDispParam, data => data, ParameterLogType.Analogue, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName); reply03Group.AddParameterOrGroup(fanSpeedChartParam); #region Diagnostic1 var groupDiagnostic1 = new GroupParamViewModel("Диагностика 1"); reply03Group.AddParameterOrGroup(groupDiagnostic1); IRecvParam <IMukFanVaporizerDataReply03Diagnostic1> diagnostic1RecvParam = new RecvParam <IMukFanVaporizerDataReply03Diagnostic1, IMukFanVaporizerDataReply03>( groupDiagnostic1.DisplayName, _cmdListenerEvaporator03Reply, data => data.Diagnostic1Parsed); var diag1NoIoWithControllerDispParam = new DispParamViewModel <bool, IMukFanVaporizerDataReply03Diagnostic1>( "Отсутствие обмена с контроллером вентилятора", diagnostic1RecvParam, _uiNotifier, data => data.FanControllerLinkLost, false, false); var diag1NoIoWithControllerChartParam = new ChartParamViewModel <IMukFanVaporizerDataReply03Diagnostic1, bool>( diagnostic1RecvParam, diag1NoIoWithControllerDispParam, data => data.FanControllerLinkLost ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName); groupDiagnostic1.ParametersAndGroups.Add(diag1NoIoWithControllerChartParam); var diag1FanErrorByDisreteInputDispParam = new DispParamViewModel <bool, IMukFanVaporizerDataReply03Diagnostic1>( "Ошибка вентилятора (по дискретному входу)", diagnostic1RecvParam, _uiNotifier, data => data.FanErrorByDiscreteInput, false, false); var diag1FanErrorByDisreteInputChartParam = new ChartParamViewModel <IMukFanVaporizerDataReply03Diagnostic1, bool>( diagnostic1RecvParam, diag1FanErrorByDisreteInputDispParam, data => data.FanErrorByDiscreteInput ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName); groupDiagnostic1.ParametersAndGroups.Add(diag1FanErrorByDisreteInputChartParam); var diag1OneWire1ErrorDispParam = new DispParamViewModel <bool, IMukFanVaporizerDataReply03Diagnostic1>( "Ошибка датчика 1w №1", diagnostic1RecvParam, _uiNotifier, data => data.ErrorOneWireSensor1, false, false); var diag1OneWire1ErrorChartParam = new ChartParamViewModel <IMukFanVaporizerDataReply03Diagnostic1, bool>( diagnostic1RecvParam, diag1OneWire1ErrorDispParam, data => data.ErrorOneWireSensor1 ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName); groupDiagnostic1.ParametersAndGroups.Add(diag1OneWire1ErrorChartParam); var diag1OneWire2ErrorDispParam = new DispParamViewModel <bool, IMukFanVaporizerDataReply03Diagnostic1>( "Ошибка датчика 1w №2", diagnostic1RecvParam, _uiNotifier, data => data.ErrorOneWireSensor2, false, false); var diag1OneWire2ErrorChartParam = new ChartParamViewModel <IMukFanVaporizerDataReply03Diagnostic1, bool>( diagnostic1RecvParam, diag1OneWire2ErrorDispParam, data => data.ErrorOneWireSensor2 ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName); groupDiagnostic1.ParametersAndGroups.Add(diag1OneWire2ErrorChartParam); #endregion IRecvParam <IMukFanVaporizerDataReply03Diagnostic2> diag2RecvParam = new RecvParam <IMukFanVaporizerDataReply03Diagnostic2, IMukFanVaporizerDataReply03>("Диагностика 2", _cmdListenerEvaporator03Reply, data => data.Diagnostic2Parsed); var groupDiagnostic2 = new GroupParamViewModel(diag2RecvParam.ReceiveName); reply03Group.AddParameterOrGroup(groupDiagnostic2); var diag2PhaseErrorOrNoPowerDispParam = new DispParamViewModel <bool, IMukFanVaporizerDataReply03Diagnostic2>( "Ошибка фазы или отсутствие питание", diag2RecvParam, _uiNotifier, diag2 => diag2.PhaseErrorOrPowerLost, false, false); var diag2PhaseErrorOrNoPowerChartParam = new ChartParamViewModel <IMukFanVaporizerDataReply03Diagnostic2, bool>( diag2RecvParam, diag1NoIoWithControllerDispParam, data => data.PhaseErrorOrPowerLost ? 1.0 : 0.0, ParameterLogType.Discrete, _parameterLogger, muk03Group.DisplayName, reply03Group.DisplayName, groupDiagnostic1.DisplayName); groupDiagnostic2.ParametersAndGroups.Add(diag2PhaseErrorOrNoPowerChartParam); /* * var diagnostic2NotReachingLimitChart = new ChartParamViewModel<IList<byte>, bool>(diag2RecvParam, diag2PhaseErrorOrNoPowerDispParam, 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% диапазона", diag2RecvParam, _uiNotifier, bytes => bytes[1].GetBit(6), false, false); * var diagnostic2NotCoveringHalfOfTheRangeChart = new ChartParamViewModel<IList<byte>, bool>(diag2RecvParam, 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", _cmdListenerEvaporator03Reply, 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", _cmdListenerEvaporator03Reply, 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>>("Версия ПО МУК заслонки", _cmdListenerEvaporator03Reply, 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); * */ muk03Group.AddParameterOrGroup(reply03Group); //muk08Group.AddParameterOrGroup(setParamsGroup); return(muk03Group); }