Пример #1
0
        private LedAlarmConfig GetInitialAlarmConfg(string sn)
        {
            LedAlarmConfig ledAlarm = new LedAlarmConfig();
            ledAlarm.SN = sn;
            ledAlarm.ParameterAlarmConfigList = new List<ParameterAlarmConfig>();

            ParameterAlarmConfig param = new ParameterAlarmConfig();
            param.ParameterType = StateQuantityType.Temperature;
            param.HighThreshold = 60;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.ParameterType = StateQuantityType.Humidity;
            param.HighThreshold = 60;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.ParameterType = StateQuantityType.Voltage;
            param.LowThreshold = 4;
            param.HighThreshold = 12;
            param.Level = AlarmLevel.Warning;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.ParameterType = StateQuantityType.Voltage;
            param.HighThreshold = 3.5;
            param.LowThreshold = 0;
            param.Level = AlarmLevel.Malfunction;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.ParameterType = StateQuantityType.FanSpeed;
            param.LowThreshold = 1000;
            param.LowThreshold = 0;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            return ledAlarm;
        }
        private LedAlarmConfig GetAlarmConfg()
        {
            LedAlarmConfig ledAlarm = new LedAlarmConfig();
            ledAlarm.SN = SN;
            ledAlarm.ParameterAlarmConfigList = new List<ParameterAlarmConfig>();

            ParameterAlarmConfig param = new ParameterAlarmConfig();
            param.Disable = !IsEnableTempAlarm;
            param.ParameterType = StateQuantityType.Temperature;
            if (_tempType == TemperatureType.Fahrenheit)
            {
                param.HighThreshold = (int)MonitorAllConfig.Instance().GetTempValueChanged(TemperatureType.Celsius, TemperatureThreshold);
            }
            else
            {
                param.HighThreshold = TemperatureThreshold;
            }
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.Disable = !IsEnableHumidityAlarm;
            param.ParameterType = StateQuantityType.Humidity;
            param.HighThreshold = HumidityThreshold;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.Disable = !IsEnableVoltageAlarm;
            param.ParameterType = StateQuantityType.Voltage;
            param.LowThreshold = VoltageThreshold;
            if (param.LowThreshold >= param.HighThreshold)
            {
                param.HighThreshold = VoltageThreshold + 0.1;
            }
            if (param.HighThreshold > 12)
            {
                param.HighThreshold = 12;
            }
            param.Level = AlarmLevel.Warning;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.Disable = !IsEnableVoltageErrorAlarm;
            param.ParameterType = StateQuantityType.Voltage;
            param.HighThreshold = VoltageErrorThreshold;
            param.LowThreshold = 0;
            param.Level = AlarmLevel.Malfunction;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            param.Disable = !IsEnableFanSpeedAlarm;
            param.ParameterType = StateQuantityType.FanSpeed;
            param.LowThreshold = FanSpeedThreshold;
            param.HighThreshold = 0;
            ledAlarm.ParameterAlarmConfigList.Add((ParameterAlarmConfig)param.Clone());
            return ledAlarm;
        }