diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 57c812370..c5e11072d 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -28,13 +28,22 @@
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -132,47 +141,47 @@
- {
- "keyToString": {
- "ASKED_ADD_EXTERNAL_FILES": "true",
- "Git.Branch.Popup.ShowAllRemotes": "true",
- "MATLAB_INTERPRETER": "/usr/local/MATLAB/R2018a/bin/matlab",
- "Python tests.Nosetests for test_power_flow.test_zip.executor": "Debug",
- "Python tests.Nosetests for tests.test_hydro.executor": "Run",
- "Python tests.Nosetests for tests.test_opf_time_series.test_opf_ts.executor": "Run",
- "Python tests.Nosetests for tests.test_topology_processor.executor": "Run",
- "Python tests.Nosetests in admittance_matrix_test.py.executor": "Run",
- "Python tests.Nosetests in deep_copy_test.py.executor": "Run",
- "Python tests.Nosetests in tests.executor": "Run",
- "Python tests.pytest for src.tests.test_cgmes_to_gridcal_ac_lines.test_ac_lines.executor": "Debug",
- "Python tests.pytest for test_line_params.test_line_parameters.executor": "Run",
- "Python tests.pytest for test_ptdf.test_mlodf.executor": "Run",
- "Python tests.pytest in tests.executor": "Run",
- "Python.AnalysisDialogue.executor": "Run",
- "Python.ExecuteGridCal.executor": "Run",
- "Python.cgmes_rdfs_graph.executor": "Run",
- "Python.new_circuit_objects.executor": "Run",
- "Python.node_widget.executor": "Run",
- "Python.pymoo_example.executor": "Debug",
- "Python.update_gui_file (1).executor": "Run",
- "Python.update_gui_file.executor": "Run",
- "Python.upload_to_pypi.executor": "Run",
- "Python.word_wrap_and_column_click.executor": "Run",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "WebServerToolWindowFactoryState": "false",
- "git-widget-placeholder": "devel",
- "last_opened_file_path": "C:/Work/git_local/GridCal/doc",
- "node.js.detected.package.eslint": "true",
- "node.js.selected.package.eslint": "(autodetect)",
- "node.js.selected.package.tslint": "(autodetect)",
- "nodejs_package_manager_path": "npm",
- "run.code.analysis.last.selected.profile": "aDefault",
- "settings.editor.selected.configurable": "preferences.pluginManager",
- "two.files.diff.last.used.file": "C:/WorkProjects/PycharmProjects/GridCal/src/trunk/cgmes_py_generator/cgmes_v2_4_15/cgmes_enums.py",
- "vue.rearranger.settings.migration": "true"
+
+}]]>
@@ -1383,7 +1392,7 @@
-
+
1656059954202
@@ -1728,7 +1737,7 @@
1698766404661
-
+
@@ -1762,7 +1771,6 @@
-
@@ -1787,7 +1795,8 @@
-
+
+
@@ -2651,7 +2660,7 @@
-
+
diff --git a/Grids_and_profiles/grids/IEEE57.gridcal b/Grids_and_profiles/grids/IEEE57.gridcal
index c7b94b8a1..8b78fc15b 100644
Binary files a/Grids_and_profiles/grids/IEEE57.gridcal and b/Grids_and_profiles/grids/IEEE57.gridcal differ
diff --git a/src/GridCal/Gui/Diagrams/MapWidget/Branches/map_line_segment.py b/src/GridCal/Gui/Diagrams/MapWidget/Branches/map_line_segment.py
index 592fc52ea..b4d59f9bd 100644
--- a/src/GridCal/Gui/Diagrams/MapWidget/Branches/map_line_segment.py
+++ b/src/GridCal/Gui/Diagrams/MapWidget/Branches/map_line_segment.py
@@ -52,8 +52,8 @@ def __init__(self, first: NodeGraphicItem, second: NodeGraphicItem, container: M
self.container: MapLineContainer = container
self.draw_labels = True
- self.style = Qt.SolidLine
- self.color = Qt.blue
+ self.style = Qt.PenStyle.SolidLine
+ self.color = QColor(115, 115, 115, 200) # translucent gray
self.width = 0.1
self.pos1: QPointF = self.first.get_center_pos()
diff --git a/src/GridCal/Gui/Diagrams/MapWidget/Substation/substation_graphic_item.py b/src/GridCal/Gui/Diagrams/MapWidget/Substation/substation_graphic_item.py
index 29589184d..499d2cdbc 100644
--- a/src/GridCal/Gui/Diagrams/MapWidget/Substation/substation_graphic_item.py
+++ b/src/GridCal/Gui/Diagrams/MapWidget/Substation/substation_graphic_item.py
@@ -374,14 +374,14 @@ def add_voltage_level(self) -> None:
max_value=100000.0,
default_value=self.editor.diagram.default_bus_voltage,
title="Add voltage level",
- text="Voltage (kV)",
+ text="Voltage (KV)",
)
inpt.exec()
if inpt.is_accepted:
kv = inpt.value
- vl = VoltageLevel(name=f'{kv}kV @ {self.api_object.name}',
+ vl = VoltageLevel(name=f'{kv}KV @ {self.api_object.name}',
Vnom=kv,
substation=self.api_object)
diff --git a/src/GridCal/Gui/Diagrams/MapWidget/grid_map_widget.py b/src/GridCal/Gui/Diagrams/MapWidget/grid_map_widget.py
index ac227690b..e9031dade 100644
--- a/src/GridCal/Gui/Diagrams/MapWidget/grid_map_widget.py
+++ b/src/GridCal/Gui/Diagrams/MapWidget/grid_map_widget.py
@@ -994,7 +994,7 @@ def colour_results(self,
#
# tooltip = str(i) + ': ' + bus.name + '\n' \
# + 'V:' + "{:10.4f}".format(vabs[i]) + " <{:10.4f}".format(vang[i]) + 'º [p.u.]\n' \
- # + 'V:' + "{:10.4f}".format(vabs[i] * bus.Vnom) + " <{:10.4f}".format(vang[i]) + 'º [kV]'
+ # + 'V:' + "{:10.4f}".format(vabs[i] * bus.Vnom) + " <{:10.4f}".format(vang[i]) + 'º [KV]'
# if Sbus is not None:
# tooltip += '\nS: ' + "{:10.4f}".format(Sbus[i] * Sbase) + ' [MVA]'
# if types is not None:
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/dc_line_graphics.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/dc_line_graphics.py
index 7d5828a4b..d8a97d776 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/dc_line_graphics.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/dc_line_graphics.py
@@ -73,7 +73,7 @@ def __init__(self, branch: DcLine, Sbase=100, templates=None, current_template=N
# X = self.branch.X * Zbase
# B = self.branch.B * Ybase
- I = self.branch.rate / Vf # current in kA
+ I = self.branch.rate / Vf # current in KA
# ------------------------------------------------------------------------------------------
@@ -177,7 +177,7 @@ def accept_click(self):
Vf = self.branch.bus_from.Vnom
Vt = self.branch.bus_to.Vnom
- Sn = np.round(I * Vf, 2) # nominal power in MVA = kA * kV
+ Sn = np.round(I * Vf, 2) # nominal power in MVA = KA * KV
Zbase = self.Sbase / (Vf * Vf)
Ybase = 1.0 / Zbase
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_editor.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_editor.py
index a0f81a5d8..eac6d04d4 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_editor.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_editor.py
@@ -87,7 +87,7 @@ def __init__(self,
R = self.line.R * Zbase / length
X = self.line.X * Zbase / length
B = self.line.B * Ybase / length
- I = np.round(self.line.rate / (Vf * 1.73205080757), 6) # current in kA
+ I = np.round(self.line.rate / (Vf * 1.73205080757), 6) # current in KA
# ------------------------------------------------------------------------------------------
@@ -225,7 +225,7 @@ def accept_click(self):
x_ohm=self.x_spinner.value(), # ohm / km
c_nf=self.b_spinner.value() * 1e3 / wf, # nF / km
length=self.l_spinner.value(), # km
- Imax=self.i_spinner.value(), # kA
+ Imax=self.i_spinner.value(), # KA
freq=self.frequency, # Hz
Sbase=self.Sbase, # MVA
apply_to_profile=self.apply_to_profile.isChecked()
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics.py
index d02c37364..93f29dd1d 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics.py
@@ -271,7 +271,7 @@ def add_to_catalogue(self):
if ok:
# rate = I
- rated_current = self.api_object.rate / (self.api_object.Vf * 1.73205080757) # MVA = kA * kV * sqrt(3)
+ rated_current = self.api_object.rate / (self.api_object.Vf * 1.73205080757) # MVA = KA * KV * sqrt(3)
tpe = SequenceLineType(name='SequenceLine from ' + self.api_object.name,
idtag=None,
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics_template.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics_template.py
index 945700239..0621cb120 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics_template.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/line_graphics_template.py
@@ -22,7 +22,7 @@
from PySide6.QtGui import QPen, QCursor, QPixmap, QBrush, QColor, QTransform, QPolygonF
from PySide6.QtWidgets import (QGraphicsLineItem, QGraphicsRectItem, QGraphicsPolygonItem,
QGraphicsEllipseItem, QGraphicsSceneMouseEvent, QGraphicsTextItem)
-from GridCal.Gui.Diagrams.generic_graphics import ACTIVE, DEACTIVATED, OTHER, GenericDiagramWidget
+from GridCal.Gui.Diagrams.generic_graphics import ACTIVE, DEACTIVATED, OTHER, GenericDiagramWidget, TRANSPARENT, WHITE
from GridCal.Gui.Diagrams.SchematicWidget.terminal_item import BarTerminalItem, RoundTerminalItem
from GridCal.Gui.Diagrams.SchematicWidget.Substation.bus_graphics import BusGraphicItem
from GridCal.Gui.Diagrams.SchematicWidget.Substation.cn_graphics import CnGraphicItem
@@ -50,115 +50,6 @@
from GridCal.Gui.Diagrams.SchematicWidget.Branches.transformer3w_graphics import Transformer3WGraphicItem
-class ArrowHead(QGraphicsPolygonItem):
- """
- This is the arrow object
- """
-
- def __init__(self,
- parent: QGraphicsLineItem,
- arrow_size: int,
- position: float = 0.9,
- under: bool = False,
- backwards: bool = False,
- separation: int = 5,
- show_text: bool = True):
- """
- Constructor
- :param parent: Parent line
- :param arrow_size: Size of the arrow
- :param position: proportion of the line where to locate the arrow
- :param under: Is it under?
- :param backwards: Is it backwards?
- :param separation: Separation
- :param show_text: Show the label?
- """
- QGraphicsPolygonItem.__init__(self, parent=parent)
-
- self.parent: QGraphicsLineItem = parent
- self.arrow_size: int = arrow_size
- self.position: float = position
- self.under: bool = under
- self.backwards: float = backwards
- self.sep = separation
-
- self.label = QGraphicsTextItem(self)
- self.label.setPlainText("")
- self.show_text = show_text
-
- self.w = arrow_size
- self.h = arrow_size
-
- self.setPen(Qt.NoPen)
-
- def set_colour(self, color: QColor, w, style: Qt.PenStyle):
- """
- Set color and style
- :param color: QColor instance
- :param w: width
- :param style: PenStyle instance
- :return:
- """
- # self.setPen(QPen(color, w, style))
- # self.setPen(Qt.NoPen)
- self.setBrush(color)
- self.label.setDefaultTextColor(color)
-
- def set_value(self, value: float, redraw=True, backwards=False, name="", units="", format_str="{:10.2f}",
- draw_label: bool = True, visibility_filter_value=1e-4):
- """
- Set the sign with a value
- :param value: any real value
- :param redraw: redraw after the sign update
- :param backwards: draw backwards
- :param name: name of the displayed magnitude (i.e. Pf)
- :param units: the units of the displayed magnitude (i.e MW)
- :param format_str: the formatting string of the displayed magnitude
- :param visibility_filter_value: threshold to determine if to show this widget
- :param draw_label: Draw label
- """
- self.setVisible(abs(value) > visibility_filter_value)
- self.backwards = backwards
-
- self.label.setVisible(draw_label)
- if draw_label:
- x = format_str.format(value)
- msg = f'{name}:{x} {units}'
- self.label.setPlainText(msg)
- self.setToolTip(msg)
-
- if redraw:
- self.redraw()
-
- def redraw(self) -> None:
- """
- Redraw the arrow
- """
- line = self.parent.line()
-
- # the angle is added 180º if the sign is negative
- angle = - line.angle()
- base_pt = line.p1() + (line.p2() - line.p1()) * self.position
-
- p1 = -self.arrow_size if self.backwards else self.arrow_size
- p2 = -self.arrow_size if self.under else self.arrow_size
- arrow_p1 = base_pt - QTransform().rotate(angle).map(QPointF(p1, 0))
- arrow_p2 = base_pt - QTransform().rotate(angle).map(QPointF(p1, p2))
- arrow_polygon = QPolygonF([base_pt, arrow_p1, arrow_p2])
-
- # base_pt = line.p1() + (line.p2() - line.p1()) * self.position
- #
- # arrow_polygon = QPolygonF([base_pt, arrow_p1, arrow_p2])
-
- self.setPolygon(arrow_polygon)
- if self.show_text:
- # angle = - line.angle()
- a = angle + 180 if 90 < line.angle() <= 270 else angle # this keep the labels upside
- label_p = base_pt - QTransform().rotate(a).map(QPointF(0, -10 if self.under else 35))
- self.label.setPos(label_p)
- self.label.setRotation(a)
-
-
class TransformerSymbol(QGraphicsRectItem):
"""
TransformerSymbol
@@ -176,19 +67,19 @@ def __init__(self, parent, pen_width: int, h=80, w=80):
self.color = ACTIVE['color']
self.style = ACTIVE['style']
- self.setPen(QPen(Qt.transparent))
+ self.setPen(QPen(TRANSPARENT))
self.setRect(QRectF(0, 0, w, h))
self.c0 = QGraphicsEllipseItem(0, 0, d, d, parent=self)
self.c1 = QGraphicsEllipseItem(0, 0, d, d, parent=self)
self.c2 = QGraphicsEllipseItem(0, 0, d, d, parent=self)
- self.c0.setPen(QPen(Qt.transparent, self.width, self.style))
+ self.c0.setPen(QPen(TRANSPARENT, self.width, self.style))
self.c2.setPen(QPen(self.color, self.width, self.style))
self.c1.setPen(QPen(self.color, self.width, self.style))
- self.c0.setBrush(QBrush(Qt.white))
- self.c2.setBrush(QBrush(Qt.white))
+ self.c0.setBrush(QBrush(WHITE))
+ self.c2.setBrush(QBrush(WHITE))
self.c0.setPos(w * 0.35 - d / 2, h * 0.5 - d / 2)
self.c1.setPos(w * 0.35 - d / 2, h * 0.5 - d / 2)
@@ -266,12 +157,12 @@ def __init__(self, parent, pen_width, h=48, w=48, icon_route=":/Icons/icons/vsc.
self.color = ACTIVE['color']
self.style = ACTIVE['style']
- self.setPen(QPen(Qt.transparent))
+ self.setPen(QPen(TRANSPARENT))
self.setRect(QRectF(0, 0, w, h))
graphic = QGraphicsRectItem(QRectF(0, 0, w, h), parent=self)
graphic.setBrush(QBrush(QPixmap(icon_route)))
- graphic.setPen(QPen(Qt.transparent, self.width, self.style))
+ graphic.setPen(QPen(TRANSPARENT, self.width, self.style))
def set_colour(self, color: QColor, w, style: Qt.PenStyle):
"""
@@ -366,7 +257,7 @@ def __init__(self, parent, pen_width, h=30, w=30):
self.color = ACTIVE['color']
self.style = ACTIVE['style']
- self.setPen(QPen(Qt.transparent))
+ self.setPen(QPen(TRANSPARENT))
self.setRect(QRectF(0, 0, w, h))
offset = 3
@@ -377,12 +268,12 @@ def __init__(self, parent, pen_width, h=30, w=30):
triangle = QGraphicsPolygonItem(self)
triangle.setPolygon(t_points)
- triangle.setPen(QPen(Qt.white))
- triangle.setBrush(QBrush(Qt.white))
+ triangle.setPen(QPen(WHITE))
+ triangle.setBrush(QBrush(WHITE))
line = QGraphicsRectItem(QRectF(h - offset, offset, offset, w - 2 * offset), parent=self)
- line.setPen(QPen(Qt.white))
- line.setBrush(QBrush(Qt.white))
+ line.setPen(QPen(WHITE))
+ line.setBrush(QBrush(WHITE))
def set_colour(self, color: QColor, w, style: Qt.PenStyle):
"""
@@ -431,6 +322,122 @@ def redraw(self):
self.setTransform(transform)
+class ArrowHead(QGraphicsPolygonItem):
+ """
+ This is the arrow object
+ """
+
+ def __init__(self,
+ parent: QGraphicsLineItem,
+ arrow_size: int,
+ position: float = 0.9,
+ under: bool = False,
+ backwards: bool = False,
+ separation: int = 5,
+ show_text: bool = True):
+ """
+ Constructor
+ :param parent: Parent line
+ :param arrow_size: Size of the arrow
+ :param position: proportion of the line where to locate the arrow
+ :param under: Is it under?
+ :param backwards: Is it backwards?
+ :param separation: Separation
+ :param show_text: Show the label?
+ """
+ QGraphicsPolygonItem.__init__(self, parent=parent)
+
+ self.parent: QGraphicsLineItem = parent
+ self.arrow_size: int = arrow_size
+ self.position: float = position
+ self.under: bool = under
+ self.backwards: float = backwards
+ self.sep = separation
+
+ self.label = QGraphicsTextItem(self)
+ self.label.setPlainText("")
+ self.show_text = show_text
+
+ self.w = arrow_size
+ self.h = arrow_size
+
+ self.setPen(Qt.PenStyle.NoPen)
+
+ def set_colour(self, color: QColor, w, style: Qt.PenStyle):
+ """
+ Set color and style
+ :param color: QColor instance
+ :param w: width
+ :param style: PenStyle instance
+ :return:
+ """
+ self.setBrush(color)
+ self.label.setDefaultTextColor(color)
+
+ def set_value(self, value: float, redraw=True, backwards=False, name="", units="", format_str="{:10.2f}",
+ draw_label: bool = True, visibility_filter_value=1e-4):
+ """
+ Set the sign with a value
+ :param value: any real value
+ :param redraw: redraw after the sign update
+ :param backwards: draw backwards
+ :param name: name of the displayed magnitude (i.e. Pf)
+ :param units: the units of the displayed magnitude (i.e MW)
+ :param format_str: the formatting string of the displayed magnitude
+ :param visibility_filter_value: threshold to determine if to show this widget
+ :param draw_label: Draw label
+ """
+ self.setVisible(abs(value) > visibility_filter_value)
+ self.backwards = backwards
+
+ self.label.setVisible(draw_label)
+ if draw_label:
+ x = format_str.format(value)
+ msg = f'{name}:{x} {units}'
+ self.label.setPlainText(msg)
+ self.setToolTip(msg)
+
+ if redraw:
+ self.redraw()
+
+ def redraw(self) -> None:
+ """
+ Redraw the arrow
+ """
+ line = self.parent.line()
+
+ # the angle is added 180º if the sign is negative
+ angle = - line.angle()
+ base_pt = line.p1() + (line.p2() - line.p1()) * self.position
+
+ p1 = -self.arrow_size if self.backwards else self.arrow_size
+ p2 = -self.arrow_size if self.under else self.arrow_size
+ arrow_p1 = base_pt - QTransform().rotate(angle).map(QPointF(p1, 0))
+ arrow_p2 = base_pt - QTransform().rotate(angle).map(QPointF(p1, p2))
+ arrow_polygon = QPolygonF([base_pt, arrow_p1, arrow_p2])
+
+ self.setPolygon(arrow_polygon)
+
+ if self.show_text:
+ # if 90 < line.angle() <= 270:
+ # label_p = base_pt - QTransform().rotate(-angle).map(QPointF(20, -10 if self.under else 35))
+ # self.label.setPos(label_p)
+ # self.label.setRotation(-angle)
+ # else:
+ # label_p = base_pt - QTransform().rotate(angle).map(QPointF(20, -10 if self.under else 35))
+ # self.label.setPos(label_p)
+ # self.label.setRotation(angle)
+
+ if 90 < line.angle() <= 270:
+ label_p = base_pt - QTransform().rotate(angle).map(QPointF(-20, -35 if self.under else +10))
+ self.label.setRotation(angle + 180)
+ else:
+ label_p = base_pt - QTransform().rotate(angle).map(QPointF(40, -10 if self.under else 35))
+ self.label.setRotation(angle)
+
+ self.label.setPos(label_p)
+
+
class LineGraphicTemplateItem(GenericDiagramWidget, QGraphicsLineItem):
"""
LineGraphicItem
@@ -476,13 +483,13 @@ def __init__(self,
self.symbol = None
self.scale = 1.0
- self.pen_style = Qt.SolidLine
- self.pen_color = Qt.black
+ self.pen_style = Qt.PenStyle.SolidLine
+ self.pen_color = QColor(0, 0, 0, 255) # Black
self.pen_width = width
self.width = width
self.setFlag(self.GraphicsItemFlag.ItemIsSelectable, True)
- self.setCursor(QCursor(Qt.PointingHandCursor))
+ self.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.pos1: QPointF = QPointF(0.0, 0.0)
self.pos2: QPointF = QPointF(0.0, 0.0)
@@ -561,7 +568,7 @@ def set_colour(self, color: QColor, w, style: Qt.PenStyle):
:return:
"""
- pen = QPen(color, w, style, Qt.RoundCap, Qt.RoundJoin)
+ pen = QPen(color, w, style, Qt.PenCapStyle.RoundCap, Qt.PenJoinStyle.RoundJoin)
self.setPen(pen)
self.arrow_p_from.set_colour(color, w, style)
@@ -589,8 +596,7 @@ def mousePressEvent(self, event: QGraphicsSceneMouseEvent):
:param event:
:return:
"""
- if self.api_object is not None:
-
+ if self.api_object is not None:
self.editor.set_editor_model(api_object=self.api_object)
def remove_widget(self):
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer3w_graphics.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer3w_graphics.py
index 1d501b6eb..4496af910 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer3w_graphics.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer3w_graphics.py
@@ -167,9 +167,9 @@ def set_winding_tool_tips(self):
:return:
"""
if self.api_object is not None:
- self.winding_circles[0].setToolTip("Winding 1: {0} kV".format(self.api_object.V1))
- self.winding_circles[1].setToolTip("Winding 2: {0} kV".format(self.api_object.V2))
- self.winding_circles[2].setToolTip("Winding 3: {0} kV".format(self.api_object.V3))
+ self.winding_circles[0].setToolTip("Winding 1: {0} KV".format(self.api_object.V1))
+ self.winding_circles[1].setToolTip("Winding 2: {0} KV".format(self.api_object.V2))
+ self.winding_circles[2].setToolTip("Winding 3: {0} KV".format(self.api_object.V3))
pass
def set_label(self, val: str):
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer_editor.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer_editor.py
index 6a28144fb..0cf193b79 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer_editor.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Branches/transformer_editor.py
@@ -186,8 +186,8 @@ def get_template(self) -> TransformerType:
:return: TransformerType instance
"""
eps = 1e-20
- Vf = self.transformer_obj.bus_from.Vnom # kV
- Vt = self.transformer_obj.bus_to.Vnom # kV
+ Vf = self.transformer_obj.bus_from.Vnom # KV
+ Vt = self.transformer_obj.bus_to.Vnom # KV
Sn = self.sn_spinner.value() + eps # MVA
Pcu = self.pcu_spinner.value() + eps # kW
Pfe = self.pfe_spinner.value() + eps # kW
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/bus_graphics.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/bus_graphics.py
index 8ff984626..b0c6fe1aa 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/bus_graphics.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/bus_graphics.py
@@ -945,7 +945,7 @@ def set_values(self, i: int, Vm: float, Va: float, P: float, Q: float, tpe: str,
msg += f" [{tpe}]"
msg += "
"
msg += f"v={vm}<{va}º pu
"
- msg += f"V={vm_kv} kV
"
+ msg += f"V={vm_kv} KV
"
if P is not None:
p = format_str.format(P)
q = format_str.format(Q)
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/busbar_graphics.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/busbar_graphics.py
index 80c47b7db..f71e4cdb1 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/busbar_graphics.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/busbar_graphics.py
@@ -797,7 +797,7 @@ def set_values(self, i: int, Vm: float, Va: float, P: float, Q: float, tpe: str,
msg += f" [{tpe}]"
msg += "
"
msg += f"v={vm}<{va}º pu
"
- msg += f"V={vm_kv} kV
"
+ msg += f"V={vm_kv} KV
"
if P is not None:
p = format_str.format(P)
q = format_str.format(Q)
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/cn_graphics.py b/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/cn_graphics.py
index d674a488a..4ebfd5fe5 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/cn_graphics.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/Substation/cn_graphics.py
@@ -579,7 +579,7 @@ def set_values(self, i: int, Vm: float, Va: float, P: float, Q: float, tpe: str,
msg += f" [{tpe}]"
msg += "
"
msg += f"v={vm}<{va}º pu
"
- msg += f"V={vm_kv} kV
"
+ msg += f"V={vm_kv} KV
"
if P is not None:
p = format_str.format(P)
q = format_str.format(Q)
diff --git a/src/GridCal/Gui/Diagrams/SchematicWidget/schematic_widget.py b/src/GridCal/Gui/Diagrams/SchematicWidget/schematic_widget.py
index 551f7c2eb..4d5a87757 100644
--- a/src/GridCal/Gui/Diagrams/SchematicWidget/schematic_widget.py
+++ b/src/GridCal/Gui/Diagrams/SchematicWidget/schematic_widget.py
@@ -345,7 +345,7 @@ def __init__(self,
Creates the Diagram Editor (DiagramEditorWidget)
:param circuit: Circuit that is handling
:param diagram: SchematicDiagram to use (optional)
- :param default_bus_voltage: Default bus voltages (kV)
+ :param default_bus_voltage: Default bus voltages (KV)
:param time_index: time index to represent
:param prefer_node_breaker: Preffer the node breaker representation?
"""
@@ -374,7 +374,7 @@ def __init__(self,
self.setStretchFactor(0, 0)
self.setStretchFactor(1, 2000)
- # default_bus_voltage (kV)
+ # default_bus_voltage (KV)
self.default_bus_voltage = default_bus_voltage
# Preffer the node breaker representation?
diff --git a/src/GridCalEngine/Devices/multi_circuit.py b/src/GridCalEngine/Devices/multi_circuit.py
index 4cdff5dae..741b50cdf 100644
--- a/src/GridCalEngine/Devices/multi_circuit.py
+++ b/src/GridCalEngine/Devices/multi_circuit.py
@@ -1385,6 +1385,7 @@ def get_injection_devices_grouped_by_group_type(
group_type: DeviceType) -> List[Dict[DeviceType, List[INJECTION_DEVICE_TYPES]]]:
"""
Get the injection devices grouped by bus and by device type
+ :param group_type: some grouping Device Type (Region, Substation, Area, Country, etc...)
:return: Dict[bus, Dict[DeviceType, List[Injection devs]]
"""
result: List[Dict[DeviceType, List[INJECTION_DEVICE_TYPES]]] = list()
@@ -1397,64 +1398,67 @@ def get_injection_devices_grouped_by_group_type(
for elm in self.injection_items():
- if group_type == DeviceType.AreaDevice:
- if elm.bus.area is not None:
- matches = elm.bus.area == group_device
- else:
- matches = False
-
- elif group_type == DeviceType.ZoneDevice:
- if elm.bus.zone is not None:
- matches = elm.bus.zone == group_device
- else:
- matches = False
-
- elif group_type == DeviceType.SubstationDevice:
- if elm.bus.substation is not None:
- matches = elm.bus.substation == group_device
- else:
- matches = False
+ if elm.bus is not None:
+ if group_type == DeviceType.AreaDevice:
+ if elm.bus.area is not None:
+ matches = elm.bus.area == group_device
+ else:
+ matches = False
- elif group_type == DeviceType.CountryDevice:
- if elm.bus.substation is not None:
- matches = elm.bus.substation.country == group_device
+ elif group_type == DeviceType.ZoneDevice:
+ if elm.bus.zone is not None:
+ matches = elm.bus.zone == group_device
+ else:
+ matches = False
- if elm.bus.country is not None:
- if elm.bus.substation.country != elm.bus.country:
- print(f"Bus <{elm.bus.name}> country is different from its substation country :/")
- else:
- if elm.bus.country is not None:
- matches = elm.bus.country == group_device
+ elif group_type == DeviceType.SubstationDevice:
+ if elm.bus.substation is not None:
+ matches = elm.bus.substation == group_device
else:
matches = False
- elif group_type == DeviceType.CommunityDevice:
- if elm.bus.substation is not None:
- if elm.bus.substation.community is not None:
- matches = elm.bus.substation.community == group_device
+ elif group_type == DeviceType.CountryDevice:
+ if elm.bus.substation is not None:
+ matches = elm.bus.substation.country == group_device
+
+ if elm.bus.country is not None:
+ if elm.bus.substation.country != elm.bus.country:
+ print(f"Bus <{elm.bus.name}> country is different from its substation country :/")
+ else:
+ if elm.bus.country is not None:
+ matches = elm.bus.country == group_device
+ else:
+ matches = False
+
+ elif group_type == DeviceType.CommunityDevice:
+ if elm.bus.substation is not None:
+ if elm.bus.substation.community is not None:
+ matches = elm.bus.substation.community == group_device
+ else:
+ matches = False
else:
matches = False
- else:
- matches = False
- elif group_type == DeviceType.RegionDevice:
- if elm.bus.substation is not None:
- if elm.bus.substation.region is not None:
- matches = elm.bus.substation.region == group_device
+ elif group_type == DeviceType.RegionDevice:
+ if elm.bus.substation is not None:
+ if elm.bus.substation.region is not None:
+ matches = elm.bus.substation.region == group_device
+ else:
+ matches = False
else:
matches = False
- else:
- matches = False
- elif group_type == DeviceType.MunicipalityDevice:
- if elm.bus.substation is not None:
- if elm.bus.substation.municipality is not None:
- matches = elm.bus.substation.municipality == group_device
+ elif group_type == DeviceType.MunicipalityDevice:
+ if elm.bus.substation is not None:
+ if elm.bus.substation.municipality is not None:
+ matches = elm.bus.substation.municipality == group_device
+ else:
+ matches = False
else:
matches = False
+
else:
matches = False
-
else:
matches = False