skrf.network.connect

skrf.network.connect(ntwkA, k, ntwkB, l, num=1)[source]

Connect two n-port networks together.

Connect ports k thru k+num-1 on ntwkA to ports l thru l+num-1 on ntwkB. The resultant network has (ntwkA.nports+ntwkB.nports-2*num) ports. The port indices (‘k’,’l’) start from 0. Ports of networks which have named ports (Network.port_names) can be given by name instead of by index. Port impedances are taken into account. When the two networks have overlapping frequencies, the resulting network will contain only the overlapping frequencies.

Note

The effect of mis-matched port impedances is handled by inserting a 2-port ‘mismatch’ network between the two connected ports. This mismatch Network is calculated with the impedance_mismatch() function.

Parameters:
  • ntwkA (Network) – network ‘A’

  • k (int or str) – starting port index on ntwkA ( port indices start from 0 ), or port name if ntwkA has named ports

  • ntwkB (Network) – network ‘B’

  • l (int or str) – starting port index on ntwkB, or port name if ntwkB has named ports

  • num (int) – number of consecutive ports to connect (default 1)

Returns:

ntwkC – new network of rank (ntwkA.nports + ntwkB.nports - 2*num)

Return type:

Network

See also

connect_s

actual S-parameter connection algorithm.

innerconnect_s

actual S-parameter connection algorithm.

innerconnect_s_lstsq

actual S-parameter connection algorithm using lstsq.

Examples

To implement a cascade of two networks

>>> ntwkA = rf.Network('ntwkA.s2p')
>>> ntwkB = rf.Network('ntwkB.s2p')
>>> ntwkC = rf.connect(ntwkA, 1, ntwkB,0)

Ports of networks with named ports can be given by name

>>> ntwkA.port_names
['in', 'out']
>>> ntwkC = rf.connect(ntwkA, 'out', ntwkB, 0)