⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examples

📁 ngspice又一个电子CAD仿真软件代码.功能更全
💻
字号:
***************************************************************** Pi attenuator pad.*   Parameters: R0 = impedance*               DB = attenuation in dB (positive).SUBCKT PIPAD 1 2 { R0 DB }R1 1 0 {R0*(1+2/(10**(DB/20)-1))}R2 1 2 {(R0/2)*(10**(DB/20)-10**(DB/-20))}R3 2 0 {R0*(1+2/(10**(DB/20)-1))}.ENDS***************************************************************** PCB Via inductance + extra L.*  H = substrate height in inches*  D = via diameter in inches*  L = extra inductance in henries..SUBCKT VIA 1 2 { H D L }LV 1 2 {L++ 5.08E-9*H*(log((2+sqrt(4+D*D/(H*H)))*H/D)++ .75*(D/H-sqrt(4+D*D/(H*H))))}.ENDS*****************************************************************   Voltage-controlled oscillator.*   Parameters: F  = frequency @ Vc = 0 in Hz*               KV = tuning sensitivity in Hz/volt*               A  = peak output amplitude*               RO = output port resistance* Connections: Vc  Out.SUBCKT VCO    20  2 { F KV A RO }RIN1    20 0 1E12VSW     30 0 DC 0 PULSE 0 1RSW     30 0 1E12BIN     3 0 V=(V(20)+{F/KV})*V(30)R3      3 0 1E6GSIN    2 0 22 0 {1/RO}RSIN    2 0 {RO}B1      1 0 I=-(V(22)*V(3))B2      22 0 I=V(1)*V(3)R2      1 0 1E9I1      0 1 PULSE {1E-9*A} 0C2      1 0 {.159154943/KV}C1      22 0 {.159154943/KV}R1      22 0 1E9.ENDS*****************************************************************   Ideal Frequency converter.*   Parameters: F  = Oscillator frequency*               RI = input port resistance*               RO = output port resistance* Connections: In Out.SUBCKT FCNVT  1  2 { F RI RO }RIN     1 0 {RI}VLO     3 0 DC 0 SIN 0 1 {F}RLO     3 0 1E12BMIX    0 2 I=(V(1)*V(3))/{RO}RO      2 0 {RO}.ENDS***************************************************************** Sine wave RF power source.* Parameters: F = Frequency*             R = Output resistance*             P = Power in dBm*             V = DC (EMF).SUBCKT RFGEN 1 2 { F R P V }*             + -Is      2 1 DC {V/R} SIN {V/R} {sqrt((10**(P/10))/(125*R))} {F}Ro      1 2 {R}.ENDS***************************************************************** Sine wave 2-tone RF power source.* Parameters: F1 = 1st tone frequency*             F2 = 2nd tone frequency*             R  = output resistance*             P  = power per tone in dBm*             V = DC (EMF).SUBCKT 2TGEN 1 2 { F1 F2 R P V }*             + -I1      2 1 DC {V/R} SIN {V/R} {sqrt((10**(P/10))/(125*R))} {F1}I2      2 1 DC 0 SIN 0 {sqrt((10**(P/10))/(125*R))} {F2}Ro      1 2 {R}.ENDS***************************************************************** Transmission lines* All ports must have external connections.*   Parameters: Z0  = impedance*               L   = length in inches*               VP  = velocity-of-propagation rel. to air* Connections: 1+ 1- 2+ 2-.SUBCKT TXL    1  2  3  4 { Z0 L VP }T1 1 2 3 4 Z0={Z0} TD={L/(1.180315E10*VP)}.ENDS***************************************************************** Lossy transmission line.* All ports must have external connections.*   Parameters: Z0  = impedance*               L   = length in inches*               VP  = velocity-of-propagation rel. to air*               A   = loss in dB/inch* Connections: 1+ 1- 2+ 2-.SUBCKT LTXL   1  2  3  4 { Z0 L VP A }O1      1 2 3 4 LOSSY.MODEL LOSSY LTRA LEN={L}+ R={5.848492e-3*A*Z0}+ L={Z0/(1.180315E10*VP)}+ C={1/(1.180315E10*VP*Z0)}.ENDS***************************************************************** 2 coupled transmission lines* All ports must have external connections.*   Parameters: Z0E = even-mode impedance*               Z0O = odd-mode impedance*               L   = length in inches*               VP  = velocity-of-propagation rel. to air* Connections: 1+ 1- 2+ 2- { Z0E Z0O L VP }.SUBCKT CPL2   1  2  3  4T1 1 0 3 0 Z0={Z0E} TD={L/(1.180315E10*VP)}T2 1 2 3 4 Z0={2*Z0E*Z0O/(Z0E-Z0O)} TD={L/(1.180315E10*VP)}T3 2 0 4 0 Z0={Z0E} TD={L/(1.180315E10*VP)}.ENDS***************************************************************** Generic Bipolar OpAmp - linear model*   Parameters: G   = open-loop gain in dB*               FT  = unity gain frequency in Hz*               IOS = input offset current in amps*               VOS = input offset voltage*               IB  = input bias current in amps.SUBCKT BIPOPA 2    3  6   7   4    { G FT IOS VOS IB }*              - In + Out Vcc VeeRP 4 7 10KRXX 4 0 10MEGIBP 3 0 {IB-IOS}RIP 3 0 10MEGCIP 3 0 1.4PFIBN 2 0 {IB}RIN 2 0 10MEGCIN 2 0 1.4PFVOFST 2 10 {VOS}RID 10 3 200KEA 11 0 10 3 1R1 11 12 5KR2 12 13 50KC1 12 0 {13E-6/FT}GA 0 14 0 13 {0.0135*(10**(G/20))}C2 13 14 {2.7E-6/FT}RO 14 0 75L 14 6 {30/FT}RL 14 6 1000CL 6 0 3PF.ENDS***************************************************************** Generic FET OpAmp - linear model*   Parameters: G   = open-loop gain in dB*               FT  = unity gain frequency in Hz*               VOS = input offset voltage.SUBCKT FETOPA 2    3  6   7   4    { G FT VOS }*              - In + Out Vcc VeeRP 4 7 6KRXX 4 0 10MEGIBP 3 0 33E-12RIP 3 0 1E12CIP 3 0 3PFIBN 2 0 30E-12RIN 2 0 1E12CIN 2 0 3PFVOFST 2 10 {VOS}RID 10 3 1E12EA 11 0 10 3 1R1 11 12 5KR2 12 13 50KC1 12 0 {24E-6/FT}GA 0 14 0 13 {0.0135*(10**(G/20))}C2 13 14 {2.33E-6/FT}RO 14 0 75L 14 6 {4E-6/FT}RL 14 6 100CL 6 0 3PF.ENDS****************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -