Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import pandas as pd
- import matplotlib.pyplot as plt
- path = "forecasts.csv"
- df = pd.read_csv(path, encoding = "utf8")
- gens = {
- "Солнце 50%": (3, [5, 10, 10]),
- "Ветер 50%": (1, [10])
- }
- cons = {
- "Больницы 50%": (2, [7, 5]),
- "Заводы 50%": (2, [8, 7]),
- "Дома 50%": (6, [8, 7, 8, 5, 8, 8])
- }
- total_gen = 0
- total_con = 0
- array_gen = []
- array_con = []
- array_gen_cost = []
- array_con_cost = []
- for i in range(len(df)):
- total_gen = 0
- total_con = 0
- gen_cost = 0
- con_cost = 0
- for j in gens:
- total_gen += gens[j][0]*df[j][i]
- for k in range(len(gens[j][1])):
- gen_cost += gens[j][1][k]
- if i in list(range(0,20)) or i in list(range(40, 66)):
- total_gen += 10
- gen_cost += 40
- for j in cons:
- total_con += cons[j][0]*df[j][i]
- for k in range(len(cons[j][1])):
- con_cost += cons[j][1][k]
- array_gen.append(total_gen)
- array_con.append(total_con)
- array_gen_cost.append(gen_cost)
- array_con_cost.append(con_cost)
- fig, ax = plt.subplots()
- ax.plot(array_con, '-b', label="Consumed")
- ax.plot(array_gen, '-g', label="Generated")
- ax.legend()
- plt.show()
- fig, ax = plt.subplots()
- ax.plot(array_con_cost, '-b', label="Consumed")
- ax.plot(array_gen_cost, '-g', label="Generated")
- ax.legend()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement