Esempio n. 1
0
 public static DeviceDataCountService GetInstance()
 {
     if (_instance == null)
     {
         _instance = new DeviceDataCountService();
     }
     return(_instance);
 }
 public static DeviceDataCountService GetInstance()
 {
     if (_instance == null)
     {
         _instance = new DeviceDataCountService();
     }
     return _instance;
 }
Esempio n. 3
0
        /// <summary>
        /// 单个电站数据项数据
        /// </summary>
        /// <param name="plant">电站</param>
        /// <param name="dataItemCode">数据项代码</param>
        /// <param name="startTime">开始时间,日报表只取开始时间,周报表的时间格式为:yyyyMMdd-yyyyMMdd</param>
        /// <param name="endTime"></param>
        /// <returns>数据项为key</returns>
        private Hashtable getPlantItemData(Plant plant, int reportType, string startTime, string endTime)
        {
            Hashtable datahash = new Hashtable();
            float     co2Rate  = ItemConfigService.GetInstance().getCO2Config();

            switch (reportType)
            {
            //--------日报表数据 start--------------
            case DataReportType.TODAY_REPORT_CODE:    //日报表
                //日发电量
                float energy = CollectorMonthDayDataService.GetInstance().getDayData(plant.plantUnits, startTime);
                //add发电量
                datahash.Add(DataItem.TODAY_ENERGY, StringUtil.formatDouble(energy, "0.00") + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).unit);
                //add日最大功率 和发生时间
                int             year  = int.Parse(startTime.Substring(0, 4));
                int             month = int.Parse(startTime.Substring(4, 2));
                int             day   = int.Parse(startTime.Substring(6, 2));
                DeviceDataCount ddc   = DeviceDataCountService.GetInstance().GetPlantMax(plant.id, MonitorType.PLANT_MONITORITEM_POWER_CODE, year, month, day);
                string          res   = LanguageUtil.getDesc("NODATA");
                if (ddc != null)
                {
                    res = ddc.maxTime + "(" + ddc.maxValue + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_POWER_CODE).unit + ")";
                }
                datahash.Add(DataItem.TODAY_MAX_POWER, res);
                //今日CO2减排

                double co2reduce = Plant.computeCO2Reduce(co2Rate, energy);
                datahash.Add(DataItem.TODAY_AVOIDED_CO2, StringUtil.formatDouble(co2reduce) + " " + Plant.computeReduceUnit(co2Rate * energy));
                //日收入
                datahash.Add(DataItem.TODAY_REVENUE, plant.currencies + " " + Currencies.format(plant.currencies, energy * plant.revenueRate));

                //累计总发电量
                datahash.Add(DataItem.TODAY_TOTAL_ENERGY, plant.DisplayTotalEnergy + " " + plant.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.TODAY_TOTAL_REVENUE, plant.currencies + " " + plant.DisplayRevenue);

                //累计CO2减排
                datahash.Add(DataItem.TODAY_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(plant.Reductiong) + " " + plant.ReductiongUnit);

                //投资收益
                datahash.Add(DataItem.TODAY_RATE, Math.Round(energy / plant.design_power, 2) + " kWh/kWp");

                return(datahash);

            //--------周报表数据--------------
            case DataReportType.WEEK_REPORT_CODE:
                //周发电量
                Hashtable w_dataHash = CollectorMonthDayDataService.GetInstance().GetUnitBetweenMonthData(plant.plantUnits, startTime, endTime);
                float     w_energy   = 0;
                foreach (Object o in w_dataHash.Values)
                {
                    w_energy += StringUtil.stringtoFloat(o.ToString());
                }
                datahash.Add(DataItem.WEEK_ENERGY, StringUtil.formatDouble(w_energy, "0.00") + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).unit);
                //周CO2减排
                double co2reduce1 = Plant.computeCO2Reduce(co2Rate, w_energy);
                datahash.Add(DataItem.WEEK_AVOIDED_CO2, co2reduce1 + " " + Plant.computeReduceUnit(co2Rate * w_energy));
                //周收益
                datahash.Add(DataItem.WEEK_REVENUE, plant.currencies + " " + Currencies.format(plant.currencies, w_energy * plant.revenueRate));
                //累计总发电量
                datahash.Add(DataItem.WEEK_TOTAL_ENERGY, plant.DisplayTotalEnergy + " " + plant.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.WEEK_TOTAL_REVENUE, plant.currencies + " " + plant.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.WEEK_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(plant.Reductiong) + " " + plant.ReductiongUnit);

                //投资收益
                datahash.Add(DataItem.WEEK_RATE, Math.Round(w_energy / plant.design_power, 2) + " kWh/kWp");
                return(datahash);

            //--------月报表------------
            case DataReportType.MONTH_REPORT_CODE:
                Hashtable m_dataHash = CollectorMonthDayDataService.GetInstance().GetUnitBetweenMonthData(plant.plantUnits, startTime, endTime);
                float     m_energy   = 0;
                foreach (Object o in m_dataHash.Values)
                {
                    m_energy += StringUtil.stringtoFloat(o.ToString());
                }
                datahash.Add(DataItem.MONTH_ENERGY, StringUtil.formatDouble(m_energy, "0.00") + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).unit);
                //月CO2减排
                double co2reduce_m = Plant.computeCO2Reduce(co2Rate, m_energy);
                datahash.Add(DataItem.MONTH_AVOIDED_CO2, StringUtil.formatDouble(co2reduce_m) + " " + Plant.computeReduceUnit(co2Rate * m_energy));
                //月收益
                datahash.Add(DataItem.MONTH_REVENUE, plant.currencies + " " + Currencies.format(plant.currencies, m_energy * plant.revenueRate));
                //累计总发电量
                datahash.Add(DataItem.MONTH_TOTAL_ENERGY, plant.DisplayTotalEnergy + " " + plant.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.MONTH_TOTAL_REVENUE, plant.currencies + " " + plant.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.MONTH_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(plant.Reductiong) + " " + plant.ReductiongUnit);

                //投资收益
                datahash.Add(DataItem.MONTH_RATE, Math.Round(m_energy / plant.design_power, 2) + " kWh/kWp");
                return(datahash);

            //------年报表-----------------
            case DataReportType.YEAR_REPORT_CODE:
                int       startYear  = int.Parse(startTime.Substring(0, 4));
                int       endYear    = int.Parse(endTime.Substring(0, 4));
                Hashtable y_dataHash = CollectorYearMonthDataService.GetInstance().GetUnitBetweenYearData(plant.plantUnits, startYear, endYear);
                float     y_energy   = 0;
                foreach (Object o in y_dataHash.Values)
                {
                    y_energy += StringUtil.stringtoFloat(o.ToString());
                }
                datahash.Add(DataItem.YEAR_ENERGY, StringUtil.formatDouble(y_energy, "0.00") + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).unit);
                //年CO2减排
                double co2reduce_y = Plant.computeCO2Reduce(co2Rate, y_energy);
                datahash.Add(DataItem.YEAR_AVOIDED_CO2, StringUtil.formatDouble(co2reduce_y) + " " + Plant.computeReduceUnit(co2Rate * y_energy));
                //年收益
                datahash.Add(DataItem.YEAR_REVENUE, plant.currencies + " " + Currencies.format(plant.currencies, y_energy * plant.revenueRate));
                //累计总发电量
                datahash.Add(DataItem.YEAR_TOTAL_ENERGY, plant.DisplayTotalEnergy + " " + plant.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.YEAR_TOTAL_REVENUE, plant.currencies + " " + plant.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.YEAR_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(plant.Reductiong) + " " + plant.ReductiongUnit);
                //投资收益
                datahash.Add(DataItem.YEAR_RATE, Math.Round(y_energy / plant.design_power, 2) + " kWh/kWp");
                return(datahash);

            //------总量报表-----------------
            case DataReportType.TOTAL_REPORT_CODE:
                //累计总发电量
                datahash.Add(DataItem.TOTAL_ENERGY, plant.DisplayTotalEnergy + " " + plant.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.TOTAL_REVENUE, plant.currencies + " " + plant.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.TOTAL_AVOIDED_CO2, StringUtil.formatDouble(plant.Reductiong) + " " + plant.ReductiongUnit);
                //投资收益
                datahash.Add(DataItem.TOTAL_RATE, Math.Round(plant.TotalEnergy / plant.design_power, 2) + " kWh/kWp");
                return(datahash);

            default:
                return(datahash);
            }
        }