コード例 #1
0
def convert_compile_load(convert_xml2tse):
    tse_path = convert_xml2tse
    cpd_path = tse_path[:-4] + " Target files\\" + tse_path.split(
        "\\")[-1][:-4] + ".cpd"
    # Open the converted tse file
    model.load(tse_path)
    # Compile the model
    model.compile()

    # Load to VHIL
    hil.load_model(file=cpd_path, offlineMode=False, vhil_device=vhil)

    # Start simulation
    hil.start_simulation()

    yield

    hil.stop_simulation()
コード例 #2
0
def load_simulate(compile_tse):
    # Load to VHIL
    cpd_path = compile_tse
    hil.load_model(file=cpd_path, offlineMode=False, vhil_device=vhil)
    # Set source value.
    hil.set_source_sine_waveform(name='Vit', rms=110, frequency=50)
    hil.set_source_sine_waveform(name='Viti1', rms=220, frequency=50)

    # Start capture
    capture.start_capture(duration=0.1, signals=['Vit_ac', 'Viti_ac'], executeAt=0.2)

    # Start simulation
    hil.start_simulation()

    yield capture.get_capture_results(wait_capture=True)

    # Stop simulation
    hil.stop_simulation()
コード例 #3
0
def convert_compile_load(convert_xml2tse):
    tse_path = convert_xml2tse
    cpd_path = tse_path[:-4] + " Target files\\" + tse_path.split("\\")[-1][:-4] + ".cpd"
    # Open the converted tse file
    model.load(tse_path)
    # Compile the model
    model.compile()

    # Load to VHIL
    hil.load_model(file=cpd_path, offlineMode=False, vhil_device=vhil)

    hil.set_pv_input_file("SCP1", psim_tests_dir + '\\E50530_Thin_Film.ipvx', illumination=1000.0, temperature=25.0)

    # Start simulation
    hil.start_simulation()

    yield

    hil.stop_simulation()
コード例 #4
0
def test_mosfet(convert_compile_load, Vmosfet1, Vmosfet2, f):

    # Set source value.
    hil.set_source_sine_waveform(name='Vmosfet1', rms=Vmosfet1, frequency=f)
    hil.set_source_sine_waveform(name='Vmosfet2', rms=Vmosfet2, frequency=f)

    # Start capture
    start_capture(duration=0.1,
                  signals=['Imosfet1', 'Imosfet2'],
                  executeAt=0.2)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    hil.set_pe_switching_block_control_mode(blockName='Q1',
                                            switchName='S1',
                                            swControl=True)
    hil.set_pe_switching_block_software_value(blockName='Q1',
                                              switchName='S1',
                                              value=1)
    hil.set_pe_switching_block_control_mode(blockName='Q2',
                                            switchName='S1',
                                            swControl=True)
    hil.set_pe_switching_block_software_value(blockName='Q2',
                                              switchName='S1',
                                              value=0)
    capture = get_capture_results(wait_capture=True)
    Imosfet1 = np.mean(capture['Imosfet1'])
    Imosfet2 = np.mean(capture['Imosfet2'])

    # Expected currents
    R = 10
    Imosfet1_exp = Vmosfet1 / R
    Imosfet2_exp = Vmosfet2 / R / np.sqrt(2)

    # Tests
    assert Imosfet1 == pytest.approx(Imosfet1_exp, rel=1e-2)
    assert Imosfet2 == pytest.approx(Imosfet2_exp, abs=0.2)

    # Stop simulation
    hil.stop_simulation()
