Energy Storage Optimization with PV to Increase the Revenue

12 ビュー (過去 30 日間)
Ali Almarzooqi
Ali Almarzooqi 2020 年 8 月 23 日
回答済み: Payam 2023 年 3 月 27 日
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

回答 (1 件)

Payam
Payam 2023 年 3 月 27 日
HI Ali,
Did you ever firgure this out? I am facing a similar problem.

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by