-
Notifications
You must be signed in to change notification settings - Fork 9
Description
I didn't know jupyter before finding this project and I barely can read python. Having problems simulating batteries using this project I hope that this issue might help creating some instructions for people wanting to use this without skills around python and jupyter.
I installed like this:
python3 -m venv venv
. venv/bin/activate
pip3 install -r Battery-Simulation/requirements.txt
pip3 install jupyter
Started jupyter notebook which runs a service in the terminal window and opens a jupyter page in my browser at http://localhost:8889/tree:
My logfile is from fhem and I tried to convert it to a format the same as the sample provided. Mine looks like this now:
$ head my_power.csv
,timestamp,power
1,2024-01-01T00:00:28.000Z,268
2,2024-01-01T00:01:28.000Z,268
3,2024-01-01T00:02:28.000Z,260
4,2024-01-01T00:03:28.000Z,243
5,2024-01-01T00:04:28.000Z,237
6,2024-01-01T00:05:29.000Z,237
7,2024-01-01T00:06:29.000Z,343
8,2024-01-01T00:07:29.000Z,1856
9,2024-01-01T00:08:29.000Z,1861
In jupyters web interface I clicked on the subdirectory containing the repository and then on Simulate_Battery.ipynb which opened a new tab containing the notebook (I suppose).
In section Load data I edited the code to include different csv files like this
# all_data = pd.read_csv('my_power.csv')
all_data = pd.read_csv('sample_data.csv')
all_data.head()
showing the uncommented original sample data.
Clicked on
to run the script. This results in one warning in Calculate Power and Energy usable by Battery:
/tmp/ipykernel_9868/564330700.py:1: FutureWarning: Passing a DataFrame to DataFrame.from_records is deprecated. Use set_index and/or drop to modify the DataFrame instead.
df = pd.DataFrame.from_records(all_data, columns = ['timestamp', 'power'])
This generated these graphics:
My data
Then I changed the all_data variable to pd.read_csv('my_power.csv') which looks like this:
$ head head_my_power.csv; echo '[...]'; tail head_my_power.csv
,timestamp,power
1,2024-01-01T00:00:28.000Z,268
2,2024-01-01T00:01:28.000Z,268
3,2024-01-01T00:02:28.000Z,260
4,2024-01-01T00:03:28.000Z,243
5,2024-01-01T00:04:28.000Z,237
6,2024-01-01T00:05:29.000Z,237
7,2024-01-01T00:06:29.000Z,343
8,2024-01-01T00:07:29.000Z,1856
9,2024-01-01T00:08:29.000Z,1861
[...]
9990,2024-01-07T23:10:31.000Z,212
9991,2024-01-07T23:11:31.000Z,221
9992,2024-01-07T23:12:31.000Z,216
9993,2024-01-07T23:13:31.000Z,211
9994,2024-01-07T23:14:32.000Z,209
9995,2024-01-07T23:15:33.000Z,209
9996,2024-01-07T23:16:33.000Z,277
9997,2024-01-07T23:17:33.000Z,261
9998,2024-01-07T23:18:33.000Z,257
9999,2024-01-07T23:19:33.000Z,260
Again I clicked on Restart the kernel and run all cells and after some time (there's a circle showing progress in the upper right corner of the jupyter notebook page) got my graphics 🙃.
Thanks for the nice project!


