Beispiel #1
0
    def __init__(self):
        """Constructor of the PowerFactorySimulator

        Creates an instance of the PowerFactorySimulation with the default
        option set. It also starts powerfactory in engine mode.

        Returns:
            A Instance of PowerFacotrySimulator

        """
        # Init the Metadata in the Super Class
        super().__init__(META)
        # Init Power Facotry
        self.pf = powerfactory.GetApplication()
        if self.pf is None:
            raise Exception(
                "Starting PowerFactory application in engine mode failed")
        # Hide the app to imporve speed
        self.pf.Hide()
        self.pf.EchoOff()

        # Set the default step sizes
        self.step_size = 1  #s

        # Set the default referenze time
        self._ref_date_time = None

        # Set the studdy case to none by default
        self.study_case = None

        # Set the command object to none as default
        self._command = None
def main():
    app = QtGui.QApplication(sys.argv)
    Digapp = pf.GetApplication('counties')
    dmw = DesignerMainWindow(
        Digapp)  # instantiate a window and pass the Digapp to the mainwindow
    dmw.show()
    sys.exit(app.exec_())
Beispiel #3
0
    def pf_app():
        import powerfactory

        app = powerfactory.GetApplication()
        if app is None:
            raise Exception("getting PoerFactory application failure")

        app.ActivateProject(PROJECT_PATH)
        return app, powerfactory
def main(app, project):
    '''
    Calculates the AFL at each terminal element and creates the KML file for viewing
    '''
    app = pf.GetApplication()
    app.ClearOutputWindow()
    project = app.GetActiveProject()
    if project is None:
        logger.error("No Active Project or passed project, Ending Script")
        return
    
    current_script = app.GetCurrentScript()
    order = ['Name', 'Latitude', 'Longitude']
   
    study_case_folder = app.GetProjectFolder("study")

    current_time = datetime.datetime.now()
    dt_string = current_time.strftime("%d-%m-%Y %H-%M-%S")
    file_name =  'pia_results ' + dt_string

    # TODO: let the user pick the folder for PIA stuff
    base_case_PIA_summary = [case for case in study_case_folder.GetContents() if 'PIA' in case.loc_name][0].GetContents() 
    ElmTerms = app.GetCalcRelevantObjects('*.ElmTerm')
    buses = []  # list containing the bus objects from bus.py
    
    for bus in ElmTerms: # only use the first 10 buses for testing  
        try:
            if (bus.GPSlat != 0) or (bus.cpSubstat.GPSlat != 0):  # filter out the Powerlink ones with no GPS coordinates
                buses.append(Busbar(bus))
        except AttributeError:  # buses without a cpSubstat attribute will raise an AttributeError, these buses are still calc relevant
            if (bus.GPSlat != 0):
                buses.append(Busbar(bus))
    
    for study_case in base_case_PIA_summary:
        study_case.Activate()
        execute_short_circuit(app)  # calculate short circuit at every bus and junction node
        for bus in buses:
            try:
                Skss = str(bus.bus_obj.GetAttribute('m:Skss'))
                if 'Sync' in study_case.loc_name:
                    bus.sync_gens_only_MVA = float(Skss)
                elif 'All' in study_case.loc_name:
                    bus.all_gens_MVA = float(Skss)
            except AttributeError:
                logger.debug('bus: {} is removed from calculation'.format(bus.bus_obj))  # buses without a fault power loss get removed

    buses = write_bus_attributes(app, buses)
    write_csv(app, buses, file_name + '.csv')
    
    csvreader = csv.DictReader(open(file_name + '.csv'),order)  # creates a dictionary with {column name: row[n]} pairing
    kml = createKML(csvreader, file_name + '.kml', order, app)
Beispiel #5
0
    def __init__(self, project_name):
        """Class constructor."""
        # Start PowerFactory.
        self.app = (pf.GetApplication()
                    )  # powerfactory.application object created and returned

        if self.app is None:
            raise RuntimeError("Failed to load powerfactory.")

        # Activate project.
        self.project = self.app.ActivateProject(project_name)

        if self.project is None:
            raise RuntimeError("No project activated.")

        # Get the output window
        self.window = self.app.GetOutputWindow()

        # Get the load flow object
        self.ldf = self.app.GetFromStudyCase("ComLdf")

        self.lines = {
            line.cDisplayName: Line(line)
            for line in self.app.GetCalcRelevantObjects("*.ElmLne")
        }

        self.gens = {
            gen.cDisplayName: Generator(gen)
            for gen in self.app.GetCalcRelevantObjects("*.ElmSym")
        }

        self.loads = {
            load.cDisplayName: Load(load)
            for load in self.app.GetCalcRelevantObjects("*.ElmLod")
        }

        self.areas = {
            area.GetFullName().split("\\")[-1].split(".")[0]: Area(area)
            for area in self.app.GetCalcRelevantObjects("*.ElmArea")
        }

        self.buses = {
            bus.cDisplayName: Bus(bus)
            for bus in self.app.GetCalcRelevantObjects("*.ElmTerm")
        }
