Optimal electrical and thermal energy management of a residential energy hub in the presence of PV systems