Hi Omer Ali, Yes, you should always use the “mpc” (or any variable name of your choice) to store the MATPOWER case files in the workspace. So this applies both to any m-Files as well as your command window operation. Otherwise, it can happen that you accidentally call other functions, like happened to you with the “branch()” command.
Best, Patrick On 09/11/15 11:20, "Umer Ali Alsedeeq Ibrahim" <[email protected]> wrote: >Dear Mr. Patrick > >I f I want to construct m.file is it necessary to use mpc within m.file >such as > >mpc= loadcase('case9'); > >mpc.branch(Location, BR_X) = branch(Location, BR_X) + x1; > >or we use mpc only in command window > >Best Regards > >Omer Ali > >________________________________________ >From: [email protected] >[[email protected]] on behalf of Eser Patrick >[[email protected]] >Sent: 08 November 2015 18:36 >To: MATPOWER discussion forum >Subject: AW: Varying the reactance of branch > >Hi, > >The error message you receive has nothing to do with MATPOWER, but >probably stems from calling the function "branch" of a different program. >Please use > >mpc = loadcase('case9'); > >because that will store the case file data in the struct "mpc". > >And then, replace all "branch" with "mpc.branch" in your code below. So >for example, it should be > >mpc.branch(Location, BR_X) = mpc.branch(Location, BR_X) + x1; > >Does that work? > >Best, > >Patrick > >________________________________________ >Von: [email protected] >[[email protected]]" im Auftrag von >"Umer Ali Alsedeeq Ibrahim [[email protected]] >Gesendet: Sonntag, 8. November 2015 16:03 >An: MATPOWER discussion forum >Betreff: Varying the reactance of branch > >Dear All > >I would like to change reactance of branch and shunt susceptance >repeatedly as below > >1- varying of reactance by the below code > >rate= rand(); > >location = 5; > >loadcase('case9'); > >r = -0.7 + 0.9 * rate; > > x1 = r * branch(Location, BR_X); > >branch(Location, BR_X) = branch(Location, BR_X) + x1; > > >2- varying of shunt susceptance by the below code > >rate= rand(); > >location = 2; > >loadcase('case9'); > >Q = -100 + 200 * rate; >V = bus(branch(Location, F_BUS), VM) .* exp(sqrt(-1) * pi/180 * >bus(branch(Location, F_BUS), VA)) >V = abs(V); > bs1 = -Q / (V^2); >bus(branch(Location, F_BUS), BS) = bus(branch(Location, F_BUS), BS) + bs1; >bus(branch(Location, F_BUS), BUS_TYPE) = PV; > >when I have running the above code I receive the following error: > >??? Error using ==> branch at 112 >first input argument must be either a TREE or an LTI created by MKSYS > >please help > > >[Logo] > >Disclaimer: > >This e-mail and any attachments may contain information which is >confidential. They should not be distributed, disclosed or copied to >anyone without the approval of the sender. If you are not one of the >intended recipients of this e-mail, please delete the e-mail and any >attachments, and all copies, and notify the sender by e-mail or >telephone. Confidentiality is not waived or lost by mistaken >communication. Before opening this e-mail or an attachment, you should >check them for viruses. تنويه هام: هذه الرسالة الإلكترونية وأية ملحقات >معها قد تحتوي على معلومات سرية، يجب أن لا يوزعا أو يكشف مضمونهما و/أو >نسخهما لأي كان من دون موافقة المرسل. إذا لم تكن واحداً من الأشخاص الموجه >لهم هذا البريد الإلكتروني ووصل إلى بريدك الإلكتروني عن طريق الخطاً، يرجى >حذف الرسالة مع ملحقاتها فضلاً عن حذف جميع نسخها. وبعد ذلك، يرجى الإتصال >بالمرسل عبر البريد الإلكتروني او الهاتف لإبلاغه بالخطأ الحاصل. لا تفقد >سرية المعلومات أو يتنازل عنها بسبب خطأ ناجم عن إرسال وتوجيه البريد >الالكتروني لأشخاص غير مقصودين. كما يتوجب على متلقي البريد الإلكتروني >وملحقاته أن يتفحصوهما دوماً قبل الإطلاع عليهما، للتأكد من خلوهما من >الفيروسات الإلكترونية الضارة. > >Qatar General Electricity & Water Corporation <http://www.km.qa> > > >[Logo] > >Disclaimer: > >This e-mail and any attachments may contain information which is >confidential. They should not be distributed, disclosed or copied to >anyone without the approval of the sender. If you are not one of the >intended recipients of this e-mail, please delete the e-mail and any >attachments, and all copies, and notify the sender by e-mail or >telephone. Confidentiality is not waived or lost by mistaken >communication. Before opening this e-mail or an attachment, you should >check them for viruses. تنويه هام: هذه الرسالة الإلكترونية وأية ملحقات >معها قد تحتوي على معلومات سرية، يجب أن لا يوزعا أو يكشف مضمونهما و/أو >نسخهما لأي كان من دون موافقة المرسل. إذا لم تكن واحداً من الأشخاص الموجه >لهم هذا البريد الإلكتروني ووصل إلى بريدك الإلكتروني عن طريق الخطاً، يرجى >حذف الرسالة مع ملحقاتها فضلاً عن حذف جميع نسخها. وبعد ذلك، يرجى الإتصال >بالمرسل عبر البريد الإلكتروني او الهاتف لإبلاغه بالخطأ الحاصل. لا تفقد >سرية المعلومات أو يتنازل عنها بسبب خطأ ناجم عن إرسال وتوجيه البريد >الالكتروني لأشخاص غير مقصودين. كما يتوجب على متلقي البريد الإلكتروني >وملحقاته أن يتفحصوهما دوماً قبل الإطلاع عليهما، للتأكد من خلوهما من >الفيروسات الإلكترونية الضارة. > >Qatar General Electricity & Water Corporation <http://www.km.qa> > > >
