Exemplo n.º 1
0
        /// <summary>
        /// 设定温度偏移
        /// </summary>
        /// <param name="Address">站号地址</param>
        /// <param name="Channel">通道地址</param>
        /// <param name="InL">标定下限,修正前</param>
        /// <param name="OuL">标定下限,修正后</param>
        /// <param name="InH">标定上限,修正前</param>
        /// <param name="OuH">标定上限,修正后</param>
        /// <returns>成功或失败</returns>
        public static bool SetTempDeviation(byte Address, ushort Channel, float InL, float OuL, float InH, float OuH)
        {
            if (PMAMaster == null)
            {
                return(false);
            }
            byte   SlaveAddress = Address;
            ushort StartAddress = (ushort)(17465 + Channel * 512);

            ushort[] Value = new ushort[4];
            Value[0] = Auxiliary.ShortToUshort((short)(InL * 10f));
            Value[1] = Auxiliary.ShortToUshort((short)(OuL * 10f));
            Value[2] = Auxiliary.ShortToUshort((short)(InH * 10f));
            Value[3] = Auxiliary.ShortToUshort((short)(OuH * 10f));

            try
            {
                lock (LockValue)
                {
                    PMAMaster.WriteMultipleRegisters(SlaveAddress, StartAddress, Value);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 设定指定通道温度
        /// </summary>
        /// <param name="Address">站号地址</param>
        /// <param name="Channel">通道地址</param>
        /// <param name="Temp">设定的温度</param>
        /// <returns>成功或失败</returns>
        public static bool Set_SP(byte Address, ushort Channel, float Temp)
        {
            if (PMAMaster == null)
            {
                return(false);
            }
            byte   SlaveAddress = Address;
            ushort StartAddress = (ushort)(17526 + Channel * 512);
            ushort Value        = Auxiliary.ShortToUshort((short)(Temp * 10));
            float  SP           = 0;

            try
            {
                lock (LockValue)
                {
                    PMAMaster.WriteSingleRegister(SlaveAddress, StartAddress, Value);
                }
                if (Get_SP(Address, Channel, ref SP) == false)
                {
                    return(false);
                }

                if (SP != Temp)
                {
                    return(false);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 设定加热功率上限
        /// </summary>
        /// <param name="Address">站号地址</param>
        /// <param name="Channel">通道地址</param>
        /// <param name="Limit">功率上限值</param>
        /// <returns></returns>
        public static bool SetPowerLimit(byte Address, ushort Channel, ushort Limit)
        {
            if (PMAMaster == null)
            {
                return(false);
            }
            byte   SlaveAddress = Address;
            ushort StartAddress = (ushort)(17572 + Channel * 512);
            ushort Value        = Auxiliary.ShortToUshort((short)(Limit * 10));

            try
            {
                lock (LockValue)
                {
                    PMAMaster.WriteSingleRegister(SlaveAddress, StartAddress, Value);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }