예제 #1
0
def rough_judge(temporary, number, season):
    ele_demand_sum = 0
    heat_demand_sum = 0
    cold_demand_sum = 0
    chp = CHP(temporary, number)
    gasboiler = GasBoiler(temporary)
    heatpump = HeatPump(temporary)
    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):  # 暗含了H 和 C 的sheetnrows 和 E 的相同
        ele_demand_sum = ele_demand_sum + demand_ele[t]
        heat_demand_sum = heat_demand_sum + demand.H[t]
        cold_demand_sum = cold_demand_sum + demand.C[t]
    if (heat_demand_sum <= (chp.H_out_max + gasboiler.nominal)*Parameters.delttime * (demand.H_sheetnrows-1)) & \
            (cold_demand_sum <= (chp.C_out_max + heatpump.nominal) * Parameters.delttime * (demand.C_sheetnrows-1)):
        return 1  # 初判成功,返回1,继续判断
    else:
        return 0  # 初判失败,系统不可用
예제 #2
0
def feasible_region(temporary, number):
    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 ((heatstorage.H_out_nominal + chp.H_out_max + gasboiler.nominal) * Parameters.delttime < demand.H[t]) |\
                ((coldstorage.C_out_nominal + chp.C_out_max + heatpump.nominal) * Parameters.delttime < demand.C[t]):
            return 0
    return 1
예제 #3
0
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
예제 #4
0
def signal_cold(t, temporary, cold_stor, season):  # 储电够,储热够,储冷不够
    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    boiler = Boiler(temporary)
    absorptionchiller = AbsorptionChiller(temporary)
    gasboiler = GasBoiler(temporary)
    heatpump = HeatPump(temporary)
    coldstorage = ColdStorage(temporary)
    demand = DemandData()
    if season == 0:
        demand_ele = demand.cold_E
    elif season == 1:
        demand_ele = demand.heat_E
    else:
        demand_ele = demand.transition_E

    elestorage_ele_out = demand_ele[t]
    heatstorage_heat_out = demand.H[t]
    coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
    coldstorage_cold_in = 0
    powergrid_ele_out = 0
    gasboiler_heat_out = 0
    gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)

    if demand.C[t] <= coldstorage_cold_out + chp.C_out_max:
        absorptionchiller_cold_out = demand.C[t] - coldstorage_cold_out
        heatpump_cold_out = 0
    else:
        absorptionchiller_cold_out = chp.C_out_max
        heatpump_cold_out = demand.C[t] - coldstorage_cold_out - absorptionchiller_cold_out
    absorptionchiller_heat_in = absorptionchiller.get_H_in(absorptionchiller_cold_out)
    boiler_heat_out = absorptionchiller_heat_in / Parameters.k
    boiler_heat_out_users = boiler_heat_out * (1 - Parameters.k)
    heatstorage_heat_in = boiler_heat_out_users
    boiler_heat_in = boiler.get_H_in(boiler_heat_out)
    gasturbine_ele_out = boiler_heat_in / chp.heat_ele_ratio
    gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
    heatpump_ele_in = heatpump.get_E_in(heatpump_cold_out)

    if heatpump_ele_in <= gasturbine_ele_out:
        elestorage_ele_in = gasturbine_ele_out - heatpump_ele_in
        heatpump_powergrid = 0
    else:
        elestorage_ele_in = 0
        heatpump_powergrid = heatpump_ele_in - gasturbine_ele_out

    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in, heatstorage_heat_out,
              elestorage_ele_in, elestorage_ele_out, absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out, gasboiler_fuel, gasturbine_fuel,
              heatpump_powergrid)
    return result
