Commit e030d4a6 authored by Madhur Panwar's avatar Madhur Panwar
Browse files

Cleanup dev

parent e35bafab
Loading
Loading
Loading
Loading
Loading

pyehub/Just_Testing.py

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
# import all the required packages
from pyehub.excel_to_request_format import convert as ex_req_convert
from pyehub.outputter import pretty_print
from pyehub.energy_hub.ehub_model import EHubModel
import pickle
# from pyehub import plots
# specify the input file

# input_file = 'C:\\Users\\User\\Desktop\\JupyterNB\\Notebooks\\test_tt.xlsx' # or "my_input.xlsx" you just created
input_file = 'tutorials/test_file.xlsx'



# form the model
# model = EHubModel(excel=input_file)

request = ex_req_convert(input_file)
model = EHubModel(request=request)

di = model._public_attributes()
# with open('dict.dd','rb') as dd:
#     ddo=pickle.load(dd)
# print(ddo)
# for i in range(17505):
#     ddo[i]=float(ddo[i])
# print(type(ddo[0]))
# model.time=[x for x in range(20)]
# model.TIME_SERIES['Elec']={x:0.394 for x in range(20)}
#
# model.TIME_SERIES['Heat']={x:20.0 for x in range(20)}
# model.TIME_SERIES['Irradiation']={x:0.019 for x in range(20)}
# model.LOADS['Elec']=model.TIME_SERIES['Elec']
# model.LOADS['Heat']=model.TIME_SERIES['Heat']
# solve the model

result = model.solve()
# with open('model1.results', 'wb') as results_file:
#     pickle.dump(result, results_file)



# print(model.is_installed)
# print(model.technologies)
# output the results
# plots.plot_energy_balance(result)
pretty_print(result)
# print(result['solution']['LOADS']['Elec'])


# convert python dict to json
# import json
# with open('result.json', 'w') as fp:
#     json.dump(<name of python dict>, fp)

# multiple_hubs(False, 'out.xlsx','tests/network_tests/hub' ,'tests/network_tests/network2.xlsx',24.5, 3)
import pickle

with open('model1.results','wb') as dd:
    pickle.dump(result,dd)
with open('model1.mdl','wb') as md:
    pickle.dump(model,md)
 No newline at end of file

pyehub/Just_Testing2.py

deleted100644 → 0
+0 −50
Original line number Diff line number Diff line
# import all the required packages

from pyehub.outputter import pretty_print
from pyehub.energy_hub.ehub_model import EHubModel
import pickle
# from pyehub import plots
# specify the input file

# input_file = 'C:\\Users\\User\\Desktop\\JupyterNB\\Notebooks\\test_tt.xlsx' # or "my_input.xlsx" you just created
input_file = 'tutorials/test_file.xlsx'



# form the model
model = EHubModel(excel=input_file)
# with open('dict.dd','rb') as dd:
#     ddo=pickle.load(dd)
# for i in range(17505):
#     ddo[i]=float(ddo[i])
# print(type(ddo[0]))
# model.time=[x for x in range(20)]
# model.TIME_SERIES['Elec']={x:0.394 for x in range(20)}
#
# model.TIME_SERIES['Heat']=[20.0 for x in range(20)]
# model.TIME_SERIES['Irradiation']=[0.019 for x in range(20)]
# model.LOADS['Elec']=model.TIME_SERIES['Elec']
# model.LOADS['Heat']=model.TIME_SERIES['Heat']
# solve the model
result = model.solve()
# with open('model1.results', 'wb') as results_file:
#     pickle.dump(result, results_file)


# print(model.is_installed)
# print(model.technologies)
# output the results
# plots.plot_energy_balance(result)
pretty_print(result)
# print(result['solution']['LOADS']['Elec'])


# convert python dict to json
# import json
# with open('result.json', 'w') as fp:
#     json.dump(<name of python dict>, fp)

# multiple_hubs(False, 'out.xlsx','tests/network_tests/hub' ,'tests/network_tests/network2.xlsx',24.5, 3)


pyehub/model.results

deleted100644 → 0
−6.5 KiB

File deleted.

pyehub/model1.results

deleted100644 → 0
−22 KiB

File deleted.

pyehub/plots.py

deleted100644 → 0
+0 −59
Original line number Diff line number Diff line
from pyehub.outputter import plot_storages
from pyehub.outputter import plot_energy_balance
import pickle
import pandas as pd
import matplotlib.pyplot as plt
from pyehub.energy_hub.ehub_model import EHubModel
from pyehub.outputter import pretty_print
# import seaborn as sns

# sns.set()





def main():
    # with open('model1.results', 'rb') as results_file:
    #     results = pickle.load(results_file)
    # with open('model1.mdl', 'rb') as md:
    #     model = pickle.load(md)
    input_file = 'tutorials/test_file.xlsx'
    model = EHubModel(excel=input_file)
    model1 =EHubModel(excel=input_file)
    results = model.solve()
    results1=model1.solve()
    # print(results['solution'] == results1['solution'])
    plot_storages(results)

    plot_energy_balance(model1, results)
    # pretty_print(results)
    # print(results['solution'] == results1['solution'])

if __name__ == '__main__':
    main()



    # current_palette = sns.color_palette()
    # sns.palplot(current_palette)

# df_storage_state = attributes['storage_level']
# df_storage_state.plot(kind='line', y=storage, ax=ax, xticks=attributes['time'], yticks=ser_storage_state)
# df_gross_charge = attributes['energy_to_storage']
# df_gross_charge.plot(kind='line', y=storage, ax=ax, yticks=ser_gross_charge)
# df_discharging = -attributes['energy_from_storage']
# df_discharging.plot(kind='line', y=storage, ax=ax, yticks=df_discharging[storage])
# # df.plot(kind='line', y='Hot Water Tank', color='red', ax=ax)
# plt.show()

# list_for_yticks = ser_storage_state.tolist() + ser_gross_charge.tolist() + ser_gross_discharge.tolist()
        # list_for_yticks = list(dict.fromkeys(list_for_yticks))


# list_for_yticks = list_for_yticks/capacity * 100

# df.drop(['storage_state'], axis=1).plot(drawstyle='steps-post',color=('green','red'),linewidth=2, ax=ax,)

 # overlay.set_xlim(right=10)
        # overlay.grid(marker='x')
Loading