Yalmip Error: Adding NaN to an SDPVAR makes no sense.

728 views
Skip to first unread message

Shankar Suresh Kartha

unread,
May 10, 2017, 4:36:41 PM5/10/17
to YALMIP
Hi Guys, 
I'm trying to get this code working but I'm not able to get it to run due to an error. 

Snippet of the Code: 

P = sdpvar(3, 48, 'full'); %power generation at each unit 

Pl = sdpvar(3, 48, 'full'); %power injection at each bus 

Pl_bus_out = zeros(9,48);
Pl_bus_in = zeros(9,48);

L1 = 50*sin(1:Horizon)+50; 
L2 = 20*sin(1:Horizon)+50;
L3 = 50*sin(1:Horizon)+100;
L = [L1; L2; L3];

for k = 1:48 
    
    Pl_bus_in(:,k) = [0; Pl(7,k); 0; Pl(1,k)+ Pl(9,k); Pl(2,k); Pl(3,k) + Pl(4,k); Pl(5,k); Pl(6,k); Pl(8,k)];     
    Pl_bus_out(:,k) = [0; 0; Pl(4,k); Pl(2,k); Pl(3,k); Pl(5,k); Pl(6,k); Pl(8,k) + Pl(7,k); Pl(9,k)];
    Constraints = [Constraints, sum(P(:,k)) + sum(Pl_bus_in(:,k)) == sum(L(:,k)) + sum(Pl_bus_out(:,k))];%DC power balance constraint

end 

Error:

Error using  +  (line 56)
Adding NaN to an SDPVAR makes no sense.

Error in trial (line 69)
    Constraints = [Constraints, sum(P(:,k)) + sum(Pl_bus_in(:,k)) == sum(L(:,k)) + sum(Pl_bus_out(:,k))];%DC power balance constraint

I don't understand why this error is happening when I have assigned the Pl_bus_in and Pl_bus_out zeros matrices with sdpvar values from the Pl. 

Thanks! 
Shankar. 

Johan Löfberg

unread,
May 10, 2017, 4:40:05 PM5/10/17
to YALMIP
Reply all
Reply to author
Forward
0 new messages