예제 #5
0
def signal_ele(t, temporary, ele_stor):
    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    boiler = Boiler(temporary)
    absorptionchiller = AbsorptionChiller(temporary)
    gasboiler = GasBoiler(temporary)
    elestorage = EleStorage(temporary)
    demand = DemandData()
    heatpump_powergrid = 0
    heatpump_cold_out = 0
    gasboiler_heat_out = 0
    gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)
    coldstorage_cold_out = demand.C[t]
    heatstorage_heat_out = demand.H[t]
    elestorage_ele_in = 0
    elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
    if demand.E[t] > (elestorage.get_E_out_max(ele_stor) +
                      chp.E_out_max) * Parameters.delttime:  # 储电+ CHP + 电网
        powergrid_ele_out = demand.E[t] - elestorage.get_E_out_max(
            ele_stor) - chp.E_out_max
        gasturbine_ele_out = chp.E_out_max  # kWh
    else:  # 储电+ CHP
        gasturbine_ele_out = demand.E[t] - elestorage.get_E_out_max(ele_stor)
        powergrid_ele_out = 0
    gasturbine_heat_out = gasturbine.get_H_out(gasturbine_ele_out)
    gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
    if gasturbine_heat_out <= boiler.heat_in_max:  # 防止汽轮机输出热量 > 余热锅炉允许进入热量
        boiler_heat_in = gasturbine_heat_out
    else:
        boiler_heat_in = boiler.heat_in_max
    boiler_heat_out = boiler.get_H_out(boiler_heat_in)
    boiler_heat_out_users = boiler_heat_out * (1 - Parameters.k)
    absorptionchiller_heat_in = boiler_heat_out * Parameters.k
    absorptionchiller_cold_out = absorptionchiller.get_C_out(
        absorptionchiller_heat_in)
    coldstorage_cold_in = absorptionchiller_cold_out
    heatstorage_heat_in = boiler_heat_out_users
    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in,
              heatstorage_heat_out, elestorage_ele_in, elestorage_ele_out,
              absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out,
              gasboiler_fuel, gasturbine_fuel, heatpump_powergrid)  # 15项
    return result
예제 #6
0
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
예제 #7
0
def mode_base_load(t, temporary, cold_stor, heat_stor, ele_stor, season):
    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    gasboiler = GasBoiler(temporary)
    heatpump = HeatPump(temporary)
    elestorage = EleStorage(temporary)
    heatstorage = HeatStorage(temporary)
    coldstorage = ColdStorage(temporary)
    demand = DemandData()
    if season == 0:
        demand_ele = demand.cold_E
    elif season == 1:
        demand_ele = demand.heat_E
    else:
        demand_ele = demand.transition_E

    remainder = t % 24
    if (remainder >= 8) & (remainder <= 19):  # 8:00-20:00
        gasturbine_ele_out = gasturbine.nominal
        gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
        boiler_heat_out_users = chp.H_out_max
        boiler_heat_out = boiler_heat_out_users / (1 - Parameters.k)
        absorptionchiller_cold_out = chp.C_out_max
        if demand_ele[t] <= gasturbine_ele_out:  # 电量先由chp提供,再由储能提供
            elestorage_ele_in = gasturbine_ele_out - demand_ele[t]
            elestorage_ele_out = 0
            powergrid_ele_out = 0
        elif ((demand_ele[t] > gasturbine_ele_out)
              & (demand_ele[t] <=
                 gasturbine_ele_out + elestorage.get_E_out_max(ele_stor))):
            elestorage_ele_in = 0
            elestorage_ele_out = gasturbine_ele_out + elestorage.get_E_out_max(
                ele_stor) - demand_ele[t]
            powergrid_ele_out = 0
        else:
            elestorage_ele_in = 0
            elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
            powergrid_ele_out = demand_ele[
                t] - gasturbine_ele_out - elestorage_ele_out

        if demand.H[t] <= boiler_heat_out_users:
            heatstorage_heat_in = boiler_heat_out_users - demand.H[t]
            heatstorage_heat_out = 0
            gasboiler_heat_out = 0
        elif ((demand.H[t] > boiler_heat_out_users)
              & (demand.H[t] <= boiler_heat_out_users +
                 heatstorage.get_H_out_max(heat_stor))):
            heatstorage_heat_in = 0
            heatstorage_heat_out = demand.H[t] - boiler_heat_out_users
            gasboiler_heat_out = 0
        else:
            heatstorage_heat_in = 0
            heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
            gasboiler_heat_out = demand.H[
                t] - boiler_heat_out_users - heatstorage_heat_out
        gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)

        if demand.C[t] <= absorptionchiller_cold_out:
            coldstorage_cold_in = absorptionchiller_cold_out - demand.C[t]
            coldstorage_cold_out = 0
            heatpump_cold_out = 0
        elif ((demand.C[t] > absorptionchiller_cold_out)
              & (demand.C[t] <= absorptionchiller_cold_out +
                 coldstorage.get_C_out_max(cold_stor))):
            coldstorage_cold_in = 0
            coldstorage_cold_out = demand.C[t] - absorptionchiller_cold_out
            heatpump_cold_out = 0
        else:
            coldstorage_cold_in = 0
            coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
            heatpump_cold_out = demand.C[
                t] - absorptionchiller_cold_out - coldstorage_cold_out
        heatpump_powergrid = heatpump.get_E_in(heatpump_cold_out)
    else:  # 20:00-凌晨8:00
        gasturbine_ele_out = 0
        boiler_heat_out = 0
        absorptionchiller_cold_out = 0
        gasturbine_fuel = 0
        elestorage_ele_in = 0
        heatstorage_heat_in = 0
        coldstorage_cold_in = 0

        if demand_ele[t] <= elestorage.get_E_out_max(ele_stor):
            elestorage_ele_out = demand_ele[t]
            powergrid_ele_out = 0
        else:
            elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
            powergrid_ele_out = demand_ele[t] - elestorage_ele_out

        if demand.H[t] <= heatstorage.get_H_out_max(heat_stor):
            heatstorage_heat_out = demand.H[t]
            gasboiler_heat_out = 0
        else:
            heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
            gasboiler_heat_out = demand.H[t] - heatstorage_heat_out
        gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)

        if demand.C[t] <= coldstorage.get_C_out_max(cold_stor):
            coldstorage_cold_out = demand.C[t]
            heatpump_cold_out = 0
        else:
            coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
            heatpump_cold_out = demand.C[t] - coldstorage_cold_out
        heatpump_powergrid = heatpump.get_E_in(heatpump_cold_out)

    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in,
              heatstorage_heat_out, elestorage_ele_in, elestorage_ele_out,
              absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out,
              gasboiler_fuel, gasturbine_fuel, heatpump_powergrid)
    return result
