Exemplo n.º 1
0
        public Relay(IJournal journal, RelayName name, ISignalsFactory signals)
        {
            mJournal = journal;
            mOutput  = signals.GetSignal(SensorName.Relay(name));

            // TODO: uncomment
            mFeedback = signals.GetSignal(SensorName.Relay(name, SignalName.Feedback));

            if (mFeedback != null)
            {
                mFeedback.OnChange += FeedbackOnChange;
            }

            if (mOnTimeout == null)
            {
                mOnTimeout = signals.GetSignal("relay.feedback.on.timeout");
            }

            if (mFeedback != null)
            {
                mOnTimeout.OnUpdate += signal =>
                {
                    var rv = signal.ValueAsInt < 1500 ? 1500 : signal.ValueAsInt > 6000 ? 6000 : signal.ValueAsInt;
                    mJournal.Debug(string.Format("Таймер реле (ОС) установлен в {0} мс для {1}", rv, mOutput.Specification.Id), MessageLevel.System);
                    mTask.SetTimeout(rv);
                };
            }

            // задержка на контроль обратной связи по контактору по умолчанию
            mTask            = new DelayedTask(mOnTimeout == null ? 3000 : mOnTimeout.ValueAsInt < 1500 ? 1500 : mOnTimeout.ValueAsInt > 6000 ? 6000 : mOnTimeout.ValueAsInt);
            mTask.OnTimeout += Checkout;
        }
Exemplo n.º 2
0
        public static void Init(IJournal journal, ISignalsFactory signals)
        {
            mRelay = new Relay(journal, RelayName.Kv4, signals);

            mOnTimeout           = signals.GetSignal("soundalarm.on.timeout");
            mOnTimeout.OnUpdate += signal =>
            {
                var rv = signal.ValueAsInt < 1500 ? 1500 : signal.ValueAsInt > 6000 ? 6000 : signal.ValueAsInt;
                journal.Debug(string.Format("Таймер вкл. сирены установлен в {0} мс", rv), MessageLevel.System);
                mTask.SetTimeout(rv);
            };

            mOffTimeout           = signals.GetSignal("soundalarm.off.timeout");
            mOffTimeout.OnUpdate += signal =>
            {
                var rv = signal.ValueAsInt < 2500 ? 2500 : signal.ValueAsInt > 10000 ? 10000 : signal.ValueAsInt;
                journal.Debug(string.Format("Таймер выкл. сирены установлен в {0} мс", rv), MessageLevel.System);
                mUnlockInterval = rv;
            };

            // values by default
            mTask           = new DelayedTask(mOnTimeout.ValueAsInt); // 1500
            mUnlockInterval = mOffTimeout.ValueAsInt;                 // 5000

            mTask.OnTimeout += ProcessTimerEvent;
        }
Exemplo n.º 3
0
            public Encoder(ISignalsFactory signals)
            {
                mEncoderPoint = signals.GetSignal("encoder.point");

                // TODO: debug only

                /*
                 * mEncoderPoint.OnChange +=
                 *  signal =>
                 *  {
                 *      if (Math.Abs(signal.ValueAsInt) != 1)
                 *      {
                 *          Console.WriteLine("compensation: {0}",
                 *              signal.ValueAsInt > 0
                 *                  ? string.Format("right at {0}", signal.Value)
                 *                  : string.Format("left at {0}", signal.Value));
                 *      }
                 *      else
                 *          Console.WriteLine("compensation set to none");
                 *  };
                 */
                mEncoderPoint.Update(1.0f);

                mZeroPoint = signals.GetSignal("encoder.settings.zero").ValueAsInt;
                mIsEnabled = signals.GetSignal("encoder.settings.enable").IsSet;

                // load compensation table
                mCompensationTable    = new ushort[30];
                mCompensationTable[0] = 0;
                for (var i = 1; i < mCompensationTable.Length; i++)
                {
                    mCompensationTable[i] = (ushort)signals.GetSignal("encoder.settings.limit." + i).ValueAsInt;
                }
            }
Exemplo n.º 4
0
            public static void Init(IJournal journal, ISignalsFactory signals)
            {
                mPressureAlarmMin     = signals.GetSignal(string.Format("{0}.alarm.min", SensorName.Cabel(SignalName.Pressure))).Value;
                mPressureAlarmMax     = signals.GetSignal(string.Format("{0}.alarm.max", SensorName.Cabel(SignalName.Pressure))).Value;
                mPressureWarningMax   = signals.GetSignal(string.Format("{0}.warning.max", SensorName.Cabel(SignalName.Pressure))).Value;
                mStartTrackingTimeout = signals.GetSignal("pump.alarm.startup.timeout").Value;

                // датчик давления в системе рулевого и его обработка
                mCabelPressure = new Sensor(SensorName.Cabel(SignalName.Pressure), signals)
                {
                    OnUpdate = value =>
                    {
                        if (mStartAt == DateTime.MaxValue)
                        {
                            return;
                        }

                        if (DateTime.Now.Subtract(mStartAt).TotalSeconds < mStartTrackingTimeout)
                        {
                            return;
                        }

                        if (value > mPressureAlarmMax)
                        {
                            if (OnError != null)
                            {
                                OnError(SystemStateCodes.Alarm.CabelPressureMax);
                            }

                            return;
                        }

                        if (value < mPressureAlarmMin)
                        {
                            if (OnError != null)
                            {
                                OnError(SystemStateCodes.Alarm.CabelPressureMin);
                            }

                            return;
                        }

                        if (value > mPressureWarningMax)
                        {
                            return;
                        }

                        if (OnWarning != null)
                        {
                            OnWarning(SystemStateCodes.Warning.CabelPressureMax);
                        }
                    }
                };
            }
