How do I impose constraints for each time step of the calculation?
1 view (last 30 days)
Show older comments
Hello,
I am trying to find the optimal size for each component in a microgrid power system. The system has a battery with a state of charge SOC that I calculate as :
SOC=zeros(8760,1);
SOC(1)=SOC_min;
for t=2:8760
if Npv*P_pv_each(t)*eta_inv-P_dmd(t)>0
mu_c=1;
mu_d=0;
else
mu_c=0;
mu_d=1;
end
SOC(t)=SOC(t-1)*(1-SD)+(mu_c*(Npv*P_pv_each(t)-P_dmd(t))*eta_bat_c/eta_inv + mu_d*(Npv*P_pv_each(t)/eta_inv-P_dmd(t))*eta_bat_d);
end
The SOC needs to obey a set of constraints that I formulate as:
% Inequality constraints
PVEVopt.Constraint.const1=SOC_min<=SOC(t); % Guarantee minimum SOC
PVEVopt.Constraint.const2=SOC(t)<=SOC_max; % Do not exceed maximum SOC I.e battery capacity
PVEVopt.Constraint.const3=abs(SOC(t)-SOC(t-1)*(1-SD))*1000/V_bus<=I_max; % Limite charging/Discharging current
can I have this for loop in my program followed by the constraints like this? What would be another way to impose these constraints
Thanks
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!