/// <summary>
        /// 设置年度的最大值发生时间
        /// </summary>
        /// <param name="deviceDataCount"></param>
        /// <returns></returns>
        public void SetYearMax(DeviceDataCount deviceDataCount)
        {
            string          cacheKey = CacheKeyUtil.buildDeviceDataCountYearKey(deviceDataCount.year, deviceDataCount.deviceId, deviceDataCount.monitorCode);
            object          obj      = MemcachedClientSatat.getInstance().Get(cacheKey);
            DeviceDataCount ddc;

            if (obj == null || string.IsNullOrEmpty(obj.ToString()))
            {
                ddc = _ReportGroupDao.GetYearMax(deviceDataCount);
                if (ddc != null)
                {
                    if (deviceDataCount.maxValue < ddc.maxValue)
                    {
                        deviceDataCount.maxValue = ddc.maxValue;
                        deviceDataCount.maxTime  = ddc.maxTime;
                    }
                }
                MemcachedClientSatat.getInstance().Add(cacheKey, deviceDataCount, DateTime.Now.AddDays(7));
            }
            else
            {
                ddc = (DeviceDataCount)obj;
                if (deviceDataCount.maxValue > ddc.maxValue)
                {
                    ddc.maxValue = deviceDataCount.maxValue;
                    ddc.maxTime  = deviceDataCount.maxTime;
                    MemcachedClientSatat.getInstance().Set(cacheKey, ddc);
                }
            }
        }
        /// <summary>
        /// 取得设备某个测点最大发生时间和值
        /// </summary>
        /// <param name="deviceId">设备id</param>
        /// <param name="monitorCode">测点代码,参见MonitorType.cs,比如:MonitorType.PLANT_MONITORITEM_POWER_CODE</param>
        /// <param name="year">年</param>
        /// <param name="month">月</param>
        /// <param name="day">日</param>
        /// <returns></returns>
        public DeviceDataCount GetDeviceMax(int deviceId, int monitorCode, int year, int month, int day)
        {
            DeviceDataCount ddc = new DeviceDataCount()
            {
                deviceId = deviceId, deviceTable = TableUtil.PLANT, monitorCode = monitorCode, year = year, day = day, month = month
            };

            return(this.Get(ddc));
        }
示例#3
0
        /// <summary>
        /// 取得采集器日数据列表
        /// </summary>
        /// <returns></returns>
        public void GetCollectorDaydataList()
        {
            //将单元头部的发电量加入历史测点数据map中,然后统一处理
            historyMonitorMap[MonitorType.PLANT_MONITORITEM_ENERGY_CODE] = messageHeader.DayEnergy;
            historyMonitorMap[MonitorType.PLANT_MONITORITEM_POWER_CODE]  = messageHeader.Power;

            int collectorID = GetCollectorId();
            //根据历史测点数据构建设备天数据
            //这里需要改进为依据设备时间,防止设备数据的时间和采集器的时间是不一致的
            CollectorDayData mdd;
            string           mapObjectKey;

            //遍历测点数据
            foreach (int key in historyMonitorMap.Keys)
            {
                mapObjectKey = CacheKeyUtil.buildCollectorDayDataKey(collectorID, messageHeader.year + messageHeader.month, int.Parse(messageHeader.day), key);
                if (!collectordayDataMap.ContainsKey(mapObjectKey))
                {
                    //先从缓存中取得
                    mdd = CollectorDayDataService.GetInstance().getCollectorDayData(collectorID, key, int.Parse(messageHeader.day), int.Parse(messageHeader.year), int.Parse(messageHeader.month));
                    if (mdd == null)
                    {
                        mdd = new CollectorDayData()
                        {
                            collectorID = collectorID, sendDay = int.Parse(messageHeader.day), monitorCode = key, yearmonth = messageHeader.year + messageHeader.month
                        }
                    }
                    ;
                    collectordayDataMap[mapObjectKey] = mdd;
                }
                else
                {
                    mdd = collectordayDataMap[mapObjectKey];
                }
                float newValue = historyMonitorMap[key] == null?0:float.Parse(historyMonitorMap[key].ToString());
                mdd.dataContent    += "#" + messageHeader.hour + messageHeader.minute + messageHeader.second + ":" + newValue;
                mdd.sendtime        = messageHeader.TimeNow;
                mdd.localAcceptTime = DateTime.Now;
                mdd.yearmonth       = messageHeader.year + messageHeader.month;
                mdd.changed         = true;
                //将功率和关照的最大发生时间记录下来.稍后优化下
                if (key == MonitorType.PLANT_MONITORITEM_POWER_CODE)
                {
                    //if (collectorID >= 189 && collectorID < 199)
                    //{
                    //    LogUtil.writeline(messageHeader.TimeNow + "-" + newValue);
                    //}
                    collectorDataCount = new DeviceDataCount()
                    {
                        deviceId = collectorID, monitorCode = key, year = int.Parse(messageHeader.year), month = int.Parse(messageHeader.month), day = int.Parse(messageHeader.day), deviceTable = TableUtil.PLANT, maxValue = newValue, maxTime = messageHeader.TimeNow, localAcceptTime = DateTime.Now
                    };
                }
            }
        }
