
%% AC RUNUOPF
clear all
close all
 define_constants;
mpc = loadcase('my_case');
mpopt = mpoption('verbose', 1, 'out.bus', 0, 'out.branch', 0, 'out.sys_sum', 0);
%mpopt = mpoption('verbose', 1);
mpc = toggle_softlims(mpc, 'on');
PD_JAN=5;
PW_JAN=0;
            mpc.gen(1 , GEN_STATUS)=1;
            mpc.gen(2 , GEN_STATUS)=0;
            mpc.gen(3 , GEN_STATUS)=0;
            mpc.gen(4 , GEN_STATUS)=0;
            mpc.gen(5 , GEN_STATUS)=0;
            mpc.gen(6 , GEN_STATUS)=0;       
            
        % mpc.bus(: , PD) for each bus   
        mpc.bus(2 , PD) = 0.28*PD_JAN;
        mpc.bus(3 , PD) = 0.14*PD_JAN;
        mpc.bus(4 , PD) = 0.32*PD_JAN;
        mpc.bus(5 , PD) = 0.21*PD_JAN;
        mpc.bus(6 , PD) = (0.05*PD_JAN)-PW_JAN;
        % COSö=0.97 ö=14 tan14
        tan14=0.24932800284318069162403993780486;
        
        % mpc.bus(: . QD) for each bus 
        mpc.bus(2 , QD) = 0.28*PD_JAN*tan14;
        mpc.bus(3 , QD) = 0.14*PD_JAN*tan14;
        mpc.bus(4 , QD) = 0.32*PD_JAN*tan14;
        mpc.bus(5 , QD) = 0.21*PD_JAN*tan14;
        mpc.bus(6 , QD) = ((0.05*PD_JAN))*tan14;            
            
            
%mpc = toggle_softlims(mpc, 'on');
ropf = runopf(mpc, mpopt)
%ruopf = runuopf(mpc, mpopt)

