-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.py
139 lines (111 loc) · 5.17 KB
/
interface.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import tkinter as tk
from tkinter import filedialog, messagebox
import os
def get_user_values():
root = tk.Tk()
# Funktion zum Speichern der Werte und Beenden der GUI
def save_values():
global p_req, roughness_length, p_min, single_cell_energy, single_cell_cost, interest_rate, lifetime, capex, save_path_powerdata, data_power_curve_path, data_tech_path, data_wind_path
p_req = float(entry_p_req.get())
roughness_length = float(entry_roughness_length.get())
p_min = float(entry_p_min.get())
single_cell_energy = float(entry_single_cell_energy.get())
single_cell_cost = float(entry_single_cell_cost.get())
interest_rate = float(entry_interest_rate.get())
lifetime = int(entry_lifetime.get())
capex = float(entry_capex.get())
save_path_powerdata = entry_save_path_powerdata.get()
data_power_curve_path = var_data_power_curve_path.get()
data_tech_path = var_data_tech_path.get()
data_wind_path = var_data_wind_path.get()
root.destroy()
root.title("Eingabewerte")
root.geometry("400x550") # Vergrößert die Höhe des Fensters
# Label und Eingabefelder
label_p_req = tk.Label(root, text="Jahresenergiebedarf (kWh):")
label_p_req.pack()
entry_p_req = tk.Entry(root)
entry_p_req.insert(tk.END, "85000")
entry_p_req.pack()
label_roughness_length = tk.Label(root, text="Rauigkeitslänge (m):")
label_roughness_length.pack()
entry_roughness_length = tk.Entry(root)
entry_roughness_length.insert(tk.END, "0.1")
entry_roughness_length.pack()
label_p_min = tk.Label(root, text="Mindestleistung des Systems (kW):")
label_p_min.pack()
entry_p_min = tk.Entry(root)
entry_p_min.insert(tk.END, "0.300")
entry_p_min.pack()
label_single_cell_energy = tk.Label(root, text="Batteriezellkapazität (kWh):")
label_single_cell_energy.pack()
entry_single_cell_energy = tk.Entry(root)
entry_single_cell_energy.insert(tk.END, str(5120 / 1000))
entry_single_cell_energy.pack()
label_single_cell_cost = tk.Label(root, text="Batteriezellkosten (€):")
label_single_cell_cost.pack()
entry_single_cell_cost = tk.Entry(root)
entry_single_cell_cost.insert(tk.END, "1700")
entry_single_cell_cost.pack()
label_interest_rate = tk.Label(root, text="Zinssatz:")
label_interest_rate.pack()
entry_interest_rate = tk.Entry(root)
entry_interest_rate.insert(tk.END, "0.04")
entry_interest_rate.pack()
label_lifetime = tk.Label(root, text="Betriebsdauer (a):")
label_lifetime.pack()
entry_lifetime = tk.Entry(root)
entry_lifetime.insert(tk.END, "20")
entry_lifetime.pack()
label_capex = tk.Label(root, text="Capex (€/kW):")
label_capex.pack()
entry_capex = tk.Entry(root)
entry_capex.insert(tk.END, "4500")
entry_capex.pack()
label_data_wind_path = tk.Label(root, text="Pfad Windgeschwindigkeitsmessung:")
label_data_wind_path.pack()
var_data_wind_path = tk.StringVar(root)
data_wind_files = [f for f in os.listdir('weatherdata') if os.path.isfile(os.path.join('weatherdata', f))]
var_data_wind_path.set('Wetterdaten_Wanna_Szenario_1.txt')
dropdown_data_wind_path = tk.OptionMenu(root, var_data_wind_path, *data_wind_files)
dropdown_data_wind_path.pack()
label_save_path_powerdata = tk.Label(root, text="Speicherpfad Leistungsdatei:")
label_save_path_powerdata.pack()
entry_save_path_powerdata = tk.Entry(root)
entry_save_path_powerdata.insert(tk.END, r'data/Wetterdaten_Wanna_Szenario_1.xlsx')
entry_save_path_powerdata.pack()
# Eingabefeld mit doppelter Breite
entry_save_path_powerdata.config(width=40)
label_data_power_curve_path = tk.Label(root, text="Pfad zur Leistungsdatei:")
label_data_power_curve_path.pack()
var_data_power_curve_path = tk.StringVar(root)
data_power_curve_files = [f for f in os.listdir('data') if os.path.isfile(os.path.join('data', f))]
var_data_power_curve_path.set('powercurves_interpolated.csv')
dropdown_data_power_curve_path = tk.OptionMenu(root, var_data_power_curve_path, *data_power_curve_files)
dropdown_data_power_curve_path.pack()
label_data_tech_path = tk.Label(root, text="Pfad zur Technologiedatei:")
label_data_tech_path.pack()
var_data_tech_path = tk.StringVar(root)
data_tech_files = [f for f in os.listdir('data') if os.path.isfile(os.path.join('data', f))]
var_data_tech_path.set('technical_information.xlsx')
dropdown_data_tech_path = tk.OptionMenu(root, var_data_tech_path, *data_tech_files)
dropdown_data_tech_path.pack()
# Speichern-Button
button_save = tk.Button(root, text="Speichern", command=save_values)
button_save.pack()
root.mainloop()
# Rückgabe der eingegebenen Werte
return (
float(p_req),
float(roughness_length),
float(p_min),
float(single_cell_energy),
float(single_cell_cost),
float(interest_rate),
int(lifetime),
float(capex),
os.path.join(save_path_powerdata),
os.path.join('data', data_power_curve_path),
os.path.join('data', data_tech_path),
os.path.join('weatherdata', data_wind_path)
)