예제 #8
0
def signal_heat(t, temporary, cold_stor, heat_stor):  # 储电够,储热不够
    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    boiler = Boiler(temporary)
    absorptionchiller = AbsorptionChiller(temporary)
    gasboiler = GasBoiler(temporary)
    heatpump = HeatPump(temporary)
    heatstorage = HeatStorage(temporary)
    coldstorage = ColdStorage(temporary)
    demand = DemandData()

    elestorage_ele_out = demand.E[t]
    heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
    heatstorage_heat_in = 0
    powergrid_ele_out = 0

    if demand.H[t] <= heatstorage_heat_out + chp.H_out_max:
        boiler_heat_out_users = demand.H[t] - heatstorage_heat_out
        gasboiler_heat_out = 0
    else:
        boiler_heat_out_users = chp.H_out_max
        gasboiler_heat_out = demand.H[
            t] - heatstorage_heat_out - boiler_heat_out_users
    boiler_heat_out = boiler_heat_out_users / (1 - Parameters.k)
    boiler_heat_in = boiler.get_H_in(boiler_heat_out)
    gasturbine_ele_out = boiler_heat_in / chp.heat_ele_ratio
    gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
    absorptionchiller_cold_out = absorptionchiller.get_C_out(boiler_heat_out *
                                                             Parameters.k)
    gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)

    if demand.C[t] <= coldstorage.get_C_out_max(cold_stor):
        coldstorage_cold_out = demand.C[t]
        coldstorage_cold_in = absorptionchiller_cold_out
        heatpump_cold_out = 0
    elif (
        (demand.C[t] > coldstorage.get_C_out_max(cold_stor) &
         (demand.C[t] <=
          coldstorage.get_C_out_max(cold_stor) + absorptionchiller_cold_out))):
        coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
        coldstorage_cold_in = coldstorage_cold_out + absorptionchiller_cold_out - demand.C[
            t]
        heatpump_cold_out = 0
    else:
        coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
        coldstorage_cold_in = 0
        heatpump_cold_out = demand.C[
            t] - coldstorage_cold_out - absorptionchiller_cold_out
    heatpump_ele_in = heatpump.get_E_in(heatpump_cold_out)

    if heatpump_ele_in <= gasturbine_ele_out:  # 热泵的电首先由chp供电
        heatpump_powergrid = 0
        elestorage_ele_in = gasturbine_ele_out - heatpump_ele_in
    else:
        heatpump_powergrid = heatpump_ele_in - gasturbine_ele_out
        elestorage_ele_in = 0
    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in,
              heatstorage_heat_out, elestorage_ele_in, elestorage_ele_out,
              absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out,
              gasboiler_fuel, gasturbine_fuel, heatpump_powergrid)
    return result
