Hi Usama,
Just to elaborate a bit more on your questions:
1.) There is not an explicit function or macro, but we do provide outputs that should make it possible for you to determine the self-consumption of the system. If you are running with Lifetime set to "PV simulation over one year", the outputs appear in the "Data Tables" under "Single Values". The values are:
- Battery annual energy charged (kWh)
- Battery annual energy charged from PV (kWh)
- Battery annual energy charged from grid (kWh)
- Battery annual energy discharged (kWh)
- Battery annual energy loss (kWh)
Note, if you are running with "Lifetime" set to "PV simulation over analysis period", then these values will be present under the "Data Table" results under "Annual Data", and will have values for every year. So, if for example, you have:
"Battery annual energy charged": 16189 kWh
"Battery annual energy charged from PV": 3017 kWh
"Battery annual energy charged from Grid": 13172 kWh
You could calculate that you charge your battery 18.6% from PV and 81.4% from the grid, i.e, it's not very self sufficient.
2. Paul gave a nice description of the look-behind controller. The same concept applies for the look-ahead controller, except the algorithm has a perfect forecast of the next 24 hours electric load and PV production, so it can more accurately compute the peak grid power and when to schedule the battery to charge and discharge to reduce that peak. Every 24 hours, the controller tries to reduce the grid power as much as possible, but doesn't reduce the peak any lower that the current monthly peak, since that is the peak that will be used to compute demand charges.
I hope that helps, I will eventually publish more documentation on the automatic dispatch algorithm, please don't hesitate to ask if you have additional questions.
Best,
Nick DiOrio