# Why does this circuit start at a very high value?

I have a capacitor connected in series with a current source. But the voltage remains at 1TV. Why is it not increasing?

Also, in general, if I don't want to connect the other end of the current source to Gnd, how do I leave it so that it supplies enough voltage to allow the current source to operate correctly? Can I tie it to any voltage?

• 1TV isn't high? – user133493 Jul 19 '18 at 4:51
• Its not increasing after that. It should be a linear value(integrate the current through it) – loader Jul 19 '18 at 4:55
• @loader 1 TV is a very high value. It's 1,000,000,000,000 V. – duskwuff -inactive- Jul 19 '18 at 7:08
• For a sense of scale, 1TV is a high enough voltage to strike an arc over 300km long through clear air. – J... Jul 19 '18 at 16:11

It's pretty simple. You forgot to set "UIC" in the .TRAN statement. Also, you need some kind of resistance at the joint node. (Not critical, but it removes some errors.) This is because you have an "all-frequency infinite impedance" (the current source) on one side and a "DC infinite impedance" on the other side. There's no galvanic path indicated to the node. So it helps to add one (namely, $R_1$.)

Here you can see the "uic" added to the .tran statement. Just click on that on your own schematic. This prevents LTspice from trying to find a default "operating point" before starting the simulation.

It's really no more complicated than that.

• For someone that doesn't know LTspice, what do the terms "uic" and ".TRAN statement" mean? – MichaelK Jul 19 '18 at 12:19
• @MichaelK UIC: "Normally, a DC operating point analysis is performed before starting the transient analysis. This directive suppresses this initialization." If you don't know what .TRAN is, you don't use spice much. It's not a unique "card" to LT's version. All spice programs accept it, use it, and require it if you want a non-linear transient run. – jonk Jul 19 '18 at 14:59
• "If you don't know what .TRAN is, you don't use spice much" - Yep, you got me :) Thanks for the explanation – MichaelK Jul 19 '18 at 16:20

In theory an ideal voltage source can provide infinite current, and an ideal current source infinite voltage. But in the real world (and even in a computer model) it isn't like that. There is some limit to the hardware (or the computational model). For a current source this is called its "compliance".

It looks like you just found the limits of the simulated voltage.

I don't think you have a current source and a capacitor, I think you have a simulation of a current source and capacitor.

If you had a real current source and capacitor, you would see them stop at much less than 1 TV. I would be challenged on the bench to measure more than 10s of kV before some form of breakdown. While industry measures MV routinely, they need to be very careful about it. There's still 5 or 6 orders of magnitude to go from that before you get to TV.

If I was writing a simulator, I may well limit my voltages to 1.000 TV, just because floating point arithmetic does have a limit, so it's got to stop somewhere. 1 TV is so much, much higher than anything anybody would want physically in a circuit, that it seems a not unreasonable arbitrary limit.

But it might be something else, I've not tried it on LTSPICE yet. It might be @replete's answer, that you've messed up elsewhere. In which case, once you've got it running, it might be fun to explore whether the simulator does have an arbitrary limit lower than that of the number system, and whether it just falls over, or generates sensible errors to the user when the limit is reached.

If I had a criticism, it's that 1 TV is possibly too high. Much more important that the absolute limit of number representation, which for IEE754 doubles is around $10^{308}$, is the dynamic range. When a simulator solves the circuit matrix, if the ratio of numbers in it approaches the dynamic range of the numbers used, about 16 decimal places for IEE754 doubles, the solution becomes ill-conditioned and the results meaningless. $10^{12}$ is very close to that 16 digits limit if we want to measure even integer volts, let alone mV or uV.

If you want a simulator that goes above 1 TV, there are two ways to do it. (1) write your own, you may need to use a bignum package to get adequate dynamic range. (2) do it analytically, 1 TV + some increment d = 1+d TV.

(edit)

You've commented that But at least initially I should be able to see the voltage increasing linearly if a step is applied. I cant see that.

A standard way to probe what arbitrary magnitude limit or ratio limit is being used in a system is to set it up so that it effectively computes big_number += small_increment. When the computation agrees with what you'd expect analytically, you're still below the limit. When big_number stops increasing, you've hit a limit, whether precision or absolute you don't know yet. Now change the size of small_increment. If the limit is proportional to small_increment, it's precision, if it's independent, it's absolute.

(/edit)

• But atleast initially I should be able to see the voltage increasing linearly if a step is applied. I cant see that – loader Jul 19 '18 at 5:11
• Actually IEEE-754 floating-point arithmetic does not have a limit; it can represent infinity. As for "integer volts", that doesn't make sense. Volts are not a discrete unit. Even on a 300kV line, a few volt is random noise which can be ignored. That means 6 digits (single precision) is in fact sufficient. – MSalters Jul 19 '18 at 12:43
• @MSalters That fact that IEE-754 has a representation of +/-infinity doesn't mean it doesn't have a limit to its arithmetic: there's a very large gap between 10^308 and +Inf. that you won't be able to work in. – TripeHound Jul 19 '18 at 13:53
• @MSalters Check out my 'if I had a criticism' paragraph. Dynamic range is important too, otherwise you get ill-conditioned matrices that solve only very noisily. Often you need dynamic range in the number system orders of magnitude more than the dynamic range of the components that go into the matrix. – Neil_UK Jul 19 '18 at 16:01