224 lines
102 KiB
Plaintext
224 lines
102 KiB
Plaintext
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 4,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"from matplotlib import pyplot as plt\n",
|
||
|
"import xarray as xr\n",
|
||
|
"from pathlib import Path\n",
|
||
|
"\n",
|
||
|
"dir_ = Path(globals()[\"_dh\"][0]) # __file__ does not exist in ipynb"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 49,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"def read_wpd_csv(\n",
|
||
|
" filepath: Path | str, x_coord: str, ds_coord: str | None = None\n",
|
||
|
") -> xr.DataArray:\n",
|
||
|
" filepath = Path(filepath)\n",
|
||
|
"\n",
|
||
|
" header = np.loadtxt(filepath, dtype=str, max_rows=2, delimiter=\",\")\n",
|
||
|
" header_values = header[0][::2]\n",
|
||
|
" try:\n",
|
||
|
" np.array(header_values, dtype=float)\n",
|
||
|
" except ValueError:\n",
|
||
|
" np.array(header_values)\n",
|
||
|
"\n",
|
||
|
" values = np.loadtxt(filepath, dtype=float, skiprows=2, delimiter=\",\")\n",
|
||
|
"\n",
|
||
|
" coords = dict()\n",
|
||
|
" dims = [x_coord]\n",
|
||
|
" if ds_coord is not None:\n",
|
||
|
" dims.append(ds_coord)\n",
|
||
|
" coords[ds_coord] = header_values\n",
|
||
|
"\n",
|
||
|
" for col in range(int(values.shape[1] / 2)):\n",
|
||
|
" x = values[:, col * 2]\n",
|
||
|
" if col == 0:\n",
|
||
|
" coords[x_coord] = x\n",
|
||
|
" else:\n",
|
||
|
" if np.any(x != coords[x_coord]):\n",
|
||
|
" raise ValueError(f\"All webplotdigitizer datasets must share x values\")\n",
|
||
|
"\n",
|
||
|
" da = xr.DataArray(\n",
|
||
|
" values[:, 1::2],\n",
|
||
|
" dims=dims,\n",
|
||
|
" coords=coords,\n",
|
||
|
" attrs=dict(filename=filepath.name),\n",
|
||
|
" )\n",
|
||
|
" return da"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 78,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# LED properties\n",
|
||
|
"LEDS = {\n",
|
||
|
" \"APHHS1005F3C-70MAV\": dict(\n",
|
||
|
" emissivity=8e-3, # W/sr\n",
|
||
|
" emissivity_current=70e-3, # A\n",
|
||
|
" )\n",
|
||
|
"}\n",
|
||
|
"\n",
|
||
|
"# Photodiode properties\n",
|
||
|
"PHOTODIODES = {\n",
|
||
|
" \"PD15-22B/TR8\": dict(\n",
|
||
|
" dark_current=5e-9, # A\n",
|
||
|
" light_current=read_wpd_csv(\n",
|
||
|
" dir_ / \"data/PD15-22B/reverse_light_current.csv\",\n",
|
||
|
" \"irradiance\",\n",
|
||
|
" \"vr\",\n",
|
||
|
" ).isel(vr=0),\n",
|
||
|
" ),\n",
|
||
|
" \"TEMD5110X01\": dict(\n",
|
||
|
" dark_current=3e-9, # A\n",
|
||
|
" light_current=read_wpd_csv(\n",
|
||
|
" dir_ / \"data/TEMD5110X01/reverse_light_current.csv\",\n",
|
||
|
" \"irradiance\",\n",
|
||
|
" \"vr\",\n",
|
||
|
" ).isel(vr=0),\n",
|
||
|
" ),\n",
|
||
|
"}"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 83,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"Text(0.5, 1.0, 'Photodiode Transfer Function')"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 83,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnY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usuYmNjCQ4OpmPHjrz//vuFjnP69GnGjRtHZGQk1atXZ+zYsR7HyVfUPXZ5eXk888wzNGvWjKCgIBo3bsxjjz1GTk6ORzvDMHj22WepX78+oaGh9O/fn+3btxf5uZ0+fZoHHniABg0aEBQURPPmzfn73/+Oy+Uqsn1J5d83+PLLLzNjxgx3zDt27CA3N5cpU6bQpUsXIiMjCQsLo3fv3qxYscLrPt5++233Prp168a6des82h47dozx48dTv359goKCqFOnDtdccw0HDx4EwGKxMHv2bDIyMtz/f2dfivzggw/o0qULISEhREVFcfPNN/Prr796HKNfv360a9eODRs20KdPH0JDQ3nssccu+jMq6pKoxWLh6aefdj/P/3nYu3cv48aNo3r16kRGRjJ+/HgyMzMLvf6DDz6ge/fuhIaGUqNGDfr06cPixYsB817L7du3891337k/i379+gHe77GbN2+e+/OJjo7mtttu4/Dhwx5txo0bR3h4OIcPH2b06NGEh4dTq1YtHn74YZxO5wV/TiLlwT//bBYRt3379gFQs2ZNj/L777+fGjVq8NRTT3Hw4EFmzJjBxIkTmTt3rrvN008/zdSpUxk4cCD33XcfiYmJvPXWW6xbt45Vq1Zht9t5/PHHSU1N5bfffuO1114DCi41ZmVl0a9fP/bu3cvEiRNp0qQJ8+bNY9y4cZw+fZq//OUvgJlwXXPNNfzwww/ce++9tGnThvnz5zN27NgSvce7776b999/nxtuuIGHHnqIn376ienTp7Nz507mz5/vbjdlyhSeffZZhg8fzvDhw9m4cSODBw8mNzfXY3+ZmZn07duXw4cP88c//pGGDRuyevVqJk+ezNGjR8vkfsLZs2eTnZ3NPffcQ1BQEFFRUaSlpfHuu+9yyy23MGHCBM6cOcN7773HkCFDWLt2baFBDR9++CFnzpzhj3/8IxaLhRdffJHrrruO/fv3Y7fbAbj++uvZvn07999/P40bNyY5OZklS5Zw6NAhGjduzL///W/efvtt1q5dy7vvvgvAFVdcAcBzzz3Hk08+yZgxY7j77rtJSUnh9ddfp0+fPvz8889Ur17dHcuJEycYNmwYN998M7fddhuxsbHn/QxOn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e5uVwuTp48SV5eHl27dmXjxo2F9nHTTTd59HD17t0bgP379wO475v79ttvOXXqVKni+/TTT3G5XIwZM8bjM6hduzYtWrQodHk4KCiI8ePHl+oYn3zyCUuWLHE//vOf/5Tq9We79957PZ737t2bEydOkJaWBsBnn32Gy+ViypQpHj/PwAVNn7N+/XqSk5P505/+5HHv3YgRI2jdunWR50dRMeb/X4n4C12KFfEzCQkJtGzZkoCAAGJjY2nVqlWhX2QADRs29HienyDkJwD5CV6rVq082gUGBtK0aVN3fXF++eUXWrRoUej4bdq08TjGL7/8Qp06dQqNkDz32N6OYbVaad68uUd57dq1qV69uscxAFq0aOHRrlatWoUu/+3Zs4ctW7YUSrzyJScnnzeu82nSpEmR5e+//z6vvPIKu3btwuFwFNv+fP+HQUFB/P3vf+ehhx4iNjaWyy+/nJEjR3LHHXdQu3btYuPbs2cPhmEU+rzy5V/qzVevXr1SD77o06dPmQ2eKO6ziIiIYN++fVitVuLi4srkeN7OD4DWrVvzww8/eJQFBwcX+nmqUaNGqRNukfKmxE7Ez3Tv3t09KrY4NputyHLDMMo6pEuiLCctdrlcDBo0iEceeaTI+pYtW170MUJCQgqVffDBB4wbN47Ro0fz17/+lZiYGGw2G9OnT3ffK3m2kvwfPvDAA4waNYrPPvuMRYsW8eSTTzJ9+nS
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"fig, ax = plt.subplots(tight_layout=True)\n",
|
||
|
"for diode, properties in PHOTODIODES.items():\n",
|
||
|
" lc: xr.DataArray = properties[\"light_current\"]\n",
|
||
|
" lines = ax.loglog(lc.coords[\"irradiance\"], lc, label=diode)\n",
|
||
|
"\n",
|
||
|
" ax.axhline(properties[\"dark_current\"], color=lines[0].get_color(), linestyle=\"--\")\n",
|
||
|
" ax.axvline(\n",
|
||
|
" np.max(lc.coords[\"irradiance\"]), color=lines[0].get_color(), linestyle=\"--\"\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
"ax.set_xlabel(\"Irradiance [$W/m^2$]\")\n",
|
||
|
"ax.set_ylabel(\"Current [A]\")\n",
|
||
|
"ax.grid(True)\n",
|
||
|
"ax.legend(loc=\"upper left\")\n",
|
||
|
"ax.set_title(\"Photodiode Transfer Function\")"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 84,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"Text(0.5, 1.0, 'Component comparison')"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 84,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnYAAAHWCAYAAAD6oMSKAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAAChNElEQVR4nOzdd1gU19cH8O/sLrv03kQRVBREERAbIthQxF5jjAWxJQYrMbYk9l80mihGiS2CLSrR2GJBEQuoWBEbFlAUCyCKgtSF3fv+4cvGlSKwi0s5n+fZ53Fnzt45O1yHw8zcOxxjjIEQQgghhFR7PFUnQAghhBBClIMKO0IIIYSQGoIKO0IIIYSQGoIKO0IIIYSQGoIKO0IIIYSQGoIKO0IIIYSQGoIKO0IIIYSQGoIKO0IIIYSQGoIKO0IIIYSQGoIKO0IIISpjbW2N0aNHqzoNQmoMKuwIqYUePnyIr7/+Gg0bNoS6ujp0dXXh5uaG1atXIycnR9XpVXs7d+5EQECAqtMghNRCHD0rlpDa5ciRIxgyZAhEIhFGjRqF5s2bQywW49y5c/jnn38wevRobNy4UdVpVmu9e/fG7du38fjxY1WnUu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98+BCrV68GAPTs2RMAijxBYeXKlQCAXr16KT2/tWvXyv7NGMPatWuhpqaGrl27ynKSSCRycQCwatUqcBwHb2/vcm2Pz+dj0KBB+Oeff4o9k5mamlqBbwFoaWkVuRRZkv79+4PH42HRokVFznIVnlHy9PSEUCjE77//LneWafPmzUhPT6+Un0VgYKDc+zVr1gCAbB8
|
||
|
"text/plain": [
|
||
|
"<Figure size 640x480 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"d = np.linspace(0.1, 200, 4000) # downrange distance\n",
|
||
|
"area_objective = np.pi * (80e-3 / 2) ** 2\n",
|
||
|
"area_spot = np.pi * (3e-3 / 2) ** 2 # approximation\n",
|
||
|
"gain_optical = area_objective / area_spot\n",
|
||
|
"\n",
|
||
|
"# Received power density\n",
|
||
|
"power_density = dict()\n",
|
||
|
"for led, properties in LEDS.items():\n",
|
||
|
" incident_power = properties[\"emissivity\"] * (1 / (d**2)) # W / m^2 at objective\n",
|
||
|
" power_density[led] = incident_power * gain_optical\n",
|
||
|
"\n",
|
||
|
"fig, ax = plt.subplots(tight_layout=True)\n",
|
||
|
"for led in LEDS:\n",
|
||
|
" lines = ax.loglog(\n",
|
||
|
" d,\n",
|
||
|
" power_density[led],\n",
|
||
|
" label=f\"{led} ({LEDS[led]['emissivity_current']/1e-3:5.1f} mA)\",\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
"ax.set_prop_cycle(None) # reset color cycle to keep colors consistent across plots\n",
|
||
|
"for diode, properties in PHOTODIODES.items():\n",
|
||
|
" ax.axhline(\n",
|
||
|
" np.max(properties[\"light_current\"].coords[\"irradiance\"]),\n",
|
||
|
" linestyle=\"--\",\n",
|
||
|
" label=f\"{diode} Psat\",\n",
|
||
|
" color=ax._get_lines.get_next_color(),\n",
|
||
|
" )\n",
|
||
|
"\n",
|
||
|
"ax.set_xlabel(\"Range [m]\")\n",
|
||
|
"ax.set_ylabel(\"RX Power Density [$W/m^2$]\")\n",
|
||
|
"ax.grid(True)\n",
|
||
|
"ax.legend(loc=\"upper right\")\n",
|
||
|
"ax.set_title(\"Component comparison\")"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": ".venv",
|
||
|
"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.10.12"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|