def __init__(self, temporary, t, heat_stor): heatstorage = HeatStorage(temporary) gas_boiler = GasBoiler(temporary) demand = DemandData() if heatstorage.get_H_out_max(heat_stor) > 0: if demand.H[t] <= heatstorage.get_H_out_max(heat_stor): heatstorage_heat_out = demand.H[t] self.heat_gas_boiler = 0 else: heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor) self.heat_gas_boiler = demand.H[t] - heatstorage_heat_out self.heat_stor = heatstorage.get_S(heat_stor, 0, heatstorage_heat_out) else: self.heat_stor = heatstorage.get_S(heat_stor, 0, 0) self.heat_gas_boiler = demand.H[t] self.fuel = gas_boiler.get_Fuel_in(self.heat_gas_boiler)
def max_output_judge( temporary, number): # CHP 最大产能情况下是否可行, 该函数下的 储热 储冷 是假想的,没有额定容量的 储热 储冷 heatstor = 0 coldstor = 0 heat_out_max = 0 cold_out_max = 0 chp = CHP(temporary, number) gasboiler = GasBoiler(temporary) heatpump = HeatPump(temporary) heatstorage = HeatStorage(temporary) coldstorage = ColdStorage(temporary) demand = DemandData() for t in range(0, demand.E_sheetnrows - 1, Parameters.delttime): if ((heat_out_max + chp.H_out_max + gasboiler.nominal)*Parameters.delttime >= demand.H[t]) &\ ((cold_out_max + chp.C_out_max + heatpump.nominal)*Parameters.delttime >= demand.C[t]): # 判断进入储热的热量和储热放出的热量 # if (chp.H_out_max + gasboiler.nominal ) * Parameters.delttime >= demand.H[t]: # 最大产生热量大于热需求,热量可存入储热器 heat_in = (( (chp.H_out_max + gasboiler.nominal) * Parameters.delttime - demand.H[t]) / Parameters.delttime) heat_out = 0 else: # 最大产生热量小于热需求,储热器放热 heat_in = 0 heat_out = ( (demand.H[t] - (chp.H_out_max + gasboiler.nominal) * Parameters.delttime) / Parameters.delttime) # 此时heat_out 一定小于 heat_out_max heatstor = heatstorage.get_S(heatstor, heat_in, heat_out) heat_out_max = heatstorage.get_H_out_max(heatstor) # 接下来判断进入储冷的冷量和储冷放出的冷量 # if (chp.C_out_max + heatpump.nominal ) * Parameters.delttime >= demand.C[t]: # 最大产生冷量大于热需求,冷量可存入储热器 cold_in = ( (chp.C_out_max + heatpump.nominal) * Parameters.delttime - demand.C[t]) / Parameters.delttime cold_out = 0 else: # 最大产生冷量小于热需求,储冷器放冷 cold_in = 0 cold_out = (demand.C[t] - (chp.C_out_max + heatpump.nominal) * Parameters.delttime) / Parameters.delttime # 此时cold_out 一定小于 cold_out_max coldstor = coldstorage.get_S(coldstor, cold_in, cold_out) cold_out_max = coldstorage.get_C_out_max(coldstor) else: return 0 # 任何时刻需求超过储能 + CHP 最大产能,系统都不行 return 1
def __init__(self, t, temporary, number, heat_stor): demand = DemandData() heatstorage = HeatStorage(temporary) chp = CHPInternalCombustionEngine(temporary, number) self.heatstorage_in = 0 if demand.H[t] <= heatstorage.get_H_out_max(heat_stor): self.heatstorage_out = demand.H[t] self.heat = 0 self.gas_boiler_out = 0 elif ((demand.H[t] > heatstorage.get_H_out_max(heat_stor)) & (demand.H[t] <= heatstorage.get_H_out_max(heat_stor) + chp.heat_space_water_max)): self.heatstorage_out = heatstorage.get_H_out_max(heat_stor) self.heat = demand.H[t] - self.heatstorage_out self.gas_boiler_out = 0 else: self.heatstorage_out = heatstorage.get_H_out_max(heat_stor) self.heat = chp.heat_space_water_max self.gas_boiler_out = demand.H[t] - self.heatstorage_out - self.heat self.heat_stor = heatstorage.get_S(heat_stor, self.heatstorage_in, self.heatstorage_out)
def __init__(self, t, temporary, number, heat_stor): demand = DemandData() heatstorage = HeatStorage(temporary) ice = InternalCombustionEngine(number, temporary) self.heatstorage_in = 0 if demand.H[t] <= heatstorage.get_H_out_max(heat_stor): self.heatstorage_out = demand.H[t] self.heat = 0 self.gas_boiler_out = 0 elif ((demand.H[t] > heatstorage.get_H_out_max(heat_stor)) & (demand.H[t] <= heatstorage.get_H_out_max(heat_stor) + ice.get_jacket_water_pl(1))): self.heatstorage_out = heatstorage.get_H_out_max(heat_stor) self.heat = demand.H[t] - self.heatstorage_out self.gas_boiler_out = 0 else: self.heatstorage_out = heatstorage.get_H_out_max(heat_stor) self.heat = ice.get_jacket_water_pl(1) self.gas_boiler_out = demand.H[t] - self.heatstorage_out - self.heat self.heat_stor = heatstorage.get_S(heat_stor, self.heatstorage_in, self.heatstorage_out)
def __init__(self, t, temporary, heat_stor, heat): # heat为chp产热(空间热+热水热) demand = DemandData() heatstorage = HeatStorage(temporary) self.heat_out = heat if demand.H[t] <= heatstorage.get_H_out_max(heat_stor): self.heatstorage_out = demand.H[t] self.heatstorage_in = self.heat_out self.gas_boiler_out = 0 elif ((demand.H[t] > heatstorage.get_H_out_max(heat_stor)) & (demand.H[t] <= heatstorage.get_H_out_max(heat_stor) + self.heat_out)): self.heatstorage_out = heatstorage.get_H_out_max(heat_stor) self.heatstorage_in = self.heatstorage_out + self.heat_out - demand.H[ t] self.gas_boiler_out = 0 else: self.heatstorage_out = heatstorage.get_H_out_max(heat_stor) self.heatstorage_in = 0 self.gas_boiler_out = demand.H[ t] - self.heatstorage_out - self.heat_out self.heat_stor = heatstorage.get_S(heat_stor, self.heatstorage_in, self.heatstorage_out)
def running_judge(temporary, number, season, mode, steam_or_not): heatstor = 0 coldstor = 0 elestor = 0 cold_stor_list = [] heat_stor_list = [] ele_stor_list = [] chp = CHP(temporary, number) gasboiler = GasBoiler(temporary) heatpump = HeatPump(temporary) absorption_chiller = AbsorptionChiller(temporary) boiler = Boiler(temporary) elestorage = EleStorage(temporary) heatstorage = HeatStorage(temporary) coldstorage = ColdStorage(temporary) totalfuel_gasturbine = 0 totalfuel_gasboiler = 0 totalele_powergrid = 0 total_ele_waste = 0 total_heat_waste = 0 total_cold_waste = 0 demand = DemandData() if season == 0: demand_ele = demand.cold_E demand_cold = demand.C if steam_or_not == 0: demand_heat = [] for hour in range(24): demand_heat.append(0) else: demand_heat = demand.cold_Steam elif season == 1: demand_ele = demand.heat_E if steam_or_not == 0: demand_heat = demand.H else: demand_heat = [] for hour in range(24): demand_heat.append(demand.H[hour] + demand.heat_Steam[hour]) demand_cold = [] for hour in range(24): demand_cold.append(0) else: demand_ele = demand.transition_E demand_cold = [] if steam_or_not == 0: demand_heat = [] for hour in range(24): demand_heat.append(0) demand_cold.append(0) else: demand_heat = demand.transition_Steam for hour in range(24): demand_cold.append(0) for t in range(0, demand.E_sheetnrows - 1, Parameters.delttime): cold_stor_list.append(coldstor) heat_stor_list.append(heatstor) ele_stor_list.append(elestor) if mode == 0: # 以冷定热再定电 chp_cold = min(demand_cold[t], chp.C_out_max) boiler_heat_out = absorption_chiller.get_H_in( chp_cold) / Parameters.k chp_heat = boiler_heat_out * (1 - Parameters.k) if demand_heat[t] > heatstorage.get_H_out_max( heatstor) + chp_heat + gasboiler.nominal: return 0 else: result = mode_cold_first(t, temporary, number, coldstor, heatstor, elestor, season, steam_or_not) elif mode == 1: # 以电定热再定冷 暂缺base load运行(运行模式已写好,就是还没加进来) chp_ele = min(demand_ele[t], chp.E_out_max) boiler_heat_in = chp_ele / chp.heat_ele_ratio chp_heat = boiler.get_H_out(boiler_heat_in) * (1 - Parameters.k) chp_cold = chp_heat / (1 - Parameters.k) * Parameters.k if ((demand_heat[t] > heatstorage.get_H_out_max(heatstor) + chp_heat + gasboiler.nominal) | (demand_cold[t] > coldstorage.get_C_out_max(coldstor) + chp_cold + heatpump.nominal)): return 0 else: result = mode_ele_first(t, temporary, number, coldstor, heatstor, elestor, season, steam_or_not) else: if (t >= 7) & (t <= 21): if season == 0: if demand_cold[t] > coldstorage.get_C_out_max( coldstor) + chp.C_out_max + heatpump.nominal: return 0 else: if demand_heat[t] > heatstorage.get_H_out_max( heatstor) + chp.H_out_max + gasboiler.nominal: return 0 else: if season == 0: if demand_cold[t] > coldstorage.get_C_out_max( coldstor) + heatpump.nominal: return 0 else: if demand_heat[t] > heatstorage.get_H_out_max( heatstor) + gasboiler.nominal: return 0 result = mode_base_load(t, temporary, number, coldstor, heatstor, elestor, season, steam_or_not) coldstorage_cold_in = result[0] coldstorage_cold_out = result[1] heatstorage_heat_in = result[2] heatstorage_heat_out = result[3] elestorage_ele_in = result[4] elestorage_ele_out = result[5] powergrid_ele_out = result[11] gasboiler_fuel = result[12] gasturbine_fuel = result[13] totalfuel_gasturbine = totalfuel_gasturbine + gasturbine_fuel totalfuel_gasboiler = totalfuel_gasboiler + gasboiler_fuel totalele_powergrid = totalele_powergrid + powergrid_ele_out elestor = elestorage.get_S(elestor, elestorage_ele_in, elestorage_ele_out) if elestor > elestorage.nominal: total_ele_waste = total_ele_waste + elestor - elestorage.nominal elestor = elestorage.nominal # 若冲进的电过多,则剩余部分浪费 heatstor = heatstorage.get_S(heatstor, heatstorage_heat_in, heatstorage_heat_out) if heatstor > heatstorage.nominal: total_heat_waste = total_heat_waste + heatstor - heatstorage.nominal heatstor = heatstorage.nominal coldstor = coldstorage.get_S(coldstor, coldstorage_cold_in, coldstorage_cold_out) if coldstor > coldstorage.nominal: total_cold_waste = total_cold_waste + coldstor - coldstorage.nominal coldstor = coldstorage.nominal output = (1, totalfuel_gasturbine, totalfuel_gasboiler, totalele_powergrid, total_ele_waste, total_heat_waste, total_cold_waste) return output
def __init__(self, temporary, number): heat_stor = 0 cold_stor = 0 ele_stor = 0 chp = CHPInternalCombustionEngine(temporary, number) ice = InternalCombustionEngine(number, temporary) absorption_chiller = DoubleEffectAbsorptionChiller(temporary) gas_boiler = GasBoiler(temporary) heat_pump = HeatPump(temporary) heatstorage = HeatStorage(temporary) coldstorage = ColdStorage(temporary) elestorage = EleStorage(temporary) demand = DemandData() time = demand.E_sheetnrows - 1 self.fuel = [] self.ele_bought = [] self.ele_ice = [] self.heat = [] self.heat_gas_boiler = [] self.cold_absorption_chiller = [] self.cold_heat_pump = [] self.cold_waste = [] self.heat_waste = [] self.ele_waste = [] for t in range(0, time, Parameters.delttime): if demand.C[t] > coldstorage.get_C_out_max( cold_stor ) + chp.cold_out_max_exhaust_gas + heat_pump.nominal: self.judge = 0 else: judge_cold = min( demand.C[t] - coldstorage.get_C_out_max(cold_stor), chp.cold_out_max_exhaust_gas) judge_heat = chp.get_heat_water_though_cold(judge_cold) if demand.H[t] > heatstorage.get_H_out_max( heat_stor) + judge_heat + gas_boiler.nominal: self.judge = 0 else: self.judge = 1 if self.judge == 0: break else: heat_drive = HeatDriveJW(t, temporary, number, heat_stor) if heat_drive.heat == 0: cold_drive = ColdDrive(t, temporary, number, cold_stor) if cold_drive.cold == 0: ele_drive = EleDrive(t, temporary, number, ele_stor, 2) ele_stor = ele_drive.ele_stor ele = ele_drive.ele pl = ele / ice.nominal heat = ice.get_jacket_water_pl(pl) cold = ice.get_exhaust_gas_pl( pl) * absorption_chiller.COP_double cold_heat_pump = [] cold_stor = coldstorage.get_S( cold_stor, cold, cold_drive.coldstorage_out) heat_stor = heatstorage.get_S( heat_stor, heat, heat_drive.heatstorage_out) self.fuel.append(ice.get_fuel(ele / ice.nominal)) self.ele_bought.append(ele_drive.ele_bought) else: cold = cold_drive.cold cold_heat_pump = cold_drive.heat_pump_out cold_stor = cold_drive.cold_stor exhaust_gas = cold_drive.cold / absorption_chiller.COP_double pl = ice.get_pl_through_exhaust_gas(exhaust_gas) ele = pl * ice.nominal heat = ice.get_jacket_water_pl(pl) heat_stor = heatstorage.get_S( heat_stor, heat, heat_drive.heatstorage_out) ele_follow = EleFollow(t, temporary, ele_stor, ele, 2) ele_stor = ele_follow.ele_stor self.fuel.append(ice.get_fuel(pl)) self.ele_bought.append( ele_follow.ele_bought + heat_pump.get_E_in(cold_drive.heat_pump_out)) gas_boiler_out = 0 else: heat_stor = heat_drive.heat_stor heat = heat_drive.heat pl = ice.get_pl_through_jacket_water(heat_drive.heat) ele = pl * ice.nominal cold = ice.get_exhaust_gas_pl( pl) * absorption_chiller.COP_double cold_follow = ColdFollow(t, temporary, cold_stor, cold) cold_heat_pump = cold_follow.heat_pump_out cold_stor = cold_follow.cold_stor ele_follow = EleFollow(t, temporary, ele_stor, ele, 2) ele_stor = ele_follow.ele_stor gas_boiler_out = heat_drive.gas_boiler_out self.fuel.append( ice.get_fuel(pl) + gas_boiler.get_Fuel_in(heat_drive.gas_boiler_out)) self.ele_bought.append( ele_follow.ele_bought + heat_pump.get_E_in(cold_follow.heat_pump_out)) self.ele_ice.append(ele) self.heat.append(heat) self.heat_gas_boiler.append(gas_boiler_out) self.cold_absorption_chiller.append(cold) self.cold_heat_pump.append(cold_heat_pump) if cold_stor > coldstorage.nominal: self.cold_waste.append(cold_stor - coldstorage.nominal) cold_stor = coldstorage.nominal else: self.cold_waste.append(0) if heat_stor > heatstorage.nominal: self.heat_waste.append(heat_stor - heatstorage.nominal) heat_stor = heatstorage.nominal else: self.heat_waste.append(0) if ele_stor > elestorage.nominal: self.ele_waste.append(ele_stor - elestorage.nominal) ele_stor = elestorage.nominal else: self.ele_waste.append(0)
def __init__(self, temporary, number): heat_stor = 0 ele_stor = 0 chp = CHPInternalCombustionEngine(temporary, number) ice = InternalCombustionEngine(number, temporary) absorption_chiller = DoubleEffectAbsorptionChiller(temporary) heatstorage = HeatStorage(temporary) elestorage = EleStorage(temporary) gas_boiler = GasBoiler(temporary) demand = DemandData() time = demand.E_sheetnrows - 1 self.fuel = [] self.ele_bought = [] self.ele_ice = [] self.heat = [] self.heat_absorption_chiller = [] self.heat_gas_boiler = [] self.heat_waste = [] self.ele_waste = [] for t in range(0, time, Parameters.delttime): if demand.H[t] > heatstorage.get_H_out_max( heat_stor) + chp.heat_space_water_max + gas_boiler.nominal: self.judge = 0 break else: self.judge = 1 heat_drive = HeatDriveChiller(t, temporary, number, heat_stor) if heat_drive.heat == 0: ele_drive = EleDrive(t, temporary, number, ele_stor, 1) ele_stor = ele_drive.ele_stor ele = ele_drive.ele pl = ele / ice.nominal heat_absorption_chiller = ice.get_exhaust_gas_pl( pl) * absorption_chiller.COP_heat heat = heat_absorption_chiller + ice.get_jacket_water_pl( pl) heat_stor = heatstorage.get_S(heat_stor, heat, heat_drive.heatstorage_out) self.ele_bought.append(ele_drive.ele_bought) self.fuel.append(ice.get_fuel(ele / ice.nominal)) heat_gas_boiler = 0 else: heat = heat_drive.heat heat_gas_boiler = heat_drive.gas_boiler_out heat_stor = heat_drive.heat_stor ele = ice.get_ele_out_through_heat_mode(heat_drive.heat) pl = ele / ice.nominal heat_absorption_chiller = heat - ice.get_jacket_water_pl( pl) ele_follow = EleFollow(t, temporary, ele_stor, ele, 1) ele_stor = ele_follow.ele_stor self.ele_bought.append(ele_follow.ele_bought) self.fuel.append( ice.get_fuel(ele / ice.nominal) + gas_boiler.get_Fuel_in(heat_gas_boiler)) self.ele_ice.append(ele) self.heat.append(heat) self.heat_gas_boiler.append(heat_gas_boiler) self.heat_absorption_chiller.append(heat_absorption_chiller) if heat_stor > heatstorage.nominal: self.heat_waste.append(heat_stor - heatstorage.nominal) heat_stor = heatstorage.nominal else: self.heat_waste.append(0) if ele_stor > elestorage.nominal: self.ele_waste.append(ele_stor - elestorage.nominal) ele_stor = elestorage.nominal else: ele_stor = elestorage.nominal
def __init__(self, temporary, number): demand = DemandData() heatstorage = HeatStorage(temporary) coldstorage = ColdStorage(temporary) elestorage = EleStorage(temporary) gas_boiler = GasBoiler(temporary) heat_pump = HeatPump(temporary) ice = InternalCombustionEngine(number, temporary) chp = CHPInternalCombustionEngine(temporary, number) heat_stor = 0 ele_stor = 0 cold_stor = 0 self.fuel = [] self.ele_bought = [] self.ele_ice = [] self.heat_jacket_water = [] self.heat_gas_boiler = [] self.cold_absorption_chiller = [] self.cold_heat_pump = [] self.cold_waste = [] self.heat_waste = [] self.ele_waste = [] for t in range(7, 23, Parameters.delttime): if ((demand.C[t] > chp.cold_out_max_exhaust_gas + coldstorage.get_C_out_max(cold_stor) + heat_pump.nominal) | (demand.H[t] > (ice.get_jacket_water_pl(1) + heatstorage.get_H_out_max(heat_stor) + gas_boiler.nominal))): self.judge = 0 break else: self.judge = 1 ele = ice.nominal heat = ice.get_jacket_water_pl(1) cold = chp.cold_out_max_exhaust_gas if demand.C[t] <= cold: coldstorage_cold_in = cold - demand.C[t] coldstorage_cold_out = 0 cold_heat_pump = 0 ele_needed_for_heat_pump = 0 elif (demand.C[t] > cold) & (demand.C[t] <= cold + coldstorage.get_C_out_max(cold_stor)): coldstorage_cold_out = coldstorage.get_C_out_max( cold_stor) + cold - demand.C[t] coldstorage_cold_in = 0 cold_heat_pump = 0 ele_needed_for_heat_pump = 0 else: coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor) coldstorage_cold_in = 0 cold_heat_pump = demand.C[t] - coldstorage_cold_out - cold ele_needed_for_heat_pump = heat_pump.get_E_in( cold_heat_pump) cold_stor = coldstorage.get_S(cold_stor, coldstorage_cold_in, coldstorage_cold_out) if demand.transition_E <= ele: ele_bought_for_ele = 0 if ele_needed_for_heat_pump > 0: if ele - demand.transition_E[ t] >= ele_needed_for_heat_pump: elestorage_ele_in = ele - demand.transition_E[ t] - ele_needed_for_heat_pump elestorage_ele_out = 0 ele_bought_for_heat_pump = 0 else: elestorage_ele_in = 0 elestorage_ele_out = 0 ele_bought_for_heat_pump = ele_needed_for_heat_pump - ( ele - demand.transition_E[t]) else: ele_bought_for_heat_pump = 0 elestorage_ele_out = 0 elestorage_ele_in = ele - demand.transition_E[t] elif(demand.transition_E[t] > ele) \ & (demand.transition_E[t] < ele + elestorage.get_E_out_max(ele_stor)): ele_bought_for_ele = 0 elestorage_ele_out = demand.transition_E[t] - ele elestorage_ele_in = 0 ele_bought_for_heat_pump = ele_needed_for_heat_pump else: ele_bought_for_ele = demand.transition_E[ t] - ele - elestorage.get_E_out_max(ele_stor) elestorage_ele_out = elestorage.get_E_out_max(ele_stor) elestorage_ele_in = 0 ele_bought_for_heat_pump = ele_needed_for_heat_pump ele_stor = elestorage.get_S(ele_stor, elestorage_ele_in, elestorage_ele_out) ele_bought = ele_bought_for_heat_pump + ele_bought_for_ele if demand.H[t] <= heat: heatstorage_heat_out = 0 heatstorage_heat_in = heat - demand.H[t] heat_gas_boiler = 0 elif (demand.H[t] > heat) & (demand.H[t] <= heat + heatstorage.get_H_out_max(heat_stor)): heatstorage_heat_out = demand.H[t] - heat heatstorage_heat_in = 0 heat_gas_boiler = 0 else: heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor) heatstorage_heat_in = 0 heat_gas_boiler = demand.H[ t] - heat - heatstorage.get_H_out_max(heat_stor) heat_stor = heatstorage.get_S(heat_stor, heatstorage_heat_in, heatstorage_heat_out) if cold_stor > coldstorage.nominal: self.cold_waste.append(cold_stor - coldstorage.nominal) cold_stor = coldstorage.nominal else: self.cold_waste.append(0) if heat_stor > heatstorage.nominal: self.heat_waste.append(heat_stor - heatstorage.nominal) heat_stor = heatstorage.nominal else: self.heat_waste.append(0) if ele_stor > elestorage.nominal: self.ele_waste.append(ele_stor - elestorage.nominal) ele_stor = elestorage.nominal else: self.ele_waste.append(0) self.ele_ice.append(ele) self.heat_jacket_water.append(heat) self.cold_absorption_chiller.append(cold) self.cold_heat_pump.append(cold_heat_pump) self.heat_gas_boiler.append(heat_gas_boiler) self.ele_bought.append(ele_bought) self.fuel.append( ice.get_fuel(1) + gas_boiler.get_Fuel_in(heat_gas_boiler)) if self.judge == 1: for t in range(23, 24, Parameters.delttime): cold_during_shut_down = ColdDuringShutDown( temporary, t, cold_stor) heat_during_sut_down = HeatDuringShutDown( temporary, t, heat_stor) ele_during_shut_down = EleDuringShutDown( temporary, t, ele_stor, 2) cold_stor = cold_during_shut_down.cold_stor heat_stor = heat_during_sut_down.heat_stor ele_stor = ele_during_shut_down.ele_stor self.cold_heat_pump.append( cold_during_shut_down.cold_heat_pump) self.heat_gas_boiler.append( heat_during_sut_down.heat_gas_boiler) self.fuel.append(heat_during_sut_down.fuel) self.ele_bought.append( cold_during_shut_down.ele_bought_for_heat_pump + ele_during_shut_down.ele_bought_for_ele) for t in range(0, 7, Parameters.delttime): cold_during_shut_down = ColdDuringShutDown( temporary, t, cold_stor) heat_during_sut_down = HeatDuringShutDown( temporary, t, heat_stor) ele_during_shut_down = EleDuringShutDown( temporary, t, ele_stor, 2) cold_stor = cold_during_shut_down.cold_stor heat_stor = heat_during_sut_down.heat_stor ele_stor = ele_during_shut_down.ele_stor self.cold_heat_pump.append( cold_during_shut_down.cold_heat_pump) self.heat_gas_boiler.append( heat_during_sut_down.heat_gas_boiler) self.fuel.append(heat_during_sut_down.fuel) self.ele_bought.append( cold_during_shut_down.ele_bought_for_heat_pump + ele_during_shut_down.ele_bought_for_ele)
def __init__(self, temporary, number): chp = CHPInternalCombustionEngine(temporary, number) ice = InternalCombustionEngine(number, temporary) gas_boiler = GasBoiler(temporary) elestorage = EleStorage(temporary) heatstorage = HeatStorage(temporary) demand = DemandData() heat_stor = 0 ele_stor = 0 self.fuel = [] self.ele_bought = [] self.ele_ice = [] self.heat_gas_boiler = [] self.heat_waste = [] self.ele_waste = [] for t in range(7, 23, Parameters.delttime): if demand.H[t] > chp.heat_out_max + heatstorage.get_H_out_max( heat_stor) + gas_boiler.nominal: self.judge = 0 break else: self.judge = 1 ele = ice.nominal heat = chp.heat_out_max if demand.H[t] <= heat: heatstorage_heat_in = heat - demand.H[t] heatstorage_heat_out = 0 heat_gas_boiler = 0 elif (demand.H[t] > heat) & (demand.H[t] <= heat + heatstorage.get_H_out_max(heat_stor)): heatstorage_heat_in = 0 heatstorage_heat_out = heatstorage.get_H_out_max( heat_stor) + heat - demand.H[t] heat_gas_boiler = 0 else: heatstorage_heat_in = 0 heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor) heat_gas_boiler = demand.H[ t] - heat - heatstorage.get_H_out_max(heat_stor) heat_stor = heatstorage.get_S(heat_stor, heatstorage_heat_in, heatstorage_heat_out) if demand.heat_E[t] <= ele: elestorage_ele_in = ele - demand.heat_E[t] elestorage_ele_out = 0 ele_bought = 0 elif (demand.heat_E[t] > ele) & (demand.heat_E[t] <= ele + elestorage.get_E_out_max(ele_stor)): elestorage_ele_in = 0 elestorage_ele_out = elestorage.get_E_out_max( ele_stor + ele - demand.heat_E[t]) ele_bought = 0 else: elestorage_ele_in = 0 elestorage_ele_out = elestorage.get_E_out_max(ele_stor) ele_bought = demand.heat_E[ t] - ele - elestorage.get_E_out_max(ele_stor) ele_stor = elestorage.get_S(ele_stor, elestorage_ele_in, elestorage_ele_out) if heat_stor > heatstorage.nominal: self.heat_waste.append(heat_stor - heatstorage.nominal) heat_stor = heatstorage.nominal else: self.heat_waste.append(0) if ele_stor > elestorage.nominal: self.ele_waste.append(ele_stor - elestorage.nominal) ele_stor = elestorage.nominal else: self.ele_waste.append(0) self.ele_ice.append(ele) self.heat_gas_boiler.append(heat_gas_boiler) self.ele_bought.append(ele_bought) self.fuel.append( ice.get_fuel(1) + gas_boiler.get_Fuel_in(heat_gas_boiler)) if self.judge == 1: for t in range(23, 24): heat_during_shut_down = HeatDuringShutDown( temporary, t, heat_stor) ele_during_shut_down = EleDuringShutDown( temporary, t, ele_stor, 1) heat_stor = heat_during_shut_down.heat_stor ele_stor = ele_during_shut_down.ele_stor self.heat_gas_boiler.append( heat_during_shut_down.heat_gas_boiler) self.fuel.append(heat_during_shut_down.fuel) self.ele_bought.append(ele_during_shut_down.ele_bought_for_ele) for t in range(0, 7, Parameters.delttime): heat_during_shut_down = HeatDuringShutDown( temporary, t, heat_stor) ele_during_shut_down = EleDuringShutDown( temporary, t, ele_stor, 1) heat_stor = heat_during_shut_down.heat_stor ele_stor = ele_during_shut_down.ele_stor self.heat_gas_boiler.append( heat_during_shut_down.heat_gas_boiler) self.fuel.append(heat_during_shut_down.fuel) self.ele_bought.append(ele_during_shut_down.ele_bought_for_ele)
def __init__(self, temporary, number): demand = DemandData() heatstorage = HeatStorage(temporary) coldstorage = ColdStorage(temporary) elestorage = EleStorage(temporary) gas_boiler = GasBoiler(temporary) heat_pump = HeatPump(temporary) ice = InternalCombustionEngine(number, temporary) absorption_chiller = DoubleEffectAbsorptionChiller(temporary) chp = CHPInternalCombustionEngine(temporary, number) time = demand.E_sheetnrows - 1 heat_stor = 0 ele_stor = 0 cold_stor = 0 self.fuel = [] self.ele_bought = [] self.ele_ice = [] self.heat = [] self.heat_gas_boiler = [] self.cold_absorption_chiller = [] self.cold_heat_pump = [] self.cold_waste = [] self.heat_waste = [] self.ele_waste = [] for t in range(0, time, Parameters.delttime): ele = min(demand.transition_E[t] - elestorage.get_E_out_max(ele_stor), ice.nominal) cold_heat = chp.get_cold_and_heat_through_ele(ele) judge_cold = cold_heat[0] judge_heat = cold_heat[1] if ((demand.C[t] > coldstorage.get_C_out_max(cold_stor) + judge_cold + heat_pump.nominal) | (demand.H[t] > heatstorage.get_H_out_max(heat_stor) + judge_heat + gas_boiler.nominal)): self.judge = 0 break else: self.judge = 1 ele_drive = EleDrive(t, temporary, number, ele_stor, 2) if ele_drive == 0: heat_drive = HeatDriveJW(t, temporary, number, heat_stor) gas_boiler_out = heat_drive.gas_boiler_out if heat_drive == 0: cold_drive = ColdDrive(t, temporary, number, cold_stor) cold = cold_drive.cold exhaust_gas = cold / absorption_chiller.COP_double pl = ice.get_pl_through_exhaust_gas(exhaust_gas) ele = pl * ice.nominal heat = ice.get_jacket_water_pl(pl) cold_stor = cold_drive.cold_stor heat_stor = heatstorage.get_S(heat_stor, heat, heat_drive.heatstorage_out) ele_stor = elestorage.get_S(ele_stor, ele, ele_drive.elestorage_out) self.cold_heat_pump.append(cold_drive.heat_pump_out) self.fuel.append(ice.get_fuel(pl)) self.ele_bought.append(heat_pump.get_E_in(cold_drive.heat_pump_out)) else: heat = heat_drive.heat pl = ice.get_pl_through_jacket_water(heat) ele = pl * ice.nominal exhaust_gas = ice.get_exhaust_gas_pl(pl) cold = exhaust_gas * absorption_chiller.COP_double cold_follow = ColdFollow(t, temporary, cold_stor, cold) cold_stor = cold_follow.cold_stor heat_stor = heat_drive.heat_stor ele_stor = elestorage.get_S(ele_stor, ele, ele_drive.elestorage_out) self.cold_heat_pump.append(cold_follow.heat_pump_out) self.fuel.append(ice.get_fuel(pl) + gas_boiler.get_Fuel_in(heat_drive.gas_boiler_out)) self.ele_bought.append(heat_pump.get_E_in(cold_follow.heat_pump_out)) else: ele = ele_drive.ele pl = ele / ice.nominal heat = ice.get_jacket_water_pl(pl) cold = ice.get_exhaust_gas_pl(pl) * absorption_chiller.COP_double heat_follow = HeatFollow(t, temporary, heat_stor, heat) cold_follow = ColdFollow(t, temporary, cold_stor, cold) gas_boiler_out = heat_follow.gas_boiler_out cold_stor = cold_follow.cold_stor heat_stor = heat_follow.heat_stor ele_stor = ele_drive.ele_stor self.cold_heat_pump.append(cold_follow.heat_pump_out) self.fuel.append(ice.get_fuel(pl) + gas_boiler.get_Fuel_in(heat_follow.gas_boiler_out)) self.ele_bought.append(ele_drive.ele_bought + heat_pump.get_E_in(cold_follow.heat_pump_out)) self.ele_ice.append(ele) self.heat.append(heat) self.heat_gas_boiler.append(gas_boiler_out) self.cold_absorption_chiller.append(cold) if cold_stor > coldstorage.nominal: self.cold_waste.append(cold_stor - coldstorage.nominal) cold_stor = coldstorage.nominal else: self.cold_waste.append(0) if heat_stor > heatstorage.nominal: self.heat_waste.append(heat_stor - heatstorage.nominal) heat_stor = heatstorage.nominal else: self.heat_waste.append(0) if ele_stor > elestorage.nominal: self.ele_waste.append(ele_stor - elestorage.nominal) ele_stor = elestorage.nominal else: self.ele_waste.append(0)
def running_judge(temporary, mode, season): heatstor = 0 coldstor = 0 elestor = 0 cold_stor_list = [] heat_stor_list = [] ele_stor_list = [] chp = CHP(temporary) gasboiler = GasBoiler(temporary) heatpump = HeatPump(temporary) absorption_chiller = AbsorptionChiller(temporary) boiler = Boiler(temporary) elestorage = EleStorage(temporary) heatstorage = HeatStorage(temporary) coldstorage = ColdStorage(temporary) totalfuel_gasturbine = 0 totalfuel_gasboiler = 0 totalele_powergrid = 0 demand = DemandData() if season == 0: demand_ele = demand.cold_E elif season == 1: demand_ele = demand.heat_E else: demand_ele = demand.transition_E for t in range(0, demand.E_sheetnrows - 1, Parameters.delttime): cold_stor_list.append(coldstor) heat_stor_list.append(heatstor) ele_stor_list.append(elestor) if mode == 0: # 以冷定热再定电 chp_cold = min(demand.C[t], chp.C_out_max) boiler_heat_out = absorption_chiller.get_H_in( chp_cold) / Parameters.k chp_heat = boiler_heat_out * (1 - Parameters.k) if demand.H[t] > heatstorage.get_H_out_max( heatstor) + chp_heat + gasboiler.nominal: return 0 else: result = mode_cold_first(t, temporary, coldstor, heatstor, elestor, season) else: # 以电定热再定冷 暂缺base load运行(运行模式已写好,就是还没加进来) chp_ele = min(demand_ele[t], chp.E_out_max) boiler_heat_in = chp_ele / chp.heat_ele_ratio chp_heat = boiler.get_H_out(boiler_heat_in) * (1 - Parameters.k) chp_cold = chp_heat / (1 - Parameters.k) * Parameters.k if ((demand.H[t] > heatstorage.get_H_out_max(heatstor) + chp_heat + gasboiler.nominal) | (demand.C[t] > coldstorage.get_C_out_max(coldstor) + chp_cold + heatpump.nominal)): return 0 else: result = mode_ele_first(t, temporary, coldstor, heatstor, elestor, season) coldstorage_cold_in = result[0] coldstorage_cold_out = result[1] heatstorage_heat_in = result[2] heatstorage_heat_out = result[3] elestorage_ele_in = result[4] elestorage_ele_out = result[5] powergrid_ele_out = result[11] gasboiler_fuel = result[12] gasturbine_fuel = result[13] totalfuel_gasturbine = totalfuel_gasturbine + gasturbine_fuel totalfuel_gasboiler = totalfuel_gasboiler + gasboiler_fuel totalele_powergrid = totalele_powergrid + powergrid_ele_out elestor = elestorage.get_S(elestor, elestorage_ele_in, elestorage_ele_out) if elestor > elestorage.nominal: elestor = elestorage.nominal # 若冲进的电过多,则剩余部分浪费 heatstor = heatstorage.get_S(heatstor, heatstorage_heat_in, heatstorage_heat_out) if heatstor > heatstorage.nominal: heatstor = heatstorage.nominal coldstor = coldstorage.get_S(coldstor, coldstorage_cold_in, coldstorage_cold_out) if coldstor > coldstorage.nominal: coldstor = coldstorage.nominal output = 1, totalfuel_gasturbine, totalfuel_gasboiler, totalele_powergrid return output