MATPOWER / most

MOST – MATPOWER Optimal Scheduling Tool, for steady-state power systems scheduling problems.
https://matpower.org/
Other
31 stars 11 forks source link

Branch replacement in multiperiod OPF using MOST #36

Closed nick9898nick closed 2 months ago

nick9898nick commented 9 months ago

Hi everyone! I’m carrying out a project where I try to use MOST to solve an Optimal Power Flow problem in the multiperiod (nt=18). My goal is to add a new line after n-periods (so that I can consider the construction time of this new line): after a few days, I managed to do this by performing an OPF separately on each single period, and after n-periods the new branch is inserted. However, I was wondering if it was possible to use MOST to integrate a new line by running an OPF entirely on the multiperiod and add, in the meantime, a new branch inside that miltiperiod.

if(first_year_with_overload > 0)
                    fprintf("\nIl primo anno in cui la linea ",overload_line," è in sovracarico è %d",first_year_with_overload);
                    j = 1;
                    while(j <= nt)
                        fprintf("\n RESULT OUTPUT4 ANNO "+j);
                        %Se j >= first_year_with_overload + make_new_branch
                        if(j >= first_year_with_overload + make_new_branch) % 9,10,11..
                                mpc_case2 = mdo.flow(j,1).mpc; %RESET AL VALORE MPC ORIGINALE
                                nodo_inizio = mdo.flow(j,1).mpc.branch(overload_line,1); % Rilevo i nodi di riferimento (inizio e fine) ai quali stanziare la linea nuova con add_branch
                                nodo_fine = mdo.flow(j,1).mpc.branch(overload_line,2);
                                %% branch data = INSERIMENTO DEI NUOVI PARAMETRI DELLA LINEA (resistance (col.3), reactance (col.4)). N.B. I parametri di Ampacity rimangono invariati e vengono importanti gli stessi nella 'mpc' originale (o 'mdo')
                                %   fbus    tbus    r   x   b   rateA   rateB   rateC   ratio   angle   status  angmin  angmax
                                nuovo_branch =[
                                    nodo_inizio nodo_fine   0.01    0.04    0   ampacity_MW    ampacity_MW    ampacity_MW   0   0   0   -360    360;
                                    ];
                                %imposto BR_STATUS delle linee aggiunte = 1
                                nuovo_branch(1,BR_STATUS) = 1;  % BR_STATUS = 1 LINEA ATTIVA a partire dall'anno ultimo di costruzione ('make_new_branch')
                                % nuovo_branch(1,RATE_A) = mpc_case2.branch(10,RATE_A); L'HO IMPOSTATO SOPRA
                                [mpc_case2, ibrch] = addbrch2mpc(mpc_case2, nuovo_branch);  % aggiungiamo il nuovo ramo al caso studio
                                mdi2{j,1} = loadmd(mpc_case2);
                                mdo2{j,1} = most(mdi2{j,1},mpopt);          % risoluzione periodo per periodo
                                % mdi2 = loadmd(mpc_case2, nt, xgd, [], [], profiles);
                                % mdo2 = most(mdi2, mpopt);
                        else
                            %anni 1,2,3
                            rete_anno = mdo.flow(j,1).mpc;      % input rete dell'anno corrente (prima di ultimare la costruzione della linea)
                            % rete_anno.branch(overload_line,BR_STATUS) = 0;  %imposto BR_STATUS della linea su cui è presente l'overload a 0 se voglio spegnere la linea durante la costruzione di quella nuova ('out of service' finchè non viene costruita la nuova linea, tempo di costruzione m'ake_new_branch')
                            % reti{j,4} = runopf(rete_anno,mpopt);      % risoluzione con Matpower

                            mdi2{j,1} = loadmd(rete_anno);
                            mdo2{j,1} = most(mdi2{j,1},mpopt);  % N.B. La struttura della 'mdo2' è diversa da quella generata comunemente da MOST ('mdo')
                        end
                        j = j +1; %continuo a ciclare
                    end;
                else
rdzman commented 9 months ago

The easiest way to do this would be to include the new line in your case and then use a profile (like the load and wind profile examples) to control the in/out-of-service status of that line in each period of your optimization.

Note: This would be a pre-specified in/out-of-service schedule, not an optimization of when to bring the line into service. If that is what you are looking for, and it is a single line, you could simply run the optimization iteratively through all possible in-service times and then select the one that results in the smallest objective function value.