-
Notifications
You must be signed in to change notification settings - Fork 0
/
Testing_file.py
63 lines (45 loc) · 2.48 KB
/
Testing_file.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# ---------- Preparing inputs for **TESTING** -----------
import pandas as pd
import requests
import os
import json
from saving_estimator import saving_est # here we only import to test this function
# ---------- Test the function saving estimator: ------------
# Preparing the Load profile (kWh) - in the website this will be generated by the load_profile_estimator.py but here for
# testing we use a profile from api.ceem.org.au
# LP = requests.get('http://api.ceem.org.au/LoadProfiles/Avg')
# LP = LP.json()
# df = pd.DataFrame.from_dict(LP, orient='columns')
# df['TS'] = pd.to_datetime(df['TS'], unit='ms')
# df = df[['TS', 'Load']]
# load_profile = df.copy()
# PV Profile (kWh) - this file is the output of Jessie's functions - here we use a sample PV profile from excel file
# Preparing the inputs:
# 1- user inputs:
user_inputs = json.load(open('user_inputs_Default.json'))
# The default values are saved in user_inputs_Default.json.
# if user provided load profile (here we assume it is saved in csv file)
user_input_load_profile = pd.read_csv('SelfProvided_LoadProfile_Example.csv')
# 2- PV profile: (it's in kW output, hourly, local time, no daylight saving)
cwd = os.getcwd()
pv_profile = pd.read_csv(os.path.join(cwd, "PVProfile_Example.csv"))
pv_profile['TS'] = pd.to_datetime(pv_profile['TS'],format='%d/%m/%Y %H:%M')
# 3- PV size. Icelab to provide based on selected roof area (in the json file it is P0)
pv_size_kw = 3 # 3 kW
# 4- Tariff:
# Icelab to show a list of tariffs filtered by the location of user based on the distribution_boundaries.geojson file
# Suppose Icelab showed the list and user selected: Origin Flat Rate NSW (Endeavour area)
tariff_name = "Origin Flat Rate NSW (Endeavour area)"
tariff_name = "Power Direct TOU NSW"
all_tariffs = requests.get('http://api.ceem.org.au/elec-tariffs/retail')
all_tariffs = all_tariffs.json()
for i in range(len(all_tariffs)):
if all_tariffs[i]['Name'] == tariff_name:
selected_tariff = all_tariffs[i]
# 5- Battery info (zero if no battery). Icelab to obtain from user (or we will have a dropdown list of some brands)
battery_kw = 5
battery_kwh = 5
# Distributor (Icelab to provide from the location of customer based on the distribution_boundaries.geojson file)
distributor = 'Ausgrid'
# Running the function to get the result (with battery it takes 13 sec in my PC. without battery it's few seconds)
Results = saving_est(user_inputs, pv_profile, selected_tariff, pv_size_kw, battery_kw, battery_kwh, distributor, user_input_load_profile)