I am simulating the same circuit on both simulator with different results.
Please help me to know who is the right result and what to adjust to have the same result.
Thanks in advance.
This is not the content of the Kicad forum, because Kicad is not responsible for the simulation operation. In fact, it is ngspice that does the simulation work.
According to my thoughts, the component models used by ngspice and ltspice are different, so it will lead to different results.
If the component model files of the two are replaced with the same, the comparison is meaningful.
Edit:
You may be able to find the answer on the ngspice forum.
I suppose generating is the right result.
To investigate what is going on you should behave like when checking real circuit. You should check what is at all important points. For example what is at pin 5. I donât know - may be in MOS 555 versions the internal divider is made with high value resistors and voltage at pin 5 rises more slowly that you expect.
.model D1N4148 D(Is=2.682n N=1.836 Rs=.5664 Ikf=44.17m Xti=3 Eg=1.11 Cjo=4p
+ M=.3333 Vj=.5 Fc=.5 Isr=1.565n Nr=2 Bv=100 Ibv=100u Tt=11.54n)
*$
*
*
* BV, IBV, XTI, EG HAVE NOT BEEN EXTRACTED AND ARE SET TO DEFAULT VALUES.
*
* MEASURED TRR = 10.40NS, SIMULATED TRR = 5.373NS.
*
* RAD: PRERAD
* TEMP= 125
.MODEL D1N4148/125C D (
+ IS = 6.42601E-9
+ RS = 0.7520202
+ N = 1.8485649
+ TT = 6.303E-9
+ CJO = 1.75198E-12
+ VJ = 0.4
+ M = 0.2289422
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.8991
+ BV = 1E5
+ IBV = 1.0E-10
+ )
*$
*
* GENERIC FUNCTIONAL EQUIVALENT = 1N4148
* MANUFACTURER = MICROSEMI
* TYPE: DIODE
* SUBTYPE: SWITCHING
* THE FOLLOWING SECTION CONTAINS 3 PARAMETER SETS FOR NON-IRRADIATED
* DEVICES AT VARYING TEMPERATURES OF THE 1N4148-1JTXV DIODE.
* THIS MODEL CAN BE USED FOR ALL OF THE FOLLOWING DEVICES:
* 1N4148
* 1N4148-1
* 1N4148-1JTXV
* THE ROOM TEMPERATURE PRE-RAD PARAMETER SET SIMULATES NEARLY
* IDENTICALLY TO THE -55 AND THE 125 DEG C WHEN .TEMP IS USED. THIS
* PARAMETER SET CAN BE USED AT ALL TEMPERATURES BETWEEN -55 AND 125 DEG
* C.
*
* PARAMETER SETS EXTRACTED FROM MEASURED DATA
*
*** CAUTION: THE MEASURED TRR AND THE PSPICE CIRCUIT SIMULATED TRR ARE
* DIFFERENT. THIS COULD POTENTIALLY LEAD TO ERRORS IN CIRCUIT SIMULATIONS
* IF USED AS A RECTIFIER OR SWITCHING DIODE.
*** CAUTION: USE ONLY AT TEMPERATURE SPECIFIED. ANY DEVIATION FROM THIS
* TEMPERATURE WILL PRODUCE INCORRECT RESULTS.
*
* BV, IBV, XTI, EG HAVE NOT BEEN EXTRACTED AND ARE SET TO DEFAULT VALUES.
*
* MEASURED TRR = 4.681NS, SIMULATED TRR = 6.544NS.
* RAD: PRERAD
* TEMP= 27
.MODEL D1N4148/27C D (
+ IS = 1.27106E-8
+ RS = 0.7546332
+ N = 1.9215823
+ TT = 3.679E-9
+ CJO = 1.72434E-12
+ VJ = 0.3026211
+ M = 0.2
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.998001
+ BV = 1E5
+ IBV = 1.0E-10
+ )
*$
*
* 1N4148
* GENERIC FUNCTIONAL EQUIVALENT = 1N4148
* MANUFACTURER = MICROSEMI
* TYPE: DIODE
* SUBTYPE: SWITCHING
* THIS FILE CONTAINS 3 MODELS AT VARIOUS RADIATION LEVELS OF THE
* 1N4148-1JTXV DIODE.
* THIS MODEL CAN BE USED FOR ALL OF THE FOLLOWING DEVICES:
* 1N4148
* 1N4148-1
* 1N4148-1JTXV
* THE ROOM TEMPERATURE PRE-RAD PARAMETER SET SIMULATES NEARLY
* IDENTICALLY TO THE -55 AND THE 125 DEG C WHEN .TEMP IS USED. THIS
* PARAMETER SET CAN BE USED AT ALL TEMPERATURES BETWEEN -55 AND 125 DEG C.
*
* PARAMETER SETS EXTRACTED FROM MEASURED DATA
*
*
*** CAUTION: THE MEASURED TRR AND THE PSPICE CIRCUIT SIMULATED TRR ARE
* DIFFERENT. THIS COULD POTENTIALLY LEAD TO ERRORS IN CIRCUIT SIMULATIONS IF
* USED AS A RECTIFIER OR SWITCHING DIODE.
*
*** CAUTION: USE ONLY AT TEMPERATURE SPECIFIED. ANY DEVIATION FROM THIS
* TEMPERATURE WILL PRODUCE INCORRECT RESULTS.
*
*
*
* XTI, EG HAVE NOT BEEN EXTRACTED AND ARE SET TO DEFAULT VALUES.
*
* MEASURED TRR = 5.99NS, SIMULATED TRR = 5.79NS.
*
*
* RAD: 5E12
* TYPE: NEUTRON
* TEMP: 27
*
*
.SUBCKT D1N4148/27C/RAD1 99 2
D1 99 2 DFOR
C1 2 99 1.2202E-12
.MODEL DFOR D (
+ IS = 1.04734E-8
+ RS = 0.7505
+ N = 1.873917
+ TT = 7.2E-9
+ CJO = 2.34983E-13
+ VJ = 0.4
+ M = 2
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.9
+ BV = 165
+ IBV = 1E-6
+ )
.ENDS
*$
*
* XTI, EG HAVE NOT BEEN EXTRACTED AND ARE SET TO DEFAULT VALUES.
*
* MEASURED TRR = 5.67NS, SIMULATED TRR = 5.61NS.
*
*
* RAD: 2E13
* TYPE: NEUTRON
* TEMP: 27
*
*
.SUBCKT D1N4148/27C/RAD2 99 2
D1 99 2 DFOR
C1 2 99 1.30456E-12
.MODEL DFOR D (
+ IS = 6.20257E-9
+ RS = 0.7388511
+ N = 1.805135
+ TT = 7.3E-9
+ CJO = 3.05464E-13
+ VJ = 0.4
+ M = 1.824741
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.8991
+ BV = 163
+ IBV = 5E-6
+ )
.ENDS
*$
*
* MEASURED TRR = 3.4NS, SIMULATED TRR = 1.521NS.
*
* RAD: 2E14
* TYPE: NEUTRON
* TEMP= 27
*
.SUBCKT D1N4148/27C/RAD3 99 2
D1 99 2 DFOR
C1 2 99 1.34841E-12
.MODEL DFOR D (
+ IS = 7.51054E-9
+ RS = 1.672287
+ N = 1.864477
+ TT = 1E-9
+ CJO = 1.652E-13
+ VJ = 0.3619
+ M = 1.721
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.85
+ BV = 148
+ IBV = 2E-6
+ )
.ENDS
*$
*
* BV, IBV, XTI, EG HAVE NOT BEEN EXTRACTED AND ARE SET TO DEFAULT VALUES.
*
* MEASURED TRR = 3.379NS, SIMULATED TRR = 3.062NS.
*
* RAD: PRERAD
* TEMP= -55
.MODEL D1N4148/-55C D (
+ IS = 1.26351E-8
+ RS = 0.7600063
+ N = 1.953465
+ TT = 2.424E-9
+ CJO = 1.72434E-12
+ VJ = 0.3026211
+ M = 0.2
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.998001
+ BV = 1E5
+ IBV = 1.0E-10
+ )
*$
*
* GENERIC FUNCTIONAL EQUIVALENT = 1N4148
* TYPE: DIODE
* SUBTYPE: SWITCHING
* THIS FILE CONTAINS 1 MODEL THAT CAN BE USED AS A TEMPERATURE TRACKING
* MODEL FROM -55 TO 125 DEG C.
* THIS MODEL CAN BE USED FOR ALL OF THE FOLLOWING DEVICES:
* 1N4148
* 1N4148-1
* 1N4148-1JTXV
* THE ROOM TEMPERATURE PRE-RAD PARAMETER SET SIMULATES NEARLY
* IDENTICALLY TO THE -55 AND THE 125 DEG C WHEN .TEMP IS USED. THIS
* PARAMETER SET CAN BE USED AT ALL TEMPERATURES BETWEEN -55 AND 125 DEG
* C.
* PARAMETER MODELS EXTRACTED FROM MEASURED DATA.
*
* MEASURED TRR = 4.681NS, SIMULATED TRR = 6.544NS.
*
*** CAUTION: THE MEASURED TRR AND THE PSPICE CIRCUIT SIMULATED TRR ARE
* DIFFERENT. THIS COULD POTENTIALLY LEAD TO ERRORS IN CKT. SIMULATIONS IF
* USED AS A RECTIFIER OR SWITCHING DIODE
*
* BV, IBV, XTI, EG HAVE NOT BEEN EXTRACTED AND ARE SET TO DEFAULT VALUES.
*
* RAD: PRERAD
* TEMP= 27
.MODEL D1N4148/TEMP D (
+ IS = 1.27106E-8
+ RS = 0.7546332
+ N = 1.9215823
+ TT = 3.679E-9
+ CJO = 1.72434E-12
+ VJ = 0.3026211
+ M = 0.2
+ EG = 1.11
+ XTI = 3
+ KF = 0
+ AF = 1
+ FC = 0.998001
+ BV = 1E5
+ IBV = 1.0E-10
+ )
*$
The diodes in your circuit all have reverse polarity compared to your circuit diagram.
For example: netlist
D1 Net-_C2-Pad1_ Net-_D1-Pad2_ D1N4148
Anode comes first and is connected to C2 according to the netlist. This is wrong.
It is a pity that the Eeschema library designers choose to name the cathode as pin 1, contrary to all spices, where anode comes first. So you have to set an alternate node sequence
2 1
to your diodes.
Our select the generic diode from library Simulation_SPICE.
It is a pity that the Eeschema library designers choose to name the cathode as pin 1, contrary to all spices, where anode comes first. So you have to set an alternate node sequence 2 1 to your diodes.
I would rather say it is a pity that the decades-old SPICE convention (pin1=anode) is in conflict with the real-component and IPC convention that pin1=cathode. Both conventions are entrenched and practically impossible to change. Kicad being primarily a layout package, the IPC convention seems to make more sense if you have to pick one.
Periodically it gets suggested that diode symbols in the library get shipped with the alternate node sequence preset so they work for both simulation and layout, but I donât know if there are drawbacks to that approach.
IIRC, itâs just because they followed a different industry standard for footprints, when I mentioned it before. Spice_Node_Sequence="2 1" could easily be added to the official D diode symbol⌠Maybe they would listen to you?
Itâs not so simple. Changing such a thing will break all the existing schematics in which that diode is used. This is a result of the way KiCad V5.1.x and earlier works because schematic symbols are linked directly from the libraries.
In KiCad V6 schematic symbols are only updated from the data from the libraries then you order KiCad to do so.
Why would it break all? Spice_Node_Sequence only affects simulations and no PCBs, and I would guess most who donât want to have a wrong simulation schematic have replaced Device:D with pspice:DIODE or Simulation_SPICE:DIODE, which are not compatible with PCBs, (or my Elektuur:D or Generic:D for that matter, that are) after being bitten⌠I think Spice_Node_Sequence defined in the schematic is not overwritten by Spice_Node_Sequence defined in the symbol?
In LTspice you have not defined what type of diode you are using. It just says âDâ. Please right click on âDâ and choose a diode, i.e. 1N4148. If not, you are using âthe defaultsâ and the result can vary very much in result.
Maybe not so much of a difference in result with this particular netlist. But if you place a NMOS in LTspice and do not choose what transistor model you will be using the result of the simulation will most likely differ very much from real world. (A Vt of 1V or 6V is a huge difference if you drive the gate directly from the uC.)