示例#4
0
        /// <summary>
        /// 加载设备日功率统计数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult PowerCount(int id, string startYYYYMMDDHH, string endYYYYMMDDHH)
        {
            int             year  = int.Parse(startYYYYMMDDHH.Substring(0, 4));
            int             month = int.Parse(startYYYYMMDDHH.Substring(4, 2));
            int             day1  = int.Parse(startYYYYMMDDHH.Substring(6, 2));
            int             day2  = int.Parse(endYYYYMMDDHH.Substring(6, 2));
            DeviceDataCount ddc1  = new DeviceDataCount()
            {
                deviceId = id, deviceTable = TableUtil.DEVICE, monitorCode = MonitorType.MIC_INVERTER_TOTALYGPOWER, year = year, day = day1, month = month
            };
            DeviceDataCount ddc2 = new DeviceDataCount()
            {
                deviceId = id, deviceTable = TableUtil.DEVICE, monitorCode = MonitorType.MIC_INVERTER_TOTALYGPOWER, year = year, day = day2, month = month
            };
            DeviceDataCount dayddc1 = DeviceDataCountService.GetInstance().Get(ddc1);
            DeviceDataCount dayddc2 = DeviceDataCountService.GetInstance().Get(ddc2);

            DeviceDataCount ddc    = ddc1;
            DeviceDataCount dayddc = dayddc1;

            if (dayddc1 != null && dayddc2 != null)
            {
                //取最大一天的
                if (dayddc1.maxValue >= dayddc2.maxValue)
                {
                    ddc    = ddc1;
                    dayddc = dayddc1;
                }
                else
                {
                    ddc    = ddc2;
                    dayddc = dayddc2;
                }
            }
            else if (dayddc1 != null && dayddc2 == null)
            {
                ddc    = ddc1;
                dayddc = dayddc1;
            }
            else if (dayddc1 == null && dayddc2 != null)
            {
                ddc    = ddc2;
                dayddc = dayddc2;
            }

            DeviceDataCount monthddc = DeviceDataCountService.GetInstance().GetMonthMax(ddc);
            DeviceDataCount yearddc  = DeviceDataCountService.GetInstance().GetYearMax(ddc);

            ViewData["dayddc"]   = dayddc;
            ViewData["monthddc"] = monthddc;
            ViewData["yearddc"]  = yearddc;
            return(View());
        }
