示例#1
0
        public override void SetCalibParams(CalibrateParam input)
        {
            NptParam_1KEX param = new NptParam_1KEX()
            {
                Sensor = new Sensor()
                {
                    SensorUID = input.Sensor.SensorUID
                },
                MinValue = input.MinValue,
                MaxValue = input.MaxValue
            };

            SetParams(param);
        }
示例#2
0
        public override void SetParams(NptParam input0)
        {
            _PARAMS_PREV = (UInt16[])_PARAMS.Clone();
            NptParam_1KEX input = (NptParam_1KEX)input0;

            ByteArrayHelpers.WriteSingle(ref _PARAMS, 0, input.ErrOut5);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 2, input.ErrOut4);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 4, input.ErrOut3);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 6, input.ErrOut2);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 8, input.ErrOut1);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 10, input.ErrOut0);
            _PARAMS[12] = (ushort)input.ModeOut;
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 13, input.Ftime);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 15, input.MaxValue);
            ByteArrayHelpers.WriteSingle(ref _PARAMS, 17, input.MinValue);
            _PARAMS[19] = (ushort)input.FuncSqrt;
            _PARAMS[20] = (ushort)input.ModeTermRes;
            _PARAMS[21] = (ushort)(input.ColdSold ? 1 : 0);
            _PARAMS[22] = (ushort)input.Sensor.SensorUID.Senstype;
            _PARAMS[23] = (ushort)input.Sensor.SensorUID.Class;
        }
示例#3
0
        public override void OnDeviceRegistersRead(string Name)
        {
            base.OnDeviceRegistersRead(Name);
            switch (Name)
            {
            case "PARAMS":
                _PARAMS_PREV              = (UInt16[])_PARAMS.Clone();
                CurrentParams             = new NptParam_1KEX();
                CurrentParams.ErrOut5     = ByteArrayHelpers.ReadSingle(_PARAMS, 0);
                CurrentParams.ErrOut4     = ByteArrayHelpers.ReadSingle(_PARAMS, 2);
                CurrentParams.ErrOut3     = ByteArrayHelpers.ReadSingle(_PARAMS, 4);
                CurrentParams.ErrOut2     = ByteArrayHelpers.ReadSingle(_PARAMS, 6);
                CurrentParams.ErrOut1     = ByteArrayHelpers.ReadSingle(_PARAMS, 8);
                CurrentParams.ErrOut0     = ByteArrayHelpers.ReadSingle(_PARAMS, 10);
                CurrentParams.ModeOut     = _PARAMS[12];
                CurrentParams.Ftime       = ByteArrayHelpers.ReadSingle(_PARAMS, 13);
                CurrentParams.ModeTermRes = (byte)_PARAMS[20];
                CurrentParams.ColdSold    = _PARAMS[21] == 1;
                int sclass = _PARAMS[23], stype = _PARAMS[22];
                CurrentParams.Sensor = AppManager.Worker.FindSensor(DEVTYPE, new SensorUID()
                {
                    Class = sclass, Senstype = stype
                });
                CurrentParams.MaxValue = ByteArrayHelpers.ReadSingle(_PARAMS, 15);
                CurrentParams.MinValue = ByteArrayHelpers.ReadSingle(_PARAMS, 17);
                CurrentParams.FuncSqrt = _PARAMS[19];

                break;

            case "STATE":
                DeviceError     = _STATE[4];
                OutCurrent      = ByteArrayHelpers.ReadSingle(_STATE, 5);
                Tempr           = ByteArrayHelpers.ReadSingle(_STATE, 7);
                ShowDeviceError = DeviceError != 0 && DeviceError != 0x800;
                break;
            }
        }