Error missing SUBCKT: 'PARAMS:'

Error missing SUBCKT: 'PARAMS:'

Anonymous
Not applicable
6,345 Views
16 Replies
Message 1 of 17

Error missing SUBCKT: 'PARAMS:'

Anonymous
Not applicable

I am trying to bind this library to a model "LM317-T039" I have in my circuit. It is a voltage regulator but I am getting the error in the title. I am trying to simulate the circuit to be able to debug it and make sure it works. Help would be much appreciated.

0 Likes
Accepted solutions (1)
6,346 Views
16 Replies
Replies (16)
Message 2 of 17

edpataky
Autodesk
Autodesk

the issue is that the model is not pure spice formatted .. it is a pspice model ... you need to convert the pspice specific formats to spice ... regarding your particular error, the current solution is to add a global program statement then surround the program variables with braces within the model. There will be a more direct conversion possible soon as we have just added support for parameters within subcircuit models for this very reason ( it will be out in a future release soon ). still, as I said, you can convert those into global Parameters then use them in the model that way ... let me know if that makes sense.

Message 3 of 17

edpataky
Autodesk
Autodesk
excuse me i meant to write "add a global param statement the surround the param variables with braces"

there was some bad autocorrect going on there i apologize
Message 4 of 17

Anonymous
Not applicable

Hi thanks for the quick reply I tried your advice, and it is binding to the model, but when I try to run the simulation, I get PTerror: syntax error. I am not sure what is wrong with the mdl file. I have included it and help would be much appreciated.

0 Likes
Message 5 of 17

edpataky
Autodesk
Autodesk
no problem i wil take a look
0 Likes
Message 6 of 17

edpataky
Autodesk
Autodesk
Accepted solution

I reformatted a bit, here is the model that simulates for me

 