Exemplo n.º 5
0
        public static void Init(IJournal journal, ISignalsFactory signals)
        {
            mJournal = journal;

            TankSensorHandler.Init(journal, signals);
            //TankSensorHandler.OnError += OnErrorCaller;
            //TankSensorHandler.OnWarning += OnWarningCaller;

            BrakePressureHandler.Init(journal, signals);
            //BrakePressureHandler.OnError += OnErrorCaller;
            //BrakePressureHandler.OnWarning += OnWarningCaller;

            SteeringPressureHandler.Init(journal, signals);
            //SteeringPressureHandler.OnError += OnErrorCaller;
            //SteeringPressureHandler.OnWarning += OnWarningCaller;

            CabelPressureHandler.Init(journal, signals);
            //CabelPressureHandler.OnError += OnErrorCaller;
            //CabelPressureHandler.OnWarning += OnWarningCaller;

            AlarmStopTimeout = (ushort)(signals.GetSignal("pump.alarm.shutdown.timeout").Value *1000);

            // делаем отключение асинхронным  - команда на стоп не связана с реальной остановкой двигателя
            mTaskPumpStop            = new DelayedTask(100);
            mTaskPumpStop.OnTimeout += sender =>
            {
                mTaskPumpStop.Stop();

                // TODO: тут может понадобится пауза между отключением частотников и насосной станцией
                mRelay.Off();
                mStartAt = DateTime.MaxValue;                                // выключаем

                if (mState.ValueAsInt != (uint)EquipmentState.Failure)
                {
                    mState.Update((uint)EquipmentState.Stop);
                }
            };

            mRelay          = new Relay(journal, RelayName.Kv11, signals);
            mRelay.OnError += sensor => OnErrorCaller(SystemStateCodes.Alarm.Kv11OutOfControl);

            mCord           = new Cord(signals.GetSignal(SensorName.Cord(1)));
            mCord.OnChange += sensor =>
            {
                if (sensor.IsSet)
                {
                    OnErrorCaller(SystemStateCodes.Alarm.Cord1OutOfControl);
                }
            };

            mState = signals.GetSignal(SensorName.Derivative(SystemName.Pump, SignalName.Status));
        }
Exemplo n.º 6
0
        static public void Init(ISignalsFactory signals)
        {
            mForwardDrive = signals.GetSignal(SensorName.Drive(SignalName.Forward));
            if (mForwardDrive == null)
            {
                throw new NullReferenceException(SensorName.Drive(SignalName.Forward));
            }

            mReverseDrive = signals.GetSignal(SensorName.Drive(SignalName.Reverse));
            if (mReverseDrive == null)
            {
                throw new NullReferenceException(SensorName.Drive(SignalName.Reverse));
            }
        }
Exemplo n.º 7
0
            public Sensor(string id, ISignalsFactory factory)
            {
                mSignal  = factory.GetSignal(id);
                mChannel = factory.GetSignal(string.Format("{0}.channel", id));

                if (mChannel == null || mSignal == null)
                {
                    throw new ArgumentNullException("");
                }

                mSignal.OnUpdate += rv =>
                {
                    if (mChannel.IsSet && OnUpdate != null)
                    {
                        OnUpdate(mSignal.Value);
                    }
                };
            }
Exemplo n.º 8
0
        private static void SpeedSettings()
        {
            mMotionSpeed = mSignals.GetSignal(SensorName.Derivative(SystemName.System, SignalName.Speed));
            mMotionSpeed.Update(0);

            for (var i = 0; i < kMotionSpeedCount; i++)
            {
                var rv = mSignals.GetSignal(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.System, SignalName.Speed), i + 1));
                MotionFrequencies.Add(rv);
            }

            mConveyorSpeed = mSignals.GetSignal(SensorName.Derivative(SystemName.Conveyor, SignalName.Speed));
            mConveyorSpeed.Update(0);

            for (var i = 0; i < kConveyorSpeedCount; i++)
            {
                var rv = mSignals.GetSignal(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.Conveyor, SignalName.Speed), i + 1));
                ConveyorFrequencies.Add(rv);
            }

            // Понижаем частоту, если долго не давили на педали
            ResetMotionSpeedToMin.OnTimeout += sender =>
            {
                mJournal.Debug("Сброс скорости по таймеру", MessageLevel.System);
                mMotionSpeed.Update(0);
            };
        }
Exemplo n.º 9
0
        public SystemContol(IJournal journal, ISignalsFactory signals, bool isdebug = false)
        {
            debug    = isdebug;
            mJournal = journal;

            mSystemCode        = signals.GetSignal("derivative.system.code");
            mBlockedByPassword = signals.GetSignal("derivative.system.authorize");
            if (debug)
            {
                mBlockedByPassword.OnChange += signal => Console.WriteLine("derivative.system.authorize: {0}", signal.ValueAsInt);
                mSystemCode.OnChange        += signal => Console.WriteLine("system.code: {0}", signal.ValueAsInt);
            }


            SetState(SystemState.Init, SystemStateCodes.State.Initialization);

            Pedals.Init(signals);
            SoundAlarm.Init(mJournal, signals);

            Pump.Init(mJournal, signals);
            Pump.OnError += code =>
            {
                // TODO: отверить процедуру отключения по ошибке насоса (в теории, выключается все сразу)
                mJournal.Error(string.Format("Защита по маслостанции: {0}", mState), MessageLevel.System);
                SetState(SystemState.Failure, code);

                Engine.SetMode(EngineMode.Deactivate);
                Pump.Stop();
            };

            Pump.OnWarning += code => SetState(mState, code);

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Unix:
                Engine.Init(journal, signals, "/dev/ttySP0", 19200);
                break;

            default:
                Engine.Init(journal, signals, "COM1", 19200);
                break;
            }

            //Engine.Init(journal, signals, "/dev/ttySP1", 38400); // last worked
            //Engine.Init(journal, signals, "/dev/ttySP1", 57600);
            //Engine.Init(journal, signals, "COM38", 38400);

            // ошибки частотников, ошибки кордов, ошибки реле kv1, kv8, kv8
            Engine.OnError += code =>
            {
                mJournal.Error(string.Format("Защита по частотникам, кордам, реле: {0}", mState), MessageLevel.System);
                SetState(SystemState.Failure, code);
                Engine.SetMode(EngineMode.Deactivate);
            };

            Pump.OnStop += signal => Engine.SetMode(EngineMode.Deactivate);

            KeyboardInit();

            mThread = new Thread(Update);
            mThread.Start();
        }
Exemplo n.º 10
0
        public FNTGZ60(IJournal journal, ISignalsFactory signals, RS485Master modbus, byte modbusId)
        {
            var id = SensorName.Invertor(modbusId);

            if (journal == null)
            {
                throw new ArgumentNullException("journal");
            }

            if (modbus == null)
            {
                throw new ArgumentNullException("modbus");
            }

            Id          = id;
            mJournal    = journal;
            mConnection = modbus;
            mModbusId   = modbusId;

            Status = EngineStatus.Init;


            mState = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Mode));
            mError = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Error));
            var lastError = float.NaN;

            mError.OnUpdate += signal =>
            {
                if (float.IsNaN(mError.Value) && !float.IsNaN(lastError))
                {
                    mJournal.Debug(string.Format("mError уст. в неизв. сост.: {0}", Id), MessageLevel.System);
                }

                lastError = signal.Value;
            };

            mFrequency   = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Frequency));
            mCurrent     = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Current));
            mVoltage     = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Voltage));
            mTemperature = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Temperature));
            mAngle       = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.Angle));

            mLastStop     = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.LastStop));
            mHourStop     = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.HourStop));
            mMinuteStop   = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.MinuteStop));
            mDayStop      = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.DayStop));
            mMonthStop    = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.MonthStop));
            mYearStop     = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.YearStop));
            mFzadStop     = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.FzadStop));
            mFpracyStop   = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.FpracyStop));
            mUdStop       = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.UdStop));
            mIskutStop    = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.IskutStop));
            mTermSensStop = signals.GetSignal(SensorName.Invertor(mModbusId, SignalName.TermSensStop));
        }