예제 #9
0
def signal_ele(t, temporary, cold_stor, heat_stor, ele_stor):  # 储电不够
    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    boiler = Boiler(temporary)
    absorptionchiller = AbsorptionChiller(temporary)
    gasboiler = GasBoiler(temporary)
    heatpump = HeatPump(temporary)
    elestorage = EleStorage(temporary)
    heatstorage = HeatStorage(temporary)
    coldstorage = ColdStorage(temporary)
    demand = DemandData()

    elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
    elestorage_ele_in = 0
    if demand.E[t] > elestorage_ele_out + chp.E_out_max:
        powergrid_ele_out = demand.E[t] - elestorage_ele_out - chp.E_out_max
        gasturbine_ele_out = gasturbine.nominal
    else:  # 可由chp系统满足
        gasturbine_ele_out = demand.E[t] - elestorage_ele_out
        powergrid_ele_out = 0
    gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
    gasturbine_heat_out = gasturbine.get_H_out(gasturbine_ele_out)
    boiler_heat_out = boiler.get_H_out(gasturbine_heat_out)
    boiler_heat_out_users = boiler_heat_out * (1 - Parameters.k)
    absorptionchiller_heat_in = boiler_heat_out * Parameters.k
    absorptionchiller_cold_out = absorptionchiller.get_C_out(
        absorptionchiller_heat_in)

    if demand.H[t] <= heatstorage.get_H_out_max(heat_stor):
        heatstorage_heat_out = demand.H[t]
        heatstorage_heat_in = boiler_heat_out_users
        gasboiler_heat_out = 0
    elif ((demand.H[t] > heatstorage.get_H_out_max(heat_stor))
          & (demand.H[t] <=
             heatstorage.get_H_out_max(heat_stor) + boiler_heat_out_users)):
        heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
        heatstorage_heat_in = boiler_heat_out_users + heatstorage_heat_out - demand.H[
            t]
        gasboiler_heat_out = 0
    else:  # 要用燃气锅炉
        heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
        heatstorage_heat_in = 0
        gasboiler_heat_out = demand.H[
            t] - heatstorage_heat_out - boiler_heat_out_users
    gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)

    if demand.C[t] <= coldstorage.get_C_out_max(cold_stor):
        coldstorage_cold_out = demand.C[t]
        coldstorage_cold_in = absorptionchiller_cold_out
        heatpump_cold_out = 0
    elif ((demand.C[t] > coldstorage.get_C_out_max(cold_stor)) &
          (demand.C[t] <=
           coldstorage.get_C_out_max(cold_stor) + absorptionchiller_cold_out)):
        coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
        coldstorage_cold_in = coldstorage_cold_out + absorptionchiller_cold_out - demand.C[
            t] / Parameters.delttime
        heatpump_cold_out = 0
    else:
        coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
        coldstorage_cold_in = 0
        heatpump_cold_out = (demand.C[t] -
                             coldstorage.get_C_out_max(cold_stor) -
                             absorptionchiller_cold_out)
    heatpump_powergrid = heatpump.get_E_in(heatpump_cold_out)  # 此时热泵耗电全部由电网提供
    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in,
              heatstorage_heat_out, elestorage_ele_in, elestorage_ele_out,
              absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out,
              gasboiler_fuel, gasturbine_fuel, heatpump_powergrid)
    return result