* LM317
*****************************************************************************
* (C) Copyright 2014 Texas Instruments Incorporated. All rights reserved.
*****************************************************************************
** This model is designed as an aid for customers of Texas Instruments.
** TI and its licensors and suppliers make no warranties, either expressed
** or implied, with respect to this model, including the warranties of
** merchantability or fitness for a particular purpose. The model is
** provided solely on an "as is" basis. The entire risk as to its quality
** and performance is with the customer.
*****************************************************************************
*
** Released by: WEBENCH Design Center, Texas Instruments Inc.
* Part: LM317
* Date: 11DEC2014 
* Model Type: TRANSIENT
* Simulator: PSPICE
* Simulator Version: 16.2.0.p001
* EVM Order Number:
* EVM Users Guide:
* Datasheet:SLVS044VñSEPTEMBER 1997ñREVISED FEBRUARY 2013
*
* Model Version: Final 1.00
*
*****************************************************************************
*
* Updates:
*
* Final 1.00
* Release to Web
*
*****************************************************************************
.param psrr=7.9432e-4 uvlo=0 ilim=2.2 pole=15k rinp=1e7 zero=100e6 rout=0.4m
+  ttrn=1e-4 vref=1.25 uhys=0 drop=.5 VDD=1 VSS=0 VTHRESH=0.5
.SUBCKT LM317_TRANS IN ADJ OUT_0
R_R1         VXX1 IN  {RINP}  
R_R6         N242982 VYY  10 
R_R5         VZZ1 VYY  {ROUT}  
E_ABM1         N242982 0 VALUE={ MIN(v(VXX1), (v(Vzz1)+(ILIM*ROUT)))    }
R_R2         N222524 VXX1  {PSRR*RINP}  
R_U1_R2         0 U1_N26728  1G  
E_U1_ABM5         U1_N31197 0 VALUE={ MIN( v(U1_N26728) + (MAX(v(IN) - {DROP}, 0)))   }
C_U1_C2         0 U1_N26728  1n  
R_U1_R1         0 U1_N08257  1G  
R_U1_R4         U1_N28933 U1_N26728  10  
R_U1_R5         U1_N31197 N222524  10 
C_U1_C3         0 N222524  1n  
X_U1_U2         IN U1_N12783 U1_N12664 U1_UVLO_OK COMPHYS_BASIC_GEN
C_U1_C1         0 U1_N08257  {1e-6*SQRT(TTRN)}  
V_U1_V4         U1_N12783 0 {UVLO}
V_U1_V3         U1_N12664 0 {UHYS}
E_U1_ABM6         U1_EN_OUT 0 VALUE={ (V(U1_UVLO_OK)> 0.6) ? {VREF} : 0 }
R_U1_R3         U1_EN_OUT U1_N08257  {3.333e5*SQRT(TTRN)} 
E_U1_ABM4         U1_N28933 0 VALUE={ V(U1_N08257) + (abs(V(OUT_0))/(abs(V(OUT_0)-v(ADJ))))    }
X_U2         0 OUT_0 d_d
X_F1    VZZ1 OUT_0 IN VYY LM317_TRANS_F1
C_C1         VXX1 IN  {1/(6.28*RINP*POLE)}  
C_C2         VXX1 N222524  {1/(6.28*PSRR*RINP*ZERO)}  
C_C3         0 VYY  1n  
.ENDS LM317_TRANS
*$
.SUBCKT LM317_TRANS_F1 1 2 3 4  
F_F1         3 4 VF_F1 1
VF_F1         1 2 0V
.ENDS LM317_TRANS_F1
*$
.SUBCKT COMP_BASIC_GEN INP INM Y 	
E_ABM Yint 0 VALUE={ (V(INP) > V(INM)) ? {{VDD}} : {{VSS}})}
R1 Yint Y 1
C1 Y 0 1n
.ENDS COMP_BASIC_GEN
*$
.SUBCKT COMPHYS_BASIC_GEN INP INM HYS OUT 
EIN INP1 INM1 INP INM 1 
EHYS INP1 INP2 VALUE={ (V(1) > {{VTHRESH}} ? -V(HYS) : 0) }
EOUT OUT 0 VALUE={ ( V(INP2) > V(INM1) ? {{VDD}} : {{VSS}}) }
R1 OUT 1 1
C1 1 0 5n
RINP1 INP1 0 1K
.ENDS COMPHYS_BASIC_GEN
*$
.SUBCKT COMPHYS2_BASIC_GEN INP INM HYS OUT T=10
EIN INP1 INM1 INP INM 1 
EHYS INM2 INM1 VALUE={ ( V(1) > {{VTHRESH}} ? -V(HYS)/2 : V(HYS)/2) }
EOUT OUT 0 VALUE={ ( V(INP1) > V(INM2) ? {{VDD}} : {{VSS}}) }
R1 OUT 1 1
C1 1 0 {T*1e-9}
RINP1 INP1 0 10K
RINM2 INM2 0 10K
.ENDS COMPHYS2_BASIC_GEN
*$
.SUBCKT D_D 1 2
D1 1 2 DD
.MODEL DD D (IS=1E-015 N=0.01 TT=1e-011)
.ENDS D_D
*$
Message 7 of 17

edpataky
Autodesk
Autodesk

model file attached, I think what I did was simply remove some of the continuation lines that were within an expression .. that does not work in ngsipice, so just putting the expressions on one line fixed it.   

Message 8 of 17

edpataky
Autodesk
Autodesk

here is the difference

Message 9 of 17

ronovar
Contributor
Contributor

I downloaded unencrypted PSpice models from Texas Instruments site:

 

http://www.ti.com/product/LM317/toolssoftware

http://www.ti.com/product/LM337/toolssoftware

 

And when i import into Eagle model for LM317/337 i got error Missing SUBCKT: 'PARAMS:'

 

What i need to modify so that i can import into EAGLE spice model?

Message 10 of 17

Anonymous
Not applicable

I am having exactly the same problem. I cannot seem to find a working Spice model for LM317 and also get the same error.

 

Also with the edited file of Edpataky I get the same error. 

0 Likes
Message 11 of 17

edpataky
Autodesk
Autodesk

i will make a working example and post here shortly

0 Likes
Message 12 of 17

edpataky
Autodesk
Autodesk

I used the model above and I did not get any error .. here is my library with the mapped part, and an example schematic, and some screenshots.  Note that i am setting the R2 value with a parameter, but you can also just set the value directly.  

 

