def setUp(self):
        self.short_circuit_current = 3.87  # [A]
        self.open_circuit_voltage = 42.1  # [V]
        self.temperature_voltage_coefficient = -0.080  # [V/ºC]
        self.temperature_current_coefficient = (
            0.065 / 100
        ) * self.short_circuit_current  # ([%/ºC] / [100%]) * [A] = [A/ºC]
        series_resistance = 0.56
        shunt_resistance = 1862
        diode_quality_factor = 1.343

        number_of_cells_in_series = 72

        number_of_voltage_decimal_digits = 1

        self.single_diode_model = SingleDiodeModel(
            self.short_circuit_current,
            self.open_circuit_voltage,
            number_of_cells_in_series,
            number_of_voltage_decimal_digits=number_of_voltage_decimal_digits,
            temperature_voltage_coefficient=self.
            temperature_voltage_coefficient,
            temperature_current_coefficient=self.
            temperature_current_coefficient,
            series_resistance=series_resistance,
            shunt_resistance=shunt_resistance,
            diode_quality_factor=diode_quality_factor)
    def __get_single_diode_model_and_calculate(
            self, operating_temperature, actual_irradiance,
            partial_shading_ratio, number_of_corresponding_modules):

        overall_number_of_cells_in_series = self.number_of_cells_in_series * number_of_corresponding_modules

        overall_open_circuit_voltage = self.open_circuit_voltage * number_of_corresponding_modules

        single_diode_model = SingleDiodeModel(
            self.short_circuit_current,
            overall_open_circuit_voltage,
            overall_number_of_cells_in_series,
            number_of_voltage_decimal_digits=self.
            number_of_voltage_decimal_digits,
            temperature_voltage_coefficient=self.
            temperature_voltage_coefficient,
            temperature_current_coefficient=self.
            temperature_current_coefficient,
            series_resistance=self.series_resistance,
            shunt_resistance=self.shunt_resistance,
            diode_quality_factor=self.diode_quality_factor)

        actual_irradiance_for_the_group_of_modules = actual_irradiance * partial_shading_ratio

        single_diode_model.calculate(
            operating_temperature, actual_irradiance_for_the_group_of_modules)

        return single_diode_model
class TestSingleDiodeModel(unittest.TestCase):
    def setUp(self):
        self.short_circuit_current = 3.87  # [A]
        self.open_circuit_voltage = 42.1  # [V]
        self.temperature_voltage_coefficient = -0.080  # [V/ºC]
        self.temperature_current_coefficient = (
            0.065 / 100
        ) * self.short_circuit_current  # ([%/ºC] / [100%]) * [A] = [A/ºC]
        series_resistance = 0.56
        shunt_resistance = 1862
        diode_quality_factor = 1.343

        number_of_cells_in_series = 72

        number_of_voltage_decimal_digits = 1

        self.single_diode_model = SingleDiodeModel(
            self.short_circuit_current,
            self.open_circuit_voltage,
            number_of_cells_in_series,
            number_of_voltage_decimal_digits=number_of_voltage_decimal_digits,
            temperature_voltage_coefficient=self.
            temperature_voltage_coefficient,
            temperature_current_coefficient=self.
            temperature_current_coefficient,
            series_resistance=series_resistance,
            shunt_resistance=shunt_resistance,
            diode_quality_factor=diode_quality_factor)

    def test_calculate_i_v_values(self):

        # maximum_power_point_current = 3.56 # [A]
        # maximum_power_point_voltage = 33.7 # [V]

        operating_temperature = 35 + 273
        actual_irradiance = 900

        self.single_diode_model.calculate(operating_temperature,
                                          actual_irradiance)
        # self.single_diode_model.calculate(operating_temperature, actual_irradiance, maximum_power_point_current, maximum_power_point_voltage)

        voltages = self.single_diode_model.voltages
        currents = self.single_diode_model.currents
        powers = self.single_diode_model.powers

        self.assertEqual(len(voltages), 411)
        self.assertEqual(voltages[0], 0)
        self.assertEqual(voltages[410], 41.0)
        self.assertAlmostEqual(currents[0], 3.506, delta=0.001)
        self.assertEqual(currents[410], 0)
        self.assertEqual(powers[0], 0)
        self.assertEqual(powers[410], 0)