Beispiel #6
0
def test_pf_export():
    # init PowerFactory
    app = pf.GetApplication()

    # first, import the test grid to powerfactory
    path = os.path.join(pp.pp_dir, 'test', 'converter', 'testfiles',
                        'test_export.pfd')
    prj = import_project(path,
                         app,
                         'TEST_PF_CONVERTER',
                         import_folder='TEST_IMPORT',
                         clear_import_folder=True)
    prj_name = prj.GetFullName()

    net = from_pfd(app, prj_name=prj_name)

    all_diffs = validate_pf_conversion(net, tolerance_mva=1e-9)

    tol = get_tol()

    for key, diff in all_diffs.items():
        delta = diff.abs().max()
        assert delta < tol[key], "%s has too high difference: %f > %f" % (
            key, delta, tol[key])
Beispiel #7
0
def test_pf_export_trafo3w():
    app = pf.GetApplication()
    # import the 3W-Trafo test grid to powerfactory
    # todo: at the moment the 3W-Trafo model is not accurate enough, here testing with lower tol
    path = os.path.join(pp.pp_dir, 'test', 'converter', 'testfiles',
                        'test_trafo3w.pfd')
    prj = import_project(path,
                         app,
                         'TEST_PF_CONVERTER',
                         import_folder='TEST_IMPORT',
                         clear_import_folder=True)
    prj_name = prj.GetFullName()

    net = from_pfd(app, prj_name=prj_name)

    all_diffs = validate_pf_conversion(net, tolerance_mva=1e-9)
    tol = get_tol()

    # doesn't pass yet due to trafo3w implementation
    # trafo3w implementation is not very accurate
    for key, diff in all_diffs.items():
        delta = diff.abs().max()
        assert delta < tol[key], "%s has too high difference: %f > %f" % (
            key, delta, tol[key])
Beispiel #8
0
#-------------------------------------------------------------------------------
# Name:        Get projectfoder
# Purpose:
#
# Author:      766141
#
# Created:     07-04-2016
# Copyright:   (c) 766141 2016
# Licence:     <your licence>
#-------------------------------------------------------------------------------

import powerfactory as pf

app = pf.GetApplication()

#########
# MODEL #
#########

# Network model
netmod = app.GetProjectFolder('netmod')

# Network data
netdata = app.GetProjectFolder('netdat')

# Diagrams
diag_fold = app.GetProjectFolder('dia')

# Variations
var_fold = app.GetProjectFolder('scheme')
Beispiel #9
0
#-------------------------------------------------------------------------------
# Name:        module2
# Purpose:
#
# Author:      766141
#
# Created:     12-04-2016
# Copyright:   (c) 766141 2016
# Licence:     <your licence>
#-------------------------------------------------------------------------------



import powerfactory

app=powerfactory.GetApplication()

obj=app.GetGraphicsBoard()

VIPages=obj.GetContents('*.SetVipage')

for i in VIPages[0]:

   obj.Show(i)

   Page_name=i.loc_name

   File_name=('D:\\Users\\PowerFactory\\%s' %(Page_name))

   obj.WriteWMF(File_name)
Beispiel #10
0
def run_main():
    app = pf.GetApplication()
    start_stuff(app)
