Adding LTSPICE component to MATLAB

17 views (last 30 days)
Shrinivas Hanchate
Shrinivas Hanchate on 26 May 2020
We want to incorporate a SPICE component in our MATLAB model.
We are using "subcircuit2ssc" command to add that component in MATLAB, but we are getting an error.
Please find the attached error snap-shot and component file in txt format.

Answers (2)

Maadhav Akula
Maadhav Akula on 28 May 2020
I think these errors come up usually indicating that there is a syntax or expression in the file that is not recognized or supported by Matlab's SPICE conversion assistant, which is described in detail here:
From looking at your component file I have found that upon removing the following lines 116,123 and 128(bolded below)
e5 NET5 0 Value {
+ if (V(gk,s)>11 ,
*+ (-0.9267*V(gk,s)**3+49.313*V(gk,s)**2-877.727*V(gk,s)+5351.268)/10000
+ ((87.641n*V(Tj)**3+46.001u*V(Tj)**2-15.03m*V(Tj)-0.13539)*V(gk,s)**3+
+ (-4.7725u*V(Tj)**3-2.0118m*V(Tj)**2+0.69225*V(Tj)+13.826)*V(gk,s)**2+
+ (86.016u*V(Tj)**3+27.876m*V(Tj)**2-10.322*V(Tj)-366.33)*v(gk,s)+
+ (-496.9u*V(Tj)**3-0.12272*V(Tj)**2+49.167*V(Tj)+3084.3))/10000
+ ,
+ if (V(gk,s)<=11 & V(gk,s)>9,
*+ (15*V(gk,s)**2-245*V(gk,s)+1470)/10000
+ ((8.3091u*V(Tj)**3+1.2517m*V(Tj)**2-0.30635*V(Tj)-4.25318)*(V(gk,s)**2)+
+ (-166.98u*V(Tj)**3-21.874m*V(Tj)**2+4.7236*V(Tj)+53.187)*v(gk,s)+
+ (821.34u*V(Tj)**3+90.986m*V(Tj)**2-15.564*V(Tj)+475.4))/10000
+ ,
*+ (13.958*V(gk,s)**2-158.333*V(gk,s)+774.375)/10000
and also by removing the semicolon in the line 217(bolded below), you should be able to build your library!
+ (Cjo/(1+(limit(v(dk,s),0,460)/Vj)**M))*ddt(v(dk,s)) ;
This behavior might be due to the comments (as * and ; are treated as comments) in the middle of a multi-line expression.
Hope this helps!

Shrinivas Hanchate
Shrinivas Hanchate on 1 Jun 2020
Thank you Maadhav Akula ​for your replay we tried your solution but, we are now facing a new error.PFA the error image.
  2 Comments
Maadhav Akula
Maadhav Akula on 1 Jun 2020
I think ddt inside a function call is not supported by the conversion assistant, please have a look at the limitations page:
Shrinivas Hanchate
Shrinivas Hanchate on 1 Jun 2020
Thanks for your reply.
I understood derivative function ddt is not supported by matlab, but we need this SPICE component in our MATLAB model, is there any alternate way by which we can import this SPICE component in our MATLAB model ?

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!