示例#5
0
        /// <summary>
        /// 加载汇流箱设备总电流最大值统计数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult CurrentCount(int id, string YYYYMMDDHH)
        {
            int             year  = int.Parse(YYYYMMDDHH.Substring(0, 4));
            int             month = int.Parse(YYYYMMDDHH.Substring(4, 2));
            int             day   = int.Parse(YYYYMMDDHH.Substring(6, 2));
            DeviceDataCount ddc   = new DeviceDataCount()
            {
                deviceId = id, deviceTable = TableUtil.DEVICE, monitorCode = MonitorType.MIC_BUSBAR_TOTALCURRENT, year = year, day = day, month = month
            };
            DeviceDataCount dayddc   = DeviceDataCountService.GetInstance().Get(ddc);
            DeviceDataCount monthddc = DeviceDataCountService.GetInstance().GetMonthMax(ddc);
            DeviceDataCount yearddc  = DeviceDataCountService.GetInstance().GetYearMax(ddc);

            ViewData["dayddc"]   = dayddc;
            ViewData["monthddc"] = monthddc;
            ViewData["yearddc"]  = yearddc;
            return(View());
        }
        /// <summary>
        /// 取得年度的最大值发生时间
        /// </summary>
        /// <param name="deviceDataCount"></param>
        /// <returns></returns>
        public DeviceDataCount GetYearMax(DeviceDataCount deviceDataCount)
        {
            string cacheKey = CacheKeyUtil.buildDeviceDataCountYearKey(deviceDataCount.year, deviceDataCount.deviceId, deviceDataCount.monitorCode);
            object obj      = MemcachedClientSatat.getInstance().Get(cacheKey);

            if (obj == null || string.IsNullOrEmpty(obj.ToString()))
            {
                DeviceDataCount ddc = _ReportGroupDao.GetYearMax(deviceDataCount);
                if (ddc != null)
                {
                    MemcachedClientSatat.getInstance().Add(cacheKey, ddc);
                }
                return(ddc);
            }
            else
            {
                return((DeviceDataCount)obj);
            }
        }
        /// <summary>
        /// 取得电站或设备某个测点最大发生时间和值
        /// </summary>
        /// <param name="deviceDataCount"></param>
        /// <returns></returns>
        public DeviceDataCount Get(DeviceDataCount deviceDataCount)
        {
            string cacheKey = CacheKeyUtil.buildDeviceDataCountKey(deviceDataCount.year, deviceDataCount.month, deviceDataCount.day, deviceDataCount.deviceId, deviceDataCount.monitorCode);
            object obj      = MemcachedClientSatat.getInstance().Get(cacheKey);

            //暂时注释 待部署新的解析服务后 再放开
            if (obj != null && !string.IsNullOrEmpty(obj.ToString()))
            {
                return((DeviceDataCount)obj);
            }
            else
            {
                DeviceDataCount ddc = _ReportGroupDao.Get(deviceDataCount);
                if (ddc != null)
                {
                    MemcachedClientSatat.getInstance().Add(cacheKey, ddc);
                }
                return(ddc);
            }
        }
        /// <summary>
        /// 缓存单个统计对象
        /// </summary>
        /// <param name="deviceDataCount"></param>
        private void Cache(DeviceDataCount deviceDataCount)
        {
            string cacheKey = CacheKeyUtil.buildDeviceDataCountKey(deviceDataCount.year, deviceDataCount.month, deviceDataCount.day, deviceDataCount.deviceId, deviceDataCount.monitorCode);

            object obj = MemcachedClientSatat.getInstance().Get(cacheKey);

            if (obj != null && !string.IsNullOrEmpty(obj.ToString()))//存在即修改
            {
                DeviceDataCount ddc = (DeviceDataCount)obj;
                if (ddc.maxValue < deviceDataCount.maxValue)
                {
                    ddc.maxValue        = deviceDataCount.maxValue;
                    ddc.maxTime         = deviceDataCount.maxTime;
                    ddc.localAcceptTime = DateTime.Now;
                    mcs.Set(cacheKey, ddc);
                }
            }
            else
            {
                DeviceDataCount ddc = _ReportGroupDao.Get(deviceDataCount);

                if (ddc != null && deviceDataCount.maxValue < ddc.maxValue)
                {
                    deviceDataCount.maxValue = ddc.maxValue;
                    deviceDataCount.maxTime  = ddc.maxTime;
                }

                deviceDataCount.localAcceptTime = DateTime.Now;
                mcs.Add(cacheKey, deviceDataCount);
            }
            if (!persistentListKey.Contains(cacheKey))
            {
                persistentListKey.Add(cacheKey);
            }
            //设置月度最大
            SetMonthMax(deviceDataCount);
            //设置年度最大
            SetYearMax(deviceDataCount);
        }
 /// <summary>
 /// 插入自定义报表
 /// </summary>
 /// <returns>设备表ID</returns>
 public int Insert(DeviceDataCount customReport)
 {
     return(_ReportGroupDao.Insert(customReport));
 }