Beispiel #11
0
def main():
    test_file = open('test.csv', 'w')
    app = pf.GetApplication()
    app.ClearOutputWindow()
    x1 = 0
    y1 = 40
    x2 = 40
    y2 = 0

    # LineString circles
    x_circle1, y_circle1 = create_circle_placemark(app, [x1, y1])
    x_circle2, y_circle2 = create_circle_placemark(app, [x2, y2])

    # Calculation for intercept points
    r1 = 100
    r2 = 100
    R = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)
    a = 1 / 2
    b = math.sqrt((2 * ((r1**2 + r2**2) / (R**2))) - 1)

    intercept1 = [
        a * (x1 + x2) - (a * (b * (y2 - y1))),
        a * (y1 + y2) + (a * (b * (x1 - x2)))
    ]  # top intercept
    intercept2 = [
        a * (y1 + y2) + (a * (b * (y2 - y1))),
        a * (y1 + y2) - (a * (b * (x2 - x1)))
    ]  # bottom intercept

    # find the closest set of coordinates in the linestring compared to the calculations
    closest_circle1_coord_to_top_intercept = [
        get_closest_coord(app, intercept1[0], x_circle1),
        get_closest_coord(app, intercept1[1], y_circle1)
    ]
    app.PrintPlain(
        'closest coord on circle1 on to top intercept is: {}'.format(
            closest_circle1_coord_to_top_intercept))
    closest_circle1_coord_to_bottom_intercept = [
        get_closest_coord(app, intercept2[0], x_circle1),
        get_closest_coord(app, intercept2[1], y_circle1)
    ]
    app.PrintPlain(
        'closest coord on circle1 on to bottom intercept is: {}'.format(
            closest_circle1_coord_to_bottom_intercept))

    closest_circle2_coord_to_top_intercept = [
        get_closest_coord(app, intercept1[0], x_circle2),
        get_closest_coord(app, intercept1[1], y_circle2)
    ]
    app.PrintPlain(
        'closest coord on circle2 on to top intercept is: {}'.format(
            closest_circle2_coord_to_top_intercept))
    closest_circle2_coord_to_bottom_intercept = [
        get_closest_coord(app, intercept2[0], x_circle2),
        get_closest_coord(app, intercept2[1], y_circle2)
    ]
    app.PrintPlain(
        'closest coord on circle2 on to bottom intercept is: {}'.format(
            closest_circle2_coord_to_bottom_intercept))

    circle1_x_top_intercept_index = x_circle1.index(
        closest_circle1_coord_to_top_intercept[0]
    )  # upper bookend for x for circle1 x coordinate, used for iterating later
    app.PrintPlain('circle 1 x top intercept index: {}'.format(
        circle1_x_top_intercept_index))
    circle1_x_bottom_intercept_index = x_circle1.index(
        closest_circle1_coord_to_bottom_intercept[0]
    )  # lower bookend for circle1 x coordinate
    app.PrintPlain('circle 1 x bottom intercept index: {}'.format(
        circle1_x_bottom_intercept_index))

    circle1_y_top_intercept_index = y_circle1.index(
        closest_circle1_coord_to_top_intercept[1])
    app.PrintPlain('circle 1 y top intercept index: {}'.format(
        circle1_y_top_intercept_index))
    circle1_y_bottom_intercept_index = y_circle1.index(
        closest_circle1_coord_to_bottom_intercept[1])
    app.PrintPlain('circle 1 y bottom intercept index: {}'.format(
        circle1_y_bottom_intercept_index))

    circle2_x_top_intercept_index = x_circle2.index(
        closest_circle2_coord_to_top_intercept[0])
    app.PrintPlain('circle 2 x top intercept index: {}'.format(
        circle2_x_top_intercept_index))
    circle2_x_bottom_intercept_index = x_circle2.index(
        closest_circle2_coord_to_bottom_intercept[0])
    app.PrintPlain('circle 2 x bottom intercept index: {}'.format(
        circle2_x_bottom_intercept_index))

    circle2_y_top_intercept_index = y_circle2.index(
        closest_circle2_coord_to_top_intercept[1])
    app.PrintPlain('circle 2 y top intercept index: {}'.format(
        circle2_y_top_intercept_index))
    circle2_y_bottom_intercept_index = y_circle2.index(
        closest_circle2_coord_to_bottom_intercept[1])
    app.PrintPlain('circle 2 y bottom intercept index: {}'.format(
        circle2_y_bottom_intercept_index))

    to_remove = [
    ]  # a list of coordinates that will be removed from the circle linestring

    for i in range(circle1_x_top_intercept_index,
                   circle1_x_bottom_intercept_index):
        to_remove.append(x_circle1[i])
    x_circle1 = []
    for element in to_remove:
        x_circle1.append(element)
    to_remove = []

    for i in range(circle1_y_top_intercept_index,
                   circle1_y_bottom_intercept_index):
        to_remove.append(y_circle1[i])
    y_circle1 = []
    for element in to_remove:
        y_circle1.append(element)
    to_remove = []

    for i in range(circle2_y_top_intercept_index - 130,
                   circle2_y_bottom_intercept_index
                   ):  # x index is the first one it sees, not the intercept
        to_remove.append(x_circle2[i])
    for element in to_remove:
        x_circle2.remove(element)
    to_remove = []

    for i in range(circle2_y_top_intercept_index - 130,
                   circle2_y_bottom_intercept_index):
        to_remove.append(y_circle2[i])
    for element in to_remove:
        y_circle2.remove(element)
    to_remove = []
    '''
    for i in range(len(x_circle1)):  # slice out the parts of the circle which overlap
        if not(x_circle1[i] > closest_circle1_coord_to_bottom_intercept[0] and y_circle1[i] < closest_circle1_coord_to_top_intercept[1]):
            x_circle1_sliced.append(x_circle1[i])
            y_circle1_sliced.append(y_circle1[i])
    
    for i in range(len(x_circle2)):  # slice out the parts of the circle which overlap
        if x_circle2[i] < closest_circle1_coord_to_bottom_intercept[0] and y_circle2[i] > closest_circle1_coord_to_top_intercept[1]:
            x_circle2_sliced.append(x_circle2[i])
            y_circle2_sliced.append(y_circle2[i])
    '''

    for coord in x_circle1:
        coord = str(coord)
        test_file.write(coord + ',')
    test_file.write('\n')
    for coord in y_circle1:
        coord = str(coord)
        test_file.write(coord + ',')
    test_file.write('\n')
    for coord in x_circle2:
        coord = str(coord)
        test_file.write(coord + ',')
    test_file.write('\n')
    for coord in y_circle2:
        coord = str(coord)
        test_file.write(coord + ',')
    test_file.write('\n')

    app.PrintPlain('x_circle1: {}'.format(x_circle1))
    app.PrintPlain('y_circle1: {}'.format(y_circle1))
    app.PrintPlain('x_circle2: {}'.format(x_circle2))
    app.PrintPlain('y_circle2: {}'.format(y_circle2))

    output_file('circle.html')

    # Add plot
    p = figure(title='Example', x_axis_label='X axis', y_axis_label='Y Axis')
    #Render glyph
    p.line(x_circle1, y_circle1, legend='Line String Circle', line_width=2)
    p.line(x_circle2, y_circle2, legend='Line String Circle', line_width=2)

    # p.circle(x1,y1, legend='Circle 1', radius=100, fill_color=None, color='blue')
    # p.circle(x2,y2, legend='Circle 2', radius=100, fill_color=None, color='red')

    p.x(intercept1[0], intercept1[1])
    p.x(intercept2[0], intercept2[1])

    p.x(closest_circle1_coord_to_top_intercept[0],
        closest_circle1_coord_to_top_intercept[1],
        color='red')
    p.x(closest_circle1_coord_to_bottom_intercept[0],
        closest_circle1_coord_to_bottom_intercept[1],
        color='red')
    #Show results
    show(p)
    test_file.close()
