Macro arrays

<< Click to Display Table of Contents >>

Navigation:  Macros > Macro commands and parameters > Macro alteration commands >

Macro arrays

Arrays have been defined to store a large number of calculated values. Maximum 9 two-dimensional arrays are available of maximum 10000 rows and 1000 columns. A value can be stored using the command Store. Using the command Restore a value can be recalled.

 

General notation:

Store ( index , row , column , value )

Restore ( index , row , column , value )

 

The parameter Index (1..9) points to the arrays.

 

Example:

procedure(calculate_deviation)

// calculate (U-Uref) / Uref * 100%

   set(x,U)

   subtract(x,Uref)

   divide(x,Uref)

   multiply(x,100)

end

 

procedure(store_voltages_in_matrix_1)

   set(U,MyNode.U)

   call(calculate_deviation)

   add(i,1)

   store(1,i,1,U)

   store(1,i,2,Uref)

   store(1,i,3,x)

end

 

procedure(print_voltages_matrix_1)

   loop(j,1,i,1)

      restore(1,j,1,A)

      restore(1,j,2,B)

      restore(1,j,3,C)

      text(A:6:2,' kV   ',B:6:2,' kV   ',C:6:2,' %')

   end   

end

 

loadflow(0,,true)

if(Network.Result,=,'LF')

   text('Voltage     Reference   Deviation')

   text('=======     =========   =========')

   set(Uref,node('MS-Station').U)

   set(i,0)

   forselection(node('MS-net'),MyNode)

      call(store_voltages_in_matrix_1)

   end

   call(print_voltages_matrix_1)

else

   text('no loadflow')

end 

 

On the demo network this macro results in:

Voltage     Reference   Deviation

=======     =========   =========

 10,36 kV    10,36 kV     0,00 %

 10,08 kV    10,36 kV    -2,75 %

 10,31 kV    10,36 kV    -0,48 %

  9,93 kV    10,36 kV    -4,16 %

 10,37 kV    10,36 kV     0,09 %

  9,93 kV    10,36 kV    -4,16 %