import pandas
import streamlit
from Application.initialization_powerfactory \
import get_power_system_objects_for_overview
[docs]
def powerfactory_project_attributes() -> (str, str):
"""
Input mask for power factory project attributes.
:return: - **app_path** (str) - path to the power factory \
executable
- **project_name** (str) - name of the investigated \
power factory project
"""
with streamlit.sidebar.expander("PowerFactory Paths"):
# text input for path to power factory executable
app_path = streamlit.text_input(
label="Powerfactory Executable Path",
value=r'C:\Program Files\DIgSILENT\PowerFactory 2021 SP3\Python'
r'\3.9')
# text input for project name of power factory project
project_name = streamlit.text_input(
label="Powerfactory File",
value=r'20240507_Kalman_Filter')
return app_path, project_name
[docs]
def get_powersystem_components_gui(app_path: str, project_name: str) -> str:
"""
Input mask to show a user chosen amount of power system
components.
:param app_path: power factory executable path
:type app_path: str
:param project_name: name of the investigated power factory \
project
:type project_name: str
:return: - **-** (str) - boolean for distinction if the \
component table is shown or not
"""
# create a set of check boxes for the showable power system
# components
lines = streamlit.sidebar.checkbox("Show Power System Lines")
vts = streamlit.sidebar.checkbox("Show Power System VTs")
cts = streamlit.sidebar.checkbox("Show Power System CTs")
# add the submit button to show the chosen power system data
if streamlit.sidebar.button("Show Power System Data"):
object_classes = {}
if lines:
object_classes.update({"Lines": "ElmLne"})
if vts:
object_classes.update({"VTs": "StaVt"})
if cts:
object_classes.update({"CTs": "StaCt"})
# call the getter method for power system components
components_dict = get_power_system_objects_for_overview(
app_path=app_path,
project_name=project_name,
obj_classes=object_classes
)
# add the power system components to their object class
# specific streamlit session state
for comp in components_dict:
streamlit.session_state[comp] = pandas.DataFrame(
data=components_dict[comp]
)
return "True"
return streamlit.session_state["pf_comp_table_bool"]