Menu

Get Load.KW settings via COM inteface

Beginners
2016-04-19
2020-05-28
  • Iromi Ranaweera

    Iromi Ranaweera - 2016-04-19

    How can I get the kW settings of all the loads in a network? I am running time-based simulation loop with matlab. I thought following code would work. However, with this code, I get the same value for kW setting for a load at certain bus. It does not change with the time. What is the wrong with this code? Is there any other way to do this?

    for t=1:time_duration
        DSSSolution.Solve; 
        for i=1:number_of_Loads       
            Load_name=['LOAD' num2str(Load_nodes(i))];
            DSSCircuit.Loads.Name=Load_name;
            P_load(t,i)=DSSCircuit.Loads.kW;        
        end
    end
    

    Thanks!

    Iromi

     
  • Davis Montenegro

    Hi,

    I've modified your code to make it work:

    DSSElement  =   DSSCircuit.ActiveCktElement;
    for t=1:time_duration
        DSSSolution.Solve; 
        for i   =   1:number_of_Loads       
            Load_name   =   ['LOAD' num2str(Load_nodes(i))];
            DSSCircuit.Loads.Name   =   Load_name;
            powers                  =   DSSElement.powers;
            P_load(t,i)=powers(1);  % (1) kW, (2) kvar         
        end
    end
    

    Best regards

    Davis

     
  • Iromi Ranaweera

    Iromi Ranaweera - 2016-04-20

    Thanks for the help. Now it is working.

    Regards,
    Iromi

     
  • SONU

    SONU - 2020-05-28

    for load in myloads:
    KW=DSSCircuit.SetActiveElement('load.Kw'+load)
    print("loadname is:", load)
    print("load kw is :", KW)

    IS this correct way to access each load kW in loop, since getting an error where each load KW shown is -1?

     

Log in to post a comment.

MongoDB Logo MongoDB