{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "from matplotlib import cm" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from solcore.light_source import LightSource\n", "from solcore.solar_cell import SolarCell\n", "from solcore.solar_cell_solver import solar_cell_solver\n", "from solcore.structure import Junction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Illumination spectrum" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "wl = np.linspace(300, 4000, 4000) * 1e-9\n", "light = LightSource(\n", " source_type=\"standard\", version=\"AM1.5g\", x=wl, output_units=\"photon_flux_per_m\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "T = 298\n", "V = np.linspace(0, 5, 500)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This function assembles the solar cell and calculates the IV cruve" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "def solve_MJ(EgBot, EgMid, EgTop):\n", " db_junction0 = Junction(kind=\"DB\", T=T, Eg=EgBot, A=1, R_shunt=np.inf, n=3.5)\n", " db_junction1 = Junction(kind=\"DB\", T=T, Eg=EgMid, A=1, R_shunt=np.inf, n=3.5)\n", " db_junction2 = Junction(kind=\"DB\", T=T, Eg=EgTop, A=1, R_shunt=np.inf, n=3.5)\n", " my_solar_cell = SolarCell(\n", " [db_junction2, db_junction1, db_junction0], T=T, R_series=0\n", " )\n", " solar_cell_solver(\n", " my_solar_cell,\n", " \"iv\",\n", " user_options={\n", " \"T_ambient\": T,\n", " \"db_mode\": \"top_hat\",\n", " \"voltages\": V,\n", " \"light_iv\": True,\n", " \"internal_voltages\": np.linspace(-6, 5, 1100),\n", " \"wavelength\": wl,\n", " \"mpp\": True,\n", " \"light_source\": light,\n", " },\n", " )\n", " return my_solar_cell" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We create an efficiency map using Eg0 as the bandgap of the bottom junction and
\n", "scanning the bandgaps of the middle and top junctions. Increase N1 and N2 to have
\n", "higher resolution." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "N1 = 10\n", "N2 = 10\n", "Eg0 = 1.12" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "all_Eg1 = np.linspace(1.3, 1.8, N1)\n", "all_Eg2 = np.linspace(1.7, 2.4, N2)\n", "eff = np.zeros((N1, N2))" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "N = N1 * N2\n", "index = 0\n", "Effmax = -1\n", "Eg1_max = all_Eg1[0]\n", "Eg2_max = all_Eg2[0]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "And we run the calculation" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "for i, Eg1 in enumerate(all_Eg1):\n", " for j, Eg2 in enumerate(all_Eg2):\n", " my_solar_cell = solve_MJ(Eg0, Eg1, Eg2)\n", " mpp = my_solar_cell.iv.Pmpp\n", " eff[i, j] = mpp\n", " if mpp > Effmax:\n", " Effmax = mpp\n", " Eg1_max = Eg1\n", " Eg2_max = Eg2\n", " index += 1\n", " print(int(index / N * 100), \"%\\n\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "optimum_MJ = solve_MJ(Eg0, Eg1_max, Eg2_max)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(1)\n", "plt.plot(V, optimum_MJ.iv.IV[1], \"k\", linewidth=4, label=\"Total\")\n", "plt.plot(V, -optimum_MJ[0].iv(V), \"r\", label=\"Bottom\")\n", "plt.plot(V, -optimum_MJ[1].iv(V), \"g\", label=\"Middle\")\n", "plt.plot(V, -optimum_MJ[2].iv(V), \"b\", label=\"Top\")\n", "plt.ylim(0, 200)\n", "plt.xlim(0, 3.75)\n", "plt.legend()\n", "plt.xlabel(\"Voltage (V)\")\n", "plt.ylabel(\"Current (A/m$^2$)\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "plt.figure(2)\n", "eff = eff / light.power_density * 100\n", "plt.contourf(all_Eg2, all_Eg1, eff, 50, cmap=cm.jet)\n", "plt.xlabel(\"TOP Eg (eV)\")\n", "plt.ylabel(\"MID Eg (eV)\")\n", "cbar = plt.colorbar()\n", "cbar.set_label(\"Efficiency (%)\", rotation=270, labelpad=10)\n", "plt.tight_layout()\n", "plt.show()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }