import streamlit
from Application import initialization_powerfactory
[docs]
def create_shc_and_run_emt_gui(app_path: str, project_name: str) -> None:
"""
Input mask to add a shc event to the upcoming emt simulation
and run the emt simulation afterwards.
: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
"""
# text input to identify the affected transmission line
affected_line = streamlit.sidebar.text_input(
label="Short Circuit Affected Transmission Line.",
value="Line 5-7"
)
# text input to identify the time of occurrence of the shc event
time_appearance = streamlit.sidebar.text_input(
label="Time of the Event's Appearance (in s).",
value="0.7"
)
# text input to identify the relative position of the shc event
fault_location = streamlit.sidebar.text_input(
label="Relative Position of the Error on the Affected "
"Transmission Line (in %).",
value="50"
)
# dropdown menu to identify the shc type
fault_type = streamlit.sidebar.selectbox(
label="Type of Short Circuit Event.",
options=["1phG", "2phwoG", "2phG", "3ph"]
)
# text input to identify the shc fault resistance
fault_resistance = streamlit.sidebar.text_input(
label="Short Circuit Fault Resistance.",
value="0"
)
# text input to identify the shc fault reactance
fault_reactance = streamlit.sidebar.text_input(
label="Short Circuit Fault Reactance.",
value="0"
)
# text input to identify the temporal resolution of the emt
# emt simulation
simulation_step_size = streamlit.sidebar.text_input(
label="Temporal Resolution of the EMT Simulation.",
value="0.00025"
)
# text input to indentify the starting point of the upcoming emt
# simulation
simulation_start = streamlit.sidebar.text_input(
label="Start Point of EMT Simulation Time Series (in s).",
value="0"
)
# text input to identify the ending point of the upcoming emt
# simulation
simulation_end = streamlit.sidebar.text_input(
label="End Point of EMT Simulation Time Series (in s).",
value="1"
)
# button to run the emt simulation including the added shc event
if streamlit.sidebar.button("ADD SHC Event and Run EMT Simulation."):
# create a dict holding the shc args
shc_args = {
"obj": affected_line,
"event_time": time_appearance,
"fault_location": fault_location,
"fault_type": fault_type,
"fault_impedance_r": fault_resistance,
"fault_impedance_x": fault_reactance
}
# create a dict holding the simulation args
sim_args = {
"step_size": simulation_step_size,
"start_time": simulation_start,
"stop_time": simulation_end
}
# call the method to add shc event and run emt simulation
initialization_powerfactory.add_shc_and_run_emt(
app_path=app_path,
project_name=project_name,
shc_args=shc_args,
sim_args=sim_args
)