def run_main():
    app = powerfactory.GetApplication()
    start_stuff(app)
Beispiel #13
0
start = time.time()

Vmax = 0
Vmin = 0

####################### SET INPUT PARAMETERS #################################
pvSize = 5
vNom = 230

ts129Setpoints = [207, 220, 248, 253, 0.9,
                  0.95]  # Curve setpoints as per TS129
ts129Curve = pfAuto.generateCurve(pvSize, vNom,
                                  ts129Setpoints)  # Generate baseline curve

#################### START POWERFACTORY & OPEN MODELS ###########################
app = powerfactory.GetApplication()  # Start PowerFactory in Unattended Mode
user = app.GetCurrentUser()

# Get load and PV profiles from master project library
charLib = user.GetContents(
    r"Inverter Voltage Control\Library\Characteristics")[0]
chars = charLib.GetContents('*.ChaTime')
loadProfile = chars[0]
pvProfile = chars[1]

# Choosing folders
projFolder = user.GetContents(r"Inverter Voltage Control\Complete Models")[0]
models = projFolder.GetChildren(0)

resultsFiles = []
Beispiel #14
0
def loader(scenario_list, project):
    """
            Function returns dataframe with mapped values.
        """
    sc_num = len(scenario_list)
    #import powerfactory
    app = powerfactory.GetApplication()

    print('PowerFactory Opened')

    # activate project
    project = app.ActivateProject(project)
    prj = app.GetActiveProject()

    for i in range(0, sc_num):
        scenario_name = scenario_list[i]
        size = len(scenario_name)
        # # Slice string to remove last 3 characters from string
        new_str = scenario_name[:size - 2]
        excel_file_name = new_str + '_points.xlsx'
        excel_file_path = common.get_local_file_path_withfolder(
            file_name=excel_file_name, folder_name='Output_excel')
        points_df = common.import_excel(excel_file_path)
        L_points_I = points_df.loc[:, 'worst_I_L']
        R_points_I = points_df.loc[:, 'worst_I_R']
        L_points_V = points_df.loc[:, 'worst_V_L']
        R_points_V = points_df.loc[:, 'worst_V_R']
        L_I = L_points_I.tolist()
        R_I = R_points_I.tolist()
        L_V = L_points_V.tolist()
        R_V = R_points_V.tolist()

        k = 1

        folders = prj.GetContents('*.IntPrjfolder')
        temp_filtered = filter(
            lambda folders: folders.loc_name == 'Study Cases', folders)
        studyCases_folder = list(temp_filtered)
        studyCases = studyCases_folder[0].GetContents('*.IntCase')
        temp_filtered = filter(lambda folders: folders.loc_name == 'Library',
                               folders)
        Library = list(temp_filtered)
        Library_temp = Library[0]
        Library_subfolders = Library_temp.GetContents('*.')
        temp_filtered = filter(
            lambda Library_subfolders: Library_subfolders.loc_name ==
            'Operational Library', Library_subfolders)
        oper_folder = list(temp_filtered)
        oper_temp = oper_folder[0]
        oper_subfolders = oper_temp.GetContents('*.')
        temp_filtered = filter(
            lambda oper_subfolders: oper_subfolders.loc_name ==
            'Characteristics', oper_subfolders)
        char_folder = list(temp_filtered)
        char_temp = char_folder[0]
        char_subfolders = char_temp.GetContents('*.')

        # temp_filtered = filter(lambda char_subfolders: char_subfolders.loc_name == 'Oyster Creek 800MW',
        #                        char_subfolders)

        temp_filtered = filter(
            lambda char_subfolders: char_subfolders.loc_name ==
            'BL England 400MW', char_subfolders)

        scen_folder = list(temp_filtered)
        scen_temp = scen_folder[0]
        scen_subfolders = scen_temp.GetContents('*.')
        temp_filtered = filter(
            lambda scen_subfolders: scen_subfolders.loc_name == scenario_name,
            scen_subfolders)
        scen_param_folder = list(temp_filtered)
        scen_param_temp = scen_param_folder[0]
        scen_param_subvalues = scen_param_temp.GetContents('*.')
        # studyCases = folders[4].GetContents('*.IntCase')
        temp_filtered_L = filter(
            lambda scen_param_subvalues: scen_param_subvalues.loc_name == 'L',
            scen_param_subvalues)
        temp_filtered_R = filter(
            lambda scen_param_subvalues: scen_param_subvalues.loc_name == 'R',
            scen_param_subvalues)
        L = list(temp_filtered_L)
        R = list(temp_filtered_R)
        if scenario_name.endswith('_V'):
            L[0].vector = L_V
            R[0].vector = R_V
        if scenario_name.endswith('_I'):
            L[0].vector = L_I
            R[0].vector = R_I
        k = 1

    k = 1

    return k
