Thank you very much Patrick and ST. I'm really grateful to you for your 
help. 

I finally have my susceptance matrix. 

Best regards,

Michela 

Il giorno giovedì 23 aprile 2015 13:51:05 UTC+2, Michela Di Lullo ha 
scritto:
>
> Hello everyone, 
>
> I'm pretty new to the julia programming language and I'm having issues 
> while trying to declare a susceptance matrix in a unit commitment problem.
>
> I have the following elements: 
>
> BUS=[1:14]
>
> LINES=[1:20]
>
> NODE_FROM=[1 1 2 2 2 3 4 4 4 5 6 6 6 7 7 9 9 10 12 13]
>
> NODE_TO=[2 5 3 4 5 4 5 7 9 6 11 12 13 8 9 10 14 11 13 14]
>
> BRANCH=[(LINES[l], NODE_FROM[l], NODE_TO[l]) for l=1:length(LINES)]
>
> s1=[(i,i) for i in BUS]
>
> s2=[(m,k) for (l,m,k) in BRANCH]
>
> s3=[(k,m) for (l,m,k) in BRANCH]
>
> Y_BUS=union(s1,s2,s3)
>
> branch_x=[0.05917, 0.22304, 0.19797, 0.17632, 0.17388, 0.17103, 0.04211, 
> 0.20912, 0.55618, 0.25202, 0.1989, 0.25581, 0.13027, 0.17615, 0.11001, 
> 0.0845, 0.27038, 0.19207, 0.19988, 0.34802]
>
> and I need to declare the B susceptance matrix defined, in AMPL, as:
>
> param B{(k,m) in YBUS} := if(k == m)      then sum{(l,k,i) in BRANCH}  
> 1/branch_x[l,k,i] 
>                                                                              
> +sum{(l,i,k) in BRANCH}  1/branch_x[l,i,k]
>                           else if(k != m) then 
>                                                                     
> sum{(l,k,m) in BRANCH}  1/branch_x[l,k,m]
>                                                                   
> +sum{(l,m,k) in BRANCH}  1/branch_x[l,m,k];
>
> I'm trying to make it but it's not working because of the indexes. I don't 
> know how to declare the parameter branch_x indexed by (n,b_from,b_to).
>
> Any idea about how to declare the B matrix correctly? 
>
> Thank you for any suggestion, 
>
> Michela
>

Reply via email to