edit read_data.py to accept changeable data

This commit is contained in:
Hanzhang ma 2024-05-13 22:22:03 +02:00
parent 9f472b4bf4
commit e04e01e943
3 changed files with 19 additions and 5 deletions

View File

@ -43,5 +43,11 @@
"cost": "Costs of Microgrid system [m-EUR]",
"benefit": "Financial Profit Based on Py & Ess Configuration (k-EUR / year)",
"roi": "ROI"
},
"data_path": {
"pv_yield": "read_data/Serbia.csv",
"demand": "read_data/factory_power1.csv",
"sell": "read_data/electricity_price_data_sell.csv",
"buy": "read_data/electricity_price_data.csv"
}
}

BIN
main.exe

Binary file not shown.

View File

@ -1,17 +1,25 @@
import pandas as pd
import numpy as np
import csv
import json
pv_yield_file_name = 'read_data/Serbia.csv'
with open('config.json', 'r') as f:
js_data = json.load(f)
pv_yield_file_name = js_data["data_path"]["pv_yield"]
print(pv_yield_file_name)
# factory_demand_file_name = 'factory_power1.xlsx'
factory_demand_file_name = 'read_data/factory_power1.csv'
electricity_price_data = 'read_data/electricity_price_data.csv'
electricity_price_data_sell = 'read_data/electricity_price_data_sell.csv'
factory_demand_file_name = js_data["data_path"]["demand"]
print(factory_demand_file_name)
electricity_price_data = js_data["data_path"]["buy"]
print(electricity_price_data)
electricity_price_data_sell = js_data["data_path"]["sell"]
print(electricity_price_data_sell)
pv_df = pd.read_csv(pv_yield_file_name, index_col='Time', usecols=['Time', 'PV yield[kW/kWp]'])
pv_df.index = pd.to_datetime(pv_df.index)
df_power = pd.read_csv('factory_power1.csv', index_col='Time', usecols=['Time', 'FactoryPower'])
df_power = pd.read_csv(factory_demand_file_name, index_col='Time', usecols=['Time', 'FactoryPower'])
df_power.index = pd.to_datetime(df_power.index)
df_combined = pv_df.join(df_power)