summaryrefslogtreecommitdiff
path: root/prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb
diff options
context:
space:
mode:
authorMichal Hanus <mikehanus@protonmail.com>2025-06-03 13:03:55 +0200
committerMichal Hanus <mikehanus@protonmail.com>2025-06-03 13:03:55 +0200
commit3c7a3eacdd71ed90bfe05ae49324df33017b903d (patch)
tree31b4e2dbc4e5d35c47718b96f6349dc60a5f334a /prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb
parentb3b9164352b1fc276f0c1388be5e6c44f16906f2 (diff)
finalÄ›
Diffstat (limited to 'prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb')
-rw-r--r--prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb239
1 files changed, 239 insertions, 0 deletions
diff --git a/prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb b/prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb
new file mode 100644
index 0000000..5017d14
--- /dev/null
+++ b/prilohy/Jupyter_analysis/.ipynb_checkpoints/nrf60x61-checkpoint.ipynb
@@ -0,0 +1,239 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "dfd8b235-d037-4ef9-94e1-8d95a934bc23",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "from matplotlib import pyplot as plt\n",
+ "\n",
+ "m60_0 = pd.read_csv('nb60_0.csv')\n",
+ "m60_64 = pd.read_csv('nb60_64.csv')\n",
+ "m60_1024 = pd.read_csv('nb60_1024.csv')\n",
+ "\n",
+ "nb60_0 = pd.read_csv('m60_0.csv')\n",
+ "nb60_64 = pd.read_csv('m60_64.csv')\n",
+ "nb60_1024 = pd.read_csv('m60_1024.csv')\n",
+ "\n",
+ "\n",
+ "m61_0 = pd.read_csv('nb61_0.csv')\n",
+ "m61_64 = pd.read_csv('nb61_64.csv')\n",
+ "m61_1024 = pd.read_csv('nb61_1024.csv')\n",
+ "\n",
+ "nb61_0 = pd.read_csv('m61_0.csv')\n",
+ "nb61_64 = pd.read_csv('m61_64.csv')\n",
+ "nb61_1024 = pd.read_csv('m61_1024.csv')\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "64cffa34-dc55-4c31-bd8d-e00ad967e4a8",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "m61_1024"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "329b2d22-8f12-48eb-9faa-74632f2d625d",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def save_fig_tex(fname, title):\n",
+ " global files\n",
+ " files += '\\input{\"mereni/' + fname + '\"}\\n'\n",
+ " with open(f'{fname}.tex', 'w') as f:\n",
+ " f.write(r'''\n",
+ "\\begin{figure}[H]\n",
+ " \\begin{center}\n",
+ " \\includegraphics[width=1\\textwidth]{\"mereni/''' + fname + '''.png\"}\n",
+ " \\end{center}\n",
+ " \\caption[''' + title + ''']{''' + title + '''}\n",
+ " \\label{fig:'''+fname+'''}\n",
+ "\\end{figure}''')\n",
+ " \n",
+ "def stat(x, y, title):\n",
+ " fig = plt.figure(figsize=(10,6), dpi=200)\n",
+ " for df in [m60_0, m60_64, m60_1024, m61_0, m61_64, m61_1024]:\n",
+ " df = df.sort_values(x)\n",
+ " plt.plot(df[x], df[y], 'x-')\n",
+ " plt.grid()\n",
+ " plt.xlabel(x)\n",
+ " plt.ylabel(y)\n",
+ " plt.legend(['nrf9160 0B', 'nrf9160 64B', 'nrf9160 1024B', 'nrf9161 0B', 'nrf9161 64B', 'nrf9161 1024B'])\n",
+ " plt.title(f'LTE-M {title}')\n",
+ " plt.savefig(f'compltem_{title.lower().replace(\" \", \"_\")}.png')\n",
+ " save_fig_tex(f'compltem_{title.lower().replace(\" \", \"_\")}', title)\n",
+ " plt.show()\n",
+ " \n",
+ " fig = plt.figure(figsize=(10,6))\n",
+ " for df in [nb60_0, nb60_64, nb60_1024, nb61_0, nb61_64, nb61_1024]:\n",
+ " df = df.sort_values(x)\n",
+ " plt.plot(df[x], df[y], 'x-')\n",
+ " plt.grid()\n",
+ " plt.xlabel(x)\n",
+ " plt.ylabel(y)\n",
+ " plt.legend(['nrf9160 0B', 'nrf9160 64B', 'nrf9160 1024B', 'nrf9161 0B', 'nrf9161 64B', 'nrf9161 1024B'])\n",
+ " plt.title(f'NB-IoT {title}')\n",
+ " plt.savefig(f'compnbiot_{title.lower().replace(\" \", \"_\")}.png')\n",
+ " save_fig_tex(f'compnbiot_{title.lower().replace(\" \", \"_\")}', title)\n",
+ " plt.show()\n",
+ " \n",
+ " print('\\n\\n')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "ba5edf24-e6fe-4f1d-83ba-f903b6bd992a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "files = ''\n",
+ "stat('RSRP [dBm]', 'Charge [uAh]', 'Charge per message to RSRP')\n",
+ "stat('RSRP [dBm]', 'Data-rate [kB/s]', 'Data-rate to RSRP')\n",
+ "stat('RSRP [dBm]', 'Max I [mA]', 'Maximal transmit current to RSRP')\n",
+ "stat('RSRP [dBm]', 'Average I [mA]', 'Average transmit current to RSRP')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "a0876cd4-36d4-4293-a1fa-6111e994247f",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "print(files)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "bcb38c19-203c-4f5c-ae41-d0b29c19c878",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "cols = [\n",
+ "'K_U [dB]',\n",
+ "'RSRP [dBm]',\n",
+ "'SNR [dB]',\n",
+ "'Round-trip min [ms]',\n",
+ "'Round-trip max [ms]',\n",
+ "'Round-trip avg [ms]',\n",
+ "'Transmit time [s]',\n",
+ "'Max I [mA]',\n",
+ "'Ready I [mA]',\n",
+ "'Standby I [mA]',\n",
+ "'Charge [uAh]',\n",
+ "'Data-rate [kB/s]']\n",
+ "\n",
+ "shortcols = [ 'KU', 'RSRP', 'SNR', 'RT min', 'RT max', 'RT avg', 'Transmit', 'Max I', 'Ready I', 'Standby I', 'Charge', 'DR']\n",
+ "\n",
+ "units = [ '[dB]', '[dBm]', '[dB]', '[ms]', '[ms]', '[ms]', '[s]', '[mA]', '[mA]', '[mA]', '[uAh]', '[kB/s]']\n",
+ "units = [*map(lambda x: '{'+x+'}', units)]\n",
+ "\n",
+ "for df, name in zip([ nb60_0, nb60_64, nb60_1024, m60_0, m60_64, m60_1024, nb61_0, nb61_64, nb61_1024, m61_0, m61_64, m61_1024], ['nbiot60_0', 'nbiot60_64', 'nbiot60_1024', 'ltem60_0', 'ltem60_64', 'ltem60_1024', 'nbiot61_0', 'nbiot61_64', 'nbiot61_1024', 'ltem61_0', 'ltem61_64', 'ltem61_1024']):\n",
+ " with open(f'{name}_table.tex', 'w') as f:\n",
+ " ltitle = name\n",
+ " for o, n in [('nbiot', 'NB-IoT nRF91'), ('ltem', 'LTE-M nRF91'), ('_', ' measurements with payload size ')]:\n",
+ " ltitle = ltitle.replace(o, n)\n",
+ " ltitle = ltitle + ' B'\n",
+ " stitle = ltitle\n",
+ " df = df[cols]\n",
+ " df.columns = shortcols\n",
+ " tex = df.to_latex(index=False, float_format='%.2f').replace('\\\\midrule', ' & '.join(units) + ' \\\\\\\\\\\\hline\\n').replace('toprule', 'hline').replace('bottomrule', 'hline')\n",
+ " tex2 = '''\n",
+ "\\\\begin{table}[!h]\n",
+ " \\\\begin{center}\n",
+ " \\\\small\n",
+ "\\hspace*{-2cm}''' + tex + '''\n",
+ " \\\\end{center}\n",
+ " \\\\caption['''+stitle+''']{'''+ltitle+'''}\n",
+ " \\\\label{tab:''' + name + '''}\n",
+ "\\\\end{table}\n",
+ "'''\n",
+ " f.write(tex2)\n",
+ " print('\\\\input{mereni/'+name+'_table}')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "153bddfa-dfe8-4832-962a-482ea8fc88fc",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "dl = pd.DataFrame()\n",
+ "dl['SF'] = [7,8,9,10,11,12]\n",
+ "dl['Sensitivity'] = (12-dl['SF'])*2.5 - 137\n",
+ "dl['DR [kB/s]'] = [5470, 3125, 1761, 980, 440, 250]\n",
+ "dl['DR [kB/s]'] = dl['DR [kB/s]'] / 8000\n",
+ "\n",
+ "\n",
+ "def stat_msgsi(x, y, title=''):\n",
+ " fig = plt.figure(figsize=(10,6), dpi=200)\n",
+ " \n",
+ " #plt.plot(m60_1024[x], m60_1024[y], 'x-')\n",
+ " plt.plot(m61_1024[x], m61_1024[y], 'x-')\n",
+ " #plt.plot(nb60_1024[x], nb60_1024[y], 'x-')\n",
+ " plt.plot(nb61_1024[x], nb61_1024[y], 'x-')\n",
+ " \n",
+ " plt.plot(dl['Sensitivity'], dl['DR [kB/s]'], 'x-')\n",
+ " \n",
+ " \n",
+ " plt.grid()\n",
+ " plt.xlabel(x)\n",
+ " plt.ylabel(y)\n",
+ " #plt.legend([ 'LTE-M nRF9160', 'LTE-M nRF9161', 'NB-IoT nRF9160', 'NB-IoT nRF9161', 'LoRa EU'])\n",
+ " plt.legend([ 'LTE-M nRF9161', 'NB-IoT nRF9161', 'LoRa EU'])\n",
+ " ttitle = f'Comparation of sensitivity to LoRa'\n",
+ " plt.title(ttitle)\n",
+ " plt.savefig('complora.png')\n",
+ " plt.show()\n",
+ "\n",
+ "files = ''\n",
+ "stat_msgsi('RSRP [dBm]', 'Data-rate [kB/s]')\n",
+ "\n",
+ "dl"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "783064c3-1af1-4701-83eb-0c3f5470e97e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "m61_0"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3 (ipykernel)",
+ "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.11.2"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}