Energy Storage Optimization with PV to Increase the Revenue

16 visualizaciones (últimos 30 días)
Ali Almarzooqi
Ali Almarzooqi el 23 de Ag. de 2020
Respondida: Payam el 27 de Mzo. de 2023
Dear All,
I am currently working on an optimization problem for a combined Solar energy and Energy Storage. The objective of the optimization is to increase revenue from controlling the battery when to charge and when to discharge depending on when the tariff electricity rate price is high or low. The optimization is fed with one week of data of electricity tariff rate price, demand, and PV.
According to the below code, I am getting an error in the SOC constraint, which is “the following error occurred converting from optim.problemdef.OptimizationExpression to double: Conversion to double from optim.problemdef.OptimizationExpression is not possible.” Therefore, how can I solve this error, please?
% Initializtion
T = size(demand,1);
MaxGenerationLevel = ones (T,1)*MaxGenerationLevel(:,1);
MinGenerationLevel = ones(T,1)*MinGenerationLevel(:,1);
SOC = optimexpr(T,1)*SOC;
BESScap = double(T)*BESScap;
BESScapmax = ones(T,1)*7.200; %
BESScapmin = zeros(T,1);
% initialize the optimization problem
prob = optimproblem ('ObjectiveSense', 'max');
% Decision Variables
Pwr = optimvar('Pwr',T, 1, "LowerBound",-MaxGenerationLevel,"UpperBound",MaxGenerationLevel) %my Decision Variables is the battery power
% Constraints:
% Meet Demand constraints:
%
prob.Constraints.demand = sum(Pwr,2) <= demand;
% % % BESS capacity constraints:
% prob.Constraints.BESScap = BESScapmin <= BESScap <= BESScapmax;
% SOC constraint:
prob.Constraints.SOC = optimconstr(T,1);
for t = 2:T
if BESScapmin <= BESScap(t-1) <= BESScapmax
BESScap(t) = BESScap(t-1) + Pwr(t,1);% first place
SOC(t-1) = BESScap(t-1)/7.200;
else
continue
end
% BESScap(t) = BESScap(t-1) + Pwr(t); % second place
end
prob.Objective = sum(Pwr.*ElectpriceFChourly) %+ sum(PV.*ElectpriceFChourly); % the timing is per hour
Solution = solve(prob);
Moreover, I am happy to modify my code if there are more errors to get the correct optimization solution.
Appreciate your support in advance.
Best regards,
Ali

Respuestas (1)

Payam
Payam el 27 de Mzo. de 2023
HI Ali,
Did you ever firgure this out? I am facing a similar problem.

Categorías

Más información sobre Particle Swarm en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by