def pvmodule_output_power(irrad, tdry, pvmod_Pnom, pvmod_Tcoeff, pvmod_noct):
    """
    calculate the output power of a solar module depending on its
    parameters, solar irradiation, ambient temperature. At the beginning
    is calculated the cell operation temperature, from the temperature
    follows the power gain/loss with respect to STC nominal and the
    actual power output as function of the irradiation
    
    input
    - irrad: solar irradiation (W/m2), integer/float
    - tdry: ambient temperature (degrees C), float
    - pvmod_Pnom: max power output at STC (W), float
    - pvmod_Tcoeff: temperature coefficient gamma (gamma), power change%
    at STC Treference =25 C compared to Pmax (x%/C), float
    - pvmod_noct: NOCT reference temperature, to estimate cell work
    temperature at given irradiation, ambient temperature, float

    returns
    - power_out, actual power generated by the module (W), float
    - cell_temp, cell estimated work temperature (degrees C), float 

    """
    Tref_stc = 25
    Tref_noct = 20
    cell_temp = tdry + round((pvmod_noct - Tref_noct) * irrad / 800, 1)
    power_nom = pvmod_Pnom + pvmod_Tcoeff * (cell_temp - Tref_stc)
    power_out = power_nom * irrad / 1000
    return power_out, cell_temp
