Skip to content

add a function that multiplies voltages and currents for arrays #159

@wholmgren

Description

@wholmgren

I'd like to consider adding a function to pvsystem.py that would multiply the voltages and currents returned by pvsystem.sapm and pvsystem.singlediode. Of course, the motivation for this is to make it easier to calculate array parameters.

def multiply_voltage_current(data, voltage_multiplier=1, current_multiplier=1): 
    # as written, only works with a DataFrame
    # could make it work with a dict, but it would be more verbose
    data = data.copy()
    voltages = ['v_mp', 'v_oc']
    currents = ['i_mp' ,'i_x', 'i_xx', 'i_sc']
    data[voltages] *= voltage_multiplier
    data[currents] *= current_multiplier
    data['p_mp'] *= voltage_multiplier * current_multiplier

    return data


# within the PVSystem class...

    def multiply_voltage_current(self, data):

        return multiply_voltage_current(
            data, voltage_multiplier=self.series_modules,
            current_multiplier=self.parallel_modules)

Maybe the function can also be reused for some system losses.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions