This webpage explains how to model the amount of energy produced by a hydro plant when the plant can store water in a reservoir. The hydro plant has constraints on the amount of energy and the amount of capacity. Determining the amount of energy to release depends on value of energy at different time periods. Assuming that the value of energy is directly related to the size of the load, an optimisation process is easy to accomplish using the goal seek tool.
To compute peak shaving you can start with the basic load. Then you put in an arbitrary set point which is the amount of load that is present before which the water is released. If load is above the set point, energy is produced by the hydro plant. You can sum the amount of energy using the set point. Then you can make sure that the sum of the energy produced by the hydro plant is equal to the energy available. You should also make sure that the capacity of the generator is not exceeded in any hour.
The peak shaving algorithm is demonstrated in the file that you can download by pressing the button below. There are just a couple of equations and a goal seek function.
The process of using a goal seek function to find the set point is illustrated in the screenshot below. You can compute the difference between the computed generation from the hydro plant and the amount of energy available. This difference should be zero. To get the difference to zero you should also make an equation with the minimum function which assures that the generation cannot exceed the capacity of the generator.
The goal seek macro is simple as illustrated below. You should name ranges and record a macro.
. Sub peak_shave() ' ' peak_shave Macro ' Range("difference").GoalSeek Goal:=0, ChangingCell:=Range("set_point") End Sub
The screenshot below illustrates how you can use the MIN and MAX and a set point to compute the total energy when you are peak shaving.
The computation of peak shaving is demonstrated in the file that you can download by pressing the button below.