示例#10
0
 /// <summary>
 /// 修改自定义报表
 /// </summary>
 /// <returns>设备表ID</returns>
 public int Update(DeviceDataCount customReport)
 {
     return(_ReportGroupDao.Update(customReport));
 }
示例#11
0
 /// <summary>
 /// 插入自定义报表
 /// </summary>
 /// <returns>设备表ID</returns>
 public int Remove(DeviceDataCount customReport)
 {
     return(_ReportGroupDao.Remove(customReport));
 }
示例#12
0
        /// <summary>
        /// 合并某个电站的所有采集器的值记录
        /// </summary>
        /// <param name="plantId"></param>
        /// <param name="plantRecordList"></param>
        private void mergeRecord2Cache(string countCacheKey, DeviceDataCount collectorDataCount)
        {
            IDictionary <string, float> maxDictionary = new Dictionary <string, float>();
            //平滑用,统一标准坐标
            string daystr = collectorDataCount.year.ToString("00") + collectorDataCount.month.ToString("00") + collectorDataCount.day.ToString("00");

            string[] tmpIc = base.getXseriesFromYYYYMMDDHH(daystr + "00", daystr + "23", 5).ToArray();
            //给电站的采集器集合增加为完整的所有的采集器集合,以便每次都能统计所有采集器累计的最大发生值

            Plant             plant           = PlantService.GetInstance().GetPlantInfoById(collectorDataCount.deviceId);
            string            tmpcachkey      = "";
            IList <Hashtable> plantRecordList = new List <Hashtable>();

            foreach (PlantUnit unit in plant.plantUnits)
            {
                tmpcachkey = CacheKeyUtil.buildCollectorDataCountKey(collectorDataCount.year, collectorDataCount.month, collectorDataCount.day, unit.collectorID, collectorDataCount.monitorCode);
                //取得采集器日统计记录
                object obj = MemcachedClientSatat.getInstance().Get(tmpcachkey);
                if (obj == null)
                {
                    continue;
                }
                plantRecordList.Add((Hashtable)obj);
            }

            foreach (Hashtable tmpMap in plantRecordList)
            {
                //先平滑
                base.FirstHandleChartData(tmpIc, tmpMap);
                foreach (string key in tmpMap.Keys)
                {
                    if (maxDictionary.ContainsKey(key))
                    {
                        maxDictionary[key] = maxDictionary[key] + (float)tmpMap[key];
                    }
                    else
                    {
                        maxDictionary[key] = (float)tmpMap[key];
                    }
                }
            }

            //取得所有时间点中最大值
            float  maxValue   = 0;
            string maxTimeKey = "000000";
            float  tmpValue;

            foreach (string key in maxDictionary.Keys)
            {
                tmpValue = maxDictionary[key];
                if (tmpValue > maxValue)
                {
                    maxValue   = tmpValue;
                    maxTimeKey = key;
                }
            }
            //
            collectorDataCount.maxTime  = new DateTime(collectorDataCount.maxTime.Year, collectorDataCount.maxTime.Month, collectorDataCount.maxTime.Day, int.Parse(maxTimeKey.Substring(2, 2)), int.Parse(maxTimeKey.Substring(4, 2)), 0);
            collectorDataCount.maxValue = maxValue;
            LogUtil.writeline("plant max count" + collectorDataCount.deviceId + "-" + collectorDataCount.maxTime + "-" + maxValue);
            Cache(collectorDataCount);
        }