Exemplo n.º 11
0
        public static void Initwago750494(Coupler wago, ISignalsFactory signals)
        {
            {
                W750493.Add(wago, 0, new List <ISignal>
                {
                    signals.GetSignal(SensorName.Phase(1, SignalName.Voltage))
                });

                W750514.Add(wago, 518, new List <ISignal>
                {
                    signals.GetSignal(SensorName.Relay(RelayName.Kv4)),                                         // sound alarm
                    signals.GetSignal(SensorName.Relay(RelayName.Kv11)),                                        // pump on

                    signals.GetSignal(SensorName.Relay(RelayName.Kv10)),                                        //
                    signals.GetSignal(SensorName.Relay(RelayName.Kv9)),                                         //

                    signals.GetSignal(SensorName.Relay(RelayName.RectifierReset)),                              // rectifier reset//null,//new Signal(SensorName.Relay(RelayName.Kv10)),//mode mix,
                    signals.GetSignal(SensorName.Relay(RelayName.Kv1)),                                         // rectifier active mode
                });


                W7501405.Add(wago, 6, new List <ISignal>
                {
                    signals.GetSignal(SensorName.Drive(SignalName.Forward)),                  // SignalType.Ushort),
                    signals.GetSignal(SensorName.Drive(SignalName.Reverse)),                  // SignalType.Ushort),
                    signals.GetSignal(SensorName.Cord(1)),                                    //SignalType.Ushort), // F1
                    signals.GetSignal(SensorName.Cord(2)),                                    //SignalType.Ushort), // F2
                    signals.GetSignal(SensorName.Cord(3)),                                    //SignalType.Ushort), // F3
                    signals.GetSignal(SensorName.Cord(4)),                                    //SignalType.Ushort), // F4
                    signals.GetSignal(SensorName.Cord(5)),                                    //SignalType.Ushort), // F5
                    signals.GetSignal(SensorName.Cord(6)),                                    //SignalType.Ushort), // F6
                    null,                                                                     //new Signal(SensorName.Empty()),
                    signals.GetSignal(SensorName.Relay(RelayName.Kv11, SignalName.Feedback)), //SignalType.Ushort),// K1
                    signals.GetSignal(SensorName.Relay(RelayName.Kv2, SignalName.Feedback)),  //SignalType.Ushort),// K2
                    signals.GetSignal(SensorName.Relay(RelayName.Kv1, SignalName.Feedback)),  //SignalType.Ushort),// K3 -
                    signals.GetSignal(SensorName.Relay(RelayName.Kv9, SignalName.Feedback)),  //SignalType.Ushort),//  K4
                    //signals.GetSignal(SensorName.Relay(RelayName.Kv8, SignalName.Feedback)), //SignalType.Ushort),// K4 -
                    signals.GetSignal(SensorName.Relay(RelayName.Kv10, SignalName.Feedback)), //SignalType.Ushort),// K5 -
                    null,                                                                     //signals.GetSignal(SensorName.Relay(RelayName.Kv10, SignalName.Feedback)), //SignalType.Ushort),// K6, now K4
                    null                                                                      //new Signal(SensorName.Empty())
                });
            }
        }
Exemplo n.º 12
0
        public static void Init(IJournal journal, ISignalsFactory signals, string port, int baudrate)
        {
            mJournal  = journal;
            mPortName = port;
            mSignals  = signals;

            mConnection = new RS485Master(journal, mPortName, baudrate, false);
            SetState(SystemState.Init);
            SpeedSettings();

            mUz2 = InitInvertor(1);
            mUz3 = InitInvertor(2);
            mUz4 = InitInvertor(3);
            mUz5 = InitInvertor(4);

            mConveyor = mUz4;

            //mLeft = mSignals.GetSignal(SensorName.Invertor(4, SignalName.Angle)); // uz5
            //mRight = mSignals.GetSignal(SensorName.Invertor(1, SignalName.Angle)); // uz2

            mUz2State      = mSignals.GetSignal(SensorName.Derivative(SystemName.Uz, 2, SignalName.Status));
            mUz3State      = mSignals.GetSignal(SensorName.Derivative(SystemName.Uz, 3, SignalName.Status));
            mUz4State      = mSignals.GetSignal(SensorName.Derivative(SystemName.Uz, 4, SignalName.Status));
            mUz5State      = mSignals.GetSignal(SensorName.Derivative(SystemName.Uz, 5, SignalName.Status));
            mConveyorState = mSignals.GetSignal(SensorName.Derivative(SystemName.Conveyor, SignalName.Status));

            mState = new List <ISignal>
            {
                mUz2State,
                mUz3State,
                mUz4State,
                mUz5State,
                mConveyorState
            };

            for (var i = 0; i < 5; i++)
            {
                var rv = new Cord(signals.GetSignal(SensorName.Cord((byte)(i + 2))));
                rv.OnChange += sensor =>
                {
                    if (!sensor.IsSet)
                    {
                        return;
                    }

                    OnErrorWrapper(GetCordCode(sensor.Specification.Id));

                    // last action
                    for (var j = 0; j < Cords.Count; j++)
                    {
                        if (Cords[j] != rv)
                        {
                            continue;
                        }
                        mState[j].Update((float)EquipmentState.Failure);
                        return;
                    }
                };
                Cords.Add(rv);
            }

            mRectifierReset = new Relay(journal, RelayName.RectifierReset, signals);

            mKv1          = new Relay(journal, RelayName.Kv1, signals);
            mKv1.OnError += signal => OnErrorWrapper(SystemStateCodes.Alarm.Kv1OutOfControl);

            /*
             * mKv8 = new Relay(journal, RelayName.Kv8, signals);
             * mKv8.OnError += signal =>
             * {
             *  // TODO: конвейерный частотник
             *  mUz4State.Update((uint)EquipmentState.Failure);
             *  OnErrorWrapper(SystemStateCodes.Alarm.Kv8OutOfControl);
             * };
             */
            mKv9          = new Relay(journal, RelayName.Kv9, signals);
            mKv9.OnError += signal =>
            {
                mConveyorState.Update((uint)EquipmentState.Failure);
                OnErrorWrapper(SystemStateCodes.Alarm.Kv9OutOfControl);
            };

            mKv10          = new Relay(journal, RelayName.Kv10, signals);
            mKv10.OnError += signal =>
            {
                mConveyorState.Update((uint)EquipmentState.Failure);
                OnErrorWrapper(SystemStateCodes.Alarm.Kv10OutOfControl);
            };

            // Автоматическое выключение конвейера по ошибке
            mConveyorState.OnChange += signal =>
            {
                if (signal.ValueAsInt == (int)EquipmentState.Failure)
                {
                    ConveyorOff();
                }
            };


            for (byte i = 1; i < 5; i++)
            {
                var voltage = signals.GetSignal(SensorName.Invertor(i, SignalName.Voltage));
                if (voltage != null)
                {
                    Voltages.Add(voltage);
                }
                else
                {
                    throw new NullReferenceException();
                }
            }

            mConveyorState.Update((uint)EquipmentState.Stop);

            // charge
            mKv2Feedback = signals.GetSignal(SensorName.Relay(RelayName.Kv2, SignalName.Feedback));

            // включился режим заряда выпрямителя
            mKv2Feedback.OnChange += sensor =>
            {
                //if(sensor.IsSet)
                //   mJournal.Debug(string.Format("{0}: {1}", sensor.Id, sensor.IsSet), MessageLevel.System)
            };

            mTangage = mSignals.GetSignal("tangage"); //
            mEncoder = signals.GetSignal("encoder.point");

            mThread = new Thread(Update);
            mThread.Start();
        }
