Energy Storage Optimization with PV to Increase the Revenue
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Payam
le 27 Mar 2023
HI Ali,
Did you ever firgure this out? I am facing a similar problem.
0 commentaires
Voir également
Catégories
En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!