def set_heating_contribution(agent, pv_power):
    """ If the water tank is currently in use, compute and return the part of the pv_power used for heating the water"""
    pv_power_to_heating = 0
    if agent.water_tank.is_active():
        pv_power_to_heating = pv_power * agent.pv_panel.heating_contribution
    return pv_power_to_heating