## Tuesday, April 30, 2013

### Online Transmission Line Simulation

This is a finite element simulation of the Telegrapher's Equations. I outlined the details of the simulation in my last post and had a SciPy implementation, and this time I've created a javascript port with user adjustable params. The simulation is only able to handle a point-to-point transmission line with a pulse step source. The termination resistor R1 is located at the source. There are 3 pre-defined scenarios which demonstrate issues with various termination resistances. I would recommend you read my other post for details on how the simulation works.

A custom scenario as defined by the user.

The termination resistor R1 is too small (in this case, 0.25*ideal). The initial energy injection into the transmission line is too large. When the wave reaches the target R2, most of the energy is reflected back towards the source. Due to superposition this causes the line voltage to be approximately double the initial wave. Some of the energy is rejected back at the source, but the wave will continue to bounce back and fourth much longer than desirable. This is similar to an under-damped system.

The termination resistor R1 is too large (in this case, 4*ideal). The initial energy injection into the transmission line is too small. The wave must travel to the target and back to the source before any additional energy injection will increase the line voltage, taking much longer than necessary to reach the desired level. This is similar to an over-damped system.

The termination resistor R1 is at the ideal value. The iniial energy injection is capable of propogating a wave with half the source voltage. When the wave reaches the high impedence target, nearly all of that energy is reflected and due to superposition the line voltage is at the desired source voltage. This is the quickest a signal can reach the desired level for a given transmission line. This is similar to a critically damped system.

Voltage Current

Legend: Red is the simulation with the given parameters. Green is the simulation with the same parameters except R1 is set to the ideal value (R1 = Zeq). The blue line shows the source voltage level.

Von Voff tRise tFall V V s s s s Ω s Ω Ω s
 Show Ideal Termination Show Source

# Simulation Parameter Notes

## Parameter Entry

Changing of parameter fields is semi-automatic. For those familiar with client-side web development, I used the default onchange event handler. In Chrome and Firefox you can type enter or leaving the text field to force a parameter update. In Internet Explorer I did not have any luck pressing enter and had to make sure the keyboard focus left the textbox before an update happens.

Most parameters will require a simulation reset. This is taken care of automatically, just be aware that this is why after changing a parameter the simulation time may jump back to t=0.

## Real Number Scalar postfix

Many of the paremeter fields allow real numbers. These fields allow various metric scalar postfixes. The allowed fields have a similar syntax to SPICE and are case-insensitive. The allowed scalar fields:

• f: 1e-15
• p: 1e-12
• n: 1e-9
• u: 1e-6
• m: 1e-3
• k: 1e3
• meg: 1e6
• g: 1e9

## Input Error Checking

There is basic error checking. In general non-zero or non-negative numbers must be used, though some fields allow negative numbers (i.e. Von and Voff). Entering an invalid number will revert the field back to the last known good value. There is no protection against using parameters which will cause the simulation to be inaccurate or go unstable.

## Performance and other Tech Issues

I am utilizing some fairly new features which were introduced with HTMl 5. Namely, I am using the canvas element for drawing animated plots. In general it's a good idea to use an up-to-date browser as these have many improvements including better security, faster performance, and more features. I have tested the simulation in Firefox 19.0.2, Google Chrome 25.0.1364.172 m, and Internet Explorer 9.0.8112.16421.

On my laptop (Intel i5-430m processor) I had no problems with performance when running with up to 2048 elements. Increasing the number of elements or time steps per display update will increase the processing load, though the effect isn't exactly linear. Reduce the number of elements too far and the simulation results won't be accurate. I would recommend at least 32 if not 64 elements. To get the simulation to time step faster without increasing processor load significantly increase dt. This is the actual simulation time step, and increasing it too much will degrade stability.

1. Great post, wondering though what are the units on the x-axis? mm? meters?

2. It's a normalized against the wave propagation speed and delay time, so unit-less. x = x'/(c*tDelay), where x is the normalized position, x' is un-normalized position, c is the propagation speed, and tDelay is the delay time.

3. Awesome visualization!

4. Very useful, well done. Thank You.

5. helloworld922, can you pls make another simulation where capacitor will be added in series to R2?
Hence the termination on the receiver side will be series connection of a resistor (R2) and capacitor.

6. It's not too difficult to modify the source code, but for more serious work you're probably better off using an actual circuit simulator. The basic explanation of how the simulator is implemented can be found here: http://helloworld922.blogspot.com/2013/04/transmission-line-simulation.html

If you want to modify the source code, you're welcome to. It's not too hard to accomplish what you want.