Languages

CommunityCategory: XMODELThe ‘switch’ primitive seems to have leakage
SA Support Team Staff asked 3 years ago

It appears that the 'switch' primitive with the `INFINITY off-resistance does not work as an ideal switch and has some leakage current. Shown below is a simple example illustrating it. A 'switch' primitive is connecting between a 1.0V DC input and a capacitor and it has the parameter 'R0' value of `INFINITY and 'R1' value of 0.01. When the 'ctrl' input is 1, the capacitor voltage is charged to 1.0V as expected. However, when the 'ctrl' input becomes 0, the capacitor voltage slowly discharges from 1.0V, rather than staying at 1.0V. Is there any leakage path I am not aware of? How can I realize an ideal switch?

2 Answers
Best Answer
SA Support Team Staff answered 3 years ago

Your observation is correct. When a 'switch' primitive is off with `INFINITY resistance, XMODEL assumes a finite conductance of 1e-9 between each of its terminals and `ground. In other words, a 1Gohm resistor is added between each terminal and `ground. In your example, the capacitor voltage would exponentially decay towards 0 at a time constant of R*C=1G*10f=10us.

XMODEL adds these resistances to improve the stability of the circuit-level simulation. In fact, SPICE does the same and calls it the GMIN resistances. For most cases, 1Gohm is a very large resistance and effectively equivalent to an open circuit. In your case, you are expecting a 10fF capacitor to hold a voltage over 1us period, which is actually not likely in practice.

If you do not want these GMIN resistances, you can set the off-resistance with -`INFINITY instead of `INFINITY. Then the 'switch' primitive will work as an ideal switch without the GMIN resistances added. This feature is supported since the XMODEL 2021.05 release. The figures below show the simulated waveforms when the R0 value of the 'switch' primitive is changed to -`INFINITY. The capacitor voltage stays at 1V as you expect.

However, please use -`INFINITY sparingly-- as it may cause numerical instability in the simulation results, especially for circuits that use a large network of switches.

SA Support Team Staff answered 3 years ago

As of XMODEL 2021.09 Release, the minimum conductance value (GMIN) is adjusted to 1e-11, which corresponds to a resistance value of 100Gohm.

SA Support Team Staff asked 3 years ago

'switch' primitive의 off 저항값을 `INFINITY로 설정하여도 이상적인 스위치로 동작하지 않고 누설전류가 발생하는 것 같습니다. 아래는 이 현상을 보여주는 간단한 예제입니다. 이 예제에서는 'switch' primitive가 1.0V DC 입력소스와 커패시터 사이를 연결하고 있고, 파라메터 R0 값은 `INFINITY, 그리고 R1 값은 0.01을 갖고 있습니다. 스위치를 제어하는 'ctrl' 신호가 1일때는 예상대로 커패시터의 전압이 1.0V로 충전됩니다. 하지만, 'ctrl' 신호가 0이 되면, 커패시터 전압이 그대로 1.0V에 머무는 대신, 서서히 방전되는 파형을 확인할 수 있습니다. 제가 모르는 누설전류가 더 있는 것인지요? 이상적인 스위치를 모델링하려면 어떻게 해야 하나요?

2 Answers
Best Answer
SA Support Team Staff answered 3 years ago

Your observation is correct. When a 'switch' primitive is off with `INFINITY resistance, XMODEL assumes a finite conductance of 1e-9 between each of its terminals and `ground. In other words, a 1Gohm resistor is added between each terminal and `ground. In your example, the capacitor voltage would exponentially decay towards 0 at a time constant of R*C=1G*10f=10us.

XMODEL adds these resistances to improve the stability of the circuit-level simulation. In fact, SPICE does the same and calls it the GMIN resistances. For most cases, 1Gohm is a very large resistance and effectively equivalent to an open circuit. In your case, you are expecting a 10fF capacitor to hold a voltage over 1us period, which is actually not likely in practice.

If you do not want these GMIN resistances, you can set the off-resistance with -`INFINITY instead of `INFINITY. Then the 'switch' primitive will work as an ideal switch without the GMIN resistances added. This feature is supported since the XMODEL 2021.05 release. The figures below show the simulated waveforms when the R0 value of the 'switch' primitive is changed to -`INFINITY. The capacitor voltage stays at 1V as you expect.

However, please use -`INFINITY sparingly-- as it may cause numerical instability in the simulation results, especially for circuits that use a large network of switches.

SA Support Team Staff answered 3 years ago

As of XMODEL 2021.09 Release, the minimum conductance value (GMIN) is adjusted to 1e-11, which corresponds to a resistance value of 100Gohm.