Exemplo n.º 13
0
        private static void ConfigureSignalFactory(ISignalsFactory signals)
        {
            var signalBuilder = new SignalBuilder(signals);

            signalBuilder.Init <B17K>();


            signals.AddSignal(SensorName.Keyboard(), "клавиатура");
            signals.AddSignal("derivative.system.code", "Статус работы");

            //signals.AddSignal("derivative.system.authorize", "Блокировка по паролю").Update(false);
            //new SignalSpecification(string.Format("system.settings.Panel43Ver", SensorName.PcprocVer(SignalName.PcProcVer)), "Версия Процессора")

            signals.AddSignal("derivative.system.authorize", "Блокировка по паролю").Update(true);

            #region Отладочные сигналы

            signals.AddSignal("system.debug.SysInit", "Система:предстарт").Update(0);
            signals.AddSignal("system.debug.SysStart", "Система:старт").Update(0);
            signals.AddSignal("system.debug.SysStop", "Система:стоп").Update(0);
            signals.AddSignal("system.debug.SysMotion", "Система:движение").Update(0);
            signals.AddSignal("system.debug.SysError", "Система:защита").Update(0);
            #endregion

            #region Учет входа в меню сервисантов и инжинеров
            signals.AddSignal("system.settings.serviceenter", "Вход сервисанта").Update(true);
            signals.AddSignal("system.settings.engineerenter", "Вход сервисанта").Update(true);
            //signals.AddSignal(new SignalSpecification(string.Format("system.settings.year", SensorName.Year(SignalName.Year))), "Вход сервисанта");
            //signals.AddSignal("derivative.system.authorize", "Вход сервисанта").Update(true);
            #endregion



            #region Управление скоростью движения и конвейера
            signals.AddSignal(SensorName.Derivative(SystemName.System, SignalName.Speed), "").Update(0);//, SignalType.Ushort);
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.System, SignalName.Speed), 1), "Движение, 1 скорость").SaveAsUshort(700, true, 100, 100, 10000));
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.System, SignalName.Speed), 2), "Движение, 2 скорость").SaveAsUshort(2500, true, 100, 100, 10000));
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.System, SignalName.Speed), 3), "Движение, 3 скорость").SaveAsUshort(5000, true, 100, 100, 10000));
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.System, SignalName.Speed), 4), "Движение, 4 скорость").SaveAsUshort(7500, true, 100, 100, 10000));


            signals.AddSignal(SensorName.Derivative(SystemName.Conveyor, SignalName.Speed), "").Update(0);//, SignalType.Ushort);
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.Conveyor, SignalName.Speed), 1), "Конвейер, 1 скорость").SaveAsUshort(1000, true, 100, 100, 10000));
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.Conveyor, SignalName.Speed), 2), "Конвейер, 2 скорость").SaveAsUshort(1500, true, 100, 100, 10000));
            signals.AddStored(new SignalSpecification(string.Format("{0}.settings.{1}", SensorName.Derivative(SystemName.Conveyor, SignalName.Speed), 3), "Конвейер, 3 скорость").SaveAsUshort(2000, true, 100, 100, 10000));

            signals.AddSignal("roll", "").Update(0.0f);    //
            signals.AddSignal("tangage", "").Update(0.0f); //
            //signals.AddSignal("roll", "крен").Update(0.0f); //
            //signals.AddSignal("tangage", "тангаж").Update(0.0f); //
            //signals.AddStored(new SignalSpecification("tangage.uphill.frequency.max", "максимальная частота при движении в гору").SaveAsUshort(true, 1000, 100, 3500)).Update(3000);
            //signals.AddStored(new SignalSpecification("tangage.uphill.frequency.max.settings", "угол наклона для применения максимальной частоты").SaveAsUshort(true, 5, 1, 15)).Update(10);

            //signals.AddStored(new SignalSpecification("tangage.normal.frequency.levelup", "скорость набора частоты на плоскости").SaveAsUshort(true, 5, 1, 20)).Update(15);
            //signals.AddStored(new SignalSpecification("tangage.uphill.frequency.levelup", "скорость набора частоты в гору").SaveAsUshort(true, 15, 1, 25)).Update(20);
            //signals.AddStored(new SignalSpecification("tangage.uphill.frequency.levelup.settings", "угол наклона для применения повышенной скорости набора частоты").SaveAsUshort(true, 5, 1, 15)).Update(10);
            #endregion

            #region Настройка ограничения по частоте при спуске-подъеме

            signals.AddStored(new SignalSpecification("tangage.uphill.limit.enable", "Ограничение Fmax при уклоне").SaveAsBool(false));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.0", "Fmax,  0⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.1", "Fmax,  1⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.2", "Fmax,  2⁰").SaveAsUshort(71, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.3", "Fmax,  3⁰").SaveAsUshort(67, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.4", "Fmax,  4⁰").SaveAsUshort(63, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.5", "Fmax,  5⁰").SaveAsUshort(59, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.6", "Fmax,  6⁰").SaveAsUshort(55, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.7", "Fmax,  7⁰").SaveAsUshort(51, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.8", "Fmax,  8⁰").SaveAsUshort(47, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.9", "Fmax,  9⁰").SaveAsUshort(46, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.10", "Fmax, 10⁰").SaveAsUshort(45, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.11", "Fmax, 11⁰").SaveAsUshort(44, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.12", "Fmax, 12⁰").SaveAsUshort(43, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.13", "Fmax, 13⁰").SaveAsUshort(42, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.14", "Fmax, 14⁰").SaveAsUshort(41, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tangage.uphill.limit.15", "Fmax, 15+⁰").SaveAsUshort(40, true, 1, 1, 100));
            #endregion

            #region Дискретные выхода
            signals.AddSignal(SensorName.Relay(RelayName.Kv4), "");            // SignalType.Ushort), // sound alarm
            signals.AddSignal(SensorName.Relay(RelayName.Kv11), "");           // SignalType.Ushort), // pump on
            signals.AddSignal(SensorName.Relay(RelayName.Kv10), "");           //SignalType.Ushort), // mode moving,
            signals.AddSignal(SensorName.Relay(RelayName.Kv9), "");            //SignalType.Ushort),// mode conveyeor,
            signals.AddSignal(SensorName.Relay(RelayName.RectifierReset), ""); //SignalType.Ushort),// rectifier reset//null,//new Signal(SensorName.Relay(RelayName.Kv10)),//mode mix,
            signals.AddSignal(SensorName.Relay(RelayName.Kv1), "");            //SignalType.Ushort),// rectifier active mode
            #endregion

            #region Дискретные входа
            signals.AddSignal(SensorName.Drive(SignalName.Forward), "");                  // SignalType.Ushort),
            signals.AddSignal(SensorName.Drive(SignalName.Reverse), "");                  // SignalType.Ushort),
            signals.AddSignal(SensorName.Cord(1), "");                                    //SignalType.Ushort), // F1
            signals.AddSignal(SensorName.Cord(2), "");                                    //SignalType.Ushort), // F2
            signals.AddSignal(SensorName.Cord(3), "");                                    //SignalType.Ushort), // F3
            signals.AddSignal(SensorName.Cord(4), "");                                    //SignalType.Ushort), // F4
            signals.AddSignal(SensorName.Cord(5), "");                                    //SignalType.Ushort), // F5
            signals.AddSignal(SensorName.Cord(6), "");                                    //SignalType.Ushort), // F6
            signals.AddSignal(SensorName.Relay(RelayName.Kv11, SignalName.Feedback), ""); //SignalType.Ushort),// K1
            signals.AddSignal(SensorName.Relay(RelayName.Kv2, SignalName.Feedback), "");  //SignalType.Ushort),// K2
            signals.AddSignal(SensorName.Relay(RelayName.Kv1, SignalName.Feedback), "");  //SignalType.Ushort),// K3 -
            signals.AddSignal(SensorName.Relay(RelayName.Kv8, SignalName.Feedback), "");  //SignalType.Ushort),// K4 -
            signals.AddSignal(SensorName.Relay(RelayName.Kv9, SignalName.Feedback), "");  //SignalType.Ushort),// K5 -
            signals.AddSignal(SensorName.Relay(RelayName.Kv10, SignalName.Feedback), ""); //SignalType.Ushort),// K6
            #endregion

            #region Аналоговые входа и их настройки

            signals.AddSignal(SensorName.Phase(1, SignalName.Voltage), ""); //, SignalType.Ushort)

            signals.AddSignal(SensorName.Filter(SignalName.Pressure), "");
            signals.AddSignal(SensorName.Steering(SignalName.Pressure), "");
            signals.AddSignal(SensorName.Cabel(SignalName.Pressure), "");
            signals.AddSignal(SensorName.Brake(SignalName.Pressure), "");
            signals.AddSignal(SensorName.Tank(SignalName.Level), "tannk level pizda");
            signals.AddSignal(SensorName.Tank(SignalName.Temperature), "");

            //Заводим дату и время как сигнал описав его в SensorName
            signals.AddSignal(SensorName.Year(SignalName.Year), "");
            signals.AddSignal(SensorName.Month(SignalName.Month), "");
            signals.AddSignal(SensorName.Date(SignalName.Date), "");
            signals.AddSignal(SensorName.Date(SignalName.Hour), "");
            signals.AddSignal(SensorName.Date(SignalName.Minutes), "");


            /*
             * // правильные значения - для Update нужно значение на 1 больше
             * case "local.steering.pressure": return 0;
             * case "local.cabel.pressure": return 4;
             * case "local.filter.pressure": return 3;
             * case "local.brake.pressure": return 1;
             * case "local.tank.level": return 5;
             * case "local.tank.temperature": return 2;
             */

            // Update(0) - датчик не применим, канал отключен
            signals.AddStored(new SignalSpecification(string.Format("{0}.channel", SensorName.Steering(SignalName.Pressure)), "Канал датчика P рулевое").SaveAsUshort(1, true, 0, 1, 6));
            signals.AddStored(new SignalSpecification(string.Format("{0}.channel", SensorName.Cabel(SignalName.Pressure)), "Канал датчика P кабельное").SaveAsUshort(5, true, 0, 1, 6));
            signals.AddStored(new SignalSpecification(string.Format("{0}.channel", SensorName.Filter(SignalName.Pressure)), "Канал датчика P фильтра").SaveAsUshort(4, true, 0, 1, 6));
            signals.AddStored(new SignalSpecification(string.Format("{0}.channel", SensorName.Brake(SignalName.Pressure)), "Канал датчика P тормозное").SaveAsUshort(2, true, 0, 1, 6));
            signals.AddStored(new SignalSpecification(string.Format("{0}.channel", SensorName.Tank(SignalName.Level)), "Канал датчика L бак").SaveAsUshort(6, true, 0, 1, 6));
            signals.AddStored(new SignalSpecification(string.Format("{0}.channel", SensorName.Tank(SignalName.Temperature)), "Канал датчика T бак").SaveAsUshort(3, true, 0, 1, 6));
            #endregion

            #region Общие настройки
            signals.AddStored(new SignalSpecification("relay.feedback.on.timeout", "T старт включения контактора").SaveAsUshort(3000, true, 1500, 100, 6000));
            signals.AddStored((new SignalSpecification("pump.sensor.startup.timeout", "T старт маслянного насоса")).SaveAsUshort(5000, true, 3000, 1000, 20000));

            signals.AddStored(new SignalSpecification("soundalarm.on.timeout", "T звучание сирены").SaveAsUshort(1500, true, 1500, 100, 6000)); // правильное значение 6000
            signals.AddStored(new SignalSpecification("soundalarm.off.timeout", "T после звучания сирены").SaveAsUshort(5000, true, 1500, 100, 10000));
            #endregion

            #region  абочие параметры частотников
            for (byte i = 1; i < 5; i++)
            {
                signals.AddSignal(SensorName.Invertor(i, SignalName.Mode), "");        //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.Error), "");       //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.Frequency), "");   //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.Current), "");     //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.Voltage), "");     //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.Temperature), ""); //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.Angle), "");       //, SignalType.Ushort);

                /*
                 * 40009 причина последнего выключения (код как выше)
                 * 40010 час выключения (если время не подаётся в SLAVE показывает „00”)
                 * 40011 минута выключения (если время не подаётся в SLAVE показывает „00”)
                 * 40012 день выключения (если время не подаётся в SLAVE показывает „00”)
                 * 40013 месяц выключения (если время не подаётся в SLAVE показывает „00”)
                 * 40014 год выключения (если время не подаётся в SLAVE показывает „00”)
                 * 40015 Fzad при выключении в сотых частях [Гц]
                 * 40016 Fpracy при выключении в сотых частях [Гц]
                 * 40017 Ud при выключении
                 * 40018 Iskut при выключении
                 * 40019 температура сенсора при выключении
                 * 40020 скорость вращения двигателя в [обр/мин] подключенного к энкодеру
                 * LastStop,
                 * HourStop,
                 * MinuteStop,
                 * DayStop,
                 * MonthStop,
                 * YearStop,
                 * FzadStop,
                 * FpracyStop,
                 * UdStop,
                 * IskutStop,
                 * TermSensStop,
                 */
                signals.AddSignal(SensorName.Invertor(i, SignalName.LastStop), "");     //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.HourStop), "");     //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.MinuteStop), "");   //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.DayStop), "");      //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.MonthStop), "");    //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.YearStop), "");     //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.FzadStop), "");     //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.FpracyStop), "");   //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.UdStop), "");       //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.IskutStop), "");    //, SignalType.Ushort);
                signals.AddSignal(SensorName.Invertor(i, SignalName.TermSensStop), ""); //, SignalType.Ushort);
            }
            #endregion

            // как забираем Koshamarski
            //  mReciever.GetSignal("derivative.pump.status"),
            //  mReciever.GetSignal("derivative.uz.2.status"),
            //  mReciever.GetSignal("derivative.uz.3.status"),
            //  mReciever.GetSignal("derivative.uz.4.status"),
            //  mReciever.GetSignal("derivative.uz.5.status"),
            //  mReciever.GetSignal("derivative.conveyor.status"),
            //signals.AddSignal(SensorName.Drive(SignalName.Forward), "");// SignalType.Ushort),
            //signals.AddSignal(SensorName.Drive(SignalName.Reverse), "");// SignalType.Ushort),
            #region Статусы объектов управления
            signals.AddSignal(SensorName.Derivative(SystemName.Pump, SignalName.Status), "");     //, SignalType.Ushort);
            signals.AddSignal(SensorName.Derivative(SystemName.Uz, 2, SignalName.Status), "");    //, SignalType.Ushort);
            signals.AddSignal(SensorName.Derivative(SystemName.Uz, 3, SignalName.Status), "");    //, SignalType.Ushort);
            signals.AddSignal(SensorName.Derivative(SystemName.Uz, 4, SignalName.Status), "");    //, SignalType.Ushort);
            signals.AddSignal(SensorName.Derivative(SystemName.Uz, 5, SignalName.Status), "");    //, SignalType.Ushort);
            signals.AddSignal(SensorName.Derivative(SystemName.Conveyor, SignalName.Status), ""); //, SignalType.Ushort);
            #endregion

            #region Защитные уставки
            signals.AddStored(new SignalSpecification("pump.alarm.pressure.min", "Min рабочее давление насоса").SaveAsFloat(1.0f, true, 0.1f, 0.1f, 10.0f));
            signals.AddStored(new SignalSpecification("pump.alarm.pressure.max", "Max рабочее давление насоса").SaveAsFloat(10.0f, true, 0.1f, 0.1f, 10.0f));
            signals.AddStored(new SignalSpecification("pump.alarm.startup.timeout", "Время выхода насоса на режим").SaveAsUshort(10, true, 1, 1, 100));

            signals.AddStored(new SignalSpecification("pump.alarm.shutdown.timeout", "Задержка на выключение насоса").SaveAsUshort(5, true, 1, 1, 30));

            signals.AddStored(new SignalSpecification("tank.level.warning.min", "Уровень в баке, предупреждение").SaveAsUshort(10, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tank.level.alarm.min", "Уровень в баке, авария").SaveAsUshort(5, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("tank.temperature.warning.max", "Т в баке, предупреждение").SaveAsUshort(70, true, 1, 1, 120));
            signals.AddStored(new SignalSpecification("tank.temperature.alarm.max", "Т в баке, авария").SaveAsUshort(90, true, 1, 1, 120));

            signals.AddStored(new SignalSpecification("filter.pressure.warning.max", "Давление на фильтре, предупреждение").SaveAsFloat(19.0f, true, 0.1f, 0.1f, 20.0f));
            signals.AddStored(new SignalSpecification("filter.pressure.alarm.max", "Давление на фильтре, авария").SaveAsFloat(20.0f, true, 0.1f, 0.1f, 20.0f));

            signals.AddStored(new SignalSpecification(string.Format("{0}.warning.min", SensorName.Steering(SignalName.Pressure)), "Предупреждение P рулевого, min").SaveAsUshort(ushort.MaxValue));
            signals.AddStored(new SignalSpecification(string.Format("{0}.warning.max", SensorName.Steering(SignalName.Pressure)), "Предупреждение P рулевого, max").SaveAsUshort(ushort.MaxValue));

            signals.AddStored(new SignalSpecification(string.Format("{0}.warning.min", SensorName.Brake(SignalName.Pressure)), "Предупреждение P тормозного, min").SaveAsUshort(ushort.MaxValue));
            signals.AddStored(new SignalSpecification(string.Format("{0}.alarm.min", SensorName.Brake(SignalName.Pressure)), "Авария P тормозного, min").SaveAsUshort(ushort.MaxValue));
            signals.AddStored(new SignalSpecification(string.Format("{0}.alarm.max", SensorName.Brake(SignalName.Pressure)), "Авария P тормозного, max").SaveAsUshort(ushort.MaxValue));

            signals.AddStored(new SignalSpecification(string.Format("{0}.alarm.min", SensorName.Cabel(SignalName.Pressure)), "Авария P кабельного, min").SaveAsUshort(ushort.MaxValue));
            signals.AddStored(new SignalSpecification(string.Format("{0}.warning.max", SensorName.Cabel(SignalName.Pressure)), "Предупреждение P кабельного, max").SaveAsUshort(ushort.MaxValue));
            signals.AddStored(new SignalSpecification(string.Format("{0}.alarm.max", SensorName.Cabel(SignalName.Pressure)), "Авария P кабельного, max").SaveAsUshort(ushort.MaxValue));

            signals.AddStored(new SignalSpecification("engines.alarm.shutdown.timeout", "Задержка на выключение двигателей").SaveAsUshort(10, true, 1, 1, 100));
            #endregion

            #region Версия ПО
            signals.AddStored(new SignalSpecification(string.Format("system.settings.Panel43Ver", SensorName.PcprocVer(SignalName.PcProcVer)), "Версия Процессора").SaveAsUshort(3010, true, 0, 1, 10000));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.PcProcVer", SensorName.Panel43Ver(SignalName.Panel43Ver)), "Версия панель43").SaveAsUshort(3010, true, 0, 1, 10000));
            #endregion
            #region МотоЧасы и КиловатЧасы
            signals.AddStored(new SignalSpecification(string.Format("system.settings.MotoHours", SensorName.MotorHour(SignalName.MotoHours)), "МотоЧасы").SaveAsFloat(0.0f, true, 0.0f, 0.1f, 9999f));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.OilHours", SensorName.OilHour(SignalName.OilHours)), "МаслоЧасы").SaveAsFloat(0.0f, true, 0.0f, 0.1f, 9999f));
            //signals.AddStored(new SignalSpecification(string.Format("system.settings.MotoHours", SensorName.MotorHour(SignalName.MotoHours)), "МотоЧасы").SaveAsUshort(0, true, 0, 1, 3000));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.KWHours", SensorName.KilowatH(SignalName.KWHours)), "КиловаттЧасы").SaveAsUshort(0, true, 0, 1, 9999));
            #endregion

            #region Учет  наработки маслостанции
            signals.AddSignal("system.settings.ChangeOil", "НЕОБХОДИМА ЗАМЕНА МАСЛА").Update(true);
            signals.AddStored(new SignalSpecification(string.Format("system.settings.OilState", SensorName.OilPump(SignalName.OilRefresh)), "Замена масла").SaveAsUshort(0, true, 0, 1, 200));
            #endregion

            #region Системные функции
            signals.AddStored(new SignalSpecification(string.Format("system.settings.comport", SensorName.ComPort(1, SignalName.ComNumber)), "Номер COM порта").SaveAsUshort(0, true, 0, 1, 3));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.comspeed", SensorName.ComSpeed(1, SignalName.ComSpeed)), "Скорость COM порта").SaveAsUshort(19200, true, 9600, 9600, 57600));

            signals.AddStored(new SignalSpecification(string.Format("system.settings.wago493", SensorName.Wago493(1, SignalName.Detect493)), "Wago модуль 493").SaveAsUshort(1, true, 0, 1, 1));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.convmode", SensorName.ConvMode(1, SignalName.Convmode)), "Режим конвеера ПЧН").SaveAsUshort(0, true, 0, 1, 1));
            #endregion

            #region Дата и время
            //DateTime.Now.ToString("mm:ss.fff");
            //int year=DateTime.Now.Year;
            //int month = DateTime.Now.Month;
            //int hour = DateTime.Now.Hour;
            //int minute = DateTime.Now.Minute;
            //int day = DateTime.Now.Day;
            signals.AddStored(new SignalSpecification(string.Format("system.settings.year", SensorName.Year(SignalName.Year)), "Год").SaveAsUshort(2016, true, 2016, 1, 2090));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.month", SensorName.Month(SignalName.Month)), "Месяц").SaveAsUshort(01, true, 01, 1, 12));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.day", SensorName.Date(SignalName.Date)), "День").SaveAsUshort(01, true, 01, 1, 31));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.hour", SensorName.Hour(SignalName.Hour)), "Часы").SaveAsUshort(01, true, 0, 1, 24));
            signals.AddStored(new SignalSpecification(string.Format("system.settings.minutes", SensorName.Minutes(SignalName.Minutes)), "Минуты").SaveAsUshort(0, true, 0, 1, 60));
            #endregion



            #region Калибровочные точки для сигналов

            signals.AddStored(new SignalSpecification("encoder.settings.enable", "Учет поворота колес").SaveAsUshort(0, true, 0, 1, 1));
            signals.AddStored(new SignalSpecification("encoder.settings.zero", "Нулевая точка энкодера поворота").SaveAsUshort(0, true, 0, 1, 1023));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.1", "% max,  1⁰").SaveAsUshort(100, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.2", "% max,  2⁰").SaveAsUshort(100, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.3", "% max,  3⁰").SaveAsUshort(100, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.4", "% max,  4⁰").SaveAsUshort(100, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.5", "% max,  5⁰").SaveAsUshort(100, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.6", "% max,  6⁰").SaveAsUshort(95, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.7", "% max,  7⁰").SaveAsUshort(95, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.8", "% max,  8⁰").SaveAsUshort(95, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.9", "% max,  9⁰").SaveAsUshort(95, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.10", "% max, 10⁰").SaveAsUshort(95, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.11", "% max, 11⁰").SaveAsUshort(90, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.12", "% max, 12⁰").SaveAsUshort(90, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.13", "% max, 13⁰").SaveAsUshort(90, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.14", "% max, 14⁰").SaveAsUshort(90, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.15", "% max, 15⁰").SaveAsUshort(90, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.16", "% max, 16⁰").SaveAsUshort(85, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.17", "% max, 17⁰").SaveAsUshort(85, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.18", "% max, 18⁰").SaveAsUshort(85, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.19", "% max, 19⁰").SaveAsUshort(85, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.20", "% max, 20⁰").SaveAsUshort(85, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.21", "% max, 21⁰").SaveAsUshort(80, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.22", "% max, 22⁰").SaveAsUshort(80, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.23", "% max, 23⁰").SaveAsUshort(80, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.24", "% max, 24⁰").SaveAsUshort(80, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.25", "% max, 25⁰").SaveAsUshort(80, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.26", "% max, 26⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.27", "% max, 27⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.28", "% max, 28⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.29", "% max, 29⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddStored(new SignalSpecification("encoder.settings.limit.30", "% max, 30⁰").SaveAsUshort(75, true, 1, 1, 100));
            signals.AddSignal("encoder.point", "Коэфициент компенсации поворота");

            var rv = signals.GetSignal((SensorName.Tank(SignalName.Level)));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 700, 0);
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 3200, 1000);
            }


            rv = signals.GetSignal((SensorName.Tank(SignalName.Temperature)));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 385, 0);
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 2000, 1000);
            }

            rv = signals.GetSignal((SensorName.Brake(SignalName.Pressure)));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 385, 0);
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 2000, 100);
            }


            rv = signals.GetSignal((SensorName.Steering(SignalName.Pressure)));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 385, 0);
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 2000, 500);
            }


            rv = signals.GetSignal((SensorName.Filter(SignalName.Pressure)));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 385, 0);
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 2000, 500);
            }


            rv = signals.GetSignal((SensorName.Cabel(SignalName.Pressure)));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 385, 0);
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 2000, 500);
            }

            rv = signals.GetSignal(SensorName.Phase(1, SignalName.Voltage));
            if (!signals.IsCheckOrLoadCalibrationPointExist(rv.Specification.Id))
            {
                signals.AddCalibrationPoint(rv.Specification.Id, "min", 0, 0);
                //signals.AddCalibrationPoint(rv.Specification.Id, 500, 1583.33f); // 36V transf
                signals.AddCalibrationPoint(rv.Specification.Id, "max", 500, 1357.14f); // 42V transf
            }



            #endregion
        }
