In that case, what you mean is probably: define_constants; mpc = loadcase('case95');
for i = 1:10 mpc.bus(5,[PD QD]) = 1.2 * mpc.bus(5,[PD QD]); x = runpf(mpc); v(i) = x.bus(5,VM) q(i) = x.bus(5,QD) p(i) = x.bus(5,PD) end -- Jose L. Marin Gridquant España SL (Grupo AIA) On Mon, May 25, 2015 at 9:29 AM, Hiranya Seneviratne < hiranya.seneviratn...@gmail.com> wrote: > Hi Jose, > > Thank you for your reply. What I want to do is increase it by a constant > 20%. So each iteration it takes the previous loads value and increases it > by 20%. Any idea how I could do this? > > Thank you > Hiranya > On 24 May 2015, at 22:17, Jose Luis Marin <mari...@gridquant.com> wrote: > > Hi Hiranya, > > Quick guess: I think you want to increase the initial values of PQ at bus > 5 by increments of 20%, 40%, etc. If this is correct, then you need to > change your loop more or less like this: > > define_constants; > mpc = loadcase('case95'); > y = mpc.bus(5,[PD QD]); > > for i = 1:10 > mpc.bus(5,[PD QD]) = y + 0.2*i*y; > x = runpf(mpc); > v(i) = x.bus(5,VM) > q(i) = x.bus(5,QD) > p(i) = x.bus(5,PD) > end > > -- > Jose L. Marin > Gridquant España SL (Grupo AIA) > > > > On Sat, May 23, 2015 at 2:57 PM, Hiranya Seneviratne < > hiranya.seneviratn...@gmail.com> wrote: > >> >> >> Dear Ray, >> >> I am trying to implement a code in matpower, that increases the reactive >> power load by a factor and then see what happens to the voltage. >> I have written this code, however the value of y and q don’t seem to >> change appropriately. will you be please able to let me know how i can >> implement this? >> >> >> >> clear all >> close all >> define_constants; >> results = loadcase('case95'); >> >> for i = 1:10 >> define_constants; >> >> y = results.bus(5,[PD QD]); >> results.bus(5,[PD QD]) = y + 0.2*y; >> >> x = runpf(results); >> >> v(i) = x.bus(5,VM) >> q(i) = x.bus(5,QD) >> p(i) = x.bus(5,PD) >> >> >> >> >> end >> >> >> > >