I have designed a system connected to the grid with renewable sources and electricity storage.
Sometimes the renewable output exceeds the electrical consumption. Therefore, the system has two options:
- Sell the electricity back to the grid
- Store the electricity
I do not know how HOMER chooses between these two options. Sometimes it would be better selling the electricity instead of storing it, but other times if you store the excess you could use it later and save money instead of acquiring from the grid at (possibly) peak purchase prices or maybe you can store the excess in order to sell at peak sell prices.
How does HOMER consider this? Does it perform an hours ahead optimization?
HOMER does not look into the future when deciding on how to operate the system. In the situation you describe, where the system could sell excess electricity to the grid or store it in batteries, it will choose to charge the batteries unless you prevent that with the control parameters that appear on the Advanced tab of the Grid Inputs window. Those parameters let you prohibit battery charging during times of high sellback rate, for example.