Add diode model to rectifier demo (ngspice-32 fix)

Patch by Holger Vogt

Fixes https://gitlab.com/kicad/code/kicad/issues/4453
This commit is contained in:
Johannes Maibaum 2020-06-06 13:59:30 +02:00 committed by Wayne Stambaugh
parent 9d78aa604f
commit 48150389b1
3 changed files with 240 additions and 230 deletions

View File

@ -0,0 +1,2 @@
*generic diode model
.model 1N4148 D

View File

@ -1,101 +1,101 @@
EESchema-LIBRARY Version 2.4 EESchema-LIBRARY Version 2.4
#encoding utf-8 #encoding utf-8
# #
# C # rectifier_schlib_C
# #
DEF C C 0 10 N Y 1 F N DEF rectifier_schlib_C C 0 10 N Y 1 F N
F0 "C" 25 100 50 H V L CNN F0 "C" 25 100 50 H V L CNN
F1 "C" 25 -100 50 H V L CNN F1 "rectifier_schlib_C" 25 -100 50 H V L CNN
F2 "" 38 -150 50 H V C CNN F2 "" 38 -150 50 H V C CNN
F3 "" 0 0 50 H V C CNN F3 "" 0 0 50 H V C CNN
$FPLIST $FPLIST
C? C?
C_????_* C_????_*
C_???? C_????
SMD*_c SMD*_c
Capacitor* Capacitor*
Capacitors_ThroughHole:C_Radial_D10_L13_P5 Capacitors_ThroughHole:C_Radial_D10_L13_P5
Capacitors_SMD:C_0805 Capacitors_SMD:C_0805
Capacitors_SMD:C_1206 Capacitors_SMD:C_1206
$ENDFPLIST $ENDFPLIST
DRAW DRAW
P 2 0 1 20 -80 -30 80 -30 N P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 150 110 D 40 40 1 1 P X ~ 1 0 150 110 D 40 40 1 1 P
X ~ 2 0 -150 110 U 40 40 1 1 P X ~ 2 0 -150 110 U 40 40 1 1 P
ENDDRAW ENDDRAW
ENDDEF ENDDEF
# #
# D # rectifier_schlib_D
# #
DEF D D 0 40 N N 1 F N DEF rectifier_schlib_D D 0 40 N N 1 F N
F0 "D" 0 100 50 H V C CNN F0 "D" 0 100 50 H V C CNN
F1 "D" 0 -100 50 H V C CNN F1 "rectifier_schlib_D" 0 -100 50 H V C CNN
F2 "" 0 0 50 H V C CNN F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN F3 "" 0 0 50 H V C CNN
$FPLIST $FPLIST
Diode_* Diode_*
D-Pak_TO252AA D-Pak_TO252AA
*SingleDiode *SingleDiode
*_Diode_* *_Diode_*
*SingleDiode* *SingleDiode*
$ENDFPLIST $ENDFPLIST
DRAW DRAW
P 2 0 1 6 -50 50 -50 -50 N P 2 0 1 6 -50 50 -50 -50 N
P 3 0 1 0 50 50 -50 0 50 -50 F P 3 0 1 0 50 50 -50 0 50 -50 F
X K 1 -150 0 100 R 50 50 1 1 P X K 1 -150 0 100 R 50 50 1 1 P
X A 2 150 0 100 L 50 50 1 1 P X A 2 150 0 100 L 50 50 1 1 P
ENDDRAW ENDDRAW
ENDDEF ENDDEF
# #
# GND # rectifier_schlib_GND
# #
DEF GND #PWR 0 0 Y Y 1 F P DEF rectifier_schlib_GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN F0 "#PWR" 0 -150 50 H I C CNN
F1 "GND" 0 -123 30 H V C CNN F1 "rectifier_schlib_GND" 0 -123 30 H V C CNN
F2 "" 0 0 60 H V C CNN F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN F3 "" 0 0 60 H V C CNN
DRAW DRAW
P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N P 6 0 1 0 0 0 0 -50 50 -50 0 -100 -50 -50 0 -50 N
X GND 1 0 0 0 D 20 30 1 1 W N X GND 1 0 0 0 D 20 30 1 1 W N
ENDDRAW ENDDRAW
ENDDEF ENDDEF
# #
# R # rectifier_schlib_R
# #
DEF R R 0 0 N Y 1 F N DEF rectifier_schlib_R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN F0 "R" 80 0 50 V V C CNN
F1 "R" 0 0 50 V V C CNN F1 "rectifier_schlib_R" 0 0 50 V V C CNN
F2 "" -70 0 50 V V C CNN F2 "" -70 0 50 V V C CNN
F3 "" 0 0 50 H V C CNN F3 "" 0 0 50 H V C CNN
$FPLIST $FPLIST
R_* R_*
Resistor_* Resistor_*
$ENDFPLIST $ENDFPLIST
DRAW DRAW
S -40 -100 40 100 0 1 10 N S -40 -100 40 100 0 1 10 N
X ~ 1 0 150 50 D 50 50 1 1 P X ~ 1 0 150 50 D 50 50 1 1 P
X ~ 2 0 -150 50 U 50 50 1 1 P X ~ 2 0 -150 50 U 50 50 1 1 P
ENDDRAW ENDDRAW
ENDDEF ENDDEF
# #
# VSOURCE # rectifier_schlib_VSOURCE
# #
DEF ~VSOURCE V 0 40 Y Y 1 F N DEF rectifier_schlib_VSOURCE V 0 40 Y Y 1 F N
F0 "V" 200 200 50 H V C CNN F0 "V" 200 200 50 H V C CNN
F1 "VSOURCE" 250 100 50 H I C CNN F1 "rectifier_schlib_VSOURCE" 250 100 50 H I C CNN
F2 "" 0 0 50 H V C CNN F2 "" 0 0 50 H V C CNN
F3 "" 0 0 50 H V C CNN F3 "" 0 0 50 H V C CNN
F4 "Value" 0 0 60 H I C CNN "Fieldname" F4 "Value" 0 0 60 H I C CNN "Fieldname"
F5 "V" 0 0 60 H I C CNN "Spice_Primitive" F5 "V" 0 0 60 H I C CNN "Spice_Primitive"
F6 "1 2" -300 200 60 H I C CNN "Spice_Node_Sequence" F6 "1 2" -300 200 60 H I C CNN "Spice_Node_Sequence"
DRAW DRAW
C 0 0 100 0 1 0 N C 0 0 100 0 1 0 N
P 2 0 1 0 0 -75 0 75 N P 2 0 1 0 0 -75 0 75 N
P 4 0 1 0 0 75 -25 25 25 25 0 75 F P 4 0 1 0 0 75 -25 25 25 25 0 75 F
X ~ 1 0 200 100 D 50 50 1 1 I X ~ 1 0 200 100 D 50 50 1 1 I
X ~ 2 0 -200 100 U 50 50 1 1 I X ~ 2 0 -200 100 U 50 50 1 1 I
ENDDRAW ENDDRAW
ENDDEF ENDDEF
# #
#End Library #End Library

