You can use load2disp() <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/load2disp.html> to convert loads to dispatchable. Solar generation can be modeled as a normal generator with a generation cost of zero. Assuming it is not dispatchable, you would also want to set PMIN equal to PMAX, both set to the desired production level for the OPF run in question.
Ray > On Apr 21, 2018, at 5:28 PM, Khawla Munawwer <[email protected]> > wrote: > > Can someone help me with dispatching the load or how to add a solar to power > generation to limit the voltage violations.Following are the objectives: > > I want to Run 24-‐‑hour simulations and report the voltage, losses and line > loading. If the voltage violates the standard limits of 0.95 PU – 1.05 PU at > any bus, or the loading exceeds 100% during one or more time intervals > modifications > to the network to overcome the problem. > > I can include incorporating more dispatchable loads > (i.e., converting some regular loads to dispatchable ones), and/or adding more > renewable energy generation (adding new plants at new buses or enlarging > existing ones) > > > Deliverable: > > • Describe any changes that you propose, if any, and report the following > plots > for two cases: before and after modification. > • Plot a 3D plot depicting the voltage magnitude at each bus over time. > • Plot another 3D plot depicting the percent line loading through each branch > throughout the day. > • Plot a 2D plot showing the total losses throughout the day at every bus, and > calculate the total losses across the entire network. > > I have used following code but I am not able to use a code to dispatch loades > and use solar power...please help: > > > > define_constants; > mpc = loadcase('case30'); %load case30 to the variable mpc > for a=1:30 > PDdefault(a,1)=mpc.bus(a,PD); %store the default value of power demand > for each bus in case 30 > end > for b = 1:24 %Repeat for 24 hours > for a = 1:30 %Repeat for 30 buses > mpc.bus(a, PD) = powers(a,b)*PDdefault(a,1);%Change the power > demand:multiply the p.u. value from the excel file to the default power > demand for each bus > end > > % add a line to indicate the time > > time=[char(10),'---']; > disp(time) > time=[char(10),'Time=',num2str(b-1),':00']; > disp(time) > time=[char(10),'---']; > disp(time) > > > results=runopf(mpc); %Run the optimum power flow and store the > results > > > % Create 3 variables to store the value of voltage, loss and line > % loading. > > > for a = 1:30 > voltage(a,b) = results.bus(a,VM)*mpc.bus(a,BASE_KV); % p.u voltage > multiply base_KV > end > > for a = 1:41 > loss(a,b)=results.branch(a,PF)+results.branch(a,PT); % Difference between > from power injection and To power injection > end > > for a = 1:41 > if > (sqrt(results.branch(a,PF)^2+results.branch(a,QF)^2)>=sqrt(results.branch(a,PT)^2+results.branch(a,QT)^2)) > > lineload(a,b)=sqrt(results.branch(a,PF)^2+results.branch(a,QF)^2)/mpc.branch(a,RATE_A)*100; > else > lineload(a,b)=sqrt(results.branch(a,PT)^2+results.branch(a,QT)^2)/mpc.branch(a,RATE_A)*100; > end > end > end > > % Display the graph in the followings > > surface(voltage); > title('Voltage Magnitude at each bus') > xlabel('Hour') % x-axis label > ylabel('Bus') % y-axis label > zlabel('Voltage(kV)') % z-axis label > figure(); > mesh(lineload); > title('Percent line loading for each branch') > xlabel('Hour') % x-axis label > ylabel('Branch') % y-axis label > zlabel('Percent Line Loading') % z-axis label > >