def run_main():
    app = pf.GetApplication()
    app.ClearOutputWindow()
    start_stuff(app)
def run_main():
    """Get app and setup logging"""

    app = pf.GetApplication()
    main(app)
Beispiel #17
0
import os
import powerfactory  # Importieren des DigSilent Powerfactory Moduls

# Powerfactory-Objekte festlegen
app = powerfactory.GetApplication()  # Application-Objekt
script = app.GetCurrentScript()  # Aktives Powerfactory-Skript-Objekt

# ************** KONSTANTEN **************
# PowerFactory spezifische Klassen- und Verzeichnisnamen
sDiagramProjectFolder = "dia"
sIntGrfnetClassName = "IntGrfnet"
sVisTitleClassName = "VisTitle"
sSetTitmClassName = "SetTitm"
sSetTitParamName = "SetTit"
# Tuple-Liste aller Parameter eines *.SetTitm-Objektes von PowerFactory
tTitleAttributes = ("nproj", "anex", "cong1", "cong2", "subt1", \
    "sub1z", "sub2z", "sub3z", "date_user", "date_ssys", "date_str", "FileName")
# String-Variable für den Skript-Eingabeparameter "Selection"
sSelectionParamName = "Selection"


# ************** DEFINITIONEN / METHODEN **************
def GetScriptAttributeNames(sAttribute=""):
    # Definition zur Überprüfung, ob der übergebene Parameter im Skript vorhanden ist.

    # Übergabeparameter:
    #   Einzelner optionaler Name der gesuchten Skript-Variable als String, Standardwert = ""

    # Rückgabe:
    #   Liste der ermittelten Variablennamen des Skripts.
    #   Wenn Übergabeparameter Leer, dann werden alle Namen der Skript-Variablen ausgegeben.
