edit read_data.py to accept changeable data
This commit is contained in:
		| @@ -43,5 +43,11 @@ | |||||||
|         "cost": "Costs of Microgrid system [m-EUR]", |         "cost": "Costs of Microgrid system [m-EUR]", | ||||||
|         "benefit": "Financial Profit Based on Py & Ess Configuration (k-EUR / year)", |         "benefit": "Financial Profit Based on Py & Ess Configuration (k-EUR / year)", | ||||||
|         "roi": "ROI" |         "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" | ||||||
|     } |     } | ||||||
| } | } | ||||||
							
								
								
									
										18
									
								
								read_data.py
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								read_data.py
									
									
									
									
									
								
							| @@ -1,17 +1,25 @@ | |||||||
| import pandas as pd | import pandas as pd | ||||||
| import numpy as np | import numpy as np | ||||||
| import csv | 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 = 'factory_power1.xlsx' | ||||||
| factory_demand_file_name = 'read_data/factory_power1.csv' | factory_demand_file_name = js_data["data_path"]["demand"] | ||||||
| electricity_price_data = 'read_data/electricity_price_data.csv' | print(factory_demand_file_name) | ||||||
| electricity_price_data_sell = 'read_data/electricity_price_data_sell.csv' | 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 = 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) | 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_power.index = pd.to_datetime(df_power.index) | ||||||
| df_combined = pv_df.join(df_power) | df_combined = pv_df.join(df_power) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user