예제 #10
0
def signal_heat(t, temporary, heat_stor, ele_stor):  # 储冷> 冷需求, 储热 < 热需求

    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    boiler = Boiler(temporary)
    absorptionchiller = AbsorptionChiller(temporary)
    gasboiler = GasBoiler(temporary)
    elestorage = EleStorage(temporary)
    heatstorage = HeatStorage(temporary)
    demand = DemandData()
    heatpump_powergrid = 0
    heatpump_cold_out = 0
    coldstorage_cold_out = demand.C[t]
    heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
    heatstorage_heat_in = 0
    if demand.H[t] > heatstorage.get_H_out_max(
            heat_stor) + chp.H_out_max:  # 储热+ CHP + 燃气锅炉
        gasboiler_heat_out = demand.H[t] - heatstorage.get_H_out_max(
            heat_stor) - chp.H_out_max
        boiler_heat_out_users = chp.H_out_max
    else:  # 储热+ CHP
        boiler_heat_out_users = demand.H[t] - heatstorage.get_H_out_max(
            heat_stor)
        gasboiler_heat_out = 0
    gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)
    boiler_heat_out = boiler_heat_out_users / (1 - Parameters.k)
    boiler_heat_in = boiler.get_H_in(boiler_heat_out)
    gasturbine_heat_out = boiler_heat_in
    gasturbine_ele_out = gasturbine_heat_out / chp.heat_ele_ratio
    gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
    if boiler_heat_out * Parameters.k <= absorptionchiller.heat_in_max:  # 防止锅炉产热*P.k 大于制冷机允许进入的热量
        absorptionchiller_heat_in = boiler_heat_out * Parameters.k
    else:
        absorptionchiller_heat_in = absorptionchiller.heat_in_max
    absorptionchiller_cold_out = absorptionchiller.get_C_out(
        absorptionchiller_heat_in)
    coldstorage_cold_in = absorptionchiller.get_C_out(
        absorptionchiller_heat_in)
    if demand.E[t] <= elestorage.get_E_out_max(ele_stor):  # 储电
        elestorage_ele_out = demand.E[t]
        elestorage_ele_in = gasturbine_ele_out
        powergrid_ele_out = 0
    elif ((demand.E[t] > elestorage.get_E_out_max(ele_stor)) &
          (demand.E[t] <=
           elestorage.get_E_out_max(ele_stor) + gasturbine_ele_out)):
        # 储电+ CHP
        elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
        elestorage_ele_in = gasturbine_ele_out + elestorage.get_E_out_max(
            ele_stor) - demand.E[t] / Parameters.delttime
        powergrid_ele_out = 0
    else:  # 储电+ CHP + 电网
        elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
        elestorage_ele_in = 0
        powergrid_ele_out = demand.E[t] - elestorage.get_E_out_max(
            ele_stor) - gasturbine_ele_out
    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in,
              heatstorage_heat_out, elestorage_ele_in, elestorage_ele_out,
              absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out,
              gasboiler_fuel, gasturbine_fuel, heatpump_powergrid)
    return result
