Authors - Monica Alonso, Hortensia Amaris, Maria Angeles Moreno, Farzaneh Abdollahi, Lucia Gauchia Abstract - This paper introduces a novel approach to applying artificial intelligence algorithms based on Reinforcement Learning (RL) for microgrid energy management. Two energy storage systems are considered: stationary battery storage and electric vehicle batteries with G2V/V2G capability. The proposed energy management algorithm considers (i) the uncertainty of photovoltaic energy production, (ii) fluctuations in electricity market prices, and (iii) driver anxiety concerning the vehicle’ range at departure time. The significance of specific parameters, such as time horizon selection and the constant value related to the electric vehicle driver’s anxiety, are examined to optimise the RL reward. Results demonstrate the algorithm's excellent performance under different scenarios.