Skip to content

Commit

Permalink
Improved the compiled arrays with control options
Browse files Browse the repository at this point in the history
  • Loading branch information
SanPen committed Oct 30, 2024
1 parent 0d1b4ea commit fc3cf12
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
18 changes: 16 additions & 2 deletions src/GridCal/Gui/Main/SubClasses/Model/compiled_arrays.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from GridCal.Gui.Main.SubClasses.Server.server import ServerMain
import GridCal.Gui.gui_functions as gf

from GridCalEngine.enumerations import EngineType
from GridCalEngine.enumerations import EngineType, BranchImpedanceMode
from GridCalEngine.DataStructures.numerical_circuit import compile_numerical_circuit_at


Expand Down Expand Up @@ -138,7 +138,21 @@ def recompile_circuits_for_display(self):
engine = self.get_preferred_engine()

if engine == EngineType.GridCal:
numerical_circuit = compile_numerical_circuit_at(circuit=self.circuit, t_idx=None)

if self.ui.apply_impedance_tolerances_checkBox.isChecked():
branch_impedance_tolerance_mode = BranchImpedanceMode.Upper
else:
branch_impedance_tolerance_mode = BranchImpedanceMode.Specified

numerical_circuit = compile_numerical_circuit_at(
circuit=self.circuit,
t_idx=None,
branch_tolerance_mode=branch_impedance_tolerance_mode,
use_stored_guess=self.ui.use_voltage_guess_checkBox.isChecked(),
control_taps_phase=self.ui.control_tap_phase_checkBox.isChecked(),
control_taps_modules=self.ui.control_tap_modules_checkBox.isChecked(),
control_remote_voltage=self.ui.control_remote_voltage_checkBox.isChecked(),
)
calculation_inputs = numerical_circuit.split_into_islands()
self.calculation_inputs_to_display = calculation_inputs

Expand Down
10 changes: 7 additions & 3 deletions src/GridCalEngine/data_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self) -> None:

self.debug_entries: List[str] = list()

def get_message(self):
def get_message(self) -> str:
"""
Get a diagnostic message
:return: message
Expand All @@ -112,6 +112,10 @@ def get_message(self):
return "There were {} errors, {} warnings and {} info logs.".format(n_error, n_warning, n_info)

def add_debug(self, *args):
"""
:param args:
"""
self.debug_entries.append(" ".join([str(x) for x in args]))

def append(self, txt: str):
Expand Down Expand Up @@ -150,8 +154,8 @@ def add_info(self, msg: str, device="", device_class="", device_property='', val
expected_value=str(expected_value),
comment=str(comment)))

def add_warning(self, msg, device="", device_class="", device_property='', value="", expected_value="",
comment=""):
def add_warning(self, msg: str, device: str = "", device_class: str = "", device_property: str = '',
value: str = "", expected_value: str = "", comment: str = "") -> None:
"""
:param msg:
Expand Down

0 comments on commit fc3cf12

Please sign in to comment.