This paper presents theoretical and experimental work that is being carried out in a grid-connected residential building demonstrator available at the Instituto de Energía Solar (IES) of the Universidad Politécnica de Madrid (UPM) in Madrid, Spain. The house is provided with a building-integrated photovoltaic (PV) system coupled to a battery energy storage system (BESS), and a heating, ventilation, and air-conditioning system (HVAC) based on two air-to-air direct expansion reversible heat pumps. Thermal loads, HVAC consumption, and PV generation are simulated using different dynamic models, and they are validated with actual data derived from monitoring the experimental campaign. A model of intelligent control of BESS is proposed, which aims to supply the selected application (HVAC load) with two control strategies: increasing PV self-consumption and grid-peak shaving. This model has been validated with experimental data (error<10%). Furthermore, the study includes aging and degradation effects on the batteries to make allowance for realistic lifetime assessment. The results of the case study show that in a building without a BESS, the self-consumption rate is about 30%; however, with the implementation of the proposed control, it could achieve approximately 50%, depending on the BESS capacity and the PV generator nominal power. Likewise, by using a combination of both strategies, it is possible to reduce both contracted power and energy consumption (77% and 49% respectively for case study).