spice simulator: power symbol a floating point separator

Bug #1624890 reported by Eldar Khayrullin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Unknown

Bug Description

If I use a power symbol with comma separator (like +3,3V) the simulator log shows:

Node Last Voltage Previous Iter
---- ------------ -------------
net-_c2-pad1_ 0 0
+3 0 0
3v 0 0
vc1#branch 0 0

Spice think about two nodes +3 and 3v.

Application: eeschema
Version: 201609180819+7176~55~ubuntu16.04.1-, release build
Libraries: wxWidgets 3.0.2
           libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.4.0-36-generic x86_64, 64 bit, Little endian, wxGTK
- Build Info -
wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8)
Boost: 1.58.0
Curl: 7.47.0
KiCad - Compiler: GCC 5.4.0 with C++ ABI 1009
        Settings: USE_WX_GRAPHICS_CONTEXT=OFF
                  USE_WX_OVERLAY=OFF
                  KICAD_SCRIPTING=ON
                  KICAD_SCRIPTING_MODULES=ON
                  KICAD_SCRIPTING_WXPYTHON=ON
                  BUILD_GITHUB_PLUGIN=ON
                  KICAD_USE_SCH_IO_MANAGER=OFF
                  KICAD_USE_OCE=ON

Revision history for this message
jean-pierre charras (jp-charras) wrote :

In net names, when they are used in spice simulator, there are a few constraints:
- some chars are not accepted, because they are separators in directives, for instance ,{}()
- AKAIK, but I can be wrong, only ASCII7 char set is allowed

Currently, only '(' and ')' are replaced by _, because unfortunately I used these char in default net names, and the spice netlist generator replaced these not allowed chars by _ since a long time.

I am not sure replacing not allowed chars in net names is a good idea.
It can create other issues.
An user who want to use spice simulator should know the spice constraints, and must comply and live with them.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

Maybe KiCad should to preprocess your own netlist to spice simulator constraints.
If KiCad replaced ',' by '.' it will be OK because KiCad now replaces ',' by '.' in Value fields.

I want to have one file that compliance to my standards and usable without modifications with simulator - it will be ideal.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

I perfectly understand what you want (I have the same problem in France).

My concern is the fact replacing not allowed chars in spice netlist by another chars can create conflicts (there is a risk to create duplicate net names)
This is very easy to do in Kicad code.
The question is more:
Should we do that?

"If KiCad replaced ',' by '.' it will be OK because KiCad now replaces ',' by '.' in Value fields":
This is not the same case:
This change just create strings (mainly values) compatible with spice requirements, and (AFAIK) cannot create conflicts.

Revision history for this message
Eldar Khayrullin (eldar) wrote :

I don't think that it is possible to have '+3.3V' and '+3,3V' nets or others same because commas and dots uses how floating-point separators.

tags: added: spice
removed: simulator
Revision history for this message
Jeff Young (jeyjey) wrote :

I looked into this and while we handle ',' to '.' conversions in numeric fields, the net names are strings. So you can in fact have a schematic with both 3.3V and 3,3V nets (and they are treated as distinct nets).

We could auto-convert those nets that don't produce collisions. But that leaves the results unpredictable.

Better would be to check for collisions with *any* nets needing conversion, and only convert if they are all clean. But there's still a level of unpredictability with that approach.

I'm going to bump this to a wishlist and see if it gets any traction with the user base as the number of folks using the SPICE integration increases.

Changed in kicad:
importance: Undecided → Wishlist
status: New → Triaged
tags: added: ngspice
removed: spice
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

KiCad bug tracker has moved to Gitlab. This report is now available here: https://gitlab.com/kicad/code/kicad/-/issues/2033

Changed in kicad:
status: Triaged → Expired
Changed in kicad:
importance: Wishlist → Unknown
status: Expired → New
Changed in kicad:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.