class TestSingleDiodeModel(unittest.TestCase):

    def setUp(self):
        self.short_circuit_current = 3.87 # [A]
        self.open_circuit_voltage = 42.1 # [V]
        self.temperature_voltage_coefficient = -0.080 # [V/ºC]
        self.temperature_current_coefficient = (0.065 / 100) * self.short_circuit_current # ([%/ºC] / [100%]) * [A] = [A/ºC]
        series_resistance = 0.56
        shunt_resistance = 1862 
        diode_quality_factor = 1.343

        number_of_cells_in_series = 72

        number_of_voltage_decimal_digits = 1

        self.single_diode_model = SingleDiodeModel(self.short_circuit_current, 
                                                   self.open_circuit_voltage, 
                                                   number_of_cells_in_series, 
                                                   number_of_voltage_decimal_digits = number_of_voltage_decimal_digits, 
                                                   temperature_voltage_coefficient = self.temperature_voltage_coefficient, 
                                                   temperature_current_coefficient = self.temperature_current_coefficient, 
                                                   series_resistance = series_resistance, 
                                                   shunt_resistance = shunt_resistance, 
                                                   diode_quality_factor = diode_quality_factor)

    def test_calculate_i_v_values(self):

        # maximum_power_point_current = 3.56 # [A]
        # maximum_power_point_voltage = 33.7 # [V]

        operating_temperature = 35 + 273
        actual_irradiance = 900

        self.single_diode_model.calculate(operating_temperature, actual_irradiance)
        # self.single_diode_model.calculate(operating_temperature, actual_irradiance, maximum_power_point_current, maximum_power_point_voltage)

        voltages = self.single_diode_model.voltages
        currents = self.single_diode_model.currents
        powers = self.single_diode_model.powers

        self.assertEqual(len(voltages), 411)
        self.assertEqual(voltages[0], 0)
        self.assertEqual(voltages[410], 41.0)
        self.assertAlmostEqual(currents[0], 3.506, delta = 0.001)
        self.assertEqual(currents[410], 0)
        self.assertEqual(powers[0], 0)
        self.assertEqual(powers[410], 0)
    def __get_single_diode_model_and_calculate(self, operating_temperature, actual_irradiance, partial_shading_ratio, number_of_corresponding_modules):

        overall_number_of_cells_in_series = self.number_of_cells_in_series * number_of_corresponding_modules

        overall_open_circuit_voltage = self.open_circuit_voltage * number_of_corresponding_modules

        single_diode_model = SingleDiodeModel(self.short_circuit_current, 
                                              overall_open_circuit_voltage, 
                                              overall_number_of_cells_in_series, 
                                              number_of_voltage_decimal_digits = self.number_of_voltage_decimal_digits, 
                                              temperature_voltage_coefficient = self.temperature_voltage_coefficient, 
                                              temperature_current_coefficient = self.temperature_current_coefficient, 
                                              series_resistance = self.series_resistance, 
                                              shunt_resistance = self.shunt_resistance, 
                                              diode_quality_factor = self.diode_quality_factor) 

        actual_irradiance_for_the_group_of_modules = actual_irradiance * partial_shading_ratio

        single_diode_model.calculate(operating_temperature, actual_irradiance_for_the_group_of_modules)

        return single_diode_model
    def setUp(self):
        self.short_circuit_current = 3.87 # [A]
        self.open_circuit_voltage = 42.1 # [V]
        self.temperature_voltage_coefficient = -0.080 # [V/ºC]
        self.temperature_current_coefficient = (0.065 / 100) * self.short_circuit_current # ([%/ºC] / [100%]) * [A] = [A/ºC]
        series_resistance = 0.56
        shunt_resistance = 1862 
        diode_quality_factor = 1.343

        number_of_cells_in_series = 72

        number_of_voltage_decimal_digits = 1

        self.single_diode_model = SingleDiodeModel(self.short_circuit_current, 
                                                   self.open_circuit_voltage, 
                                                   number_of_cells_in_series, 
                                                   number_of_voltage_decimal_digits = number_of_voltage_decimal_digits, 
                                                   temperature_voltage_coefficient = self.temperature_voltage_coefficient, 
                                                   temperature_current_coefficient = self.temperature_current_coefficient, 
                                                   series_resistance = series_resistance, 
                                                   shunt_resistance = shunt_resistance, 
                                                   diode_quality_factor = diode_quality_factor)
Ejemplo n.º 7
0
short_circuit_current = 5.75
open_circuit_voltage = 22.5
temperature_current_coefficient = 0.04
series_resistance = 0.115820201147
shunt_resistance = 37173.5612907
diode_quality_factor = 1.27873896365

number_of_series_connected_cells = 36

number_of_voltage_decimal_digits = 1

single_diode_model = SingleDiodeModel(
    short_circuit_current,
    open_circuit_voltage,
    number_of_series_connected_cells,
    number_of_voltage_decimal_digits=number_of_voltage_decimal_digits,
    temperature_current_coefficient=temperature_current_coefficient,
    series_resistance=series_resistance,
    shunt_resistance=shunt_resistance,
    diode_quality_factor=diode_quality_factor)

# operating_temperature = 25 + 273
operating_temperature = 35 + 273
actual_irradiance = 1000

single_diode_model.calculate(operating_temperature, actual_irradiance)

# voltages = single_diode_model.voltages
# currents = single_diode_model.currents
# powers = single_diode_model.powers
# Values for RNG-100D:
short_circuit_current = 5.75
open_circuit_voltage = 22.5
temperature_current_coefficient = 0.04
series_resistance = 0.115820201147
shunt_resistance = 37173.5612907
diode_quality_factor = 1.27873896365

number_of_series_connected_cells = 36

number_of_voltage_decimal_digits = 1

single_diode_model = SingleDiodeModel(short_circuit_current, 
                                      open_circuit_voltage, 
                                      number_of_series_connected_cells, 
                                      number_of_voltage_decimal_digits = number_of_voltage_decimal_digits,
                                      temperature_current_coefficient = temperature_current_coefficient, 
                                      series_resistance = series_resistance, 
                                      shunt_resistance = shunt_resistance, 
                                      diode_quality_factor = diode_quality_factor)

# operating_temperature = 25 + 273
operating_temperature = 35 + 273
actual_irradiance = 1000

single_diode_model.calculate(operating_temperature, 
                             actual_irradiance)

# voltages = single_diode_model.voltages
# currents = single_diode_model.currents
# powers = single_diode_model.powers