Ngspice - µ versus u denominator

I played with http://ngspice.sourceforge.net/ngspice-eeschema.html#digi, which works fine, however I noticed that µ gets interpreted as part of the actual value in front.

E.g. 1µF does not equate to 1uF

Is there a known way to make ngspice to recognize this?

Then again 1000Ω versus 1k does appear to work correctly.

Traditionally ngspice requires ‘u’, if you want to express 10-6. Please see the ngspice manual chapt. 2.1.3 for a list of scale factors in ngspice.

µ is not recognized as a suitable multiplicator.

Much appreciate your input. Thank you.

Sounds like something maybe the KiCad netlist parser might be able to take care of if programmed correctly? Doesn’t it already have features to ignore that capital F since it means femto (e-15) in SPICE language? Doesn’t seem like a stretch that the converting of µ into u could be implemented too.

Traditionally, SPICEs (as far I used):
GIGA = 1e9
MEG = 1e6
k (K) = 1e3
m (M) = 1e-3
u = 1e-6

The not recognized letters are just ignored in the language. So:
V1 1 2 10mV --> voltage source between nodes 1 and 1 with the value “10e-3” in the nominal unit (the “V” is ignored such “Ω” in the example).

Also because this: a resistor 1000 = 1000Ω = 1000R = 1k = 1K. As far I know SPICE language is not case sensitive.

2 Likes

Agree about “µ” and good point about femto.
I think a conditional to ignore “F” as is the last letter in the capacitor value could be interesting.

If this was only consistent since µ obviously does not get ignored.

According to section 2.1.3 in the ngspice PDF, lower case f is defined as femto hence F can be used as ‘decorative’ denominator for Farad.

Then again while we are at it ‘a’ as in atto appears to be undefined.

What is it “µ” interpretation? (if not ignored; if ignored “1µF” should be equal to “1F”)

Nice, I didn’t know about the “F”/“f” difference in the interpretation. For most of users, it is common use “1R” / “1k” / “1kR” i for resistor but use “1u” / “1m” for capacitors, never using “f” (my experience with SPICE simulators in laboratory that I research and peoples from the academy).

The difference between u and µ is that 1µ in the Kicad simulation tool looks like a very large capacitor.

Going by the plot 1µ simulates somewhere in the range of 10000uF or so.

ngspice obviously is not equipped to interpret special characters.

Yes, I think this, all not “classical” letters/symbol are ignored. So 1µF is 1F, as far I remember to every SPICE that I used.

That would make sense since to simulator would produce a straight line while in the milli-seconds range.

… and bingo 0.000001µF equates to 1uF

F is the correct abbreviation for the derived SI unit Farad. It is capitalized because it is named after a person. f is the correct abbreviation for the metric prefix femto meaning 10−15. The greek lowercase letter mu µ is the correct abbreviation for the metric prefix micro meaning 10-6, but because it can be difficult to type on many keyboards (or encoded in ASCII) the latin lowercase letter u is often substituted. For all the gory details, please refer to these Wikipeda pages for SI units and metric prefixes.

All other usage of abbreviations that differ than the SI system (for SI units) and metric prefixes should be discouraged. It seems that Spice doesn’t recognize non ASCII characters, thus the mu letter is lost to the ether. In this case I think an auto-translation of the letter mu to the letter u should be performed when sending the schematic data to ngspice.
</soapbox>

You misunderstood what I said. SPICE is case-insensitive, and always has been since the original Berkley version. That section in the ngspice manual does a poor job of explaining this and it should be re-written to make it much more clear. F and f mean the same thing in SPICE. Any manipulation involved with translating letters must be done by KiCad while it’s generating the netlist to export to ngspice for computation. Like I mentioned before, the capital F thing can be handled by checking this box in the simulator’s settings. It’s possible for the developers to make this box also handle the mu vs u thing too.

I never have these problems because I’ve used LTspice for such a long time that I follow all the same SPICE naming rules when making my actual designs within EAGLE or KiCad. I never use units for components and I never use special characters. I even write out MEG everytime. However, I appreciate this auto-translating feature for people who want to integrate SPICE with their physical designs. It’s not practical for them to learn and adapt to all the goofy SPICE language rules just to make that happen.

Now someone just needs to write a bug report for this…

Agreed, though a tick on the ‘Adjust …’ option does nothing for µ as of 5.1.2.

Nice @Ste.
Since you, @jos, see this. Do you mind to report at https://bugs.launchpad.net/kicad/, for the devolopers?

Going to have a look at the source code, and based on the outcome I’ll write a request.

This case could be particularly tricky since not every characterset contains a µ, and not every character set that contains a µ will display correctly in Kicad. In some cases µ displays correctly in Eeschema but not in Pcbnew. Go figure.

Currently the µ from a Liberation Sans character set displays correctly in both.