using System;

namespace MECF.Framework.RT.EquipmentLibrary.HardwareUnits.UPS
{
    public class EATONUPS:UPSBase
    {
        public EATONUPS(string module, string name, string scRoot) : base(module, name, scRoot)
        {
            Oids.Add("InputVoltage", ".1.3.6.1.4.1.534.1.3.4.1.2.1");//输入电压，输入电压为0说明使用UPS    xupsInputVoltage
            Oids.Add("BatteryVoltage", ".1.3.6.1.4.1.534.1.2.2.0");//电池当前电压V  xupsBatVoltage
            Oids.Add("BatteryRemainsTime", ".1.3.6.1.4.1.534.1.2.1.0");//剩余时间s,要除60   xupsBatTimeRemaining
            Oids.Add("upsOutputSource", ".1.3.6.1.4.1.534.1.4.5.0");//当前输出源          xupsOutputSource
            Oids.Add("BatteryUnderResidue", ".1.3.6.1.4.1.534.1.2.4.0");//电量剩余百分比，直接用数值   xupsBatCapacity

        }

        public override void ParseOutputSource(string value)
        {
            //     xupsOutputSource DESCRIPTION

            //    SYNTAX INTEGER {
            //        other(1),
            //none(2),
            //normal(3),              
            //bypass(4),
            //battery(5),
            //booster(6),             
            //reducer(7),             
            //parallelCapacity(8),    
            //parallelRedundant(9),   
            //highEfficiencyMode(10), 
            //maintenanceBypass(11),   
            //essMode(12)
            //}
            //"The present source of output power.  The enumeration
            // none(2) indicates that there is no source of output
            // power(and therefore no output power), for example,
            // the system has opened the output breaker.

            // 'normal', 'bypass', and 'battery' indicate those common UPS statuses.

            // 'booster' and 'reducer' indicate boost or buck operation, for

            // line - interactive UPSs only.

            // 'parallelCapacity' and 'parallelRedundant' indicate a normal parallel

            // UPS system, in either Parallel for Capacity or Redundancy configuration.

            // 'highEfficiencyMode' is normal but enhanced by High Efficiency mode.

            // 'maintenanceBypass' indicates that the UPS is in Maintenance / Manual

            // Bypass mode.

            // 'essMode' is normal but enhanced by Energy Saver System.

            // 'other' covers any other, unusual conditions."

            if (value == "2") //None
            {
                UPSPowerAlarm = true;
            }
            else
                UPSPowerAlarm = false;
        }

        public override void ParseBatteryRemainsTime(string value)
        {
            BatteryRemainsTime = Convert.ToInt32(value)/60;
        }

        public override void ParseBatteryVoltage(string value)
        {
            BatteryVoltage = Convert.ToSingle(value);
        }

        public override void ParseInputVoltage(string value)
        {
            InputVoltage = Convert.ToSingle(value);
        }
    }
}
