This function is used to map connection lines between nodes of a grid defined in a matrix into a loopable connection list
Application example: electrical transmission lines between superstructures in TransmissionGrid_ConnectionMatrix:
parameter Integer connectMatrix[nRegions,nRegions]=[0,1,2,1; 3,0,2,1; 1,3,0,1; 2,0,2,0] "Definition of connections between regions. Multiple transmission line between regions are possible";
final parameter Integer nTL = sum(connectMatrix) "number of transmission lines";
final parameter Integer connectListElectric[nTL,2]= Functions.MatrixListIndexMap(connectMatrix);
equation
for i in 1:nTL loop
connect(epp[connectListElectric[i, 1]], transmissionLine[i].epp_n) annotation (Line(
points={{-100,0},{-80,0},{-80,16},{-10,16}},
color={28,108,200},
thickness=0.5));
connect(epp[connectListElectric[i, 2]], transmissionLine[i].epp_p) annotation (Line(
points={{-100,0},{86,0},{86,16},{10,16}},
color={28,108,200},
thickness=0.5));
end for;
2. Level of detail, physical effects considered, and physical insight
(Description)
(Description)
input Integer matrix[:,:];
output Integer list[sum(matrix),2];
(no elements)
(no equations)
(none)
(no validation or testing necessary)
(none)
Model created by Aleš Vojáček (vojacek@xrg-simulation.de), 06.09.2021
function MatrixListIndexMap input Integer matrix[:, :]; output Integer list[sum(matrix), 2]; end MatrixListIndexMap;