Connecting Networks

scikit-rf supports the connection of arbitrary ports of N-port networks. It accomplishes this using an algorithm called sub-network growth[1], available through the function connect(). Note that this function takes into account port impedances. If two connected ports have different port impedances, an appropriate impedance mismatch is inserted. This capability is illustrated here with situations often encountered.

import skrf as rf

Cascading 2-port and 1-port Networks

A common problem is to connect two Networks one to the other, also known as cascading Networks, which creates a new Network. The figure below illustrates sile simple situations, where the port numbers are identified in gray:




Let’s illustrate this by connecting a transmission line (2-port Network) to a short-circuit (1-port Network) to create a delay short (1-port Network):


Cascading Networks being a frequent operation, it can done conveniently through the ** operator or with the cascade function:

line =  # 2-port
short =  # 1-port

delayshort = line ** short  # --> 1-port Network
1-Port Network: 'wr2p2,line',  330.0-500.0 GHz, 201 pts, z0=[50.+0.j]

or, equivalently using the cascade() function:

delayshort2 = rf.cascade(line, short)
print(delayshort2 == delayshort)  # the result is the same

It is of course possible to connect two 2-port Networks together using the connect() function. The connect() function requires the Networks and the port numbers to connect together. In our example, the port 1 of the line is connected to the port 0 of the short:

delayshort3 = rf.connect(line, 1, short, 0)
print(delayshort3 == delayshort)

One often needs to cascade a chain Networks together:

24890ce9206a4c9f9eecb16e24e88d4e or, 7e5130d5e9f346608f44567986060c39

which can be realized using chained ** or the convenient function cascade_list:

line1 =  # 2-port
line2 =  # 2-port
line3 =  # 2-port
line4 =  # 2-port
short =  # 1-port

chain1 = line1 ** line2 ** line3 ** line4 ** short

chain2 = rf.cascade_list([line1, line2, line3, line4, short])

print(chain1 == chain2)

Cascacing 2N-port Networks

The cascading operator ** also works for to 2N-port Networks, width the following port scheme:


It also works for multiple 2N-port Network. For example, assuming you want to cascade three 4-port Network ntw1, ntw2 and ntw3, you can use:

resulting_ntw = ntw1 ** ntw2 ** ntw3

This is illustrated in this example on balanced Networks.

Cascading Multi-port Networks

To make specific connections between multi-port Networks, two solutions are available, which mostly depends of the complexity of the circuit one wants to build:

  • For reduced number of connection(s): the connect() function

  • For advanced connections between many arbitrary N-port Networks, the Circuit object is more relevant since it allows defining explicitly the connections between ports and Networks. For more information, please refer to the Circuit documentation.

As an example, terminating one of the port of an a 3-port Network, such as an ideal 3-way splitter:


can be done like:

tee =

To connect port 1 of the tee, to port 0 of the delay short,

terminated_tee = rf.connect(tee, 1, delayshort, 0)
2-Port Network: 'tee',  330.0-500.0 GHz, 201 pts, z0=[50.+0.j 50.+0.j]

In the previous example, the port #2 of the 3-port Network tee becomes the port #1 of the resulting 2-port Network.

Multiple Connections of Multi-port Networks

Keeping track of the port numbering when using multiple time the connect function can be tedious (this is the reason why the Circuit object can be simpler to use).

Let’s illustrate this with the following example: connecting the port #1 of a tee-junction (3-port) to the port #0 of a transmission line (2-port):


To keep track of the port scheme after the connection operation, let’s change the port characteristic impedances (in red in the figure above):

tee.z0 = [1, 2, 3]
line.z0 = [10, 20]
# the resulting network is:
rf.connect(tee, 1, line, 0)
3-Port Network: 'tee',  330.0-500.0 GHz, 201 pts, z0=[ 1.+0.j 20.+0.j  3.+0.j]


[1] Compton, R.C.; , “Perspectives in microwave circuit analysis,” Circuits and Systems, 1989., Proceedings of the 32nd Midwest Symposium on , vol., no., pp.716-718 vol.2, 14-16 Aug 1989. URL:

[ ]: