~o=39
~?i&32768
~o=24
~$>end_of_copyright
~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
~/Copyright (C) Heinz Spiess, CH-2558 Aegerten, 1994. All rights reserved.
~/
~/The right to use this macro is granted to all EMME/2 users, provided the
~/following conditions are met:
~/ 1) The macro cannot be sold for a fee (but it can be used and distributed
~/ without charge within consulting projects).
~/ 2) The user is aware that this macro is not a part of the EMME/2 software
~/ licence and there is no explicit or implied warranty or support
~/ provided with this macro.
~/ 3) The comments in this macros must not be removed and any additions or
~/ modification must be appropriately identified as such and give at least
~/ date, name and the reason of the modification.
~/!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
~:end_of_copyright
~/********** legimped - 1.3 (H.Spiess EMME/2 Support Center) ****************
~/legimped - a macro to extract the first or second leg impedance matrix
~/ according to a zone index matrix containing the intermediate
~/ zones and a full impedance matrix.
~/
~/Intermediate zone index matrices are often the result of convolutions
~/computed with module 3.23. This macro takes such a zone index matrix Kpq
~/and an impedance matrix Upq, and produces one of the following matrices:
~/
~/ - the first leg impedance matrix: R1 = U
~/ pq pK
~/ pq
~/ - the second leg impedance matrix: R2 = U
~/ pq K q
~/ pq
~/
~/usage: ~
~/
~/where: =1 for first leg (pk), =2 for second leg (kq) impedances
~/ Impedance matrix to extract leg impedances from (input)
~/ index matrix containing intermediate zone numbers (input)
~/ resulting first or second leg impedance matrix (output)
~/
~/notes: - macro is called from main menu
~/ - mo99 is used as temporary matrix
~/***************************************************************************
~x=%0%
~?x<4
~$>end_of_macro
~+|~x=%1%|~?x>2|~$>end_of_macro|~?x<1|~$>end_of_macro|~t5=first|~?x=2|~t5=second
~/ .... creating temporary origin matrix containing zone numbers
3.21 / fill mo99 with zone numbers and set ms99 to zero
~+|1|y|mo99|y|p|zone numbers used by macro legimped|~?q=1|y|0|p|||n|2
~+|1|y|ms99|y|zero|zero|~?q=1|y|0|0|||2|q
3.23 / compute convolution for extracting %t5% leg impedance matrix
~/ .... extracting %t5% leg impedance matrix (%4%)
~+|1|%3%|*|ms99|n|+|n|mo99|==|n|%3%|1|*|n|%2%|~x+1|%%%x%%%||+
~+|%4%|y|~x-1|R%%%x%%%pq|legimped(%1%,%2%,%3%,%4%)|~?q=1|n|~?q=0|0|n||y|2|q
~/***************************************************************************
~/Macro legimped terminated normally. The resulting %t5% leg impedance
~/matrix is stored in matrix %4%.
~/***************************************************************************
~:end_of_macro
~o=6