Screenshot at Jan 29 14-36-04.png

Message 13 of 17

edpataky
Autodesk
Autodesk

If you want to be able to handle ripple, add a cap at the VADJ pin .. i added 50mV ripple to the input, then notice the output is nice and clean with the cap added - this model seems to work as expected

 

 

Screenshot at Jan 29 14-42-28.png

Message 14 of 17

ronovar
Contributor
Contributor

I downloaded LM317_TRANS PSPICE from above website and modify as you suggested a few posts above (add inline text with parameters excluding + sign)

 

Import is successfull but i im getting errors when i try to simulate example circuit:

0 Likes
Message 15 of 17

Anonymous
Not applicable

I made it! 🙂

 

Thank you so much for your help. It worked with your model and your library.

 

The mistake I made was this:

 

Schermafbeelding 2019-01-30 om 13.05.01.png

I had the 'Spice Type' set as 'J: Junction Field-effect Transistor', in your library it was 'X: Subcircuit'.

 

(I tried this spice type before, but was using a wrong spice model at that time.)

 

 

0 Likes
Message 16 of 17

ronovar
Contributor
Contributor

After doing some research i finally got LM317 PSPICE model import and simulated very fine..attached is modded mdl file for use with eagle ngspice...

 

Here are the future mods for any PSPICE file that needs to be converted:

 

MODS:

- REMOVE OUT_1 (LM317 regulators have one ONE output in TO220 case)
.SUBCKT LM317_TRANS IN ADJ OUT_0 OUT_1 (original)
.SUBCKT LM317_TRANS IN ADJ OUT_0 (modify)

- REMOVE EACH TC=0,0
R_R6 N242982 VYY 10 TC=0,0 (original)
R_R6 N242982 VYY 10 (modify)

- ADD = AFTER EACH VALUE
E_ABM1 N242982 0 VALUE { MIN(V(VXX), (V(Vzz)+(ILIM*ROUT))) } (original)
E_ABM1 N242982 0 VALUE={ MIN(V(VXX), (V(Vzz)+(ILIM*ROUT))) } (modify)

- ADD EACH + INLINE (remove , and add inline +)
E_U1_ABM5 U1_N31197 0 VALUE={ MIN(V(U1_N26728),
+ MAX(V(IN) - {DROP}, 0)) } (original)
E_U1_ABM5 U1_N31197 0 VALUE={ MIN(V(U1_N26728) + MAX(V(IN) - {DROP}, 0)) } (modify)

- REMOVE PARAMS: FROM LINE AND ADD VALUES TO .PARAM
X_U1_U2 IN U1_N12783 U1_N12664 U1_UVLO_OK COMPHYS_BASIC_GEN PARAMS:
.PARAM psrr=7.9432e-4 uvlo=0 ilim=2.2 pole=15k rinp=1e7 zero=100e6 rout=0.4m
+ ttrn=1e-4 vref=1.25 uhys=0 drop=.5
+ VDD=1 VSS=0 VTHRESH=0.5 (original)
X_U1_U2 IN U1_N12783 U1_N12664 U1_UVLO_OK COMPHYS_BASIC_GEN
.PARAM psrr=7.9432e-4 uvlo=0 ilim=2.2 pole=15k rinp=1e7 zero=100e6 rout=0.4m
+ ttrn=1e-4 vref=1.25 uhys=0 drop=.5 VDD=1 VSS=0 VTHRESH=0.5

- ADD = AFTER EACH VALUE AND REMOVE IF AND REPLACE IN IF FIRST , WITH ? AND SECOND , WITH : (? means IF and ? means else)
E_U1_ABM6 U1_EN_OUT 0 VALUE { IF(V(U1_UVLO_OK)> 0.6, {VREF}, 0) } (original)
E_U1_ABM6 U1_EN_OUT 0 VALUE={ (V(U1_UVLO_OK)> 0.6 ? {VREF} : 0) } (modify)

0 Likes
Message 17 of 17

ronovar
Contributor
Contributor

Ok, here is mdl for LM317/337 so that can be direct imported into EAGLE and used in simulation in ngspice...i converted it using this guide and it is simulating and working perfectly..these are new models added as today if someone use it.