Example #1
0
 public static ItemConfigService GetInstance()
 {
     if (_instance == null)
     {
         _instance = new ItemConfigService();
     }
     return _instance;
 }
Example #2
0
 public static ItemConfigService GetInstance()
 {
     if (_instance == null)
     {
         _instance = new ItemConfigService();
     }
     return(_instance);
 }
Example #3
0
        /// <summary>
        /// 取得等效树木配置
        /// </summary>
        /// <returns></returns>
        public float getTreeConfig()
        {
            ItemConfig itemConfig = ItemConfigService.GetInstance().GetItemConfigByName(ItemConfig.Tree);

            if (itemConfig == null)
            {
                return(ItemConfig.defaultreductionRate);
            }
            else
            {
                return(itemConfig.value);
            }
        }
Example #4
0
        /// <summary>
        /// 取得CO2减排换算率
        /// </summary>
        /// <returns></returns>
        protected float getCO2Rate()
        {
            ItemConfig modcon = ItemConfigService.GetInstance().GetItemConfigByName(ItemConfig.CO2);

            if (modcon == null)
            {
                return(1F);
            }
            else
            {
                return(modcon.value);
            }
        }
Example #5
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);
            }
        }
Example #6
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 getUserItemData(User user, int reportType, string startTime, string endTime)
        {
            Hashtable datahash = new Hashtable();
            double    co2Rate  = ItemConfigService.GetInstance().getCO2Config();

            switch (reportType)
            {
            //--------日报表数据 start--------------
            case DataReportType.TODAY_REPORT_CODE:    //日报表
                //日发电量
                float energy = CollectorMonthDayDataService.GetInstance().getDayData(user.plantUnits(), startTime);
                //add发电量
                datahash.Add(DataItem.TODAY_ENERGY, StringUtil.formatFloat(energy) + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).unit);
                //今日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, user.currencies + " " + Currencies.format(user.currencies, energy * user.revenueRate));

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

                //累计CO2减排
                datahash.Add(DataItem.TODAY_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(user.TotalReductiong) + " " + user.TotalReductiongUnit);

                return(datahash);

            //--------周报表数据--------------
            case DataReportType.WEEK_REPORT_CODE:
                //周发电量
                float  w_energy  = 0;
                double w_revenue = 0;
                foreach (Plant plant in user.plants)
                {
                    Hashtable w_dataHash = CollectorMonthDayDataService.GetInstance().GetUnitBetweenMonthData(plant.plantUnits, startTime, endTime);
                    float     tmpenergy  = 0;
                    foreach (Object o in w_dataHash.Values)
                    {
                        tmpenergy += StringUtil.stringtoFloat(o.ToString());
                    }
                    w_energy  += tmpenergy;
                    w_revenue += tmpenergy * plant.revenueRate;
                }

                datahash.Add(DataItem.WEEK_ENERGY, StringUtil.formatDouble(w_energy) + " " + MonitorType.getMonitorTypeByCode(MonitorType.PLANT_MONITORITEM_ENERGY_CODE).unit);
                //周CO2减排
                double co2reduce1 = Plant.computeCO2Reduce(co2Rate, w_energy);
                datahash.Add(DataItem.WEEK_AVOIDED_CO2, StringUtil.formatDouble(co2reduce1) + " " + Plant.computeReduceUnit(co2Rate * w_energy));
                //周收益
                datahash.Add(DataItem.WEEK_REVENUE, user.currencies + " " + Currencies.format(user.currencies, w_revenue));
                //累计总发电量
                datahash.Add(DataItem.WEEK_TOTAL_ENERGY, user.DisplayTotalEnergy + " " + user.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.WEEK_TOTAL_REVENUE, user.currencies + " " + user.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.WEEK_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(user.TotalReductiong) + " " + user.TotalReductiongUnit);
                return(datahash);

            //--------月报表------------
            case DataReportType.MONTH_REPORT_CODE:
                float  m_energy  = 0;
                double m_revenue = 0;
                foreach (Plant plant in user.plants)
                {
                    Hashtable m_dataHash = CollectorMonthDayDataService.GetInstance().GetUnitBetweenMonthData(plant.plantUnits, startTime, endTime);
                    float     tmpenergy  = 0;
                    foreach (Object o in m_dataHash.Values)
                    {
                        tmpenergy += StringUtil.stringtoFloat(o.ToString());
                    }
                    m_energy  += tmpenergy;
                    m_revenue += tmpenergy * plant.revenueRate;
                }

                datahash.Add(DataItem.MONTH_ENERGY, StringUtil.formatDouble(m_energy) + " " + 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, user.currencies + " " + Currencies.format(user.currencies, m_revenue));
                //累计总发电量
                datahash.Add(DataItem.MONTH_TOTAL_ENERGY, user.DisplayTotalEnergy + " " + user.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.MONTH_TOTAL_REVENUE, user.currencies + " " + user.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.MONTH_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(user.TotalReductiong) + " " + user.TotalReductiongUnit);
                return(datahash);

            //------年报表-----------------
            case DataReportType.YEAR_REPORT_CODE:
                int    startYear = int.Parse(startTime.Substring(0, 4));
                int    endYear   = int.Parse(endTime.Substring(0, 4));
                float  y_energy  = 0;
                double y_revenue = 0;
                foreach (Plant plant in user.plants)
                {
                    Hashtable y_dataHash = CollectorYearMonthDataService.GetInstance().GetUnitBetweenYearData(user.plantUnits(), startYear, endYear);
                    float     tmpenergy  = 0;
                    foreach (Object o in y_dataHash.Values)
                    {
                        tmpenergy += StringUtil.stringtoFloat(o.ToString());
                    }
                    y_energy  += tmpenergy;
                    y_revenue += tmpenergy * plant.revenueRate;
                }

                datahash.Add(DataItem.YEAR_ENERGY, StringUtil.formatDouble(y_energy) + " " + 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, user.currencies + " " + Currencies.format(user.currencies, y_revenue));
                //累计总发电量
                datahash.Add(DataItem.YEAR_TOTAL_ENERGY, user.DisplayTotalEnergy + " " + user.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.YEAR_TOTAL_REVENUE, user.currencies + " " + user.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.YEAR_TOTAL_AVOIDED_CO2, StringUtil.formatDouble(user.TotalReductiong) + " " + user.TotalReductiongUnit);
                return(datahash);

            //------总量报表-----------------
            case DataReportType.TOTAL_REPORT_CODE:
                //累计总发电量
                datahash.Add(DataItem.TOTAL_ENERGY, user.DisplayTotalEnergy + " " + user.TotalEnergyUnit);
                //累计总收入
                datahash.Add(DataItem.TOTAL_REVENUE, user.currencies + " " + user.DisplayRevenue);
                //累计CO2减排
                datahash.Add(DataItem.TOTAL_AVOIDED_CO2, StringUtil.formatDouble(user.TotalReductiong) + " " + user.TotalReductiongUnit);
                return(datahash);

            default:
                return(datahash);
            }
        }