Exemplo n.º 14
0
            public static void Init(IJournal journal, ISignalsFactory signals)
            {
                mLevelAlarmMin = signals.GetSignal("tank.level.alarm.min").Value;           // Уровень в баке, авария
                mLevelWarnMin  = signals.GetSignal("tank.level.warning.min").Value;         // Уровень в баке, предупреждение
                mTempWarnMax   = signals.GetSignal("tank.temperature.warning.max").Value;   // Т в баке, предупреждение
                mTempAlarmMax  = signals.GetSignal("tank.temperature.alarm.max").Value;     // Т в баке, авария

                IsNormalState = true;

                mTankTemperature = new Sensor(SensorName.Tank(SignalName.Temperature), signals);
                mTankLevel       = new Sensor(SensorName.Tank(SignalName.Level), signals)
                {
                    OnUpdate = value =>
                    {
                        if (value <= mLevelAlarmMin)
                        {
                            if (OnError != null)
                            {
                                OnError(SystemStateCodes.Alarm.TankLevelMin);
                            }

                            IsNormalState = false;
                            return;
                        }

                        if (value > mLevelWarnMin)
                        {
                            return;
                        }
                        if (OnWarning != null)
                        {
                            OnWarning(SystemStateCodes.Warning.TankLevelMin);
                        }

                        // датчик температуры конструктивно выполнен в одном корпусе с датчиком уровня, но датчик уровня является приоритетным
                        if (mTankTemperature.IsAvailable)
                        {
                            if (mTankTemperature.Value > mTempAlarmMax)
                            {
                                if (OnError != null)
                                {
                                    OnError(SystemStateCodes.Alarm.TankTemperatureMin);
                                }

                                IsNormalState = false;
                                return;
                            }

                            if (mTankTemperature.Value < mTempWarnMax)
                            {
                                return;
                            }
                            if (OnWarning != null)
                            {
                                OnWarning(SystemStateCodes.Warning.TankTemperatureMin);
                            }
                        }

                        IsNormalState = true;
                    }
                };
            }
