## Setting up an optimization in matlab

Hi everyone.

I have an optimization problem that seeks to aid the selection of suitable conductors in a network planning exercise. I have set up two functions – one of the functions sets up the objective function which is to calculate the total cost based on the type of conductor and the cost associated with the type of conductor. The total cost is thus calculated based on the code below.

function TotCost = minTotCost(RepCondpath,fdrpath1,sheetname)

%fdrpath1: describes the path to the an excel file with the conductors on

%the network while RepCondpath described the path to the costs associated

%with each type of conductor.

[TR,TAmp, C_index]=rep_repository_cr_opt(RepCondpath);

[R,Amp]=getInitialCon_par(fdrpath1,sheetname);

% examine the Resistance of the conductor

% check the TR to find out the value of the

C_weights=C_index;

cost =zeros(length(R),1);

for i =1:length (R)

disp(i);

j= TR == R(i);

cost(i) = C_weights(j);

end

TotCost= sum(cost);

The second thing is to describe the constraints function. In this case, the two constraints are voltage levels (NPI) and conductor loading (CPI). These two are calculated based on the a powerflow function- which calculate the network’s NPI and CPI using the following constraint function.

function[NPI,CPI]=ConstraintFnc(fdrpath1,sheetname)

fname1 = fdrpath1;sheet = sheetname;

fdrcon=get_fdrcon(fdrpath1,sheetname);

[VA,VB,VC,~,IA,IB,IC]= start_f7(1,1,1,1,sheetname,fdrpath1); % This is the powerflow function

ResRange1 = "G6:G12"; AmpRange="AG6:AG12";

R=xlsread(fname1,sheet,ResRange1);

Amp=xlsread(fname1,sheet,AmpRange);

[CPI,NPI]= BNPerf_opt(VA, VB, VC, IA, IB, IC); % This is the function that calculates the CPI and NPI

The objective is to find conductors in TR whose combination has the least total cost. How do I bring these two functions together to run on Matlab.Hi everyone.

I have an optimization problem that seeks to aid the selection of suitable conductors in a network planning exercise. I have set up two functions – one of the functions sets up the objective function which is to calculate the total cost based on the type of conductor and the cost associated with the type of conductor. The total cost is thus calculated based on the code below.

function TotCost = minTotCost(RepCondpath,fdrpath1,sheetname)

%fdrpath1: describes the path to the an excel file with the conductors on

%the network while RepCondpath described the path to the costs associated

%with each type of conductor.

[TR,TAmp, C_index]=rep_repository_cr_opt(RepCondpath);

[R,Amp]=getInitialCon_par(fdrpath1,sheetname);

% examine the Resistance of the conductor

% check the TR to find out the value of the

C_weights=C_index;

cost =zeros(length(R),1);

for i =1:length (R)

disp(i);

j= TR == R(i);

cost(i) = C_weights(j);

end

TotCost= sum(cost);

The second thing is to describe the constraints function. In this case, the two constraints are voltage levels (NPI) and conductor loading (CPI). These two are calculated based on the a powerflow function- which calculate the network’s NPI and CPI using the following constraint function.

function[NPI,CPI]=ConstraintFnc(fdrpath1,sheetname)

fname1 = fdrpath1;sheet = sheetname;

fdrcon=get_fdrcon(fdrpath1,sheetname);

[VA,VB,VC,~,IA,IB,IC]= start_f7(1,1,1,1,sheetname,fdrpath1); % This is the powerflow function

ResRange1 = "G6:G12"; AmpRange="AG6:AG12";

R=xlsread(fname1,sheet,ResRange1);

Amp=xlsread(fname1,sheet,AmpRange);

[CPI,NPI]= BNPerf_opt(VA, VB, VC, IA, IB, IC); % This is the function that calculates the CPI and NPI

The objective is to find conductors in TR whose combination has the least total cost. How do I bring these two functions together to run on Matlab. Hi everyone.

I have an optimization problem that seeks to aid the selection of suitable conductors in a network planning exercise. I have set up two functions – one of the functions sets up the objective function which is to calculate the total cost based on the type of conductor and the cost associated with the type of conductor. The total cost is thus calculated based on the code below.

function TotCost = minTotCost(RepCondpath,fdrpath1,sheetname)

%fdrpath1: describes the path to the an excel file with the conductors on

%the network while RepCondpath described the path to the costs associated

%with each type of conductor.

[TR,TAmp, C_index]=rep_repository_cr_opt(RepCondpath);

[R,Amp]=getInitialCon_par(fdrpath1,sheetname);

% examine the Resistance of the conductor

% check the TR to find out the value of the

C_weights=C_index;

cost =zeros(length(R),1);

for i =1:length (R)

disp(i);

j= TR == R(i);

cost(i) = C_weights(j);

end

TotCost= sum(cost);

The second thing is to describe the constraints function. In this case, the two constraints are voltage levels (NPI) and conductor loading (CPI). These two are calculated based on the a powerflow function- which calculate the network’s NPI and CPI using the following constraint function.

function[NPI,CPI]=ConstraintFnc(fdrpath1,sheetname)

fname1 = fdrpath1;sheet = sheetname;

fdrcon=get_fdrcon(fdrpath1,sheetname);

[VA,VB,VC,~,IA,IB,IC]= start_f7(1,1,1,1,sheetname,fdrpath1); % This is the powerflow function

ResRange1 = "G6:G12"; AmpRange="AG6:AG12";

R=xlsread(fname1,sheet,ResRange1);

Amp=xlsread(fname1,sheet,AmpRange);

[CPI,NPI]= BNPerf_opt(VA, VB, VC, IA, IB, IC); % This is the function that calculates the CPI and NPI

The objective is to find conductors in TR whose combination has the least total cost. How do I bring these two functions together to run on Matlab. ga, optimization, conductor selection MATLAB Answers — New Questions