I don’t think your N matrix is what you want … it looks like the number of columns would be correct for a 48-bus system, but the first row would appear to have a 1 in the columns corresponding to voltage angles at buses 7, 13, 23, 27, 39, and 41 as well as voltage magnitudes at those buses. I don’t think you want to apply a cost to the sum of all of those do you?
Based on your original post, I thought you just wanted a cost on the voltage magnitudes. In that case, you’d want N to select the voltage magnitudes, like this … mpc.N = [sparse(nb, nb) speye(nb, nb) sparse(nb, 2*ng)]; Then with the fparm you defined, w will be the vector of bus voltage deviations from 1 p.u. If you want to add additional objectives, simply add other rows to N and extend fparm to define additional elements in w, then extend H and Cw accordingly. Ray On Mar 16, 2020, at 4:17 PM, Ali Mohammadi <amoh...@lsu.edu<mailto:amoh...@lsu.edu>> wrote: Thanks, it works. I wrote the code as follows: nb = size(mpc.bus, 1); ng = size(mpc.gen, 1); mpc.N = [sparse(nb, 6) speye(nb, 1) sparse(nb, 5) speye(nb, 1) sparse(nb, 9) speye(nb, 1) sparse(nb, 3) speye(nb, 1)... sparse(nb,11) speye(nb, 1) sparse(nb, 1) speye(nb, 1) sparse(nb, 7) ... sparse(nb, 6) speye(nb, 1) sparse(nb, 5) speye(nb, 1) sparse(nb, 9) speye(nb, 1) sparse(nb, 3) speye(nb, 1)... sparse(nb,11) speye(nb, 1) sparse(nb, 1) speye(nb, 1) sparse(nb, 7) ... sparse(nb, 2*ng)]; r_hat=1; " OutmailID: 124467581, List: 'matpower-l', MemberID: 82861091 SCRIPT: "r lam=100; w=50; mpc.fparm = ones(nb, 1) * [1 r_hat 0 1]; % mpc.fparm(); mpc.Cw = lam * ones(nb, 1); mpc.H=w^2*speye(nb,nb); I want to add another objective function to my optimization is it possible? (e.g, mpc.fparm2 doesn't work) Ali Mohammadi Ph.D. Candidate Electrical & Computer Engineering Louisiana State University 133 EE building, Baton Rouge, LA 70803 <Outlook-1qa4sfck.png><https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fscholar.google.com%2Fcitations%3Fuser%3DySg5z18AAAAJ%26hl%3Den&data=02%7C01%7Camoha39%40lsu.edu%7Cafed59aeb33c45a9c3e008d6dff512ce%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636942641017445763&sdata=KIRy3hlv4sT0iFDRC%2BxeA9QX2NSgG9noP%2BLrmF49ygQ%3D&reserved=0> <Outlook-f0wdoavu.png><https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fali-mohammadi-8aa98460%2F%3ForiginalSubdomain%3Dir&data=02%7C01%7Camoha39%40lsu.edu%7Cafed59aeb33c45a9c3e008d6dff512ce%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636942641017445763&sdata=3lxyL4rrWZXUqrZFdsajpO4A1YXnhlUpLyYyCBE%2Fjmw%3D&reserved=0> ________________________________ From: bounce-124463678-85971...@list.cornell.edu<mailto:bounce-124463678-85971...@list.cornell.edu> <bounce-124463678-85971...@list.cornell.edu<mailto:bounce-124463678-85971...@list.cornell.edu>> on behalf of Ray Daniel Zimmerman <r...@cornell.edu<mailto:r...@cornell.edu>> Sent: Monday, March 16, 2020 10:45 AM To: MATPOWER-L <matpowe...@list.cornell.edu<mailto:matpowe...@list.cornell.edu>> Subject: Re: Question regarding adding cost function The opf_model object (om) is created by opf_setup() which is called automatically when you execute runopf(). In order to modify it directly using om.add_quad_cost(), you will need to define a callback function as described in Chapter 7 of the manual. For a simple addition like this, it may be easier to just use the legacy cost mechanism described in Section 6.3.3. In that case, you can do it by simply adding some parameters to mpc. For example, define the mpc.N matrix to select the voltage magnitudes from the optimization vector x (i.e. the columns from nb+1 to 2*nb), and mpc.Cw equal to your Cw. Hope this helps, Ray On Mar 12, 2020, at 2:46 PM, Ali Mohammadi <amoh...@lsu.edu<mailto:amoh...@lsu.edu>> wrote: Hi, I want to add a cost function in my objective function. I wrote the code as follows but I got error please correct me, If my code is wrong (this is just the code example). case_name='9'; mpc=loadcase(['case',case_name]); om=opt_model(mpc); % test = loadcase('t_case30_userfcns') % res=runopf(mpc); mpopt = mpoption('pf.alg', 'FDXB', 'verbose', 2, 'out.all', 0); om = opf_setup(mpc,mpopt); % mpc = toggle_reserves(mpc, 'on') " OutmailID: 124463678, List: 'matpower-l', MemberID: 85971972 SCRIPT: "% Cw=zeros(9,1); Q=zeros(9,1); Cw([5])=1; om.add_quad_cost('myQcost', Q, Cw, 0, {'Vm'}); " TCL MERGE ERROR ( 03/16/2020 12:45:11 ): "extra characters after close-quote% mpc = add_userfcn(mpc, 'formulation', om); runopf(mpc) Thank you so much Ali --_000_CBF9094398B94D9B9931C3B63D9714C7cornelledu_ Content-Type: text/html; charset="utf-8" Content-ID: <5a68704fa72a204ca5a26398661e8...@namprd04.prod.outlook.com> Content-Transfer-Encoding: base64 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""> I don’t think your <span style="font-style: normal;" class=""><font face="Courier" class="">N</font></span> matrix is what you want … it looks like the number of columns would be correct for a 48-bus system, but the first row would appear to have a 1 in the columns corresponding to voltage angles at buses 7, 13, 23, 27, 39, and 41 as well as voltage magnitudes at those buses. I don’t think you want to apply a cost to the sum of all of those do you? <div class=""> <div class=""> <div class=""> <div><br class=""> </div> <div>Based on your original post, I thought you just wanted a cost on the voltage magnitudes. In that case, you’d want <span style="font-family: Courier;" class="">N</span> to select the voltage magnitudes, like this …</div> <div><br class=""> </div> <div><font face="Courier" class="">mpc.N = [sparse(nb, nb) speye(nb, nb) sparse(nb, 2*ng)];</font></div> <div><br class=""> </div> <div>Then with the <font face="Courier" class="">fparm</font> you defined, <i class=""> w</i> will be the vector of bus voltage deviations from 1 p.u.</div> <div><br class=""> </div> <div>If you want to add additional objectives, simply add other rows to <font face="Courier" class=""> N</font> and extend <font face="Courier" class="">fparm</font> to define additional elements in <i class="">w</i>, then extend <font face="Courier" class="">H</font> and <font face="Courier" class=""> Cw</font> accordingly.</div> <div><br class=""> </div> <div> Ray</div> <div><br class=""> </div> <div><br class=""> <blockquote type="cite" class=""> <div class="">On Mar 16, 2020, at 4:17 PM, Ali Mohammadi <<a href="mailto:amoh...@lsu.edu" class="">amoh...@lsu.edu</a>> wrote:</div> <br class="Apple-interchange-newline"> <div class=""> <div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> Thanks, it works. I wrote the code as follows:</div> <div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> <br class=""> </div> <div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> <span class="">nb = size(mpc.bus, 1);<br class=""> </span> <div class="">ng = size(mpc.gen, 1);<br class=""> </div> <div class="">mpc.N = [sparse(nb, 6) speye(nb, 1) sparse(nb, 5) speye(nb, 1) sparse(nb, 9) speye(nb, 1) sparse(nb, 3) speye(nb, 1)...<br class=""> </div> <div class=""> sparse(nb,11) speye(nb, 1) sparse(nb, 1) speye(nb, 1) sparse(nb, 7) ...<br class=""> </div> <div class=""> sparse(nb, 6) speye(nb, 1) sparse(nb, 5) speye(nb, 1) sparse(nb, 9) speye(nb, 1) sparse(nb, 3) speye(nb, 1)...<br class=""> </div> <div class=""> sparse(nb,11) speye(nb, 1) sparse(nb, 1) speye(nb, 1) sparse(nb, 7) ...<br class=""> </div> <div class=""> sparse(nb, 2*ng)];<br class=""> </div> <div class="">r_hat=1;" TCL MERGE ERROR ( 03/17/2020 11:55:39 ): "extra characters after close-quote r<br class=""> </div> <div class="">lam=100;<br class=""> </div> <div class="">w=50;<br class=""> </div> <div class="">mpc.fparm = ones(nb, 1) * [1 r_hat 0 1];<br class=""> </div> <div class="">% mpc.fparm();<br class=""> </div> <div class="">mpc.Cw = lam * ones(nb, 1);<br class=""> </div> <span class="">mpc.H=w^2*speye(nb,nb);</span><br class=""> </div> <div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> <span class=""><br class=""> </span></div> <div style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> <span class="">I want to add another objective function to my optimization is it possible? (e.g, <span style="font-family: "Times New Roman", Times, serif; background-color: rgb(255, 255, 255); display: inline !important;" class="">mpc.fparm2 doesn't work</span>)<br class=""> <br class=""> </span></div> <div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> <div style="font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> <br class=""> </div> <div id="Signature" class=""> <div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""> <div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: rgb(255, 255, 255);" class=""> <font face="Times New Roman,Times,serif" class=""><span style="font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""><b class="">Ali Mohammadi</b></span></font></div> <div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: rgb(255, 255, 255);" class=""> <font face="Times New Roman,Times,serif" class=""><span style="margin: 0px; font-size: 11pt; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); display: inline !important;" class="">Ph.D. Candidate</span></font></div> <div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: rgb(255, 255, 255);" class=""> <font face="Times New Roman,Times,serif" class=""><span style="margin: 0px; font-size: 11pt; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); display: inline !important;" class="">Electrical & Computer Engineering</span><br style="color: rgb(51, 51, 51); font-family: Roboto; font-size: 14px; background-color: rgb(255, 255, 255);" class=""> <span style="margin: 0px; font-size: 11pt; font-family: "Times New Roman", Times, serif; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); display: inline !important;" class="">Louisiana State University</span></font></div> <div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: rgb(255, 255, 255);" class=""> <font face="Times New Roman,Times,serif" class=""><span style="margin: 0px; font-size: 14px; font-family: Roboto; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255); display: inline !important;" class=""><span style="margin: 0px; background-color: rgb(255, 255, 255); font-family: "Times New Roman", Times, serif; font-size: 11pt; display: inline !important;" class="">133 EE building, Baton Rouge, LA 70803 </span><br class=""> </span></font></div> <div style="margin: 0px; font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols; text-align: start; background-color: rgb(255, 255, 255);" class=""> <font face="Times New Roman,Times,serif" class=""> <div style="margin: 0px; font-family: "Times New Roman", Times, serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;" class=""> <div style="margin: 0px;" class=""><font size="1" face="Tahoma" class=""><span style="margin: 0px; font-size: 13px;" class=""> <div style="margin: 0px;" class=""><a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fscholar.google.com%2Fcitations%3Fuser%3DySg5z18AAAAJ%26hl%3Den&data=02%7C01%7Camoha39%40lsu.edu%7Cafed59aeb33c45a9c3e008d6dff512ce%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636942641017445763&sdata=KIRy3hlv4sT0iFDRC%2BxeA9QX2NSgG9noP%2BLrmF49ygQ%3D&reserved=0" target="_blank" rel="noopener noreferrer" originalsrc="https://scholar.google.com/citations?user=ySg5z18AAAAJ&hl=en" title="Original URL: https://scholar.google.com/citations?user=ySg5z18AAAAJ&hl=en. Click or tap if you trust this link." style="margin: 0px;" class=""><span id="cid:c87c2bf8-6841-4f03-8c82-d39f08a364b2"><Outlook-1qa4sfck.png></span></a><span style="font-family: "Times New Roman", Times, serif; font-size: 11pt;" class=""> </span><a href="https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fali-mohammadi-8aa98460%2F%3ForiginalSubdomain%3Dir&data=02%7C01%7Camoha39%40lsu.edu%7Cafed59aeb33c45a9c3e008d6dff512ce%7C2d4dad3f50ae47d983a09ae2b1f466f8%7C0%7C0%7C636942641017445763&sdata=3lxyL4rrWZXUqrZFdsajpO4A1YXnhlUpLyYyCBE%2Fjmw%3D&reserved=0" target="_blank" rel="noopener noreferrer" originalsrc="https://www.linkedin.com/in/ali-mohammadi-8aa98460/?originalSubdomain=ir" title="Original URL: https://www.linkedin.com/in/ali-mohammadi-8aa98460/?originalSubdomain=ir. Click or tap if you trust this link." style="margin: 0px;" class=""><span id="cid:f70eb5af-7faa-4c9d-986e-0c985bc1c708"><Outlook-f0wdoavu.png></span></a></div> </span></font></div> </div> </font></div> <br class=""> </div> </div> </div> <div id="appendonsend" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> </div> <hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; display: inline-block; width: 987.828125px;" class=""> <span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""></span> <div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""> <font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span><a href="mailto:bounce-124463678-85971...@list.cornell.edu" class="">bounce-124463678-85971...@list.cornell.edu</a><span class="Apple-converted-space"> </span><<a href="mailto:bounce-124463678-85971...@list.cornell.edu" class="">bounce-124463678-85971...@list.cornell.edu</a>> on behalf of Ray Daniel Zimmerman <<a href="mailto:r...@cornell.edu" class="">r...@cornell.edu</a>><br class=""> <b class="">Sent:</b><span class="Apple-converted-space"> </span>Monday, March 16, 2020 10:45 AM<br class=""> <b class="">To:</b><span class="Apple-converted-space"> </span>MATPOWER-L <<a href="mailto:matpowe...@list.cornell.edu" class="">matpowe...@list.cornell.edu</a>><br class=""> <b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: Question regarding adding cost function</font> <div class=""> </div> </div> <div class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; line-break: after-white-space;"> The<span class="Apple-converted-space"> </span><font face="Courier" class="">opf_model</font><span class="Apple-converted-space"> </span>object (<font face="Courier" class="">om</font>) is created by<span class="Apple-converted-space"> </span><font face="Courier" class="">opf_setup()</font><span class="Apple-converted-space"> </span>which is called automatically when you execute<span class="Apple-converted-space"> </span><font face="Courier" class="">runopf()</font>. In order to modify it directly using<span class="Apple-converted-space"> </span><font face="Courier" class="">om.add_quad_cost()</font>, you will need to define a callback function as described in Chapter 7 of the manual. For a simple addition like this, it may be easier to just use the legacy cost mechanism described in Section 6.3.3. In that case, you can do it by simply adding some parameters to<span class="Apple-converted-space"> </span><font face="Courier" class="">mpc</font>. For example, define the<span class="Apple-converted-space"> </span><font face="Courier" class="">mpc.N</font><span class="Apple-converted-space"> </span>matrix to select the voltage magnitudes from the optimization vector<span class="Apple-converted-space"> </span><i class="">x</i><span class="Apple-converted-space"> </span>(i.e. the columns from<span class="Apple-converted-space"> </span><font face="Courier" class="">nb</font>+1 to 2*<font face="Courier" class="">nb</font>), and<span class="Apple-converted-space"> </span><font face="Courier" class="">mpc.Cw</font><span class="Apple-converted-space"> </span>equal to your<span class="Apple-converted-space"> </span><font face="Courier" class="">Cw</font>. <div class=""><br class=""> </div> <div class="">Hope this helps,</div> <div class=""><br class=""> </div> <div class=""> Ray</div> <div class=""><br class=""> </div> <div class=""> <div class=""><br class=""> <blockquote type="cite" class=""> <div class="">On Mar 12, 2020, at 2:46 PM, Ali Mohammadi <<a href="mailto:amoh...@lsu.edu" class="">amoh...@lsu.edu</a>> wrote:</div> <br class="x_Apple-interchange-newline"> <div class=""> <div class="x_WordSection1" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; text-decoration: none;"> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> Hi,<span class="x_Apple-converted-space"> </span></div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> </div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> I want to add a cost function in my objective function. I wrote the code as follows but I got error please correct me, If my code is wrong (this is just the code example).</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> </div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> case_name='9';</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> mpc=loadcase(['case',case_name]);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> om=opt_model(mpc);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> % test = loadcase('t_case30_userfcns')</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> % res=runopf(mpc);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> mpopt = mpoption('pf.alg', 'FDXB', 'verbose', 2, 'out.all', 0);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> om = opf_setup(mpc,mpopt);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> % mpc = toggle_reserves(mpc, 'on')</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> " OutmailID: 124463678, List: 'matpower-l', MemberID: 85971972 SCRIPT: "%</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> Cw=zeros(9,1);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> Q=zeros(9,1);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> Cw([5])=1;</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> om.add_quad_cost('myQcost', Q, Cw, 0, {'Vm'});</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> " TCL MERGE ERROR ( 03/16/2020 12:45:11 ): "extra characters after close-quote%</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> mpc = add_userfcn(mpc, 'formulation', om);</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> runopf(mpc)</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> </div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> Thank you so much</div> <div class="" style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> Ali</div> </div> </div> </blockquote> </div> </div> </div> </div> </blockquote> </div> <br class=""> </div> </div> </div> </body> </html> --