EPS: add script with calculation for EPS power monitoring

Solar_module_XY
Petr Malanik 3 years ago
parent a7c70f83db
commit 576f148910

@ -0,0 +1,114 @@
{
"metadata": {
"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.8.10"
},
"orig_nbformat": 4,
"kernelspec": {
"name": "python3",
"display_name": "Python 3.8.10 64-bit"
},
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"--------------------------------------------\nIdeal resistor: 0.0132R\nPower loss: 0.33W\n"
]
},
{
"output_type": "error",
"ename": "IndexError",
"evalue": "Replacement index 0 out of range for positional args tuple",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mIndexError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m/tmp/ipykernel_112179/3645271640.py\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Ideal resistor: {}R\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mideal_resistor\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Power loss: {}W\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpower_loss\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 16\u001b[0;31m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Resolution: {}A\"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 17\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mIndexError\u001b[0m: Replacement index 0 out of range for positional args tuple"
]
}
],
"source": [
"max_sense_voltage = 3.3\n",
"max_output_current = 5.0\n",
"adc_resolution = 4096\n",
"\n",
"max_acceptable_power_loss = 0.1\n",
"\n",
"amp_ratios = [50,100,200]\n",
"\n",
"for ratio in amp_ratios:\n",
"\n",
" ideal_resistor = max_sense_voltage/ratio / max_output_current\n",
" power_loss = ideal_resistor * max_output_current**2\n",
" resolution = \n",
" print(\"--------------------------------------------\")\n",
" print(\"Ideal resistor: {}R\".format(ideal_resistor))\n",
" print(\"Power loss: {}W\".format(power_loss))\n",
" print(\"Resolution: {}A\".format())\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"Length: 1.1136363636363635\nWraps: 16.880069721867685\n"
]
}
],
"source": [
"import math\n",
"\n",
"bat_diameter = 21\n",
"wrap_length = bat_diameter * math.pi / 1000\n",
"heating_power = 2\n",
"voltage = 3.5\n",
"wire_resistance = 5.5 # per meter\n",
"\n",
"current = heating_power / voltage\n",
"resistance = voltage / current\n",
"length = resistance / wire_resistance\n",
"wraps = length / wrap_length\n",
"\n",
"print(\"Length: {}\".format(length))\n",
"print(\"Wraps: {}\".format(wraps))\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
]
}
Loading…
Cancel
Save