Problem-Based Optimization, No feasible solution found
Show older comments
In this simplified version of a system designed to produce hydrogen from pv, I want to find out the lowest possible capacity of the electrolyzer?
The problem is that when I run the model it says that there is no solution avaliable. However, when I fill in the capacity of the electrolyzer by hand I can easily find a solution for the constraints.
%% Problem-Based Optimization
load('CF_pv.mat'); % Hourly data of capacity factor sun
energyprob = optimproblem;
PV = 748; % in MW
Electrolyzer = optimvar('Electrolyzer',1,'LowerBound',0); % Capacity of ELectrolyzer in MW
Electrolyzer_costs =[(200+0.7*200)];
costs = Electrolyzer_costs*Electrolyzer;
%Objective Function
energyprob.Objective = costs;
%% Optimization constraints
PV_Load = PV*CF_pv;
T = 8760; % hours in a year
Bat_In = optimvar('Bat_In',T,'LowerBound',0); % Electricity send to battery
Bat_Out = optimvar('Bat_Out',T,'LowerBound',0); % Electricity send from battery to Electrolyzer
Bat_In_c = optimconstr(T);
Bat_Out_c = optimconstr(T);
for t=1:T
Bat_In_c(t) = Bat_In(t) == (PV_Load(t)-1.1*Electrolyzer); % Abundant Electricity, above 110% of the limit of the electrolyzer
Bat_Out_c(t) = Bat_Out(t) == 0.1*Electrolyzer-PV_Load(t); % Electricity necessary to keep electrolyzer running
end
Elec_In = PV_Load - Bat_In + Bat_Out; % Generated electricity - input in battery + electricty from battery to electrolyzer
energyprob.Constraints.Bat_In_c = Bat_In_c;
energyprob.Constraints.Bat_Out_c = Bat_Out_c;
Desired_Elec_In = 1.7618*10^6; % Desired electricty input for a whole year
cons1 = Elec_In == sum(Desired_Elec_In);
energyprob.Constraints.cons1 = cons1;
[sol,fval] = solve(energyprob);
sol.Electrolyzer % display electrolyzer capacity
Accepted Answer
More Answers (0)
Categories
Find more on Linear Programming and Mixed-Integer Linear Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!