示例#13
0
        /// <summary>
        /// 取得采集器日数据列表
        /// </summary>
        /// <returns></returns>
        public void GetCollectorDaydataList()
        {
            //如果没有数据则直接返回,增加for2.0协议,分包发送消息的情况
            if (!messageHeader.hasData)
            {
                return;
            }
            //将单元头部的发电量加入历史测点数据map中,然后统一处理
            if (!messageHeader.issub)//只有电站数据加入者两个电站测点
            {
                if (messageHeader.DayEnergy != null)
                {
                    historyMonitorMap[MonitorType.PLANT_MONITORITEM_ENERGY_CODE] = messageHeader.DayEnergy;
                }
                if (messageHeader.Power != null)
                {
                    historyMonitorMap[MonitorType.PLANT_MONITORITEM_POWER_CODE] = messageHeader.Power;
                }
            }
            int collectorID = GetCollectorId();
            //根据历史测点数据构建设备天数据
            //这里需要改进为依据设备时间,防止设备数据的时间和采集器的时间是不一致的
            CollectorDayData mdd;
            string           mapObjectKey;

            //遍历测点数据
            foreach (int key in historyMonitorMap.Keys)
            {
                mapObjectKey = CacheKeyUtil.buildCollectorDayDataKey(collectorID, messageHeader.year + messageHeader.month, int.Parse(messageHeader.day), key);
                if (!collectordayDataMap.ContainsKey(mapObjectKey))
                {
                    //先从缓存中取得
                    mdd = CollectorDayDataService.GetInstance().getCollectorDayData(collectorID, key, int.Parse(messageHeader.day), int.Parse(messageHeader.year), int.Parse(messageHeader.month));
                    if (mdd == null)
                    {
                        mdd = new CollectorDayData()
                        {
                            collectorID = collectorID, sendDay = int.Parse(messageHeader.day), monitorCode = key, yearmonth = messageHeader.year + messageHeader.month
                        }
                    }
                    ;
                    collectordayDataMap[mapObjectKey] = mdd;
                }
                else
                {
                    mdd = collectordayDataMap[mapObjectKey];
                }
                float  newValue = historyMonitorMap[key] == null?0:float.Parse(historyMonitorMap[key].ToString());
                string tmpStr   = "#" + messageHeader.hour + messageHeader.minute + messageHeader.second + ":" + newValue;
                if (mdd.dataContent != null)
                {//避免数据串有重复数据过大
                    if (!mdd.dataContent.Contains(tmpStr))
                    {
                        mdd.dataContent += tmpStr;
                    }
                }
                else
                {
                    mdd.dataContent = tmpStr;
                }
                mdd.sendtime        = messageHeader.TimeNow;
                mdd.localAcceptTime = DateTime.Now;
                mdd.yearmonth       = messageHeader.year + messageHeader.month;
                mdd.changed         = true;
                //add by qhb in 20121028 for 会写到memcahced 以便持久化能取到改数据.采集器天数据集中缓存处有点问题,和设备天数据一样的问题。
                //导致曲线数据有丢失现象
                try
                {
                    MemcachedClientSatat.getInstance().Set(mapObjectKey, mdd);
                }
                catch (Exception e) {
                    Console.WriteLine("set collector day data to memecached error:" + e.Message);
                    //出现错误,可能是mdd太大,所以整理下mdd,去掉重复数据,减少size,因为memached内存有2m限制
                }
                //将功率和关照的最大发生时间记录下来.稍后优化下
                if (key == MonitorType.PLANT_MONITORITEM_POWER_CODE)
                {
                    //if (collectorID >= 189 && collectorID < 199)
                    //{
                    //    LogUtil.writeline(messageHeader.TimeNow + "-" + newValue);
                    //}
                    //LogUtil.warn("collectorDataCount = new DeviceDataCount(): collectorID is " + collectorID + "-" + messageHeader.year.ToString() + messageHeader + "");
                    collectorDataCount = new DeviceDataCount()
                    {
                        deviceId = collectorID, monitorCode = key, year = int.Parse(messageHeader.year), month = int.Parse(messageHeader.month), day = int.Parse(messageHeader.day), deviceTable = TableUtil.PLANT, maxValue = newValue, maxTime = messageHeader.TimeNow, localAcceptTime = DateTime.Now
                    };
                }
            }
        }
示例#14
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);
            }
        }