示例#1
0
def plot_daily_psychrometric(hourly, name='', interactive=False):
    fig = plt.figure()
    ti = daily_mean(hourly.Ti)
    wi = daily_mean(hourly.Wi)
    rt = daily_total(hourly.RTFc) # cooling runtime
    cd = np.where(rt > 0)[0] # cooling days
    ncd = np.where(rt <= 0)[0] # non-cooling days
    plt.scatter(ti[cd], wi[cd], color='b')
    plt.scatter(ti[ncd], wi[ncd], color='r')
    # plot some lines of constant RH
    ts = np.linspace(65,85,5)
    for rh in np.linspace(0.1, 1, 10):
        plt.plot(ts, humidity_ratio(rh, ts), 'k')
    plt.xlabel('Indoor Temperature [degF]')
    plt.ylabel('Indoor Humidity Ratio')
    plt.title('{0}: Psychrometric Chart'.format(name))
    # RH labels on right hand side
    ax1 = plt.axes()
    ax2 = ax1.twinx()
    ax2.get_yaxis().set_major_locator(ticker.FixedLocator(humidity_ratio(np.linspace(0,1,11), 85)/0.030)) # TODO don't hardcode limits
    ax2.get_yaxis().set_major_formatter(ticker.FixedFormatter(np.linspace(0,100,11)))
    plt.ylabel('Indoor RH [%]')
#    ax2.get_yaxis().set_major_locator(ticker.FixedLocator(np.linspace(0,1,11)))
    if name:
        fig.savefig('{1}/{0}-psychrometric.png'.format(name, summary_path))
        if not interactive:
            plt.close()
示例#2
0
def plot_humidity_ratio(hourly, name='', interactive=False):
    fig = plt.figure()
    plt.scatter(daily_mean(hourly.Wo), daily_mean(hourly.Wi))
    plt.xlabel('Outdoor Humidity Ratio')
    plt.ylabel('Indoor Humidity Ratio')
    plt.title('{0}: Daily Humidity Ratio'.format(name))
    if name:
        fig.savefig('{1}/{0}-wi-wo.png'.format(name, summary_path))
        if not interactive:
            plt.close()
示例#3
0
def rh_by_runtime(RTFc, RTFh, RHi, **hourly):
    heads = ['Hours above 50% RH; days with no cooling or heating',
             'Number of days; no cooling or heating',
             'Mean RH, days with no cooling or heating',
             'Hours above 50% RH; days with cooling, no heating',
             'Number of days;  cooling, no heating',
             'Mean RH, days with cooling, no heating',
             'Hours above 50% RH; days with heating, no cooling',
             'Number of days; heating, no cooling',
             'Mean RH, days with heating, no cooling',
             'Hours above 50% RH; days with heating and cooling',
             'Number of days; heating and cooling',
             'Mean RH, days with heating and cooling']
    vals = []
    conditions = [np.intersect1d(np.where(daily_total(RTFc)==0)[0], np.where(daily_total(RTFh)==0)[0]),
                  np.intersect1d(np.where(daily_total(RTFc)>0)[0], np.where(daily_total(RTFh)==0)[0]),
                  np.intersect1d(np.where(daily_total(RTFc)==0)[0], np.where(daily_total(RTFh)>0)[0]),
                  np.intersect1d(np.where(daily_total(RTFc)>0)[0], np.where(daily_total(RTFh)>0)[0])]
    for condition in conditions:
        vals.append(daily_total(np.where(RHi > 50, 1, 0))[condition].sum())
        vals.append(len(condition))
        vals.append(daily_mean(RHi)[condition].mean())
    if len(heads) != len(vals):
        print("only {0} values for {1}".format(len(vals), hourly['name']))
    return (heads, vals)
示例#4
0
def ac_bal_point(h, name='', interactive=False):
    fig = plt.figure()
    rt = daily_total(h.RTFc) # AC runtime
    ts = daily_mean(h.To)
    ch = np.where(rt>0) # cooling hours
    trlim = (60,90)
    p = np.polyfit(ts[ch], rt[ch], 1)
    tr = np.poly1d(p)
    plt.scatter(ts, rt, marker='+', s=10, linewidths=0.1, color='r')
    # don't plot balance point, Hugh says
    #plt.plot(trlim, tr(trlim), 'r')
    plt.ylim(0,40)
    plt.xlabel('Outdoor Daily Avg T [degF]')
    plt.ylabel('Daily AC Runtime [hours]')
    plt.title('{0}:Cooling Balance'.format(name))
    if name:
        fig.savefig('{1}/{0}-AC-balance.png'.format(name, summary_path))
        if not interactive: # if name is provided, assume called from script, unless interactive set
            plt.close()
    return p[1]/p[0] # Balance Point below which no AC is needed