How should I model this?

I have a forecast amount of electricity consumption and then a set of potential solar PV system sizes (5.4kW, 10kW and 15kW) for a small residential estate.

I have modeled hourly and cumulative energy generation/use.

The times where the blue line is above the other lines is the net consumer position and then the capacity of the system determine the surplus generation that can be stored.

It is an optimization problem to determine what battery size should be installed. I need other parameters:

  • Cost of energy purchased from grid
  • Price of energy sold to grid
  • Infrastructure costs (additional solar, battery and inverters).

It is not a complex problem but nice to do it on a small scale.