Exemplo n.º 15
0
            public static void Init(IJournal journal, ISignalsFactory signals)
            {
                mPressureAlarmMin     = signals.GetSignal("pump.alarm.pressure.min").Value;
                mPressureAlarmMax     = signals.GetSignal("pump.alarm.pressure.max").Value;
                mStartTrackingTimeout = signals.GetSignal("pump.alarm.startup.timeout").Value;

                mFilterPressureDifferenceWarnMax  = signals.GetSignal("filter.pressure.warning.max").Value;
                mFilterPressureDifferenceAlarmMax = signals.GetSignal("filter.pressure.alarm.max").Value;

                // разница по давлению актуальна только при наличии датчика в гидромагистрали кузова, т.е. в нашем случае - рулевого
                mFilterPressure = new Sensor(SensorName.Filter(SignalName.Pressure), signals);

                // датчик давления в системе рулевого и его обработка
                mSteeringPressure = new Sensor(SensorName.Steering(SignalName.Pressure), signals)
                {
                    OnUpdate = value =>
                    {
                        if (mStartAt == DateTime.MaxValue)
                        {
                            return;
                        }

                        if (DateTime.Now.Subtract(mStartAt).TotalSeconds < mStartTrackingTimeout)
                        {
                            return;
                        }

                        if ((mPressureAlarmMax > value) && (value > mPressureAlarmMin))
                        {
                            return;
                        }

                        if (OnError != null)
                        {
                            OnError(SystemStateCodes.Alarm.SystemPressureOutOfRange);
                            return;
                        }

                        if (!mFilterPressure.IsAvailable)
                        {
                            return;
                        }

                        // проверка на разницу давления на фильтре, если датчик давления перед фильтром доступен
                        var filterDifference = Math.Abs(value - mFilterPressure.Value);
                        if (filterDifference > mFilterPressureDifferenceAlarmMax)
                        {
                            if (OnError != null)
                            {
                                OnError(SystemStateCodes.Alarm.FilterPressureMax);
                                return;
                            }
                        }

                        if (!(filterDifference > mFilterPressureDifferenceWarnMax))
                        {
                            return;
                        }
                        if (OnWarning != null)
                        {
                            OnWarning(SystemStateCodes.Warning.FilterPressureMax);
                        }
                    }
                };
            }
Exemplo n.º 16
0
 /// <summary>
 /// Прописываем датчик в общую регистровую карту
 /// </summary>
 /// <param name="id"></param>
 /// <param name="factory"></param>
 public Sensor(string id, ISignalsFactory factory)
 {
     mSignal  = factory.GetSignal(id);
     mChannel = factory.GetSignal(string.Format("{0}.channel", id));
 }