# Error: File: frelay_old​Of_09Jun20​22_MINLP.m Line: 434 Column: 1 Illegal use of reserved keyword "end".

2 views (last 30 days)
Answered: Mathieu NOE on 23 Jun 2022
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%% OVERCURRENT RELAY COORDINATION %%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%09 JUN 2022%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% MISCOORDINATION PROBLEM %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Of]=frelay_oldOf_09Jun2022_MINLP(TSM,Ipickup)
%Ipickup=[736 540 437 237 700 200 419 270 537 450 550 220 350 358 359 117 177 100 108 211 115 326 150 315 102 399 150 154 200 100 164 100 100 112 100 100 11 249 266 100];
%Ipickup=[881 579 408 216 758 296 532 226 444 488 477 352 294 418 333 149 216 110 164 151 100 174 119 147 133 260 150 204 245 150 241 100 177 123 100 146 36 238 268 113];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% DECLARATION OF PARAMETERS %%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Calling the input data %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
inputdatahatta_30bus_62relays_singleOF_MINLP_09Jun2022;
%% This is to calculate the relays operating times for 90 primary relay for near end faults %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
K1=28.2;
K2=2;
K3=0.1217;
% K1=0.14;
% K2=0.02;
% K3=0;
tp1n=((K1/(((i_scpn(1)/Ipickup(1)).^K2)-1))+K3)*TSM(1);
tp2n=((K1/(((i_scpn(2)/Ipickup(1)).^K2)-1))+K3)*TSM(1);
tp3n=((K1/(((i_scpn(3)/Ipickup(1)).^K2)-1))+K3)*TSM(1);
tp4n=((K1/(((i_scpn(4)/Ipickup(2)).^K2)-1))+K3)*TSM(2);
tp5n=((K1/(((i_scpn(5)/Ipickup(2)).^K2)-1))+K3)*TSM(2);
tp6n=((K1/(((i_scpn(6)/Ipickup(2)).^K2)-1))+K3)*TSM(2);
tp7n=((K1/(((i_scpn(7)/Ipickup(3)).^K2)-1)+K3))*TSM(3);
tp8n=((K1/(((i_scpn(8)/Ipickup(4)).^K2)-1)+K3))*TSM(4);
tp9n=((K1/(((i_scpn(9)/Ipickup(4)).^K2)-1)+K3))*TSM(4);
tp10n=((K1/(((i_scpn(10)/Ipickup(5)).^K2)-1)+K3))*TSM(5);
tp11n=((K1/(((i_scpn(11)/Ipickup(5)).^K2)-1)+K3))*TSM(5);
tp12n=((K1/(((i_scpn(12)/Ipickup(6)).^K2)-1)+K3))*TSM(6);
tp13n=((K1/(((i_scpn(13)/Ipickup(7)).^K2)-1)+K3))*TSM(7);
tp14n=((K1/(((i_scpn(14)/Ipickup(8)).^K2)-1)+K3))*TSM(8);
tp15n=((K1/(((i_scpn(15)/Ipickup(9)).^K2)-1)+K3))*TSM(9);
tp16n=((K1/(((i_scpn(16)/Ipickup(9)).^K2)-1)+K3))*TSM(9);
tp17n=((K1/(((i_scpn(17)/Ipickup(9)).^K2)-1)+K3))*TSM(9);
tp18n=((K1/(((i_scpn(18)/Ipickup(10)).^K2)-1)+K3))*TSM(10);
tp19n=((K1/(((i_scpn(19)/Ipickup(10)).^K2)-1)+K3))*TSM(10);
tp20n=((K1/(((i_scpn(20)/Ipickup(10)).^K2)-1)+K3))*TSM(10);
tp21n=((K1/(((i_scpn(21)/Ipickup(11)).^K2)-1)+K3))*TSM(11);
tp22n=((K1/(((i_scpn(22)/Ipickup(12)).^K2)-1)+K3))*TSM(12);
tp23n=((K1/(((i_scpn(23)/Ipickup(13)).^K2)-1))+K3)*TSM(13);
tp24n=((K1/(((i_scpn(24)/Ipickup(14)).^K2)-1))+K3)*TSM(14);
tp25n=((K1/(((i_scpn(25)/Ipickup(15)).^K2)-1))+K3)*TSM(15);
tp26n=((K1/(((i_scpn(26)/Ipickup(16)).^K2)-1))+K3)*TSM(16);
tp27n=((K1/(((i_scpn(27)/Ipickup(16)).^K2)-1))+K3)*TSM(16);
tp28n=((K1/(((i_scpn(28)/Ipickup(17)).^K2)-1))+K3)*TSM(17);
tp29n=((K1/(((i_scpn(29)/Ipickup(17)).^K2)-1)+K3))*TSM(17);
tp30n=((K1/(((i_scpn(30)/Ipickup(18)).^K2)-1)+K3))*TSM(18);
tp31n=((K1/(((i_scpn(31)/Ipickup(18)).^K2)-1)+K3))*TSM(18);
tp32n=((K1/(((i_scpn(32)/Ipickup(19)).^K2)-1)+K3))*TSM(19);
tp33n=((K1/(((i_scpn(33)/Ipickup(19)).^K2)-1)+K3))*TSM(19);
tp34n=((K1/(((i_scpn(34)/Ipickup(19)).^K2)-1)+K3))*TSM(19);
tp35n=((K1/(((i_scpn(35)/Ipickup(20)).^K2)-1)+K3))*TSM(20);
tp36n=((K1/(((i_scpn(36)/Ipickup(21)).^K2)-1)+K3))*TSM(21);
tp37n=((K1/(((i_scpn(37)/Ipickup(21)).^K2)-1)+K3))*TSM(21);
tp38n=((K1/(((i_scpn(38)/Ipickup(22)).^K2)-1)+K3))*TSM(22);
tp39n=((K1/(((i_scpn(39)/Ipickup(22)).^K2)-1)+K3))*TSM(22);
tp40n=((K1/(((i_scpn(40)/Ipickup(23)).^K2)-1)+K3))*TSM(23);
tp41n=((K1/(((i_scpn(41)/Ipickup(23)).^K2)-1)+K3))*TSM(23);
tp42n=((K1/(((i_scpn(42)/Ipickup(24)).^K2)-1)+K3))*TSM(24);
tp43n=((K1/(((i_scpn(43)/Ipickup(26)).^K2)-1)+K3))*TSM(26);
tp44n=((K1/(((i_scpn(44)/Ipickup(27)).^K2)-1)+K3))*TSM(27);
tp45n=((K1/(((i_scpn(45)/Ipickup(28)).^K2)-1)+K3))*TSM(28);
tp46n=((K1/(((i_scpn(46)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
tp47n=((K1/(((i_scpn(47)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
tp48n=((K1/(((i_scpn(48)/Ipickup(31)).^K2)-1)+K3))*TSM(31);
tp49n=((K1/(((i_scpn(49)/Ipickup(32)).^K2)-1)+K3))*TSM(32);
tp50n=((K1/(((i_scpn(50)/Ipickup(33)).^K2)-1)+K3))*TSM(33);
tp51n=((K1/(((i_scpn(51)/Ipickup(33)).^K2)-1)+K3))*TSM(33);
tp52n=((K1/(((i_scpn(52)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
tp53n=((K1/(((i_scpn(53)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
tp54n=((K1/(((i_scpn(54)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
tp55n=((K1/(((i_scpn(55)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
tp56n=((K1/(((i_scpn(56)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
tp57n=((K1/(((i_scpn(57)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
tp58n=((K1/(((i_scpn(58)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
tp59n=((K1/(((i_scpn(59)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
tp60n=((K1/(((i_scpn(60)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
tp61n=((K1/(((i_scpn(61)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
tp62n=((K1/(((i_scpn(62)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
% tp63n=((K1/(((i_scpn(63)/Ipickup(26)).^K2)-1)+K3))*TSM(26);
% tp64n=((K1/(((i_scpn(64)/Ipickup(26)).^K2)-1)+K3))*TSM(26);
% tp65n=((K1/(((i_scpn(65)/Ipickup(27)).^K2)-1)+K3))*TSM(27);
% tp66n=((K1/(((i_scpn(66)/Ipickup(27)).^K2)-1)+K3))*TSM(27);
% tp67n=((K1/(((i_scpn(67)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
% tp68n=((K1/(((i_scpn(68)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
% tp69n=((K1/(((i_scpn(69)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
% tp70n=((K1/(((i_scpn(70)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
% tp71n=((K1/(((i_scpn(71)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
% tp72n=((K1/(((i_scpn(72)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
% tp73n=((K1/(((i_scpn(73)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
% tp74n=((K1/(((i_scpn(74)/Ipickup(31)).^K2)-1)+K3))*TSM(31);
% tp75n=((K1/(((i_scpn(75)/Ipickup(31)).^K2)-1)+K3))*TSM(31);
% tp76n=((K1/(((i_scpn(76)/Ipickup(31)).^K2)-1)+K3))*TSM(31);
% tp77n=((K1/(((i_scpn(77)/Ipickup(32)).^K2)-1)+K3))*TSM(32);
% tp78n=((K1/(((i_scpn(78)/Ipickup(33)).^K2)-1)+K3))*TSM(33);
% tp79n=((K1/(((i_scpn(79)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
% tp80n=((K1/(((i_scpn(80)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
% tp81n=((K1/(((i_scpn(81)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
% tp82n=((K1/(((i_scpn(82)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
% tp83n=((K1/(((i_scpn(83)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
% tp84n=((K1/(((i_scpn(84)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
% tp85n=((K1/(((i_scpn(85)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
% tp86n=((K1/(((i_scpn(86)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
% tp87n=((K1/(((i_scpn(87)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
% tp88n=((K1/(((i_scpn(88)/Ipickup(39)).^K2)-1)+K3))*TSM(39);
% tp89n=((K1/(((i_scpn(89)/Ipickup(39)).^K2)-1)+K3))*TSM(39);
% tp90n=((K1/(((i_scpn(90)/Ipickup(39)).^K2)-1)+K3))*TSM(39);
% tp91n=((K1/(((i_scpn(91)/Ipickup(40)).^K2)-1)+K3))*TSM(40);
% tp92n=((K1/(((i_scpn(92)/Ipickup(40)).^K2)-1)+K3))*TSM(40);
out_tpn=[tp1n tp2n tp3n tp4n tp5n tp6n tp7n tp8n tp9n tp10n tp11n tp12n tp13n tp14n tp15n tp16n tp17n tp18n tp19n tp20n tp21n tp22n tp23n tp24n tp25n tp26n tp27n tp28n tp29n tp30n tp31n tp32n tp33n tp34n tp35n tp36n tp37n tp38n tp39n tp40n tp41n tp42n tp43n tp44n tp45n tp46n tp47n tp48n tp49n tp50n tp51n tp52n tp53n tp54n tp55n tp56n tp57n tp58n tp59n tp60n tp61n tp62n]';
%tp63n tp64n tp65n tp66n tp67n tp68n tp69n tp70n tp71n tp72n tp73n tp74n tp75n tp76n tp77n tp78n tp79n tp80n tp81n tp82n tp83n tp84n tp85n tp86n tp87n tp88n tp89n tp90n tp91n tp92n]';
% pause(1)
%% This is to calculate the relays operating times for 90 backup relay for near end faults %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tb1n=((K1/(((i_scbn(1)/Ipickup(1)).^K2)-1)+K3))*TSM(1);
tb2n=((K1/(((i_scbn(2)/Ipickup(2)).^K2)-1)+K3))*TSM(2);
tb3n=((K1/(((i_scbn(3)/Ipickup(2)).^K2)-1)+K3))*TSM(2);
tb4n=((K1/(((i_scbn(4)/Ipickup(3)).^K2)-1)+K3))*TSM(3);
tb5n=((K1/(((i_scbn(5)/Ipickup(3)).^K2)-1)+K3))*TSM(3);
tb6n=((K1/(((i_scbn(6)/Ipickup(4)).^K2)-1)+K3))*TSM(4);
tb7n=((K1/(((i_scbn(7)/Ipickup(4)).^K2)-1)+K3))*TSM(4);
tb8n=((K1/(((i_scbn(8)/Ipickup(5)).^K2)-1)+K3))*TSM(5);
tb9n=((K1/(((i_scbn(9)/Ipickup(6)).^K2)-1)+K3))*TSM(6);
tb10n=((K1/(((i_scbn(10)/Ipickup(6)).^K2)-1)+K3))*TSM(6);
tb11n=((K1/(((i_scbn(11)/Ipickup(7)).^K2)-1)+K3))*TSM(7);
tb12n=((K1/(((i_scbn(12)/Ipickup(8)).^K2)-1)+K3))*TSM(8);
tb13n=((K1/(((i_scbn(13)/Ipickup(9)).^K2)-1)+K3))*TSM(9);
tb14n=((K1/(((i_scbn(14)/Ipickup(10)).^K2)-1)+K3))*TSM(10);
tb15n=((K1/(((i_scbn(15)/Ipickup(11)).^K2)-1)+K3))*TSM(11);
tb16n=((K1/(((i_scbn(16)/Ipickup(12)).^K2)-1)+K3))*TSM(12);
tb17n=((K1/(((i_scbn(17)/Ipickup(13)).^K2)-1)+K3))*TSM(13);
tb18n=((K1/(((i_scbn(18)/Ipickup(14)).^K2)-1)+K3))*TSM(14);
tb19n=((K1/(((i_scbn(19)/Ipickup(14)).^K2)-1)+K3))*TSM(14);
tb20n=((K1/(((i_scbn(20)/Ipickup(15)).^K2)-1)+K3))*TSM(15);
tb21n=((K1/(((i_scbn(21)/Ipickup(15)).^K2)-1)+K3))*TSM(15);
tb22n=((K1/(((i_scbn(22)/Ipickup(15)).^K2)-1)+K3))*TSM(15);
tb23n=((K1/(((i_scbn(23)/Ipickup(16)).^K2)-1)+K3))*TSM(16);
tb24n=((K1/(((i_scbn(24)/Ipickup(16)).^K2)-1)+K3))*TSM(16);
tb25n=((K1/(((i_scbn(25)/Ipickup(16)).^K2)-1)+K3))*TSM(16);
tb26n=((K1/(((i_scbn(26)/Ipickup(17)).^K2)-1)+K3))*TSM(17);
tb27n=((K1/(((i_scbn(27)/Ipickup(17)).^K2)-1)+K3))*TSM(17);
tb28n=((K1/(((i_scbn(28)/Ipickup(17)).^K2)-1)+K3))*TSM(17);
tb29n=((K1/(((i_scbn(29)/Ipickup(18)).^K2)-1)+K3))*TSM(18);
tb30n=((K1/(((i_scbn(30)/Ipickup(19)).^K2)-1)+K3))*TSM(19);
tb31n=((K1/(((i_scbn(31)/Ipickup(20)).^K2)-1)+K3))*TSM(20);
tb32n=((K1/(((i_scbn(32)/Ipickup(20)).^K2)-1)+K3))*TSM(20);
tb33n=((K1/(((i_scbn(33)/Ipickup(20)).^K2)-1)+K3))*TSM(20);
tb34n=((K1/(((i_scbn(34)/Ipickup(21)).^K2)-1)+K3))*TSM(21);
tb35n=((K1/(((i_scbn(35)/Ipickup(21)).^K2)-1)+K3))*TSM(21);
tb36n=((K1/(((i_scbn(36)/Ipickup(21)).^K2)-1)+K3))*TSM(21);
tb37n=((K1/(((i_scbn(37)/Ipickup(22)).^K2)-1)+K3))*TSM(22);
tb38n=((K1/(((i_scbn(38)/Ipickup(23)).^K2)-1)+K3))*TSM(23);
tb39n=((K1/(((i_scbn(39)/Ipickup(23)).^K2)-1)+K3))*TSM(23);
tb40n=((K1/(((i_scbn(40)/Ipickup(24)).^K2)-1)+K3))*TSM(24);
tb41n=((K1/(((i_scbn(41)/Ipickup(24)).^K2)-1)+K3))*TSM(24);
tb42n=((K1/(((i_scbn(42)/Ipickup(25)).^K2)-1)+K3))*TSM(25);
tb43n=((K1/(((i_scbn(43)/Ipickup(28)).^K2)-1)+K3))*TSM(28);
tb44n=((K1/(((i_scbn(44)/Ipickup(28)).^K2)-1)+K3))*TSM(28);
tb45n=((K1/(((i_scbn(45)/Ipickup(28)).^K2)-1)+K3))*TSM(28);
tb46n=((K1/(((i_scbn(46)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
tb47n=((K1/(((i_scbn(47)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
tb48n=((K1/(((i_scbn(48)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
tb49n=((K1/(((i_scbn(49)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
tb50n=((K1/(((i_scbn(50)/Ipickup(31)).^K2)-1)+K3))*TSM(31);
tb51n=((K1/(((i_scbn(51)/Ipickup(32)).^K2)-1)+K3))*TSM(32);
tb52n=((K1/(((i_scbn(52)/Ipickup(33)).^K2)-1)+K3))*TSM(33);
tb53n=((K1/(((i_scbn(53)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
tb54n=((K1/(((i_scbn(54)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
tb55n=((K1/(((i_scbn(55)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
tb56n=((K1/(((i_scbn(56)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
tb57n=((K1/(((i_scbn(57)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
tb58n=((K1/(((i_scbn(58)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
tb59n=((K1/(((i_scbn(59)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
tb60n=((K1/(((i_scbn(60)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
tb61n=((K1/(((i_scbn(61)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
tb62n=((K1/(((i_scbn(62)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
%tb63n=((K1/(((i_scbn(63)/Ipickup(26)).^K2)-1)+K3))*TSM(26);
%tb64n=((K1/(((i_scbn(64)/Ipickup(26)).^K2)-1)+K3))*TSM(26);
%tb65n=((K1/(((i_scbn(65)/Ipickup(28)).^K2)-1)+K3))*TSM(28);
%tb66n=((K1/(((i_scbn(66)/Ipickup(28)).^K2)-1)+K3))*TSM(28);
%tb67n=((K1/(((i_scbn(67)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
%tb68n=((K1/(((i_scbn(68)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
%tb69n=((K1/(((i_scbn(69)/Ipickup(29)).^K2)-1)+K3))*TSM(29);
%tb70n=((K1/(((i_scbn(70)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
%tb71n=((K1/(((i_scbn(71)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
%tb72n=((K1/(((i_scbn(72)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
%tb73n=((K1/(((i_scbn(73)/Ipickup(30)).^K2)-1)+K3))*TSM(30);
%tb74n=((K1/(((i_scbn(74)/Ipickup(31)).^K2)-1)+K3))*TSM(31);
%tb75n=((K1/(((i_scbn(75)/Ipickup(32)).^K2)-1)+K3))*TSM(32);
%tb76n=((K1/(((i_scbn(76)/Ipickup(32)).^K2)-1)+K3))*TSM(32);
%tb77n=((K1/(((i_scbn(77)/Ipickup(32)).^K2)-1)+K3))*TSM(32);
%tb78n=((K1/(((i_scbn(78)/Ipickup(33)).^K2)-1)+K3))*TSM(33);
%tb79n=((K1/(((i_scbn(79)/Ipickup(33)).^K2)-1)+K3))*TSM(33);
%tb80n=((K1/(((i_scbn(80)/Ipickup(34)).^K2)-1)+K3))*TSM(34);
%tb81n=((K1/(((i_scbn(81)/Ipickup(35)).^K2)-1)+K3))*TSM(35);
%tb82n=((K1/(((i_scbn(82)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
%tb83n=((K1/(((i_scbn(83)/Ipickup(36)).^K2)-1)+K3))*TSM(36);
%tb84n=((K1/(((i_scbn(84)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
%tb85n=((K1/(((i_scbn(85)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
%tb86n=((K1/(((i_scbn(86)/Ipickup(37)).^K2)-1)+K3))*TSM(37);
%tb87n=((K1/(((i_scbn(87)/Ipickup(38)).^K2)-1)+K3))*TSM(38);
%tb88n=((K1/(((i_scbn(88)/Ipickup(39)).^K2)-1)+K3))*TSM(39);
%tb89n=((K1/(((i_scbn(89)/Ipickup(39)).^K2)-1)+K3))*TSM(39);
%tb90n=((K1/(((i_scbn(90)/Ipickup(40)).^K2)-1)+K3))*TSM(40);
%tb91n=((K1/(((i_scbn(91)/Ipickup(40)).^K2)-1)+K3))*TSM(40);
%tb92n=((K1/(((i_scbn(92)/Ipickup(40)).^K2)-1)+K3))*TSM(40);
out_tbn=[tb1n tb2n tb3n tb4n tb5n tb6n tb7n tb8n tb9n tb10n tb11n tb12n tb13n tb14n tb15n tb16n tb17n tb18n tb19n tb20n tb21n tb22n tb23n tb24n tb25n tb26n tb27n tb28n tb29n tb30n tb31n tb32n tb33n tb34n tb35n tb36n tb37n tb38n tb39n tb40n tb41n tb42n tb43n tb44n tb45n tb46n tb47n tb48n tb49n tb50n tb51n tb52n tb53n tb54n tb55n tb56n tb57n tb58n tb59n tb60n tb61n tb62n
%tb63n tb64n tb65n tb66n tb67n tb68n tb69n tb70n tb71n tb72n tb73n tb74n tb75n tb76n tb77n tb78n tb79n tb80n tb81n tb82n tb83n tb84n tb85n tb86n tb87n tb88n tb89n tb90n tb91n tb92n]';
% pause(1)
%% This is to calculate the relay operating time for a fault close to the Circuit Breaker (CB) of primary relay %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
t1n==tp1n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t2n==tp4n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t3n==tp7n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t4n==tp8n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t5n==tp11n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t6n==tp12n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t7n==tp15n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t8n==tp18n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t9n==tp22n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t10n==tp25n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t11n==tp29n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t12n==tp32n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t13n==tp33n;% ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t14n==tp34n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t15n==tp38n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t16n==tp41n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t17n==tp43n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t18n==tp47n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t19n==tp48n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t20n==tp49n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t21n==tp50n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t22n==tp51n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t23n==tp54n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t24n==tp57n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t25n==tp59n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t26n==tp61n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t27n==tp65n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t29n==tp67n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t30n==tp71n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t31n==tp74n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t32n==tp77n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t33n==tp78n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t34n==tp79n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t35n==tp81n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t36n==tp83n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t37n==tp84n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t38n==tp85n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t39n==tp88n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
t40n==tp91n; % ith Relay Operating time for a fault close to the Circuit Breaker of the ith relay
out_ROTn==[t1n t2n t3n t4n t5n t6n t7n t8n t9n t10n t11n t12n t13n t14n t15n t16n t17n t18n t19n t20n t21n t22n t23n t24n t25n t26n t27n t29n t30n t31n t32n t33n t34n t35n t36n t37n t38n t39n t40n]'
% pause(1)
%% This is to calculate total operating time of primary relays %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ROTprimarynear==[t1n+t2n+t3n+t4n+t5n+t6n+t7n+t8n+t9n+t10n+t11n+t12n+t13n+t14n+t15n+t16n+t17n+t18n+t19n+t20n+t21n+t22n+t23n+t24n+t25n+t26n+t27n+t29n+t30n+t31n+t32n+t33n+t34n+t35n+t36n+t37n+t38n+t39n+t40n]
% pause(1)
%% This is to calculate total time multiplier setting %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Totaltsm==[TSM(1)+TSM(2)+TSM(3)+TSM(4)+TSM(5)+TSM(6)+TSM(7)+TSM(8)+TSM(9)+TSM(10)+TSM(11)+TSM(12)+TSM(13)+TSM(14)+TSM(15)+TSM(16)+TSM(17)+TSM(18)+TSM(19)+TSM(20)+TSM(21)+TSM(22)+TSM(23)+TSM(24)+TSM(25)+TSM(26)+TSM(27)+TSM(28)+TSM(29)+TSM(30)+TSM(31)+TSM(32)+TSM(33)+TSM(34)+TSM(35)+TSM(36)+TSM(37)+TSM(38)+TSM(39)+TSM(40)]
% %% This is to calculate the operation time difference for each relays pair %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% %Constant is based on Coordination Time Interval (CTI) microprocessor relay
% const=0.2; % depends on accuracies of the relay curves, current transformers overshoot and speed of the primary relay Circuit Breaker (CB)
%
% delta_tpb1n=tb14n-tp1n-const;
% delta_tpb2n=tb4n-tp11n-const;
% delta_tpb3n=tb10n-tp2n-const;
% delta_tpb4n=tb32n-tp3n-const;
% delta_tpb5n=tb21n-tp4n-const;
% delta_tpb6n=tb9n-tp5n-const;
% delta_tpb7n=tb31n-tp6n-const;
% delta_tpb8n=tb19n-tp7n-const;
% delta_tpb9n=tb9n-tp29n-const;
% delta_tpb10n=tb1n-tp30n-const;
% delta_tpb11n=tb20n-tp31n-const;
% delta_tpb12n=tb2n-tp15n-const;
% delta_tpb13n=tb8n-tp16n-const;
% delta_tpb14n=tb30n-tp17n-const;
% delta_tpb15n=tb29n-tp33n-const;
% delta_tpb16n=tb37n-tp32n-const;
% delta_tpb17n=tb23n-tp61n-const;
% delta_tpb18n=tb34n-tp62n-const;
% delta_tpb19n=tb16n-tp63n-const;
% delta_tpb20n=tb69n-tp64n-const;
% delta_tpb21n=tb36n-tp25n-const;
% delta_tpb22n=tb18n-tp26n-const;
% delta_tpb23n=tb61n-tp27n-const;
% delta_tpb24n=tb72n-tp28n-const;
% delta_tpb25n=tb24n-tp34n-const;
% delta_tpb26n=tb16n-tp35n-const;
% delta_tpb27n=tb59n-tp36n-const;
% delta_tpb28n=tb70n-tp37n-const;
% delta_tpb29n=tb25n-tp18n-const;
% delta_tpb30n=tb60n-tp19n-const;
% delta_tpb31n=tb35n-tp20n-const;
% delta_tpb32n=tb71n-tp21n-const;
% delta_tpb33n=tb15n-tp67n-const;
% delta_tpb34n=tb22n-tp68n-const;
% delta_tpb35n=tb33n-tp69n-const;
% delta_tpb36n=tb56n-tp70n-const;
% delta_tpb37n=tb5n-tp12n-const;
% delta_tpb38n=tb27n-tp13n-const;
% delta_tpb39n=tb41n-tp14n-const;
% delta_tpb40n=tb12n-tp8n-const;
% delta_tpb41n=tb42n-tp9n-const;
% delta_tpb42n=tb28n-tp10n-const;
% delta_tpb43n=tb11n-tp38n-const;
% delta_tpb44n=tb6n-tp39n-const;
% delta_tpb45n=tb26n-tp40n-const;
% delta_tpb46n=tb13n-tp22n-const;
% delta_tpb47n=tb7n-tp23n-const;
% delta_tpb48n=tb44n-tp24n-const;
% delta_tpb49n=tb91n-tp41n-const;
% delta_tpb50n=tb46n-tp42n-const;
% delta_tpb51n=tb84n-tp43n-const;
% delta_tpb52n=tb38n-tp44n-const;
% delta_tpb53n=tb85n-tp45n-const;
% delta_tpb54n=tb90n-tp46n-const;
% delta_tpb55n=tb39n-tp88n-const;
% delta_tpb56n=tb47n-tp89n-const;
% delta_tpb57n=tb83n-tp90n-const;
% delta_tpb58n=tb39n-tp85n-const;
% delta_tpb59n=tb89n-tp86n-const;
% delta_tpb60n=tb45n-tp87n-const;
% delta_tpb61n=tb48n-tp50n-const;
% delta_tpb62n=tb53n-tp49n-const;
% delta_tpb63n=tb44n-tp48n-const;
% delta_tpb64n=tb49n-tp47n-const;
% delta_tpb65n=tb67n-tp51n-const;
% delta_tpb66n=tb59n-tp52n-const;
% delta_tpb67n=tb75n-tp53n-const;
% delta_tpb68n=tb52n-tp54n-const;
% delta_tpb69n=tb68n-tp55n-const;
% delta_tpb70n=tb76n-tp56n-const;
% delta_tpb71n=tb52n-tp71n-const;
% delta_tpb72n=tb56n-tp72n-const;
% delta_tpb73n=tb74n-tp73n-const;
% delta_tpb74n=tb51n-tp74n-const;
% delta_tpb75n=tb57n-tp75n-const;
% delta_tpb76n=tb66n-tp76n-const;
% delta_tpb77n=tb63n-tp65n-const;
% delta_tpb78n=tb55n-tp66n-const;
% delta_tpb79n=tb64n-tp59n-const;
% delta_tpb80n=tb54n-tp60n-const;
% delta_tpb81n=tb63n-tp57n-const;
% delta_tpb82n=tb65n-tp58n-const;
% delta_tpb83n=tb80n-tp84n-const;
% delta_tpb84n=tb86n-tp83n-const;
% delta_tpb85n=tb77n-tp81n-const;
% delta_tpb86n=tb87n-tp82n-const;
% delta_tpb87n=tb81n-tp79n-const;
% delta_tpb88n=tb88n-tp80n-const;
% delta_tpb89n=tb78n-tp91n-const;
% delta_tpb90n=tb82n-tp92n-const;
% delta_tpb91n=tb79n-tp77n-const;
% delta_tpb92n=tb73n-tp78n-const;
%
% out_delta_tpbn=[delta_tpb1n delta_tpb2n delta_tpb3n delta_tpb4n delta_tpb5n delta_tpb6n delta_tpb7n delta_tpb8n delta_tpb9n delta_tpb10n delta_tpb11n delta_tpb12n delta_tpb13n delta_tpb14n delta_tpb15n delta_tpb16n delta_tpb17n delta_tpb18n delta_tpb19n delta_tpb20n delta_tpb21n delta_tpb22n delta_tpb23n delta_tpb24n delta_tpb25n delta_tpb26n delta_tpb27n delta_tpb28n delta_tpb29n delta_tpb30n delta_tpb31n delta_tpb32n delta_tpb33n delta_tpb34n delta_tpb35n delta_tpb36n delta_tpb37n delta_tpb38n delta_tpb39n delta_tpb40n delta_tpb41n delta_tpb42n delta_tpb43n delta_tpb44n delta_tpb45n delta_tpb46n delta_tpb47n delta_tpb48n delta_tpb49n delta_tpb50n delta_tpb51n delta_tpb52n delta_tpb53n delta_tpb54n delta_tpb55n delta_tpb56n delta_tpb57n delta_tpb58n delta_tpb59n delta_tpb60n delta_tpb61n delta_tpb62n delta_tpb63n delta_tpb64n delta_tpb65n delta_tpb66n delta_tpb67n delta_tpb68n delta_tpb69n delta_tpb70n delta_tpb71n delta_tpb72n delta_tpb73n delta_tpb74n delta_tpb75n delta_tpb76n delta_tpb77n delta_tpb78n delta_tpb79n delta_tpb80n delta_tpb81n delta_tpb82n delta_tpb83n delta_tpb84n delta_tpb85n delta_tpb86n delta_tpb87n delta_tpb88n delta_tpb89n delta_tpb90n delta_tpb91n delta_tpb92n]'
% % pause(1)
% %% This is to calculate total coordination time %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Totaldelta_tpbn=[delta_tpb1n+delta_tpb2n+delta_tpb3n+delta_tpb4n+delta_tpb5n+delta_tpb6n+delta_tpb7n+delta_tpb8n+delta_tpb9n+delta_tpb10n+delta_tpb11n+delta_tpb12n+delta_tpb13n+delta_tpb14n+delta_tpb15n+delta_tpb16n+delta_tpb17n+delta_tpb18n+delta_tpb19n+delta_tpb20n ...
% delta_tpb21n+delta_tpb22n+delta_tpb23n+delta_tpb24n+delta_tpb25n+delta_tpb26n+delta_tpb27n+delta_tpb28n+delta_tpb29n+delta_tpb30n+delta_tpb31n+delta_tpb32n+delta_tpb33n+delta_tpb34n+delta_tpb35n+delta_tpb36n+delta_tpb37n+delta_tpb38n+delta_tpb39n+delta_tpb40n ...
% delta_tpb41n+delta_tpb42n+delta_tpb43n+delta_tpb44n+delta_tpb45n+delta_tpb46n+delta_tpb47n+delta_tpb48n+delta_tpb49n+delta_tpb50n+delta_tpb51n+delta_tpb52n+delta_tpb53n+delta_tpb54n+delta_tpb55n+delta_tpb56n+delta_tpb57n+delta_tpb58n+delta_tpb59n+delta_tpb60n ...
% delta_tpb61n+delta_tpb62n+delta_tpb63n+delta_tpb64n+delta_tpb65n+delta_tpb66n+delta_tpb67n+delta_tpb68n+delta_tpb69n+delta_tpb70n+delta_tpb71n+delta_tpb72n+delta_tpb73n+delta_tpb74n+delta_tpb75n+delta_tpb76n+delta_tpb77n+delta_tpb78n+delta_tpb79n+delta_tpb80n ...
% delta_tpb81n+delta_tpb82n+delta_tpb83n+delta_tpb84n+delta_tpb85n+delta_tpb86n+delta_tpb87n+delta_tpb88n+delta_tpb89n+delta_tpb90n+delta_tpb91n+delta_tpb92n];
% % pause(1)
%% This is to calculate fitness function %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%alpha1=1; alpha2=1; beta2=100; M=2; N=2;
% of=alpha1.*((t1n)^M+(t2n)^M+(t3n)^M+(t4n)^M+(t5n)^M+(t6n)^M+(t7n)^M+(t8n)^M+(t9n)^M+(t10n)^M+(t11n)^M+(t12n)^M+(t13n)^M+(t14n)^M+(t15n)^M+(t16n)^M+(t17n)^M+(t18n)^M+(t19n)^M+(t20n)^M+(t21n)^M+(t22n)^M+(t23n)^M+(t24n)^M+(t25n)^M+(t26n)^M+(t27n)^M+(t29n)^M+(t30n)^M+(t31n)^M+(t32n)^M+(t33n)^M+(t34n)^M+(t35n)^M+(t36n)^M+(t37n)^M+(t38n)^M+(t39n)^M+(t40n)^M) ...
% +(alpha2).*(((delta_tpb1n)-(beta2).*((delta_tpb1n)-abs(delta_tpb1n)))^N+((delta_tpb2n)-(beta2).*((delta_tpb2n)-abs(delta_tpb2n)))^N+((delta_tpb3n)-(beta2).*((delta_tpb3n)-abs(delta_tpb3n)))^N+((delta_tpb4n)-(beta2).*((delta_tpb4n)-abs(delta_tpb4n)))^N ...
% +((delta_tpb5n)-(beta2).*((delta_tpb5n)-abs(delta_tpb5n)))^N+((delta_tpb6n)-(beta2).*((delta_tpb6n)-abs(delta_tpb6n)))^N+((delta_tpb7n)-(beta2).*((delta_tpb7n)-abs(delta_tpb7n)))^N+((delta_tpb8n)-(beta2).*((delta_tpb8n)-abs(delta_tpb8n)))^N ...
% +((delta_tpb9n)-(beta2).*((delta_tpb9n)-abs(delta_tpb9n)))^N+((delta_tpb10n)-(beta2).*((delta_tpb10n)-abs(delta_tpb10n)))^N+((delta_tpb11n)-(beta2).*((delta_tpb11n)-abs(delta_tpb11n)))^N+((delta_tpb12n)-(beta2).*((delta_tpb12n)-abs(delta_tpb12n)))^N+((delta_tpb13n)-(beta2).*((delta_tpb13n)-abs(delta_tpb13n)))^N ...
% +((delta_tpb14n)-(beta2).*((delta_tpb14n)-abs(delta_tpb14n)))^N+((delta_tpb15n)-(beta2).*((delta_tpb15n)-abs(delta_tpb15n)))^N+((delta_tpb16n)-(beta2).*((delta_tpb16n)-abs(delta_tpb16n)))^N+((delta_tpb17n)-(beta2).*((delta_tpb17n)-abs(delta_tpb17n)))^N+((delta_tpb18n)-(beta2).*((delta_tpb18n)-abs(delta_tpb18n)))^N ...
% +((delta_tpb19n)-(beta2).*((delta_tpb19n)-abs(delta_tpb19n)))^N+((delta_tpb20n)-(beta2).*((delta_tpb20n)-abs(delta_tpb20n)))^N+((delta_tpb21n)-(beta2).*((delta_tpb21n)-abs(delta_tpb21n)))^N+((delta_tpb22n)-(beta2).*((delta_tpb22n)-abs(delta_tpb22n)))^N+((delta_tpb23n)-(beta2).*((delta_tpb23n)-abs(delta_tpb23n)))^N ...
% +((delta_tpb24n)-(beta2).*((delta_tpb24n)-abs(delta_tpb24n)))^N+((delta_tpb25n)-(beta2).*((delta_tpb25n)-abs(delta_tpb25n)))^N+((delta_tpb26n)-(beta2).*((delta_tpb26n)-abs(delta_tpb26n)))^N+((delta_tpb27n)-(beta2).*((delta_tpb27n)-abs(delta_tpb27n)))^N+((delta_tpb28n)-(beta2).*((delta_tpb28n)-abs(delta_tpb28n)))^N ...
% +((delta_tpb29n)-(beta2).*((delta_tpb29n)-abs(delta_tpb29n)))^N+((delta_tpb30n)-(beta2).*((delta_tpb30n)-abs(delta_tpb30n)))^N+((delta_tpb31n)-(beta2).*((delta_tpb31n)-abs(delta_tpb31n)))^N+((delta_tpb32n)-(beta2).*((delta_tpb32n)-abs(delta_tpb32n)))^N+((delta_tpb33n)-(beta2).*((delta_tpb33n)-abs(delta_tpb33n)))^N ...
% +((delta_tpb34n)-(beta2).*((delta_tpb34n)-abs(delta_tpb34n)))^N+((delta_tpb35n)-(beta2).*((delta_tpb35n)-abs(delta_tpb35n)))^N+((delta_tpb36n)-(beta2).*((delta_tpb36n)-abs(delta_tpb36n)))^N+((delta_tpb37n)-(beta2).*((delta_tpb37n)-abs(delta_tpb37n)))^N+((delta_tpb38n)-(beta2).*((delta_tpb38n)-abs(delta_tpb38n)))^N ...
% +((delta_tpb39n)-(beta2).*((delta_tpb39n)-abs(delta_tpb39n)))^N+((delta_tpb40n)-(beta2).*((delta_tpb40n)-abs(delta_tpb40n)))^N+((delta_tpb41n)-(beta2).*((delta_tpb41n)-abs(delta_tpb41n)))^N+((delta_tpb42n)-(beta2).*((delta_tpb42n)-abs(delta_tpb42n)))^N+((delta_tpb43n)-(beta2).*((delta_tpb43n)-abs(delta_tpb43n)))^N ...
% +((delta_tpb44n)-(beta2).*((delta_tpb44n)-abs(delta_tpb44n)))^N+((delta_tpb45n)-(beta2).*((delta_tpb45n)-abs(delta_tpb45n)))^N+((delta_tpb46n)-(beta2).*((delta_tpb46n)-abs(delta_tpb46n)))^N+((delta_tpb47n)-(beta2).*((delta_tpb47n)-abs(delta_tpb47n)))^N+((delta_tpb48n)-(beta2).*((delta_tpb48n)-abs(delta_tpb48n)))^N ...
% +((delta_tpb49n)-(beta2).*((delta_tpb49n)-abs(delta_tpb49n)))^N+((delta_tpb50n)-(beta2).*((delta_tpb50n)-abs(delta_tpb50n)))^N+((delta_tpb51n)-(beta2).*((delta_tpb51n)-abs(delta_tpb51n)))^N+((delta_tpb52n)-(beta2).*((delta_tpb52n)-abs(delta_tpb52n)))^N+((delta_tpb53n)-(beta2).*((delta_tpb53n)-abs(delta_tpb53n)))^N ...
% +((delta_tpb54n)-(beta2).*((delta_tpb54n)-abs(delta_tpb54n)))^N+((delta_tpb55n)-(beta2).*((delta_tpb55n)-abs(delta_tpb55n)))^N+((delta_tpb56n)-(beta2).*((delta_tpb56n)-abs(delta_tpb56n)))^N+((delta_tpb57n)-(beta2).*((delta_tpb57n)-abs(delta_tpb57n)))^N+((delta_tpb58n)-(beta2).*((delta_tpb58n)-abs(delta_tpb58n)))^N ...
% +((delta_tpb59n)-(beta2).*((delta_tpb59n)-abs(delta_tpb59n)))^N+((delta_tpb60n)-(beta2).*((delta_tpb60n)-abs(delta_tpb60n)))^N+((delta_tpb61n)-(beta2).*((delta_tpb61n)-abs(delta_tpb61n)))^N+((delta_tpb62n)-(beta2).*((delta_tpb62n)-abs(delta_tpb62n)))^N+((delta_tpb63n)-(beta2).*((delta_tpb63n)-abs(delta_tpb63n)))^N ...
% +((delta_tpb64n)-(beta2).*((delta_tpb64n)-abs(delta_tpb64n)))^N+((delta_tpb65n)-(beta2).*((delta_tpb65n)-abs(delta_tpb65n)))^N+((delta_tpb66n)-(beta2).*((delta_tpb66n)-abs(delta_tpb66n)))^N+((delta_tpb67n)-(beta2).*((delta_tpb67n)-abs(delta_tpb67n)))^N+((delta_tpb68n)-(beta2).*((delta_tpb68n)-abs(delta_tpb68n)))^N ...
% +((delta_tpb69n)-(beta2).*((delta_tpb69n)-abs(delta_tpb69n)))^N+((delta_tpb70n)-(beta2).*((delta_tpb70n)-abs(delta_tpb70n)))^N+((delta_tpb71n)-(beta2).*((delta_tpb71n)-abs(delta_tpb71n)))^N+((delta_tpb72n)-(beta2).*((delta_tpb72n)-abs(delta_tpb72n)))^N+((delta_tpb73n)-(beta2).*((delta_tpb73n)-abs(delta_tpb73n)))^N ...
% +((delta_tpb74n)-(beta2).*((delta_tpb74n)-abs(delta_tpb74n)))^N+((delta_tpb75n)-(beta2).*((delta_tpb75n)-abs(delta_tpb75n)))^N+((delta_tpb76n)-(beta2).*((delta_tpb76n)-abs(delta_tpb76n)))^N+((delta_tpb77n)-(beta2).*((delta_tpb77n)-abs(delta_tpb77n)))^N+((delta_tpb78n)-(beta2).*((delta_tpb78n)-abs(delta_tpb78n)))^N ...
% +((delta_tpb79n)-(beta2).*((delta_tpb79n)-abs(delta_tpb79n)))^N+((delta_tpb80n)-(beta2).*((delta_tpb80n)-abs(delta_tpb80n)))^N+((delta_tpb81n)-(beta2).*((delta_tpb81n)-abs(delta_tpb81n)))^N+((delta_tpb82n)-(beta2).*((delta_tpb82n)-abs(delta_tpb82n)))^N+((delta_tpb83n)-(beta2).*((delta_tpb83n)-abs(delta_tpb83n)))^N ...
% +((delta_tpb84n)-(beta2).*((delta_tpb84n)-abs(delta_tpb84n)))^N+((delta_tpb85n)-(beta2).*((delta_tpb85n)-abs(delta_tpb85n)))^N+((delta_tpb86n)-(beta2).*((delta_tpb86n)-abs(delta_tpb86n)))^N+((delta_tpb87n)-(beta2).*((delta_tpb87n)-abs(delta_tpb87n)))^N+((delta_tpb88n)-(beta2).*((delta_tpb88n)-abs(delta_tpb88n)))^N ...
% +((delta_tpb89n)-(beta2).*((delta_tpb89n)-abs(delta_tpb89n)))^N+((delta_tpb90n)-(beta2).*((delta_tpb90n)-abs(delta_tpb90n)))^N+((delta_tpb91n)-(beta2).*((delta_tpb91n)-abs(delta_tpb91n)))^N+((delta_tpb92n)-(beta2).*((delta_tpb92n)-abs(delta_tpb92n)))^N);
%of=(t1n)^1+(t2n)^1+(t3n)^1+(t4n)^1+(t5n)^1+(t6n)^1+(t7n)^1+(t8n)^1+(t9n)^1+(t10n)^1+(t11n)^1+(t12n)^1+(t13n)^1+(t14n)^1+(t15n)^1+(t16n)^1+(t17n)^1+(t18n)^1+(t19n)^1+(t20n)^1+(t21n)^1+(t22n)^1+(t23n)^1+(t24n)^1+(t25n)^1+(t26n)^1+(t27n)^1+(t29n)^1+(t30n)^1+(t31n)^1+(t32n)^1+(t33n)^1+(t34n)^1+(t35n)^1+(t36n)^1+(t37n)^1+(t38n)^1+(t39n)^1+(t40n)^1;
%of=[t1n+t2n+t3n+t4n+t5n+t6n+t7n+t8n+t9n+t10n+t11n+t12n+t13n+t14n+t15n+t16n+t17n+t18n+t19n+t20n+t21n+t22n+t23n+t24n+t25n+t26n+t27n+t29n+t30n+t31n+t32n+t33n+t34n+t35n+t36n+t37n+t38n+t39n+t40n];
of==((t1n)+(t2n)+(t3n)+(t4n)+(t5n)+(t6n)+(t7n)+(t8n)+(t9n)+(t10n)+(t11n)+(t12n)+(t13n)+(t14n)+(t15n)+(t16n)+(t17n)+(t18n)+(t19n)+(t20n)+(t21n)+(t22n)+(t23n)+(t24n)+(t25n)+(t26n)+(t27n)+(t29n)+(t30n)+(t31n)+(t32n)+(t33n)+(t34n)+(t35n)+(t36n)+(t37n)+(t38n)+(t39n)+(t40n));
% pause(1)
end

Mathieu NOE on 23 Jun 2022
hi
see the line :
out_tbn=[tb1n tb2n tb3n tb4n tb5n.....
is missing a closing bracket

### Categories

Find more on Electrical Block Libraries in Help Center and File Exchange

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!