Hi all!
I am currently working on an optimization problem to maximize the revenue from a combined wind turbine and energy storage system. With the code below, the system charges and discharges simultaneously at certain times. I am able to change the charge and discharge variables to a single variable with the lowerbound as a negative and positive number corresponding to discharging and charging, respectively. But in doing this, I cannot accurately apply the charge and discharge efficiencies of the storage device.
prob = optimproblem;% Decision variables
% Energy storage system decision variables
ESS_ch = optimvar('ESS_ch',T,'LowerBound',0,'UpperBound',ESS_Pmax);ESS_disch = optimvar('ESS_disch',T,'LowerBound',0,'UpperBound',ESS_Pmax);ESS_SOC = optimvar('ESS_SOC',T,'LowerBound',0,'UpperBound',ESS_Cmax);% Output power to the grid variables
Grid_E = optimvar('Grid_E',T,'LowerBound',0);% Energy storage operational constraints
prob.Constraints.energyStorage = optimconstr(T);prob.Constraints.energyStorage(1) = ESS_SOC(1) == 10;prob.Constraints.energyStorage(2:T) = ESS_SOC(2:T) == ESS_SOC(1:T-1)*(1-d) - ESS_disch(1:T-1)/eff + ESS_ch(1:T-1)*eff;% Energy balance constraint (WT_E = wind turbine power output as vector of
% length T)
prob.Constraints.EnergyBalance = Grid_E == WT_E + ESS_disch - ESS_ch;prob.ObjectiveSense = 'maximize';prob.Objective = sum(Grid_E.*Price);
I have also attempted to apply a constraint that dictates the charge power multilied by the discharge power of the storage device is equal to zero at any single time step, see below.
prob.Constraints.chargeonoff = optimconstr(T);for i = 1:T prob.Constraints.chargeonoff(i) = ESS_disch(i)*ESS_ch(i) == 0;end
However, when I add this the following error occurs.
Error using optim.problemdef.OptimizationProblem/solve
SOLVE requires a non-empty initial point structure to solve a nonlinear problem.
Any assistance or insight on how to force the program to either charge or discharge at each time step would be greatly appreciated.
Best Answer