コード例 #5
0
def test_single_phase_thyristor_rectifier(load_and_compile, VAC, f,
                                          iDC_expected):

    # Set source value
    hil.set_source_sine_waveform(name='VAC', rms=VAC, frequency=f)

    #set switching blocks
    hil.set_pe_switching_block_control_mode('Rectifier',
                                            "Sa_top",
                                            swControl=True)
    hil.set_pe_switching_block_software_value('Rectifier', "Sa_top", value=1)
    hil.set_pe_switching_block_control_mode('Rectifier',
                                            "Sa_bot",
                                            swControl=True)
    hil.set_pe_switching_block_software_value('Rectifier', "Sa_bot", value=1)
    hil.set_pe_switching_block_control_mode('Rectifier',
                                            "Sb_top",
                                            swControl=True)
    hil.set_pe_switching_block_software_value('Rectifier', "Sb_top", value=1)
    hil.set_pe_switching_block_control_mode('Rectifier',
                                            "Sb_bot",
                                            swControl=True)
    hil.set_pe_switching_block_software_value('Rectifier', "Sb_bot", value=1)

    # Start capture
    start_capture(duration=0.04, signals=['iDC'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iDC = capture['iDC']

    # Tests
    # Peak
    sig.assert_is_constant(iDC,
                           during=(0.005015 - 0.0001, 0.005015 + 0.0001),
                           at_value=around(iDC_expected, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #6
0
def test_three_phase_diode_rectifier(load_and_compile, Vsin3P, f, iDC_expected):

    # Set source value
    hil.set_source_sine_waveform(name='Vsin3P', rms=Vsin3P, frequency=f)

    # Start capture
    start_capture(duration=0.2, signals=['iDC'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iDC = capture['iDC']

    # Tests
    sig.assert_is_constant(iDC, during=(0.00033 - 0.000001, 0.00033 + 0.000001), at_value=around(iDC_expected, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #7
0
def load_cpd(compile_tse):
    cpd_path = compile_tse
    # Load to VHIL
    hil.load_model(file=cpd_path, offlineMode=False, vhil_device=vhil)

    # Set source value
    hil.set_source_sine_waveform(name='Vsin_ydd',
                                 rms=1000 / np.sqrt(3),
                                 frequency=50)
    hil.set_source_sine_waveform(name='Vsin_yyd',
                                 rms=1000 / np.sqrt(3),
                                 frequency=50)

    # Start simulation
    hil.start_simulation()

    yield

    # Stop simulation
    hil.stop_simulation()
コード例 #8
0
def test_5ph_core_coupling(load_and_compile, VDC1, iRA_expected, VDC2,
                           iRB_expected, VDC3, iRC_expected, VDC4,
                           iRD_expected):

    # Set source value
    hil.set_source_constant_value(name='VDC1', value=VDC1)
    hil.set_source_constant_value(name='VDC2', value=VDC2)
    hil.set_source_constant_value(name='VDC3', value=VDC3)
    hil.set_source_constant_value(name='VDC4', value=VDC4)

    # Start capture
    start_capture(duration=0.04,
                  signals=['iRA', 'iRB', 'iRC', 'iRD'],
                  executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iRA = capture['iRA']
    iRB = capture['iRB']
    iRC = capture['iRC']
    iRD = capture['iRD']

    # Tests
    sig.assert_is_constant(iRA,
                           during=(0 + 0.000001, 0.04),
                           at_value=around(iRA_expected, tol_p=0.001))
    sig.assert_is_constant(iRB,
                           during=(0 + 0.000001, 0.04),
                           at_value=around(iRB_expected, tol_p=0.001))
    sig.assert_is_constant(iRC,
                           during=(0 + 0.000001, 0.04),
                           at_value=around(iRC_expected, tol_p=0.001))
    sig.assert_is_constant(iRD,
                           during=(0 + 0.000001, 0.04),
                           at_value=around(iRD_expected, tol_p=0.001))

    # Stop simulation
    hil.stop_simulation()
コード例 #9
0
def test_rectifiers(convert_compile_load, expected_values, measurement_names, source_name):

    # Set source value.
    hil.set_source_sine_waveform(name=source_name, rms=Vsrc, frequency=f)

    # Start capture
    start_capture(duration=0.1, signals=measurement_names, executeAt=1.0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    cap_data = get_capture_results(wait_capture=True)
    measurements = cap_data

    # Tests
    for i, expected_value in enumerate(expected_values):
        sig.assert_is_constant(measurements[measurement_names[i]], at_value=around(expected_value, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #10
0
def test_capacitor_ac(convert_compile_load, IAC1, theta, f, C2, C3):

    VC2 = IAC1 / (2 * np.pi * f * C2) * np.sqrt(2)
    VC3 = IAC1 / (2 * np.pi * f * C3)

    # Start simulation
    hil.start_simulation()

    # Set source
    hil.set_source_sine_waveform(name='IAC1',
                                 rms=IAC1,
                                 frequency=f,
                                 phase=theta)
    hil.wait_msec(1000)

    # Test
    assert capture.read('VC2') == pytest.approx(expected=VC2, rel=1e-2)
    assert capture.read('VC3') == pytest.approx(expected=VC3, rel=1e-2)

    # Stop simulation
    hil.stop_simulation()
コード例 #11
0
def test_inductor_dc(convert_compile_load, VDC1, L1, IL1_0):

    # Set sources before starting the simulation
    hil.set_source_constant_value(name='VDC1', value=VDC1)

    # Start capture
    channel_list = ["IL1"]
    capture_time = 0.01

    # Expected current
    IL1_expected = VDC1 * capture_time / L1 + IL1_0

    capture.start_capture(duration=capture_time,
                          rate=1000,
                          signals=channel_list,
                          trigger_source="Forced",
                          trigger_use_first_occurence=True,
                          fileName="")

    # Start simulation
    hil.start_simulation()

    # Wait capture to finish()
    capture.wait_capture_finish()

    # Stop simulation
    hil.stop_simulation()

    # Evaluate capture results
    meas_res = capture.get_capture_results()
    measurements = meas_res["IL1"]

    # Calculate the measured current after one second
    IL1_measured = measurements[-1]

    # Check if captured current ise the ramp with the last value equal to the I_l_expected
    slope = VDC1 / L1  # slope of the linear voltage growth
    tolerance = 0.01 * IL1_expected
    assert signal.is_ramp(measurements, slope=slope, tol=tolerance)
    assert IL1_measured == pytest.approx(IL1_expected, abs=tolerance)
コード例 #12
0
def test_resistor(load_and_compile, VDC, iR1_expected, Vout_expected,
                  Vin_expected):

    # Set source value
    hil.set_source_constant_value(name='VDC', value=VDC)

    # Start capture
    start_capture(duration=0.2, signals=['iR1', 'Vout', 'Vin'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iR1 = capture['iR1']
    Vout = capture['Vout']
    Vin = capture['Vin']

    # Tests
    sig.assert_is_constant(iR1,
                           during=(0.005 - 0.000001, 0.005 + 0.000001),
                           at_value=around(iR1_expected, tol_p=0.01))
    sig.assert_is_constant(iR1,
                           during=(0.01 - 0.000001, 0.01 + 0.000001),
                           at_value=around(iR1_expected, tol_p=0.01))
    sig.assert_is_constant(Vout,
                           during=(0.005 - 0.000001, 0.005 + 0.000001),
                           at_value=around(Vout_expected, tol_p=0.01))
    sig.assert_is_constant(Vout,
                           during=(0.01 - 0.000001, 0.01 + 0.000001),
                           at_value=around(Vout_expected, tol_p=0.01))
    sig.assert_is_constant(Vin,
                           during=(0.005 - 0.000001, 0.005 + 0.000001),
                           at_value=around(Vin_expected, tol_p=0.01))
    sig.assert_is_constant(Vin,
                           during=(0.01 - 0.000001, 0.01 + 0.000001),
                           at_value=around(Vin_expected, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #13
0
def test_igbt(convert_compile_load, Vigbt1, Vigbt2, f):

    # Set source value.
    hil.set_source_sine_waveform(name='Vigbt1', rms=Vigbt1, frequency=f)
    hil.set_source_sine_waveform(name='Vigbt2', rms=Vigbt2, frequency=f)

    # Start capture
    start_capture(duration=0.1, signals=['Iigbt1', 'Iigbt2'], executeAt=0.2)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    hil.set_pe_switching_block_control_mode(blockName='IGBT1',
                                            switchName='S1',
                                            swControl=True)
    hil.set_pe_switching_block_software_value(blockName='IGBT1',
                                              switchName='S1',
                                              value=1)
    hil.set_pe_switching_block_control_mode(blockName='IGBT2',
                                            switchName='S1',
                                            swControl=True)
    hil.set_pe_switching_block_software_value(blockName='IGBT2',
                                              switchName='S1',
                                              value=0)
    capture = get_capture_results(wait_capture=True)
    Iigbt1 = capture['Iigbt1']
    Iigbt2 = capture['Iigbt2']

    # Expected currents
    R = 10
    Iigbt1_exp = Vigbt1 / R
    Iigbt2_exp = Vigbt2 / R / np.sqrt(2)

    # Tests
    sig.assert_is_constant(Iigbt1, at_value=around(Iigbt1_exp, tol_p=0.01))
    sig.assert_is_constant(Iigbt2, at_value=around(Iigbt2_exp, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #14
0
def test_l3(load_and_compile, Vsin3P, f, iLA_expected):

    # Set source value
    hil.set_source_sine_waveform(name='Vsin3P', rms=Vsin3P, frequency=f)

    # Start capture
    start_capture(duration=0.2, signals=['iLA'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iLA = capture['iLA']

    # Tests
    sig.assert_is_constant(iLA, during=(0.01 - 0.000001, 0.01 + 0.000001), at_value=around(iLA_expected, tol_p=0.01))
    sig.assert_is_constant(iLA, during=(0.02 - 0.000001, 0.020 + 0.000001), at_value=(-0.02,0.02))


    # Stop simulation
    hil.stop_simulation()
コード例 #15
0
def test_1ph_core_coupling(load_and_compile, VDC, iR1_expected):

    # Set source value
    hil.set_source_constant_value(name='VDC', value=VDC)

    # Start capture
    start_capture(duration=0.04, signals=['iR1'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iR1 = capture['iR1']

    # Tests
    # Peak
    sig.assert_is_constant(iR1,
                           during=(0 + 0.000001, 0.04),
                           at_value=around(iR1_expected, tol_p=0.001))

    # Stop simulation
    hil.stop_simulation()
コード例 #16
0
def test_ac_cable(convert_compile_load, Vsin3ph, f, theta):

    # Set source value
    hil.set_source_sine_waveform(name='Vsin3ph', rms=Vsin3ph, frequency=f, phase=theta)

    # Start capture
    start_capture(duration=0.1, signals=['Iac_cable'], executeAt=0.5)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    Iac_cable = np.mean(capture['Iac_cable'])

    # Expected currents
    Iac_cable_exp = 42.771

    # Tests
    assert Iac_cable == pytest.approx(Iac_cable_exp, rel=1e-3)

    # Stop simulation
    hil.stop_simulation()
コード例 #17
0
def test_bi_directional_switch(convert_compile_load, Vss, f, ss_value, Iss_exp):

    # Set source value
    hil.set_source_sine_waveform(name='Vss', rms=Vss, frequency=f)

    # Set switch state
    hil.set_contactor('SS', swControl=True, swState=ss_value)

    # Start capture
    start_capture(duration=0.1, signals=['Iss'], executeAt=0.2)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    Iss = capture['Iss']

    # Tests
    sig.assert_is_constant(Iss, at_value=around(Iss_exp, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #18
0
def test_capacitor_electrolytic_dc(convert_compile_load, IDC2, C_el1,
                                   VC_el1_0):

    # Set sources before starting the simulation
    hil.set_source_constant_value(name="IDC2", value=IDC2)

    # Set capture
    channel_list = ["VC_el1"]
    capture_time = 0.01

    # Expected voltage
    VC_el1_expected = VC_el1_0 + IDC2 / C_el1 * capture_time

    capture.start_capture(duration=capture_time,
                          rate=1000,
                          signals=channel_list,
                          trigger_source="Forced",
                          trigger_use_first_occurence=True,
                          fileName="")

    # Start simulation
    hil.start_simulation()

    # Wait capture to finish
    capture.wait_capture_finish()

    # Stop simulation
    hil.stop_simulation()

    # Evaluate capture results
    meas_res = capture.get_capture_results()
    measurements = meas_res["VC_el1"]

    # Calculate the measured voltage after one second
    VC1_measured = measurements[-1]

    assert VC1_measured == pytest.approx(VC_el1_expected, rel=0.01)
コード例 #19
0
def test_igbt_leg(load_and_compile, VDC1, iR1_expected):

    # Set source value
    hil.set_source_constant_value(name='VDC1', value=VDC1)

    hil.set_pe_switching_block_control_mode('SwitchingLeg', "S_top", swControl=True)
    hil.set_pe_switching_block_software_value('SwitchingLeg', "S_top", value=1)
    hil.set_pe_switching_block_control_mode('SwitchingLeg', "S_bot", swControl=True)
    hil.set_pe_switching_block_software_value('SwitchingLeg', "S_bot", value=1)

    start_capture(duration=0.04, signals=['iR1'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iR1 = capture['iR1']

    # Tests
    sig.assert_is_constant(iR1, during=(0.01 - 0.0001, 0.01 + 0.0001), at_value=around(iR1_expected, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #20
0
def test_3ph_bi_directional_switch(convert_compile_load, Vss, f, ss_value,
                                   Iss_exp):

    # Set source value
    hil.set_source_sine_waveform(name='V3ph_ss', rms=Vss, frequency=f)

    # Set switch state
    hil.set_contactor('SS', swControl=True, swState=ss_value)

    # Start capture
    start_capture(duration=0.1, signals=['Iss'], executeAt=0.2)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    Iss = np.mean(capture['Iss'])

    # Tests
    assert Iss == pytest.approx(Iss_exp, rel=1e-2, abs=0.2)

    # Stop simulation
    hil.stop_simulation()
コード例 #21
0
def convert_compile_load(convert_xml2tse):
    tse_path = convert_xml2tse
    cpd_path = tse_path[:-4] + " Target files\\" + tse_path.split(
        "\\")[-1][:-4] + ".cpd"
    # Open the converted tse file
    model.load(tse_path)
    # Compile the model
    model.compile()

    # Load to VHIL
    hil.load_model(file=cpd_path, offlineMode=False, vhil_device=vhil)

    # Set source value
    hil.set_source_sine_waveform(name='Vsin3ph',
                                 rms=220,
                                 frequency=50,
                                 phase=0)

    hil.start_simulation()

    yield

    # Stop simulation
    hil.stop_simulation()
コード例 #22
0
if __name__ == "__main__":
    import sys
    import time
    import numpy as np
    import math
    sys.path.insert(
        0, r'C:/Typhoon HIL Control Center/python_portable/Lib/site-packages')
    sys.path.insert(0, r'C:/Typhoon HIL Control Center/python_portable')
    sys.path.insert(0, r'C:/Typhoon HIL Control Center')
    import typhoon.api.hil_control_panel as cp
    from typhoon.api.schematic_editor import model
    import os

    cp.set_debug_level(level=1)
    cp.stop_simulation()

    model.get_hw_settings()
    if not model.load(
            r'D:/SVP/SVP 1.4.3 Directories 5-2-17/svp_energy_lab-loadsim/Lib/svpelab/Typhoon/ASGC.tse'
    ):
        print("Model did not load!")

    if not model.compile():
        print("Model did not compile!")

    # first we need to load model
    cp.load_model(
        file=r'D:/SVP/SVP 1.4.3 Directories 5-2-17/svp_energy_lab-loadsim/Lib'
        r'/svpelab/Typhoon/ASGC Target files/ASGC.cpd')
コード例 #23
0
def test_three_phase_NPC_converter(load_and_compile, VDC1, VDC2, iA_expected,
                                   iB_expected, iC_expected):

    # Set source value
    hil.set_source_constant_value(name='VDC1', value=VDC1)
    hil.set_source_constant_value(name='VDC2', value=VDC2)

    for switch in range(1, 3):

        hil.set_pe_switching_block_control_mode(blockName='NPC',
                                                switchName="Sa_" + str(switch),
                                                swControl=True)
        hil.set_pe_switching_block_software_value(blockName='NPC',
                                                  switchName="Sa_" +
                                                  str(switch),
                                                  value=1)
        hil.set_pe_switching_block_control_mode(blockName='NPC',
                                                switchName="Sb_" + str(switch),
                                                swControl=True)
        hil.set_pe_switching_block_software_value(blockName='NPC',
                                                  switchName="Sb_" +
                                                  str(switch),
                                                  value=0)
        hil.set_pe_switching_block_control_mode(blockName='NPC',
                                                switchName="Sc_" + str(switch),
                                                swControl=True)
        hil.set_pe_switching_block_software_value(blockName='NPC',
                                                  switchName="Sc_" +
                                                  str(switch),
                                                  value=0)
    for switch in range(3, 5):
        hil.set_pe_switching_block_control_mode(blockName='NPC',
                                                switchName="Sa_" + str(switch),
                                                swControl=True)
        hil.set_pe_switching_block_software_value(blockName='NPC',
                                                  switchName="Sa_" +
                                                  str(switch),
                                                  value=0)
        hil.set_pe_switching_block_control_mode(blockName='NPC',
                                                switchName="Sb_" + str(switch),
                                                swControl=True)
        hil.set_pe_switching_block_software_value(blockName='NPC',
                                                  switchName="Sb_" +
                                                  str(switch),
                                                  value=1)
        hil.set_pe_switching_block_control_mode(blockName='NPC',
                                                switchName="Sc_" + str(switch),
                                                swControl=True)
        hil.set_pe_switching_block_software_value(blockName='NPC',
                                                  switchName="Sc_" +
                                                  str(switch),
                                                  value=1)

    # Start capture
    start_capture(duration=0.04, signals=['iA', 'iB', 'iC'], executeAt=0)

    # Start simulation
    hil.start_simulation()

    # Data acquisition
    capture = get_capture_results(wait_capture=True)
    iA = capture['iA']
    iB = capture['iB']
    iC = capture['iC']

    # Tests
    sig.assert_is_constant(iA,
                           during=(0.03 - 0.001, 0.03 + 0.001),
                           at_value=around(iA_expected, tol_p=0.01))

    sig.assert_is_constant(iB,
                           during=(0.03 - 0.001, 0.03 + 0.001),
                           at_value=around(iB_expected, tol_p=0.01))

    sig.assert_is_constant(iC,
                           during=(0.03 - 0.001, 0.03 + 0.001),
                           at_value=around(iC_expected, tol_p=0.01))

    # Stop simulation
    hil.stop_simulation()
コード例 #24
0
 def stop_simulation(self):
     '''
     Stop simulation
     '''
     cp.stop_simulation()
コード例 #25
0
    #  yDataMatrix  - 'numpy.ndarray' matrix with data values,
    #  xData        - 'numpy.array' with time data)
    (signalsNames, yDataMatrix, xData) = capturedDataBuffer[0]

else:

    # if error occured
    print "Unable to start capture process."

Pgen = []
Qgen = []

Pgen.append(mean(yDataMatrix[0]) / 1.0e6)
Pgen.append(mean(yDataMatrix[2]) * 3.5)
Qgen.append(mean(yDataMatrix[1]) / 1e6)
Qgen.append(mean(yDataMatrix[3]) * 3.5)

for i in range(0, len(busVoltage)):
    print "Bus %i: _____ Magnitude = %f V _____ Angle = %f degrees" % (
        i + 1, busVoltage[i], busPhase[i])

print "Grid Power: _____ Active = %f MW _____ Reactive = %f MVAr" % (Pgen[0],
                                                                     Qgen[0])
print "DG Power: _____ Active = %f MW _____ Reactive = %f MVAr" % (Pgen[1],
                                                                   Qgen[1])

print "stoping simulation"
hil.stop_simulation()
print "waiting user to stop script"
hil.end_script_by_user()