예제 #11
0
def signal_cold(t, temporary, cold_stor, heat_stor, ele_stor):  # 储冷不够

    chp = CHP(temporary)
    gasturbine = GasTurbine(temporary)
    boiler = Boiler(temporary)
    absorptionchiller = AbsorptionChiller(temporary)
    gasboiler = GasBoiler(temporary)
    heatpump = HeatPump(temporary)
    elestorage = EleStorage(temporary)
    heatstorage = HeatStorage(temporary)
    coldstorage = ColdStorage(temporary)
    demand = DemandData()

    coldstorage_cold_out = coldstorage.get_C_out_max(cold_stor)
    coldstorage_cold_in = 0
    if demand.C[t] > (coldstorage.get_C_out_max(cold_stor) + chp.C_out_max):
        # 储冷 + CHP + 热泵满足
        heatpump_cold_out = demand.C[t] - coldstorage.get_C_out_max(
            cold_stor) - chp.C_out_max
        # 热泵产冷
        absorptionchiller_cold_out = chp.C_out_max
    else:  # 储冷+ CHP 满足
        heatpump_cold_out = 0
        absorptionchiller_cold_out = demand.C[t] - coldstorage.get_C_out_max(
            cold_stor)
    heatpump_ele_in = heatpump.get_E_in(heatpump_cold_out)  # 热泵耗电
    absorptionchiller_heat_in = absorptionchiller.get_H_in(
        absorptionchiller_cold_out)
    boiler_heat_out = absorptionchiller_heat_in / Parameters.k
    boiler_heat_out_users = boiler_heat_out * (1 - Parameters.k)
    boiler_heat_in = boiler.get_H_in(boiler_heat_out)
    gasturbine_heat_out = boiler_heat_in
    gasturbine_ele_out = gasturbine_heat_out / chp.heat_ele_ratio
    gasturbine_fuel = gasturbine.get_fuel(gasturbine_ele_out)
    if gasturbine_ele_out >= heatpump_ele_in:
        gasturbine_ele_out_users = gasturbine_ele_out - heatpump_ele_in  # 别忘了
        heatpump_powergrid = 0
    else:
        gasturbine_ele_out_users = 0
        heatpump_powergrid = heatpump_ele_in - gasturbine_ele_out
    if demand.H[t] <= heatstorage.get_H_out_max(heat_stor):  # 储热即可满足
        heatstorage_heat_in = boiler_heat_out_users
        heatstorage_heat_out = demand.H[t]
        gasboiler_heat_out = 0
    elif ((demand.H[t] > heatstorage.get_H_out_max(heat_stor)) &
          (demand.H[t] <=
           boiler_heat_out_users + heatstorage.get_H_out_max(heat_stor))):
        # 储热+ CHP 满足,多余存入储热
        heatstorage_heat_in = boiler_heat_out_users + heatstorage.get_H_out_max(
            heat_stor) - demand.H[t]
        # 储热先供热,CHP产热再存入储热
        heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
        gasboiler_heat_out = 0
    else:  # DemandData.H[t] > (boiler_heat_out_users + heatstorage.get_H_out_max(heat_stor)):   # 储热+ CHP + 燃气锅炉 满足
        gasboiler_heat_out = demand.H[
            t] - boiler_heat_out_users - heatstorage.get_H_out_max(heat_stor)
        heatstorage_heat_in = 0
        heatstorage_heat_out = heatstorage.get_H_out_max(heat_stor)
    gasboiler_fuel = gasboiler.get_Fuel_in(gasboiler_heat_out)
    if demand.E[t] <= elestorage.get_E_out_max(ele_stor):  # 储电满足
        elestorage_ele_in = gasturbine_ele_out_users
        elestorage_ele_out = demand.E[t]
        powergrid_ele_out = 0
    elif ((demand.E[t] > elestorage.get_E_out_max(ele_stor)) &
          (demand.E[t] <=
           elestorage.get_E_out_max(ele_stor) + gasturbine_ele_out_users)):
        # 储电 + CHP 满足,多余存入储电
        elestorage_ele_in = elestorage.get_E_out_max(
            ele_stor) + gasturbine_ele_out_users - demand.E[t]
        elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
        powergrid_ele_out = 0
    else:  # 储电+ CHP + 电网
        elestorage_ele_in = 0
        elestorage_ele_out = elestorage.get_E_out_max(ele_stor)
        powergrid_ele_out = (demand.E[t] - elestorage.get_E_out_max(ele_stor) -
                             gasturbine_ele_out_users)
    result = (coldstorage_cold_in, coldstorage_cold_out, heatstorage_heat_in,
              heatstorage_heat_out, elestorage_ele_in, elestorage_ele_out,
              absorptionchiller_cold_out, boiler_heat_out, gasturbine_ele_out,
              heatpump_cold_out, gasboiler_heat_out, powergrid_ele_out,
              gasboiler_fuel, gasturbine_fuel, heatpump_powergrid)  # 15 项
    return result
예제 #12
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