View File

@ -1,129 +1,137 @@
EESchema Schematic File Version 4 EESchema Schematic File Version 4
LIBS:rectifier-cache EELAYER 30 0
EELAYER 26 0 EELAYER END
EELAYER END $Descr A4 11693 8268
$Descr A4 11693 8268 encoding utf-8
encoding utf-8 Sheet 1 1
Sheet 1 1 Title ""
Title "" Date ""
Date "" Rev ""
Rev "" Comp ""
Comp "" Comment1 ""
Comment1 "" Comment2 ""
Comment2 "" Comment3 ""
Comment3 "" Comment4 ""
Comment4 "" $EndDescr
$EndDescr $Comp
$Comp L rectifier_schlib:VSOURCE V1
L rectifier_schlib:VSOURCE V1 U 1 1 57336052
U 1 1 57336052 P 4400 4050
P 4400 4050 F 0 "V1" H 4528 4096 50 0000 L CNN
F 0 "V1" H 4528 4096 50 0000 L CNN F 1 "SINE(0 1.5 1k 0 0 0 0)" H 4528 4005 50 0000 L CNN
F 1 "SINE(0 1.5 1k 0 0 0 0)" H 4528 4005 50 0000 L CNN F 2 "" H 4400 4050 50 0000 C CNN
F 2 "" H 4400 4050 50 0000 C CNN F 3 "" H 4400 4050 50 0000 C CNN
F 3 "" H 4400 4050 50 0000 C CNN F 4 "Value" H 4400 4050 60 0001 C CNN "Fieldname"
F 4 "Value" H 4400 4050 60 0001 C CNN "Fieldname" F 5 "V" H 4400 4050 60 0001 C CNN "Spice_Primitive"
F 5 "V" H 4400 4050 60 0001 C CNN "Spice_Primitive" F 6 "1 2" H 4100 4250 60 0001 C CNN "Spice_Node_Sequence"
F 6 "1 2" H 4100 4250 60 0001 C CNN "Spice_Node_Sequence" 1 4400 4050
1 4400 4050 -1 0 0 1
-1 0 0 1 $EndComp
$EndComp $Comp
$Comp L rectifier_schlib:GND #PWR01
L rectifier_schlib:GND #PWR01 U 1 1 573360D3
U 1 1 573360D3 P 4400 4350
P 4400 4350 F 0 "#PWR01" H 4400 4100 50 0001 C CNN
F 0 "#PWR01" H 4400 4100 50 0001 C CNN F 1 "GND" H 4405 4177 50 0000 C CNN
F 1 "GND" H 4405 4177 50 0000 C CNN F 2 "" H 4400 4350 50 0000 C CNN
F 2 "" H 4400 4350 50 0000 C CNN F 3 "" H 4400 4350 50 0000 C CNN
F 3 "" H 4400 4350 50 0000 C CNN 1 4400 4350
1 4400 4350 1 0 0 -1
1 0 0 -1 $EndComp
$EndComp $Comp
$Comp L rectifier_schlib:R R1
L rectifier_schlib:R R1 U 1 1 573360F5
U 1 1 573360F5 P 4650 3700
P 4650 3700 F 0 "R1" V 4443 3700 50 0000 C CNN
F 0 "R1" V 4443 3700 50 0000 C CNN F 1 "1k" V 4534 3700 50 0000 C CNN
F 1 "1k" V 4534 3700 50 0000 C CNN F 2 "" V 4580 3700 50 0000 C CNN
F 2 "" V 4580 3700 50 0000 C CNN F 3 "" H 4650 3700 50 0000 C CNN
F 3 "" H 4650 3700 50 0000 C CNN F 4 "Value" H 4650 3700 60 0001 C CNN "Fieldname"
F 4 "Value" H 4650 3700 60 0001 C CNN "Fieldname" F 5 "1 2" H 4650 3700 60 0001 C CNN "SpiceMapping"
F 5 "1 2" H 4650 3700 60 0001 C CNN "SpiceMapping" F 6 "R" V 4650 3700 60 0001 C CNN "Spice_Primitive"
F 6 "R" V 4650 3700 60 0001 C CNN "Spice_Primitive" 1 4650 3700
1 4650 3700 0 1 1 0
0 1 1 0 $EndComp
$EndComp $Comp
$Comp L rectifier_schlib:D D1
L rectifier_schlib:D D1 U 1 1 573361B8
U 1 1 573361B8 P 5100 3700
P 5100 3700 F 0 "D1" H 5100 3485 50 0000 C CNN
F 0 "D1" H 5100 3485 50 0000 C CNN F 1 "1N4148" H 5100 3576 50 0000 C CNN
F 1 "1N4148" H 5100 3576 50 0000 C CNN F 2 "" H 5100 3700 50 0000 C CNN
F 2 "" H 5100 3700 50 0000 C CNN F 3 "" H 5100 3700 50 0000 C CNN
F 3 "" H 5100 3700 50 0000 C CNN F 4 "Value" H 5100 3700 60 0001 C CNN "Fieldname"
F 4 "Value" H 5100 3700 60 0001 C CNN "Fieldname" F 5 "D" H 5100 3700 60 0001 C CNN "Spice_Primitive"
F 5 "D" H 5100 3700 60 0001 C CNN "Spice_Primitive" F 6 "2 1" H 5100 3700 60 0001 C CNN "Spice_Node_Sequence"
F 6 "2 1" H 5100 3700 60 0001 C CNN "Spice_Node_Sequence" F 7 "1N4148" H 5100 3700 50 0001 C CNN "Spice_Model"
1 5100 3700 F 8 "Y" H 5100 3700 50 0001 C CNN "Spice_Netlist_Enabled"
-1 0 0 1 F 9 "diode.mod" H 5100 3700 50 0001 C CNN "Spice_Lib_File"
$EndComp 1 5100 3700
$Comp -1 0 0 1
L rectifier_schlib:C C1 $EndComp
U 1 1 5733628F $Comp
P 5400 4000 L rectifier_schlib:C C1
F 0 "C1" H 5515 4046 50 0000 L CNN U 1 1 5733628F
F 1 "100n" H 5515 3955 50 0000 L CNN P 5400 4000
F 2 "" H 5438 3850 50 0000 C CNN F 0 "C1" H 5515 4046 50 0000 L CNN
F 3 "" H 5400 4000 50 0000 C CNN F 1 "100n" H 5515 3955 50 0000 L CNN
F 4 "Value" H 5400 4000 60 0001 C CNN "Fieldname" F 2 "" H 5438 3850 50 0000 C CNN
F 5 "C" H 5400 4000 60 0001 C CNN "Spice_Primitive" F 3 "" H 5400 4000 50 0000 C CNN
F 6 "1 2" H 5400 4000 60 0001 C CNN "SpiceMapping" F 4 "Value" H 5400 4000 60 0001 C CNN "Fieldname"
1 5400 4000 F 5 "C" H 5400 4000 60 0001 C CNN "Spice_Primitive"
1 0 0 -1 F 6 "1 2" H 5400 4000 60 0001 C CNN "SpiceMapping"
$EndComp 1 5400 4000
$Comp 1 0 0 -1
L rectifier_schlib:R R2 $EndComp
U 1 1 573362F7 $Comp
P 5750 4000 L rectifier_schlib:R R2
F 0 "R2" H 5680 3954 50 0000 R CNN U 1 1 573362F7
F 1 "100k" H 5680 4045 50 0000 R CNN P 5750 4000
F 2 "" V 5680 4000 50 0000 C CNN F 0 "R2" H 5680 3954 50 0000 R CNN
F 3 "" H 5750 4000 50 0000 C CNN F 1 "100k" H 5680 4045 50 0000 R CNN
F 4 "Value" H 5750 4000 60 0001 C CNN "Fieldname" F 2 "" V 5680 4000 50 0000 C CNN
F 5 "1 2" H 5750 4000 60 0001 C CNN "SpiceMapping" F 3 "" H 5750 4000 50 0000 C CNN
F 6 "R" V 5750 4000 60 0001 C CNN "Spice_Primitive" F 4 "Value" H 5750 4000 60 0001 C CNN "Fieldname"
1 5750 4000 F 5 "1 2" H 5750 4000 60 0001 C CNN "SpiceMapping"
-1 0 0 1 F 6 "R" V 5750 4000 60 0001 C CNN "Spice_Primitive"
$EndComp 1 5750 4000
Text Notes 4300 4900 0 60 ~ 0 -1 0 0 1
.tran 1u 10m\n $EndComp
Wire Wire Line Text Notes 4300 4900 0 60 ~ 0
4400 4350 4400 4250 .tran 1u 10m\n
Wire Wire Line Wire Wire Line
4400 4300 5750 4300 4400 4350 4400 4300
Connection ~ 4400 4300 Wire Wire Line
Wire Wire Line 4400 4300 5400 4300
5250 3700 5750 3700 Connection ~ 4400 4300
Wire Wire Line Wire Wire Line
5750 3700 5750 3850 5250 3700 5400 3700
Wire Wire Line Wire Wire Line
5400 3850 5400 3700 5750 3700 5750 3850
Connection ~ 5400 3700 Wire Wire Line
Wire Wire Line 5400 3850 5400 3700
5400 4300 5400 4150 Connection ~ 5400 3700
Wire Wire Line Wire Wire Line
5750 4300 5750 4150 5400 4300 5400 4150
Connection ~ 5400 4300 Wire Wire Line
Wire Wire Line 5750 4300 5750 4150
4800 3700 4950 3700 Connection ~ 5400 4300
Wire Wire Line Wire Wire Line
4400 3850 4400 3700 4800 3700 4950 3700
Wire Wire Line Wire Wire Line
4400 3700 4500 3700 4400 3850 4400 3700
Text Label 4400 3700 2 60 ~ 0 Wire Wire Line
signal_in 4400 3700 4500 3700
Text Label 5750 3700 0 60 ~ 0 Text Label 4400 3700 2 60 ~ 0
rect_out signal_in
Text Notes 4300 5000 0 60 ~ 0 Text Label 5750 3700 0 60 ~ 0
*.ac dec 10 1 1Meg\n rect_out
$EndSCHEMATC Text Notes 4300 5000 0 60 ~ 0
*.ac dec 10 1 1Meg\n
Wire Wire Line
4400 4300 4400 4250
Wire Wire Line
5400 3700 5750 3700
Wire Wire Line
5400 4300 5750 4300
$EndSCHEMATC