import xlrd

class 数据类:
	def __init__(self):
		self.数据索引 = {}
		self.数据索引['项目名称'] = ''
		self.数据索引['管损率'] = 0
		self.数据索引['蒸汽负荷'] = [40] * 8760
		self.数据索引['电负荷'] = [20000] * 8760
		self.数据索引['技术路线列表'] = ['燃气轮机', '燃气内燃机', '燃气锅炉']

		self.数据索引['并网模式'] = '全额上网'

		self.数据索引['自耗电自供应比例'] = 1

		self.数据索引['燃气轮机发电效率修正'] = 1
		self.数据索引['燃气轮机烟气流量修正'] = 1
		self.数据索引['燃气轮机排烟温度修正'] = 1
		self.数据索引['燃气轮机发电功率修正'] = 1

		# 量化筛选计算控制
		self.数据索引['燃气轮机最大规模'] = 0
		self.数据索引['燃气轮机最小规模'] = 0
		self.数据索引['燃气内燃机最大规模'] = 0
		self.数据索引['燃气内燃机最小规模'] = 0
		self.数据索引['燃气轮机最大台数'] = 2
		self.数据索引['燃气内燃机最大台数'] = 2

		# 存量设备
		self.数据索引['存量燃气轮机型号'] = ''
		self.数据索引['存量燃气内燃机型号'] = ''
		self.数据索引['存量锅炉额定产汽量'] = 0

		# 燃气锅炉
		self.数据索引['燃气锅炉单位产汽耗电量'] = 5           # kWh/t
		self.数据索引['锅炉耗水率'] = 1.2
		self.数据索引['燃气锅炉效率'] = 0.99
		self.数据索引['燃气锅炉满负荷运行小时数限制'] = 8760
		self.数据索引['燃气锅炉最低运行负荷比例'] = 0

		# 余热锅炉
		self.数据索引['余热锅炉效率'] = 0.95
		self.数据索引['余热锅炉单位产汽耗电量'] = 2
		self.数据索引['冷却后烟气温度'] = 120

		# 燃气轮机
		# self.数据索引['燃气轮机烟气余热占比'] = 0.57
		# self.数据索引['燃气轮机发电效率'] = 0.322
		self.数据索引['燃气轮机满负荷运行小时数限制'] = 6000
		self.数据索引['燃气轮机自耗电比例'] = 0.04
		self.数据索引['燃气轮机最低运行负荷比例'] = 0.6

		# 燃气内燃机
		# self.数据索引['燃气内燃机发电效率'] = 0.422
		# self.数据索引['燃气内燃机烟气余热占比'] = 0.24
		# self.数据索引['燃气内燃机缸套水余热占比'] = 0.22
		self.数据索引['燃气内燃机满负荷运行小时数限制'] = 6000
		self.数据索引['燃气内燃机自耗电比例'] = 0.04
		self.数据索引['燃气内燃机最低运行负荷比例'] = 0.6

		# 溴冷机
		self.数据索引['溴冷机COP'] = 1.2
		self.数据索引['蒸汽型溴冷机COP'] = 1.45
		self.数据索引['烟气型溴冷机COP'] = 1.45
		self.数据索引['热水型溴冷机COP'] = 0.7
		self.数据索引['冷却水泵溴冷机用耗电量'] = 0.04
		self.数据索引['冷却塔溴冷机用耗电量'] = 0.03
		self.数据索引['冷冻水泵耗电量'] = 0.03
		self.数据索引['溴冷机自耗电比例'] = 0.01
		self.数据索引['溴冷机单位制冷耗电量'] = self.数据索引['冷却水泵溴冷机用耗电量'] + self.数据索引['冷却塔溴冷机用耗电量'] + self.数据索引['冷冻水泵耗电量'] + self.数据索引['溴冷机自耗电比例']

		# 螺杆机组
		self.数据索引['螺杆机组满负荷运行小时数限制'] = 8000
		self.数据索引['螺杆机组最低运行负荷比例'] = 0.1
		self.数据索引['冷却水泵电制冷机用耗电量'] = 0.02
		self.数据索引['冷却塔电制冷机用耗电量'] = 0.01
		self.数据索引['螺杆机组COP'] = 5

		# 离心机组

		#=======================================================================================
		# 电价
		self.数据索引['用电价格_0:00'] = 0.715
		self.数据索引['用电价格_1:00'] = 0.715
		self.数据索引['用电价格_2:00'] = 0.715
		self.数据索引['用电价格_3:00'] = 0.715
		self.数据索引['用电价格_4:00'] = 0.715
		self.数据索引['用电价格_5:00'] = 0.715
		self.数据索引['用电价格_6:00'] = 0.715
		self.数据索引['用电价格_7:00'] = 0.715
		self.数据索引['用电价格_8:00'] = 0.715
		self.数据索引['用电价格_9:00'] = 0.715
		self.数据索引['用电价格_10:00'] = 0.715
		self.数据索引['用电价格_11:00'] = 0.715
		self.数据索引['用电价格_12:00'] = 0.715
		self.数据索引['用电价格_13:00'] = 0.715
		self.数据索引['用电价格_14:00'] = 0.715
		self.数据索引['用电价格_15:00'] = 0.715
		self.数据索引['用电价格_16:00'] = 0.715
		self.数据索引['用电价格_17:00'] = 0.715
		self.数据索引['用电价格_18:00'] = 0.715
		self.数据索引['用电价格_19:00'] = 0.715
		self.数据索引['用电价格_20:00'] = 0.715
		self.数据索引['用电价格_21:00'] = 0.715
		self.数据索引['用电价格_22:00'] = 0.715
		self.数据索引['用电价格_23:00'] = 0.715

		self.数据索引['售电价格_0:00'] = 0.715
		self.数据索引['售电价格_1:00'] = 0.715
		self.数据索引['售电价格_2:00'] = 0.715
		self.数据索引['售电价格_3:00'] = 0.715
		self.数据索引['售电价格_4:00'] = 0.715
		self.数据索引['售电价格_5:00'] = 0.715
		self.数据索引['售电价格_6:00'] = 0.715
		self.数据索引['售电价格_7:00'] = 0.715
		self.数据索引['售电价格_8:00'] = 0.715
		self.数据索引['售电价格_9:00'] = 0.715
		self.数据索引['售电价格_10:00'] = 0.715
		self.数据索引['售电价格_11:00'] = 0.715
		self.数据索引['售电价格_12:00'] = 0.715
		self.数据索引['售电价格_13:00'] = 0.715
		self.数据索引['售电价格_14:00'] = 0.715
		self.数据索引['售电价格_15:00'] = 0.715
		self.数据索引['售电价格_16:00'] = 0.715
		self.数据索引['售电价格_17:00'] = 0.715
		self.数据索引['售电价格_18:00'] = 0.715
		self.数据索引['售电价格_19:00'] = 0.715
		self.数据索引['售电价格_20:00'] = 0.715
		self.数据索引['售电价格_21:00'] = 0.715
		self.数据索引['售电价格_22:00'] = 0.715
		self.数据索引['售电价格_23:00'] = 0.715

		self.数据索引['市政电价_0:00'] = 0.715
		self.数据索引['市政电价_1:00'] = 0.715
		self.数据索引['市政电价_2:00'] = 0.715
		self.数据索引['市政电价_3:00'] = 0.715
		self.数据索引['市政电价_4:00'] = 0.715
		self.数据索引['市政电价_5:00'] = 0.715
		self.数据索引['市政电价_6:00'] = 0.715
		self.数据索引['市政电价_7:00'] = 0.715
		self.数据索引['市政电价_8:00'] = 0.715
		self.数据索引['市政电价_9:00'] = 0.715
		self.数据索引['市政电价_10:00'] = 0.715
		self.数据索引['市政电价_11:00'] = 0.715
		self.数据索引['市政电价_12:00'] = 0.715
		self.数据索引['市政电价_13:00'] = 0.715
		self.数据索引['市政电价_14:00'] = 0.715
		self.数据索引['市政电价_15:00'] = 0.715
		self.数据索引['市政电价_16:00'] = 0.715
		self.数据索引['市政电价_17:00'] = 0.715
		self.数据索引['市政电价_18:00'] = 0.715
		self.数据索引['市政电价_19:00'] = 0.715
		self.数据索引['市政电价_20:00'] = 0.715
		self.数据索引['市政电价_21:00'] = 0.715
		self.数据索引['市政电价_22:00'] = 0.715
		self.数据索引['市政电价_23:00'] = 0.715

		self.数据索引['上网电价_0:00'] = 0.715
		self.数据索引['上网电价_1:00'] = 0.715
		self.数据索引['上网电价_2:00'] = 0.715
		self.数据索引['上网电价_3:00'] = 0.715
		self.数据索引['上网电价_4:00'] = 0.715
		self.数据索引['上网电价_5:00'] = 0.715
		self.数据索引['上网电价_6:00'] = 0.715
		self.数据索引['上网电价_7:00'] = 0.715
		self.数据索引['上网电价_8:00'] = 0.715
		self.数据索引['上网电价_9:00'] = 0.715
		self.数据索引['上网电价_10:00'] = 0.715
		self.数据索引['上网电价_11:00'] = 0.715
		self.数据索引['上网电价_12:00'] = 0.715
		self.数据索引['上网电价_13:00'] = 0.715
		self.数据索引['上网电价_14:00'] = 0.715
		self.数据索引['上网电价_15:00'] = 0.715
		self.数据索引['上网电价_16:00'] = 0.715
		self.数据索引['上网电价_17:00'] = 0.715
		self.数据索引['上网电价_18:00'] = 0.715
		self.数据索引['上网电价_19:00'] = 0.715
		self.数据索引['上网电价_20:00'] = 0.715
		self.数据索引['上网电价_21:00'] = 0.715
		self.数据索引['上网电价_22:00'] = 0.715
		self.数据索引['上网电价_23:00'] = 0.715

		self.数据索引['内部售电价_0:00'] = 0.715
		self.数据索引['内部售电价_1:00'] = 0.715
		self.数据索引['内部售电价_2:00'] = 0.715
		self.数据索引['内部售电价_3:00'] = 0.715
		self.数据索引['内部售电价_4:00'] = 0.715
		self.数据索引['内部售电价_5:00'] = 0.715
		self.数据索引['内部售电价_6:00'] = 0.715
		self.数据索引['内部售电价_7:00'] = 0.715
		self.数据索引['内部售电价_8:00'] = 0.715
		self.数据索引['内部售电价_9:00'] = 0.715
		self.数据索引['内部售电价_10:00'] = 0.715
		self.数据索引['内部售电价_11:00'] = 0.715
		self.数据索引['内部售电价_12:00'] = 0.715
		self.数据索引['内部售电价_13:00'] = 0.715
		self.数据索引['内部售电价_14:00'] = 0.715
		self.数据索引['内部售电价_15:00'] = 0.715
		self.数据索引['内部售电价_16:00'] = 0.715
		self.数据索引['内部售电价_17:00'] = 0.715
		self.数据索引['内部售电价_18:00'] = 0.715
		self.数据索引['内部售电价_19:00'] = 0.715
		self.数据索引['内部售电价_20:00'] = 0.715
		self.数据索引['内部售电价_21:00'] = 0.715
		self.数据索引['内部售电价_22:00'] = 0.715
		self.数据索引['内部售电价_23:00'] = 0.715

		#能源价格
		self.数据索引['上网电价'] = [0.715] * 8760
		self.数据索引['市政电价'] = [0.715] * 8760
		self.数据索引['内部售电价'] = [0.715] * 8760

		self.数据索引['用电价格'] = []
		self.数据索引['供电价格'] = []
		self.数据索引['燃气价格'] = 2.7                  # unit:元/Nm3
		self.数据索引['水价格'] = 6                       # unit：元/t
		self.数据索引['蒸汽价格'] = 260                   # unit：元/t
		self.数据索引['供冷价格'] = 0
		self.数据索引['额外天然气销售年总收入'] = 0
		self.数据索引['额外天然气销售年总成本'] = 0

		self.数据索引['人数'] = 0
		self.数据索引['工资'] = 0

		#其他基础数据
		self.数据索引['燃气热值'] = 8100                   # unit：kJ/m3
		self.数据索引['水蒸气焓差'] = 2600

		#投资估算数据
		self.数据索引['基本预备费占一二类总费用比例'] = 0.05

		self.数据索引['燃气轮机单位造价'] = 5000
		self.数据索引['余热锅炉单位造价'] = 200000
		self.数据索引['燃气内燃机单位造价'] = 5000
		self.数据索引['脱销装置单位造价'] = 300
		self.数据索引['燃气锅炉单位造价'] = 100000
		self.数据索引['溴冷机单位造价'] = 1000
		self.数据索引['螺杆机组单位造价'] = 500

		self.数据索引['燃气轮机安装费占设备费比例'] = 0.05
		self.数据索引['燃气内燃机安装费占设备费比例'] =0.1
		self.数据索引['其他工艺安装费占设备费比例'] = 0.3

		self.数据索引['土建工程建筑'] = 0
		self.数据索引['辅助设施设备占工艺系统总投资比例'] = 0.1
		self.数据索引['辅助设施安装占辅助设施设备比例'] = 0.3
		self.数据索引['电气工程系统设备占工艺系统总投资比例'] = 0.0833
		self.数据索引['电气工程系统安装占电气工程系统设备比例'] = 0.2
		self.数据索引['智能控制系统设备占工艺系统总投资比例'] = 0.0667
		self.数据索引['智能控制系统安装占智能控制系统设备比例'] = 0.2
		self.数据索引['管网投资总费用'] = 0
		self.数据索引['管网投资安装占管网投资总费用比例'] = 0.5

		# self.数据索引['设计勘察费'] = 0
		# self.数据索引['建设单位管理费'] = 0
		# self.数据索引['联合试运转费'] = 0
		# self.数据索引['办公及家具购置费'] = 0
		# self.数据索引['生产准备费'] = 0
		# self.数据索引['监理费用'] = 0
		# self.数据索引['前期咨询费用'] = 0
		# self.数据索引['工程保险费用'] = 0
		# self.数据索引['项目建设服务费'] = 0
		# self.数据索引['招投标费用'] = 0
		self.数据索引['电力接入费'] = 0
		self.数据索引['土地费'] = 0
		self.数据索引['燃气工程费'] = 0
		self.数据索引['收购费用'] = 0

		# 投资估算设定值
		self.数据索引['采用投资估算设定值赋值'] = '否'
		self.数据索引['工艺系统_设备_设定值'] = 0
		self.数据索引['工艺系统_安装_设定值'] = 0
		self.数据索引['电气系统_设备_设定值'] = 0
		self.数据索引['电气系统_安装_设定值'] = 0
		self.数据索引['自控系统_设备_设定值'] = 0
		self.数据索引['自控系统_安装_设定值'] = 0
		self.数据索引['室外管网_设备_设定值'] = 0
		self.数据索引['室外管网_安装_设定值'] = 0
		self.数据索引['辅助工程_设备_设定值'] = 0
		self.数据索引['辅助工程_安装_设定值'] = 0

		self.数据索引['设计费_设定值'] = 0
		self.数据索引['设单位管理费_设定值'] = 0
		self.数据索引['联合试运转费_设定值'] = 0
		self.数据索引['办公及家具购置费_设定值'] = 0
		self.数据索引['进场培训费_设定值'] = 0
		self.数据索引['前期咨询费用_设定值'] = 0
		self.数据索引['监理费_设定值'] = 0
		self.数据索引['工程保险费_设定值'] = 0
		self.数据索引['项目建设服务费_设定值'] = 0
		self.数据索引['招投标费用_设定值'] = 0
		self.数据索引['特种设备安全监督检验费_设定值'] = 0
		self.数据索引['勘察费_设定值'] = 0
		self.数据索引['设备采买费_设定值'] = 0

		# 成本收入设定值
		self.数据索引['采用成本收入设定值赋值'] = '否'
		self.数据索引['供冷收入_设定值'] = 0
		self.数据索引['供蒸汽收入_设定值'] = 0
		self.数据索引['发电收入_设定值'] = 0
		self.数据索引['供热收入_设定值'] = 0
		self.数据索引['光伏发电收入_设定值'] = 0
		self.数据索引['天然气销售收入_设定值'] = 0
		self.数据索引['供冷配套费收入_设定值'] = 0
		self.数据索引['供热配套费收入_设定值'] = 0
		self.数据索引['光伏运维成本_设定值'] = 0
		self.数据索引['天然气支出_设定值'] = 0
		self.数据索引['水支出_设定值'] = 0
		self.数据索引['电支出_设定值'] = 0
		self.数据索引['维修费_设定值'] = 0

		# 技经相关参数
		self.数据索引['天然气是否先用后付'] = 0
		self.数据索引['电费是否先用后付'] = 1
		self.数据索引['水费是否先用后付'] = 1
		self.数据索引['维修费是否先用后付'] = 1
		self.数据索引['工资是否先用后付'] = 1


		self.数据索引['变压器容量费'] = 0
		self.数据索引['系统备用容量费'] = 0
		self.数据索引['土地租金'] = 0
		self.数据索引['设备租金'] = 0
		# 尚未添加至GUI
		self.数据索引['其他管理费用占工资比例'] = 0.5
		self.数据索引['第一年达产率'] = 0.75
		self.数据索引['达产率'] = [0] + [1] * 20

		self.数据索引['其他工艺设备维修费占比'] = 0.03
		self.数据索引['辅助设施维修费占比'] = 0.03
		self.数据索引['电气工程维修费占比'] = 0.01
		self.数据索引['智能控制系统维修费占比']= 0.01
		self.数据索引['管网维修费占比'] = 0.015
		self.数据索引['燃气轮机单位发电维修费'] = 0.06
		self.数据索引['燃气内燃机单位发电维修费']  = 0.06
		self.数据索引['维修费是否手动赋值'] = '否'
		self.数据索引['维修费_设定值'] = 0

		self.数据索引['所得税率'] = 0.25
		self.数据索引['还本起始年'] = 1
		self.数据索引['借款比例'] = 0.7
		self.数据索引['借款利率'] = 0.049
		self.数据索引['还款周期'] = 7

		self.数据索引['冷增值税税率'] = 0.1
		self.数据索引['蒸汽增值税税率'] = 0.1
		self.数据索引['电增值税税率'] = 0.16
		self.数据索引['建筑类残值率']= 0.05
		self.数据索引['设备及安装类残值率']= 0.05
		self.数据索引['气增值税税率'] = 0.1
		self.数据索引['热增值税税率'] = 0.1
		self.数据索引['水增值税税率'] = 0.1
		self.数据索引['建筑费用增值税税率'] = 0.1
		self.数据索引['设备费用增值税税率'] = 0.16
		self.数据索引['安装费用增值税税率'] = 0.1
		self.数据索引['工程建设其他费用增值税税率'] = 0.06
		self.数据索引['电力接入费增值税税率'] = 0.16
		self.数据索引['燃气工程费增值税税率'] = 0.16
		self.数据索引['土地费用增值税税率'] = 0
		self.数据索引['城市维护建设税率'] = 0.07
		self.数据索引['教育附加税率'] = 0.05
		self.数据索引['水利基金税率'] = 0
		self.数据索引['应收账款周转次数'] = 12
		self.数据索引['应付账款周转次数'] = 12
		self.数据索引['天然气存货周转次数'] = 12
		self.数据索引['电存货周转次数'] = 12
		self.数据索引['水存货周转次数'] = 12
		self.数据索引['维修费周转次数'] = 12
		self.数据索引['是否备天然气存货'] = 1
		self.数据索引['是否备电存货'] = 1
		self.数据索引['是否备水存货'] = 1
		self.数据索引['建筑类折旧年限'] = 20
		self.数据索引['设备及安装类折旧年限'] = 15
		self.数据索引['无形资产残值率'] = 0
		self.数据索引['无形资产折旧年限'] = 20
		self.数据索引['土地购置费残值率'] = 0
		self.数据索引['土地购置费折旧年限'] = 20

	def 生成索引(self, 输入数据):
		索引 = {}
		sheet1 = 输入数据.sheets()[0]
		sheet2 = 输入数据.sheets()[2]
		nrows1 = sheet1.nrows
		nrows2 = sheet2.nrows
		for i in range(nrows1):
			索引[sheet1.cell(i,0).value] = sheet1.cell(i,1).value
		for i in range(nrows2):
			索引[sheet2.cell(i,0).value] = sheet2.cell(i,1).value
		return 索引


	# 数据 = 数据类()