Beispiel #18
0
def run_main():
    app = pf.GetApplication()
	app.ClearOutputWindow()
import sys
import json
sys.path.append(
    r"C:\DigSILENT15p1p7\python"
)  # set the path to python folder inside your digsilent instalatio folder

# import  PowerFactory  module
import powerfactory

# start PowerFactory  in engine  mode
app = powerfactory.GetApplication(
    'jmmauricio',
    '')  # change 'jmmauricio' by your user name and '' by your password

# activate project
project = app.ActivateProject(
    "20150209 SING DB Febrero original"
)  # change "Nine Bus System" by the name of your project
prj = app.GetActiveProject()  # active project instance

print('prj: {:s}'.format(prj))  # to check if the project is opened properly

ldf = app.GetFromStudyCase("ComLdf")  # Load flow
ini = app.GetFromStudyCase('ComInc')  # Dynamic initialization
sim = app.GetFromStudyCase('ComSim')  # Transient simulations

buses = app.GetCalcRelevantObjects("*.StaBar,*.ElmTerm")
syms = app.GetCalcRelevantObjects("*.ElmSym")
loads = app.GetCalcRelevantObjects("*.ElmLod")
substats = app.GetCalcRelevantObjects("*.ElmSubstat")
##buses = []
Beispiel #20
0
    def process(self):

        self.result = []
        self.result2 = []

        if self.app is None:

            try:

                self.app = pf.GetApplication('counties')
                prja = self.app.ActivateProject('test')
                prj = self.app.GetActiveProject()
            except Exception as e:
                print('Error is {}'.format(e))

        self.ldf = self.app.GetFromStudyCase("ComLdf")
        self.shc = self.app.GetFromStudyCase("ComShc")

        print('beginning load flow')

        try:
            ######### Load flow study #####
            self.ldf.iopt_net = 0
            self.ldf.Execute()

            print("Collecting all calculation relevant terminals..")
            terminals = self.app.GetCalcRelevantObjects("*.ElmTerm")
            if not terminals:
                raise Exception("No calculation relevant terminals found")
            print("Number of terminals found: %d" % len(terminals))

            for terminal in terminals:
                voltage = terminal.__getattr__("m:u")
                self.result.append(voltage)
                print("Voltage at terminal %s is %f p.u." %
                      (terminal.cDisplayName, voltage))

        except Exception as e:
            print('Load flow errors {}'.format(e))

        print('beginning fault study')

        try:

            ################# Fault Study ###################
            self.shc.iopt_mde = 3  # for complete method
            self.shc.Execute()

            print("Collecting all calculation relevant terminals..")
            terminals = self.app.GetCalcRelevantObjects("*.ElmTerm")
            if not terminals:
                raise Exception("No calculation relevant terminals found")
            print("Number of terminals found: %d" % len(terminals))

            terminals = self.app.GetCalcRelevantObjects("*.ElmTerm")

            for terminal in terminals:
                voltage = terminal.__getattr__("m:U1")
                self.result2.append(voltage)
                print("Voltage at terminal %s is %f p.u." %
                      (terminal.cDisplayName, voltage))

            print("Collecting all calculation relevant lines..")
            lines = self.app.GetCalcRelevantObjects("*.ElmLne")

            for line in lines:
                amps = line.__getattr__("m:Ikss:bus1:A")
                Z0 = line.__getattr__("m:Z0:bus1")

                print("Amps in line %s is %f p.u.and %f" %
                      (line.cDisplayName, amps, Z0))

        except Exception as err:
            print("Error is {}".format(err))

        self.resultReady.emit()