During the same simulation, HOMER shows that the excess energy produced is 85.3%, while it also shows that there is a capacity shortage of 49%. If there is excess energy why it does not use it for minimizing the capacity shortage?
The excess energy and the capacity shortage do no happen at the same moment. This result is expected, for example, if you have a PV system that generates excess electricity during the day, and generates no power at night. The system has excess electricity during the day, when the sun is shining. At night, when there is no PV power output, but there is still a load, there will be a capacity shortage.
This "intermittency" (clouds, night, for PV, variability in wind for wind power) is a property of many renewable energy sources. Adding enough storage (i.e. batteries) to the system can supply the load at night or on cloudy days, but this can be expensive. For batteries to help, you also have enough excess PV to recharge the batteries when it's sunny. A backup generator or a grid connection are also good ways to augment any intermittent renewable generation.