diff --git a/examples/no_study.py b/examples/no_study.py index c88e5ad..7395238 100644 --- a/examples/no_study.py +++ b/examples/no_study.py @@ -21,5 +21,5 @@ dss_tools.model.add_line_in_vsource(add_meter=True) dss.text("solve") dss_tools.dss_view.voltage_profile() - +#teste print("here") diff --git a/examples/vtcd_study_exemple.py b/examples/vtcd_study_exemple.py new file mode 100644 index 0000000..7152185 --- /dev/null +++ b/examples/vtcd_study_exemple.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : vtcd_study_exemple.py +# @Software: PyCharm + + +import os +import pathlib +import py_dss_tools + +script_path = os.path.dirname(os.path.abspath(__file__)) + +dss_file = pathlib.Path(script_path).joinpath("feeders", "123Bus", "IEEE123Master.dss") + +study = py_dss_tools.CreateStudy.vtcd_study(name="VTCD Case 1", dss_file=str(dss_file)) +study.dss.text("New EnergyMeter.Feeder Line.L115 1") +study.dss.text(f"Buscoords Buscoords.dat") +study.dss.text("batchedit regcontrol..* enabled=No") +study.dss.text("batchedit load..* enabled=No") + +# study.results.sag_3phsc_df_pu("95") +# study.view.vtcd_sag_circuit() + +# study.results.sag_swell_1phsc_df_pu("95") +# study.view.vtcd_sag_swell_circuit() +# +# study.results.bus_vulnerability_sag_map_sc3ph("52", dss_file) +# study.view.vtcd_vulnerability_circuit_sc3ph() +# +study.results.bus_vulnerability_sag_swell_map_sc1ph("52", dss_file) +study.view.vtcd_vulnerability_circuit_sc1ph() + +print("here") + + + diff --git a/src/py_dss_tools/api/Creation.py b/src/py_dss_tools/api/Creation.py index 23837cf..4ab61ef 100644 --- a/src/py_dss_tools/api/Creation.py +++ b/src/py_dss_tools/api/Creation.py @@ -9,6 +9,7 @@ from py_dss_tools.studies.StudyPowerFlow import StudyPowerFlow from py_dss_tools.studies.StudyTemporal import StudyTemporal from py_dss_tools.studies.StudyFault import StudyFault +from py_dss_tools.studies.StudyVTCD import StudyVTCD from typing import Optional @@ -56,6 +57,14 @@ def fault_study( sc = StudyFault(_name=name, _dss_file=dss_file, _frequency_base=frequency_base, _dll=dll) return sc + @staticmethod + def vtcd_study( + name: str, + dss_file: str, + frequency_base: [int, float] = 60, + dll: Optional[str] = None) -> StudyVTCD: + sc = StudyVTCD(_name=name, _dss_file=dss_file, _frequency_base=frequency_base, _dll=dll) + return sc # def update_circuit_df(sc: Scenario): # if sc.circuit.created: diff --git a/src/py_dss_tools/results/VTCDSag.py b/src/py_dss_tools/results/VTCDSag.py new file mode 100644 index 0000000..2299ef4 --- /dev/null +++ b/src/py_dss_tools/results/VTCDSag.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : VTCDSag.py +# @Software: PyCharm + + +import pandas as pd +from py_dss_interface import DSS +from py_dss_tools.dss_tools import DSSTools + + +class VTCDSag: + + def __init__(self, dss: DSS): + self._dss = dss + self.vmags_df = pd.DataFrame() + + def sag_3phsc_df_pu(self, bus_fault,v_1=0.1,v_2=0.2,v_3=0.3,v_4=0.4,v_5=0.5,v_6=0.6,v_7=0.7,v_8=0.8,v_9=0.9,v_10=0.95) -> pd.DataFrame: + self._bus_fault = bus_fault + self._v_1 = v_1 + self._v_2 = v_2 + self._v_3 = v_3 + self._v_4 = v_4 + self._v_5 = v_5 + self._v_6 = v_6 + self._v_7 = v_7 + self._v_8 = v_8 + self._v_9 = v_9 + self._v_10 = v_10 + self._dss.text(f"new fault.3_ph_{self._bus_fault} phases=3 bus1={self._bus_fault} bus2={self._bus_fault}.4.4.4") + self._dss.text("solve") + vmags_df, vangs_df = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + vmags_df = vmags_df.iloc[:, :-1] #Descarta a última coluna. + vmags_df['vmin'] = vmags_df.min(axis=1) + + colors = [] + for v_min in vmags_df['vmin']: + if v_min <= v_1: + colors.append("black") + elif v_min <= v_2: + colors.append("maroon") + elif v_min <= v_3: + colors.append("purple") + elif v_min <= v_4: + colors.append("navy") + elif v_min <= v_5: + colors.append("teal") + elif v_min <= v_6: + colors.append("blue") + elif v_min <= v_7: + colors.append("aqua") + elif v_min <= v_8: + colors.append("yellow") + elif v_min <= v_9: + colors.append("lime") + elif v_min < v_10: + colors.append("olive") + else: + colors.append("green") + + vmags_df['colors'] = colors + + self.vmags_df = vmags_df + + return vmags_df + + + + # sag_3phsc_df_pu(self, bus_fault, v_1=0.1, v_2=0.5, v_3=0.95) + + # colors = [] + # for v_min in vmags_df['vmin']: + # if v_min < v_1: + # colors.append("black") + # elif v_min < v_2: + # colors.append("red") + # elif v_min < v_3: + # colors.append("yellow") + # else: + # colors.append("green") diff --git a/src/py_dss_tools/results/VTCDSagSwell.py b/src/py_dss_tools/results/VTCDSagSwell.py new file mode 100644 index 0000000..d35d2ed --- /dev/null +++ b/src/py_dss_tools/results/VTCDSagSwell.py @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : VTCDSagSwell.py +# @Software: PyCharm + + +import pandas as pd +from py_dss_interface import DSS +from py_dss_tools.dss_tools import DSSTools + + +class VTCDSagSwell: + + def __init__(self, dss: DSS): + self._dss = dss + self.vmags_df = pd.DataFrame() + + def sag_swell_1phsc_df_pu(self, bus_fault,vsag_1=0.1,vsag_2=0.2,vsag_3=0.3,vsag_4=0.4,vsag_5=0.5,vsag_6=0.6,vsag_7=0.7, + vsag_8=0.8,vsag_9=0.9,vsag_10=0.95, vswell_1=1.05, vswell_2=1.06, vswell_3=1.1) -> pd.DataFrame: + + self._bus_fault = bus_fault + self._vsag_1 = vsag_1 + self._vsag_2 = vsag_2 + self._vsag_3 = vsag_3 + self._vsag_4 = vsag_4 + self._vsag_5 = vsag_5 + self._vsag_6 = vsag_6 + self._vsag_7 = vsag_7 + self._vsag_8 = vsag_8 + self._vsag_9 = vsag_9 + self._vsag_10 = vsag_10 + self._vswell_1 = vswell_1 + self._vswell_2 = vswell_2 + self._vswell_3 = vswell_3 + self._dss.text(f"new fault.1_ph_{self._bus_fault} phases=1 bus1={self._bus_fault}.1 bus2={self._bus_fault}.0") + self._dss.text("solve") + + + vmags_df, vangs_df = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + vmags_df['vmin'] = vmags_df.min(axis=1) #Cria uma coluna adicional e faz o mínimo das 3 anteriores. + vmags_df['vmax'] = vmags_df.iloc[:, :-1].max(axis=1) #Cria uma coluna adicional e faz o máximo das 3 primeiras + + colors_sag = [] + + for v_min in vmags_df['vmin']: + if v_min <= vsag_1: + colors_sag.append("black") + elif v_min <= vsag_2: + colors_sag.append("maroon") + elif v_min <= vsag_3: + colors_sag.append("purple") + elif v_min <= vsag_4: + colors_sag.append("navy") + elif v_min <= vsag_5: + colors_sag.append("teal") + elif v_min <= vsag_6: + colors_sag.append("blue") + elif v_min <= vsag_7: + colors_sag.append("aqua") + elif v_min <= vsag_8: + colors_sag.append("yellow") + elif v_min <= vsag_9: + colors_sag.append("lime") + elif v_min < vsag_10: + colors_sag.append("olive") + else: + colors_sag.append("green") + + vmags_df['colors_sag'] = colors_sag + + colors_swell = [] + for v_max in vmags_df['vmax']: + if v_max <= vswell_1: + colors_swell.append("green") + elif v_max <= vswell_2: + colors_swell.append("yellow") + elif v_max <= vswell_3: + colors_swell.append("red") + else: + colors_swell.append("black") + + vmags_df['colors_swell'] = colors_swell + + self.vmags_df = vmags_df + + return vmags_df diff --git a/src/py_dss_tools/results/VTCDVulnerabilityArea.py b/src/py_dss_tools/results/VTCDVulnerabilityArea.py new file mode 100644 index 0000000..4a08034 --- /dev/null +++ b/src/py_dss_tools/results/VTCDVulnerabilityArea.py @@ -0,0 +1,168 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : VTCDVulnerabilityArea.py +# @Software: PyCharm + + +import pandas as pd +from py_dss_interface import DSS +from py_dss_tools.dss_tools import DSSTools + + +class VTCDVunerabilityArea: + + def __init__(self, dss: DSS): + self._dss = dss + self.vmags_df = pd.DataFrame() + + + def bus_vulnerability_sag_map_sc3ph(self, bus_analyzed, dss_file, v_1=0.1,v_2=0.2,v_3=0.3,v_4=0.4,v_5=0.5,v_6=0.6,v_7=0.7,v_8=0.8,v_9=0.9,v_10=0.95): + self._bus_analyzed = bus_analyzed + self._v_1 = v_1 + self._v_2 = v_2 + self._v_3 = v_3 + self._v_4 = v_4 + self._v_5 = v_5 + self._v_6 = v_6 + self._v_7 = v_7 + self._v_8 = v_8 + self._v_9 = v_9 + self._v_10 = v_10 + self.dss_file = dss_file + + vmags_df, _ = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + + for bus in self._dss.circuit.buses_names: + + self._dss.text(f"Compile [{self.dss_file}]") + self._dss.text("batchedit regcontrol..* enabled=No") + self._dss.text("batchedit load..* enabled=No") + self._dss.text(f"Buscoords Buscoords.dat") + + self._dss.circuit.set_active_bus(bus) + if len(self._dss.bus.nodes) >= 3 and self._dss.bus.x: + self._dss.text(f"new fault.3_ph_{bus} phases=3 bus1={bus} bus2={bus}.4.4.4") + self._dss.text("solve") + vmags_df_temp, _ = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + vmags_df_temp = vmags_df_temp.iloc[:, :-1] #Descarta a última coluna. + vmags_df.loc[bus] = vmags_df_temp.loc[self._bus_analyzed].values + + else: + self._dss.text(f"new fault.1_ph_{bus} phases=1 bus1={bus}.1 bus2={bus}.0") + self._dss.text("solve") + vmags_df_temp, _ = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + vmags_df.loc[bus] = vmags_df_temp.loc[self._bus_analyzed].values + + vmags_df['vmin'] = vmags_df.min(axis=1) #Gera uma coluna no df com nome vmin e armazena o mínimo das 3 anteriores. + + colors = [] + for v_min in vmags_df['vmin']: + if v_min <= v_1: + colors.append("black") + elif v_min <= v_2: + colors.append("maroon") + elif v_min <= v_3: + colors.append("purple") + elif v_min <= v_4: + colors.append("navy") # fuchsia + elif v_min <= v_5: + colors.append("teal") + elif v_min <= v_6: + colors.append("blue") + elif v_min <= v_7: + colors.append("aqua") + elif v_min <= v_8: + colors.append("yellow") + elif v_min <= v_9: + colors.append("lime") + elif v_min < v_10: + colors.append("olive") + else: + colors.append("green") + + vmags_df['colors'] = colors + self.vmags_df = vmags_df + + return vmags_df + + def bus_vulnerability_sag_swell_map_sc1ph(self, bus_analyzed, dss_file, vsag_1=0.1,vsag_2=0.2,vsag_3=0.3,vsag_4=0.4, + vsag_5=0.5,vsag_6=0.6,vsag_7=0.7,vsag_8=0.8,vsag_9=0.9,vsag_10=0.95, + vswell_1=1.05,vswell_2=1.06, vswell_3=1.1): + + self._bus_analyzed = bus_analyzed + self._vsag_1 = vsag_1 + self._vsag_2 = vsag_2 + self._vsag_3 = vsag_3 + self._vsag_4 = vsag_4 + self._vsag_5 = vsag_5 + self._vsag_6 = vsag_6 + self._vsag_7 = vsag_7 + self._vsag_8 = vsag_8 + self._vsag_9 = vsag_9 + self._vsag_10 = vsag_10 + self._vswell_1 = vswell_1 + self._vswell_2 = vswell_2 + self._vswell_3 = vswell_3 + self.dss_file = dss_file + + vmags_df, _ = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + + for bus in self._dss.circuit.buses_names: + + self._dss.text(f"Compile [{self.dss_file}]") + self._dss.text("batchedit regcontrol..* enabled=No") + self._dss.text("batchedit load..* enabled=No") + self._dss.text(f"Buscoords Buscoords.dat") + + self._dss.text(f"new fault.1_ph_{bus} phases=1 bus1={bus}.1 bus2={bus}.0") + self._dss.text("solve") + vmags_df_temp, _ = DSSTools(self._dss).results.circuit_vmag_vang_dfs() + vmags_df.loc[bus] = vmags_df_temp.loc[self._bus_analyzed].values + + vmags_df['vmin'] = vmags_df.min(axis=1) # Gera uma coluna no df com nome vmin e armazena o mínimo das 3 anteriores. + vmags_df['vmax'] = vmags_df.iloc[:, :-1].max(axis=1) # Cria uma coluna adicional e faz o máximo das 3 primeiras + + colors_sag = [] + for v_min in vmags_df['vmin']: + if v_min <= vsag_1: + colors_sag.append("black") + elif v_min <= vsag_2: + colors_sag.append("maroon") + elif v_min <= vsag_3: + colors_sag.append("purple") + elif v_min <= vsag_4: + colors_sag.append("navy") + elif v_min <= vsag_5: + colors_sag.append("teal") + elif v_min <= vsag_6: + colors_sag.append("blue") + elif v_min <= vsag_7: + colors_sag.append("aqua") + elif v_min <= vsag_8: + colors_sag.append("yellow") + elif v_min <= vsag_9: + colors_sag.append("lime") + elif v_min < vsag_10: + colors_sag.append("olive") + else: + colors_sag.append("green") + + vmags_df['colors_sag'] = colors_sag + + colors_swell = [] + for v_max in vmags_df['vmax']: + if v_max <= vswell_1: + colors_swell.append("green") + elif v_max <= vswell_2: + colors_swell.append("yellow") + elif v_max <= vswell_3: + colors_swell.append("red") + else: + colors_swell.append("black") + + vmags_df['colors_swell'] = colors_swell + + self.vmags_df = vmags_df + + return vmags_df diff --git a/src/py_dss_tools/results/VTCDresults.py b/src/py_dss_tools/results/VTCDresults.py new file mode 100644 index 0000000..3d0468a --- /dev/null +++ b/src/py_dss_tools/results/VTCDresults.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccair +# @Email : raphaelmaccari@gmail.com +# @File : VTCDresults.py +# @Software: PyCharm + +from py_dss_interface import DSS +from py_dss_tools.results.VTCDSag import VTCDSag +from py_dss_tools.results.VTCDSagSwell import VTCDSagSwell +from py_dss_tools.results.VTCDVulnerabilityArea import VTCDVunerabilityArea + + +class VTCDresults(VTCDSag, VTCDSagSwell,VTCDVunerabilityArea): + + def __init__(self, dss: DSS): + self._dss = dss + VTCDSag.__init__(self, self._dss) + VTCDSagSwell.__init__(self, self._dss) + VTCDVunerabilityArea.__init__(self, self._dss) diff --git a/src/py_dss_tools/studies/StudyVTCD.py b/src/py_dss_tools/studies/StudyVTCD.py new file mode 100644 index 0000000..c08cf73 --- /dev/null +++ b/src/py_dss_tools/studies/StudyVTCD.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : StudyVTCD.py +# @Software: PyCharm + +from py_dss_tools.studies.StudyBase import StudyBase +from py_dss_tools.results.VTCDresults import VTCDresults +from py_dss_tools.view.ViewVTCDstudy import ViewVTCDresults +from dataclasses import dataclass + +@dataclass(kw_only=True) +class StudyVTCD(StudyBase): + + def __post_init__(self): + super().__post_init__() + self._results = VTCDresults(self._dss) + self._view = ViewVTCDresults(self._dss, self._results) + + @property + def results(self): + return self._results + + @property + def view(self): + return self._view diff --git a/src/py_dss_tools/view/ShortCircuitImpedances.py b/src/py_dss_tools/view/ShortCircuitImpedances.py index fe7a340..0f7bade 100644 --- a/src/py_dss_tools/view/ShortCircuitImpedances.py +++ b/src/py_dss_tools/view/ShortCircuitImpedances.py @@ -19,6 +19,7 @@ def __init__(self, dss: DSS, results: FaultResults): self._plot_style = CustomPlotStyle() + @property def short_circuit_impedances_plot_style(self): return self._plot_style diff --git a/src/py_dss_tools/view/VTCDSagCircuit.py b/src/py_dss_tools/view/VTCDSagCircuit.py new file mode 100644 index 0000000..169d05d --- /dev/null +++ b/src/py_dss_tools/view/VTCDSagCircuit.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : VTCDSagCircuit.py +# @Software: PyCharm + +from py_dss_interface import DSS +from py_dss_tools.results import VTCDresults + + +class VTCDSagCircuit: + + def __init__(self, dss: DSS, results): + self._results = results + self._dss = dss + self.vmags_df = None + + + def vtcd_sag_circuit(self): + + if self._results is None: + raise ValueError("VTCDresults object not set. Call set_results method first.") + + vmags_df_circuit = self._results.vmags_df + + if vmags_df_circuit.empty: + raise ValueError("vmags_df is empty. Run sag_3phsc_df_pu method first.") + + bus_fault = self._results._bus_fault + self._dss.text(f"AddBusMarker Bus={bus_fault} code=7 color=red size=14") #Destaca a barra + + for index, row in vmags_df_circuit.iterrows(): + bus_name = index # Obtém o valor da primeira coluna (bus_name) + color = row.iloc[-1] # Obtém o valor da última coluna (color) + self._dss.text(f"AddBusMarker Bus={bus_name} code=7 color={color} size=7") + self._dss.text("plot circuit Power max=0 n y C1=$00FF0000 1ph=3") diff --git a/src/py_dss_tools/view/VTCDSagSwellCircuit.py b/src/py_dss_tools/view/VTCDSagSwellCircuit.py new file mode 100644 index 0000000..95284f5 --- /dev/null +++ b/src/py_dss_tools/view/VTCDSagSwellCircuit.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : VTCDSagSwellCircuit.py +# @Software: PyCharm + +from py_dss_interface import DSS +from py_dss_tools.results import VTCDresults +import time + + +class VTCDSagSwellCircuit: + + def __init__(self, dss: DSS, results: VTCDresults): + self._results = results + self._dss = dss + self.vmags_df = None + + + def vtcd_sag_swell_circuit(self): + + if self._results is None: + raise ValueError("VTCDresults object not set. Call set_results method first.") + + vmags_df_circuit = self._results.vmags_df + + bus_fault = self._results._bus_fault + self._dss.text(f"AddBusMarker Bus={bus_fault} code=7 color=red size=14") + + if vmags_df_circuit.empty: + raise ValueError("vmags_df is empty. Run sag_swell_1phsc_df_pu method first.") + + for index, row in vmags_df_circuit.iterrows(): + bus_name = index #Obtém o valor da primeira coluna (bus_name) + color = row['colors_sag'] #Obtém o valor da coluna "colors_sag" + self._dss.text(f"AddBusMarker Bus={bus_name} code=7 color={color} size=7") + self._dss.text("plot circuit Power max=2000 n y C1=$00FF0000 1ph=3" ) + + time.sleep(1) + + self._dss.text(f"ClearBusMarkers") # Fiz isso não repetir as cores + + bus_fault = self._results._bus_fault # Adicionei + self._dss.text(f"AddBusMarker Bus={bus_fault} code=7 color=red size=14") + + for index, row in vmags_df_circuit.iterrows(): + bus_name = index #Obtém o valor da primeira coluna (bus_name) + color = row['colors_swell'] #Obtém o valor da coluna "colors_swell" + self._dss.text(f"AddBusMarker Bus={bus_name} code=7 color={color} size=7") + self._dss.text("plot circuit Power max=2000 n y C1=$00FF0000 1ph=3") diff --git a/src/py_dss_tools/view/VTCDVulnerabilityCircuit.py b/src/py_dss_tools/view/VTCDVulnerabilityCircuit.py new file mode 100644 index 0000000..fb2f95c --- /dev/null +++ b/src/py_dss_tools/view/VTCDVulnerabilityCircuit.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : VTCDVulnerabilityCircuit.py +# @Software: PyCharm + +from py_dss_interface import DSS +from py_dss_tools.results import VTCDresults +import time + + +class VTCDVulnerabilityCircuit: + + def __init__(self, dss: DSS, results): + self._results = results + self._dss = dss + self.vmags_df = None + + + def vtcd_vulnerability_circuit_sc3ph(self): + + if self._results is None: + raise ValueError("VTCDresults object not set. Call set_results method first.") + + vmags_df_circuit = self._results.vmags_df + + if vmags_df_circuit.empty: + raise ValueError("vmags_df is empty. Run vulnerability_sag_map_sc3ph method first.") + + bus_analyzed = self._results._bus_analyzed + self._dss.text(f"AddBusMarker Bus={bus_analyzed} code=7 color=red size=14") + + for index, row in vmags_df_circuit.iterrows(): + bus_name = index #Obtém o valor da primeira coluna (bus_name) + color = row.iloc[-1] #Obtém o valor da última coluna (color) + self._dss.text(f"AddBusMarker Bus={bus_name} code=7 color={color} size=7") + self._dss.text("plot circuit Power max=2000 n y C1=$00FF0000 1ph=3") + + def vtcd_vulnerability_circuit_sc1ph(self): + + if self._results is None: + raise ValueError("VTCDresults object not set. Call set_results method first.") + + vmags_df_circuit = self._results.vmags_df + + if vmags_df_circuit.empty: + raise ValueError("vmags_df is empty. Run vulnerability_sag_map_sc1ph method first.") + + bus_analyzed = self._results._bus_analyzed # Adicionei + self._dss.text(f"AddBusMarker Bus={bus_analyzed} code=7 color=red size=14") + + for index, row in vmags_df_circuit.iterrows(): + bus_name = index #Obtém o valor da primeira coluna (bus_name) + color = row['colors_sag'] #Obtém o valor da coluna "colors_sag" + self._dss.text(f"AddBusMarker Bus={bus_name} code=7 color={color} size=7") + self._dss.text("plot circuit Power max=2000 n y C1=$00FF0000 1ph=3") + + time.sleep(1) + + self._dss.text(f"ClearBusMarkers") + + bus_analyzed = self._results._bus_analyzed + self._dss.text(f"AddBusMarker Bus={bus_analyzed} code=7 color=red size=14") + + for index, row in vmags_df_circuit.iterrows(): + bus_name = index #Obtém o valor da primeira coluna (bus_name) + color = row['colors_swell'] #Obtém o valor da coluna "colors_swell" + self._dss.text(f"AddBusMarker Bus={bus_name} code=7 color={color} size=7") + self._dss.text("plot circuit Power max=2000 n y C1=$00FF0000 1ph=3") diff --git a/src/py_dss_tools/view/ViewVTCDstudy.py b/src/py_dss_tools/view/ViewVTCDstudy.py new file mode 100644 index 0000000..80c7bd0 --- /dev/null +++ b/src/py_dss_tools/view/ViewVTCDstudy.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# @Author : Raphael Maccari +# @Email : raphaelmaccari@gmail.com +# @File : ViewVTCDstudy.py +# @Software: PyCharm + +from py_dss_tools.view.VTCDSagCircuit import VTCDSagCircuit +from py_dss_tools.view.VTCDSagSwellCircuit import VTCDSagSwellCircuit +from py_dss_tools.view.VTCDVulnerabilityCircuit import VTCDVulnerabilityCircuit +from py_dss_interface import DSS +from py_dss_tools.results.VTCDresults import VTCDresults + + + +class ViewVTCDresults(VTCDSagCircuit, VTCDSagSwellCircuit, VTCDVulnerabilityCircuit): + + def __init__(self, dss: DSS, results: VTCDresults): + VTCDSagCircuit.__init__(self, dss, results) + VTCDSagSwellCircuit.__init__(self, dss, results) + VTCDVulnerabilityCircuit.__init__(self, dss, results)