diff --git a/examples/case_study_1/post_process.ipynb b/examples/case_study_1/post_process.ipynb index fd9c1046..274f123e 100644 --- a/examples/case_study_1/post_process.ipynb +++ b/examples/case_study_1/post_process.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 52, "metadata": {}, "outputs": [], "source": [ @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 53, "metadata": {}, "outputs": [], "source": [ @@ -99,7 +99,7 @@ "\n", "def set_cases_and_initiate_plot():\n", " from matplotlib.gridspec import GridSpec\n", - " cases = ['Base case', 'Guideline 36']\n", + " cases = ['Base\\ case', 'Guideline\\ 36']\n", " seasons = ['Winter', 'Spring', 'Summer']\n", " num_cases = len(cases)\n", " num_seasons = len(seasons)\n", @@ -122,32 +122,45 @@ " return cases, seasons, num_cases, num_seasons, fig, ax\n", "\n", "def set_up_labels(i, ax, cases, seasons, num_cases, num_seasons, x_axis_label, y_axis_label):\n", - " # Hide xtick labels and ticks on the upper case subplot (each basecase)\n", - " if i % 2 == 0:\n", - " hide_tick_labels(ax)\n", - "\n", - " # Print x axis title only below the lowest subplot\n", - " if i == num_cases*num_seasons - 1:\n", - " ax.set_xlabel(x_axis_label)\n", - " ax.set_ylabel(y_axis_label)\n", - " #ax.xaxis.set_ticks(np.arange(min(t)+0, 365, 1))\n", + " left, width = .01, .97\n", + " bottom, height = .01, .88\n", + " right = left + width\n", + " top = bottom + height\n", + " # Hide xtick labels and ticks on the upper case subplot (each basecase)\n", + " if i % 2 == 0:\n", + " hide_tick_labels(ax)\n", + "\n", + " # Print x axis title only below the lowest subplot\n", + " if i == num_cases*num_seasons - 1:\n", + " ax.set_xlabel(x_axis_label)\n", + " ax.set_ylabel(y_axis_label)\n", + " #ax.xaxis.set_ticks(np.arange(min(t)+0, 365, 1))\n", " \n", - " # Annotate case\n", - " if i % 2 == 0:\n", - " title_str = r\"$\\bf{\" + seasons[i/2] + \"}$\" + ' (upper: ' + r\"$\\it{\" + cases[i % 2] + \"}$\" + ', lower: ' + r\"$\\it{\" + cases[(i-1) % 2] + \"}$\" + ')'\n", - " ax.set_title(title_str, # mg assign appropriate season/case\n", - " verticalalignment = 'top',\n", - " horizontalalignment = 'center', \n", - " fontsize = 6, color = 'k')\n", + " # Annotate case\n", + " title_str = r\"$\\it{\" + cases[i % 2] + \"}$\"\n", + " ax.text(left, top,\n", + " title_str, # mg assign appropriate season/case\n", + " verticalalignment = 'center',\n", + " horizontalalignment = 'left', \n", + " transform=ax.transAxes,\n", + " fontsize = 6, color = 'k')\n", + " \n", + " # Annotate case\n", + " # if i % 2 == 0:\n", + " # title_str = r\"$\\bf{\" + seasons[i/2] + \"}$\" + ' (upper: ' + r\"$\\it{\" + cases[i % 2] + \"}$\" + ', lower: ' + r\"$\\it{\" + cases[(i-1) % 2] + \"}$\" + ')'\n", + " # ax.set_title(title_str, # mg assign appropriate season/case\n", + " # verticalalignment = 'top',\n", + " # horizontalalignment = 'center', \n", + " # fontsize = 6, color = 'k')\n", " \n", - " # Print legend only at the lower plot (g36 case)\n", - " if i % 2 == 1:\n", - " ax.legend(loc='center right', ncol=1)\n", - " configure_axes(ax)\n", + " # Print legend only at the lower plot (g36 case)\n", + " if i % 2 == 1:\n", + " ax.legend(loc='center right', ncol=1)\n", + " configure_axes(ax)\n", " \n", - " #plt.tight_layout(h_pad=0)\n", - " plt.tight_layout()\n", - " #plt.subplots_adjust(hspace = .2)\n", + " #plt.tight_layout(h_pad=0)\n", + " plt.tight_layout()\n", + " #plt.subplots_adjust(hspace = .2)\n", " \n", "def tem_conv_CtoF(T_in_degC):\n", " '''Converts temperature provided in degC to degF\n", @@ -183,7 +196,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 54, "metadata": {}, "outputs": [ { @@ -257,7 +270,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 75, "metadata": {}, "outputs": [], "source": [ @@ -339,7 +352,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 56, "metadata": {}, "outputs": [], "source": [ @@ -389,9 +402,9 @@ "\n", " ax[i].plot(t, TOut-273.15, 'k', label='$T_{out}$', linewidth=0.5)\n", " ax[i].plot(t, TRoo_N_S[0]-273.15, 'b', label='$T_{nor}$', linewidth=0.5)\n", - " ax[i].plot(tWith, TRoo_N_S[1]-273.15, 'b', label='$T_{norWdivIHG}$', linewidth=0.5, linestyle='--')\n", + " ax[i].plot(tWith, TRoo_N_S[1]-273.15, 'b', label='$T_{nor\\_with\\_divIHG}$', linewidth=0.5, linestyle='--')\n", " ax[i].plot(t, TRoo_N_S[2]-273.15, 'r', label='$T_{sou}$', linewidth=0.5)\n", - " ax[i].plot(tWith, TRoo_N_S[3]-273.15, 'r', label='$T_{souWdivIHG}$', linewidth=0.5, linestyle='--')\n", + " ax[i].plot(tWith, TRoo_N_S[3]-273.15, 'r', label='$T_{sou\\_with\\_divIHG}$', linewidth=0.5, linestyle='--')\n", "\n", " ax[i].patch.set_facecolor('mistyrose') \n", " ax[i].fill_between(t, TSetHea-273.15, y2=TSetCoo-273.15, color='white')\n", @@ -421,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 74, "metadata": {}, "outputs": [], "source": [ @@ -432,7 +445,7 @@ " from buildingspy.io.outputfile import Reader\n", " import matplotlib.pyplot as plt\n", "\n", - " room_styles = ['k', 'b', 'g', 'r', 'c', 'g']\n", + " room_styles = ['b', 'k', 'r', 'g', 'c', 'g']\n", " room_names = ['nor', 'wes', 'sou', 'eas', 'cor'] \n", " plt.clf() \n", " time_scale=86400.\n", @@ -462,8 +475,9 @@ " for iRoo in [0, 2]:\n", " ax[i].plot(t, yHea[iRoo], room_styles[iRoo], \\\n", " label='$y_{{hea,{name}}}$'.format(name=room_names[iRoo]), linewidth=0.25)\n", - " ax[i].plot(t, yVAV[iRoo], room_styles[iRoo+1], \\\n", - " label='$y_{{vav,{name}}}$'.format(name=room_names[iRoo]), linewidth=0.25)\n", + " ax[i].plot(t, yVAV[iRoo], room_styles[iRoo], \\\n", + " label='$y_{{vav,{name}}}$'.format(name=room_names[iRoo]), linewidth=0.25, linestyle=\"--\", \\\n", + " marker='^', markersize=1, markevery=200)\n", " \n", " # customize days to display\n", " ax[i].set_xlim([min(t)+5, min(t)+12])\n", @@ -488,7 +502,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 57, "metadata": {}, "outputs": [], "source": [ @@ -550,7 +564,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 76, "metadata": {}, "outputs": [], "source": [ @@ -585,12 +599,12 @@ "\n", " \n", " # Plot figure\n", - "\n", - " ax = plt.subplot(2, 1, 1)\n", + " fig = plt.figure(figsize=(6.5,4.))\n", + " ax = fig.add_subplot(2, 1, 1)\n", " ax.plot(t, TOut-273.15, 'gray', label='$T_{out}$', linewidth=0.25)\n", - " ax.plot(t, TSupNoFr-273.15, 'b', label='$T_{sup}$', linewidth=0.25)\n", - " ax.plot(tWith, TMixWith-273.15, 'g', label='$T_{mix,with}$', linewidth=0.5)\n", - " ax.plot(t, TMixNoFr-273.15, 'r', label='$T_{mix}$', linewidth=0.5)\n", + " ax.plot(t, TSupNoFr-273.15, 'k', label='$T_{sup}$', linewidth=0.25)\n", + " ax.plot(tWith, TMixWith-273.15, 'b', label='$T_{mix,with}$', linewidth=0.5)\n", + " ax.plot(t, TMixNoFr-273.15, 'b', label='$T_{mix}$', linewidth=0.5, linestyle=\"--\")\n", "\n", " #ax.set_xlabel('time [days]')\n", " ax.set_ylabel('temperature [$^\\circ$C]')\n", @@ -602,9 +616,9 @@ "\n", " configure_axes(ax)\n", "\n", - " ax = plt.subplot(2, 1, 2)\n", - " ax.plot(tWith, yEcoOutWith, 'g', label='$y_{eco,out,with}$', linewidth=0.25)\n", - " ax.plot(t, yEcoOutNoFr, 'r', label='$y_{eco,out,no}$', linewidth=0.25)\n", + " ax = fig.add_subplot(2, 1, 2)\n", + " ax.plot(tWith, yEcoOutWith, 'r', label='$y_{eco,out,with}$', linewidth=0.25)\n", + " ax.plot(t, yEcoOutNoFr, 'r', label='$y_{eco,out,no}$', linewidth=0.25, linestyle=\"--\")\n", " ax.set_xlabel('time [days]')\n", " ax.set_ylabel('$y_{eco,out}$ [$1$]')\n", " #ax.xaxis.set_ticks(np.arange(min(t)+0, 365, 1))\n", @@ -631,7 +645,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 62, "metadata": {}, "outputs": [], "source": [ @@ -666,9 +680,9 @@ " # ax[i] = plt.subplot(num_cases*num_seasons, 1, i+1)\n", "\n", " ax[i].plot(t, yFanSup, 'r', label='$y_{fan,sup}$', linewidth=0.25)\n", - " #ax[i].plot(t, yFanRet, 'g', label='$y_{fan,ret}$', linewidth=0.25)\n", - " #ax[i].plot(t, yEcoOut, 'g', label='$y_{eco,out}$', linewidth=0.25)\n", - " #ax[i].plot(t, yEcoRet, 'b', label='$y_{eco,ret}$', linewidth=0.25)\n", + " #ax[i].plot(t, yFanRet, 'b', label='$y_{fan,ret}$', linewidth=0.25, linestyle='--')\n", + " #ax[i].plot(t, yEcoOut, 'r', label='$y_{eco,out}$', linewidth=0.25)\n", + " #ax[i].plot(t, yEcoRet, 'r', label='$y_{eco,ret}$', linewidth=0.25, linestyle='--')\n", " \n", " ax[i].set_xlim([min(t)+5, min(t)+12])\n", " \n", @@ -692,7 +706,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 64, "metadata": { "scrolled": true }, @@ -762,9 +776,9 @@ " \n", " # ax[i] = plt.subplot(num_cases*num_seasons, 1, i+1)\n", "\n", - " ax[i].plot(t, fanSupACH, 'r', label='$\\dot m_{fan,sup}/V_{bui}$', linewidth=0.25)\n", + " ax[i].plot(t, fanSupACH, 'b', label='$\\dot m_{fan,sup}/V_{bui}$', linewidth=0.25)\n", "# ax[i].plot(t, mFanRet, 'g', label='$\\dot m_{fan,ret}/\\dot m_{0}$', linewidth=0.25)\n", - " ax[i].plot(t, ecoACH, 'g', label='$\\dot m_{eco,out}/V_{bui}$', linewidth=0.25)\n", + " ax[i].plot(t, ecoACH, 'r', label='$\\dot m_{eco,out}/V_{bui}$', linewidth=0.25)\n", "\n", " \n", " # customize days to display\n",