def test_buses(self):
        filename = 'data/Sample-Powell-3.1.xlsx'
        builder = power_system_builder.ExcelPowerSystemBuilder(filename)

        actual = builder.build_buses()
        expected = [
            power_system.Bus(1, 0, 0, 0, 1),
            power_system.Bus(2, 0.4, 0.2, 0, 1),
            power_system.Bus(3, 0.25, 0.15, 0, 1),
            power_system.Bus(4, 0.4, 0.2, 0, 1),
            power_system.Bus(5, 0.5, 0.2, 0, 1)
        ]

        self.assertListEqual(expected, actual)
Пример #2
0
    def build_buses(self):
        result = []
        for row in self._bus_data_worksheet.iter_rows(row_offset=1):
            bus_number = row[0].value
            if not bus_number:
                break

            voltage_magnitude = row[8].value
            voltage_angle = row[9].value
            voltage = voltage_magnitude * np.exp(1j * np.deg2rad(voltage_angle))

            # Y_load = S* / |V|^2
            p_load = row[1].value or 0
            q_load = row[2].value or 0
            s_load = p_load + 1j * q_load
            load_admittance = np.conjugate(s_load) / voltage_magnitude ** 2

            gen_z0 = 1j * row[6].value or 0j
            gen_z1 = 1j * row[4].value or 0j
            gen_z2 = 1j * row[5].value or 0j
            gen_zn = self._generator_neutral_impedance if row[7].value == 1 else np.inf

            result.append(power_system.Bus(bus_number, voltage, load_admittance, gen_z0, gen_z1, gen_z2, gen_zn))

        return result
Пример #3
0
    def build_buses(self):
        """Builds a list of buses in the system."""
        result = []
        for row in self._bus_data_worksheet.iter_rows(min_row=2):
            bus_number = row[0].value
            if not bus_number:
                break

            p_load = (row[1].value or 0) / self._power_base
            q_load = (row[2].value or 0) / self._power_base
            p_generator = (row[3].value or 0) / self._power_base
            p_voltage = row[4].value or self._start_voltage
            result.append(
                power_system.Bus(bus_number, p_load, q_load, p_generator,
                                 p_voltage))

        return result