Go Back   Home > Forums > >
Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read

Software Tools SPICE, PCB CAD, speaker design and measurement software, calculators

Installing and using ngspice - an opensource simulator
Installing and using ngspice - an opensource simulator
Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 22nd February 2019, 07:44 AM   #101
astx is offline astx  Austria
diyAudio Member
 
Join Date: Jan 2011
Location: Tyrol / Austria
Installing and using ngspice - an opensource simulator
Dear keantoken,

should be easy to fix. An example with wrong and corrected values would be helpful.

Have fun, Toni
__________________
Hint: have a look at first post of my threads for an updated index!
  Reply With Quote
Old 22nd February 2019, 08:11 AM   #102
keantoken is offline keantoken  United States
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
I found the problem. The regular expressions weren't in Perl format. I seem to have succeeded in fixing them. It needs testing though, especially to make sure the units conversions work. New script attached.

I don't know if the expression for xin is correct. In the scripts it is

xin=xti-ne*xtb

Whereas in the VBIC PDF it is

xin=xti-xtb


On page 13 here, we see why we should use level=9 instead of level=4.

https://www.iee.et.tu-dresden.de/iee...nchmarking.pdf


One last thing that might matter, in LTspice there is the option to use "3k3" syntax for 3.3k. The script might need to support this.
Attached Files
File Type: txt sgp2vbic12-beta2.txt (15.5 KB, 2 views)
__________________
The Kmultiplier rail filter! -=- The Simple Kuartlotron Superbuffer!
Need something built, repaired or modded? PM me and ask what I can do!
  Reply With Quote
Old 22nd February 2019, 09:11 AM   #103
astx is offline astx  Austria
diyAudio Member
 
Join Date: Jan 2011
Location: Tyrol / Austria
Installing and using ngspice - an opensource simulator
Quote:
Originally Posted by keantoken View Post
I found the problem. The regular expressions weren't in Perl format. I seem to have succeeded in fixing them. It needs testing though, especially to make sure the units conversions work. New script attached.

I don't know if the expression for xin is correct. In the scripts it is

xin=xti-ne*xtb

Whereas in the VBIC PDF it is

xin=xti-xtb


On page 13 here, we see why we should use level=9 instead of level=4.

https://www.iee.et.tu-dresden.de/iee...nchmarking.pdf


One last thing that might matter, in LTspice there is the option to use "3k3" syntax for 3.3k. The script might need to support this.

Dear keantoken,



In the code we have these 2 expressions:
Code:
        $r->{'xii'}     =       ($val->{'xti'} - $val->{'xtb'});
        $r->{'xin'}     =       ($val->{'xti'} - $val->{'ne'} * $val->{'xtb'});
xii is not xin. Which expression is wrong/ok?


To support "3k3" syntax needs some time. Maybe on weekend.
A few regex more ...
__________________
Hint: have a look at first post of my threads for an updated index!
  Reply With Quote
Old 22nd February 2019, 09:18 AM   #104
Jakob2 is offline Jakob2  Germany
diyAudio Member
 
Join Date: Jun 2004
Location: germany
Quote:
Originally Posted by condenser View Post
<snip>

BTW - I aggree with Holger: VBIC is more important for integrated circuit design with the high impact of substrate and is supported meanwhile by Foundries like x-fab and tsmc.

The onlyest exception is the Kull extension for Quasi-Saturation which is implemented in VBIC.
But the Question is, which devices in diy practice suffer from this missed feature in SGP. I think not the hundreds of small signal devices. Can somebody provide examples for power bjt's with QS effect.

Kind Regards,
Dietmar
Keantoken posted already about the relevance of the QS effect, to add further i think it is enlightning what the vbic web page stated as reasons to implement the VBIC model as an open source model implementation in comparison to the STGP:

Improved Early effect modeling
Quasi-saturation modeling
Parasitic substrate transistor modeling
Parasitic fixed (oxide) capacitance modeling
Includes an avalanche multiplication model
Improved temperature modeling
Base current is decoupled from collector current
Electrothermal modeling
Smooth, continuous model

While i agree that obviously two or three entries are mainly important for ICs, the others help to get better results for audio circuit simulations.
  Reply With Quote
Old 22nd February 2019, 09:28 AM   #105
keantoken is offline keantoken  United States
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
This is a good regular expressions test site. I used PCRE, which I think mean Perl.

Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript


Quote:
Originally Posted by astx View Post
xii is not xin. Which expression is wrong/ok?

Look at the conversion for xii here:

http://www.designers-guide.org/VBIC/...s/VbicText.pdf

I noticed the difference when I discovered xii was a negative value when I converted my KSC1845 model.
__________________
The Kmultiplier rail filter! -=- The Simple Kuartlotron Superbuffer!
Need something built, repaired or modded? PM me and ask what I can do!
  Reply With Quote
Old 22nd February 2019, 04:34 PM   #106
astx is offline astx  Austria
diyAudio Member
 
Join Date: Jan 2011
Location: Tyrol / Austria
Installing and using ngspice - an opensource simulator
Quote:
Originally Posted by keantoken View Post
This is a good regular expressions test site. I used PCRE, which I think mean Perl.

Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript

Look at the conversion for xii here:

http://www.designers-guide.org/VBIC/...s/VbicText.pdf

I noticed the difference when I discovered xii was a negative value when I converted my KSC1845 model.

Code:
#------------------------------------------------------------------------------
sub normalize_units
#------------------------------------------------------------------------------
{
        my $val=shift;
        if ($debug) {
                print STDERR "normalize units:\t$val\t=>\t";
        }
        if    ($val=~/([\+\-\.0-9]+)f$/i)        {      $val=$1 * 1e-15;        }
        elsif ($val=~/([\+\-\.0-9]+)p$/i)        {      $val=$1 * 1e-12;        }
        elsif ($val=~/([\+\-\.0-9]+)n$/i)        {      $val=$1 * 1e-9;         }
        elsif ($val=~/([\+\-\.0-9]+)u$/i)        {      $val=$1 * 1e-6;         }
        elsif ($val=~/([\+\-\.0-9]+)m$/i)        {      $val=$1 * 1e-3;         }
        elsif ($val=~/([\+\-\.0-9]+)k$/i)        {      $val=$1 * 1e+3;         }
        elsif ($val=~/([\+\-\.0-9]+)meg$/i)      {      $val=$1 * 1e+6;         }
        elsif ($val=~/([\+\-\.0-9]+)g$/i)        {      $val=$1 * 1e+9;         }
        elsif ($val=~/([\+\-\.0-9]+)t$/i)        {      $val=$1 * 1e+12;        }

        if ($debug) {
                print STDERR "$val\n";
        }
        return $val;
}
Above regex should be ok. Here the "3k3" variant could be inserted too (next release).
Code:
        0.76f   =>      7.6e-16
        0.8569n =>      8.569e-10
        100f    =>      1e-13
        100m    =>      0.1
        101.1p  =>      1.011e-10
        105m    =>      0.105
        1.073u  =>      1.073e-06
        10n     =>      1e-08
        10p     =>      1e-11
        113.1p  =>      1.131e-10
        115p    =>      1.15e-10
        118.5p  =>      1.185e-10
        1.2f    =>      1.2e-15
        1.2n    =>      1.2e-09
        1.345p  =>      1.345e-12
        13.6p   =>      1.36e-11
        13p     =>      1.3e-11
        141.1p  =>      1.411e-10
        14.65n  =>      1.465e-08
        1.4f    =>      1.4e-15
        150f    =>      1.5e-13
        150m    =>      0.15
        1.588n  =>      1.588e-09
        15f     =>      1.5e-14
        1.5n    =>      1.5e-09
        166.7f  =>      1.667e-13
        188.8n  =>      1.888e-07
        18p     =>      1.8e-11
        1.9n    =>      1.9e-09
        1k      =>      1000
        1n      =>      1e-09
        200m    =>      0.2
        200n    =>      2e-07
        200p    =>      2e-10
        20m     =>      0.02
        22.03m  =>      0.02203
        227.6p  =>      2.276e-10
        22n     =>      2.2e-08
        230f    =>      2.3e-13
        250n    =>      2.5e-07
        255p    =>      2.55e-10
        2.65p   =>      2.65e-12
        2.77p   =>      2.77e-12
        2.83p   =>      2.83e-12
        28p     =>      2.8e-11
        293.5f  =>      2.935e-13
        295.4p  =>      2.954e-10
        2u      =>      2e-06
        300f    =>      3e-13
        300p    =>      3e-10
        30f     =>      3e-14
        31p     =>      3.1e-11
        330n    =>      3.3e-07
        33f     =>      3.3e-14
        3.5p    =>      3.5e-12
        380p    =>      3.8e-10
        4.033n  =>      4.033e-09
        420p    =>      4.2e-10
        4.2p    =>      4.2e-12
        4.5p    =>      4.5e-12
        4.948p  =>      4.948e-12
        4n      =>      4e-09
        500f    =>      5e-13
        500m    =>      0.5
        500p    =>      5e-10
        50m     =>      0.05
        5.26n   =>      5.26e-09
        550p    =>      5.5e-10
        55m     =>      0.055
        5n      =>      5e-09
        600f    =>      6e-13
        600m    =>      0.6
        6.1n    =>      6.1e-09
        620p    =>      6.2e-10
        62f     =>      6.2e-14
        6.2p    =>      6.2e-12
        6.3p    =>      6.3e-12
        6.4u    =>      6.4e-06
        650f    =>      6.5e-13
        72p     =>      7.2e-11
        750p    =>      7.5e-10
        800.3p  =>      8.003e-10
        800m    =>      0.8
        80p     =>      8e-11
        830p    =>      8.3e-10
        85n     =>      8.5e-08
        86.19m  =>      0.08619
        875p    =>      8.75e-10
        893.1f  =>      8.931e-13
        8n      =>      8e-09
        8p      =>      8e-12
        90m     =>      0.09
        939.8f  =>      9.398e-13
         970p    =>      9.7e-10
Above some conversions - hopefully ok.
Attached the mapping table you hopefully mean. I have inserted the corrected calculation in the script - see this changes here:


Code:
-               $val->{$key}=$value;
-               if ($key eq 'rbm') {$done->{'rbm'}='yes';}
                if (defined $keep->{$key}) {
-                       $r->{$key}=$value;
+                       # will become a comment only!
+                       $info->{$key}=$value;
+               } else {
+                       $val->{$key}=$value;
                }
+               if ($key eq 'rbm') {$done->{'rbm'}='yes';}
+               if ($key eq 'ibe') {$done->{'ibe'}='yes';}
+               if ($key eq 'ibc') {$done->{'ibc'}='yes';}
        }
        if (!defined($done->{'rbm'})) {
                $val->{'rbm'}=$val->{'rb'};
        }
-       if (!defined($val->{'ibe'})) {          # Prefer ibe to is, if it is available
+       if (!defined($done->{'ibe'})) {         # Prefer ibe to is, if it is available
                $val->{'ibe'}=$val->{'is'};
        }
-       if (!defined($val->{'ibc'})) {          # Prefer ibc to is, if it is available
+       if (!defined($done->{'ibc'})) {         # Prefer ibc to is, if it is available
                $val->{'ibc'}=$val->{'is'};
        }
        if ($val->{'ise'} > 1.0) {
@@ -517,13 +558,15 @@
        $r->{'eane'}    =       $val->{'eg'};
        $r->{'eanc'}    =       $val->{'eg'};
        $r->{'xis'}     =       $val->{'xti'};
+
        $r->{'xii'}     =       ($val->{'xti'} - $val->{'xtb'});
-       $r->{'xin'}     =       ($val->{'xti'} - $val->{'ne'} * $val->{'xtb'});
+       # $r->{'xin'}   =       ($val->{'xti'} - $val->{'ne'} * $val->{'xtb'});
+       $r->{'xin'}     =       ($val->{'xti'} - $val->{'xtb'});        # corrected according to the url: http://www.designers-guide.org/VBIC/...s/VbicText.pdf
See revision ID: $Id: convert_sgp_modelfile_to_vbic.pl 1601 2019-02-22 17:38:47Z sta $

Now option '-o outfile' allows to output the results directly into file, not only on stdout. With option '-d' you get many debug lines to check.

BR, Toni
Attached Images
File Type: png sgp_vbic_mapping.png (55.0 KB, 160 views)
Attached Files
File Type: zip convert_sgp_modelfile_to_vbic.zip (5.1 KB, 5 views)
__________________
Hint: have a look at first post of my threads for an updated index!

Last edited by astx; 22nd February 2019 at 04:43 PM.
  Reply With Quote
Old 22nd February 2019, 06:15 PM   #107
condenser is offline condenser
diyAudio Member
 
Join Date: Mar 2012
There are two slashes in front:
#!//usr/bin/perl

and has not worked.

Quote:
Originally Posted by astx View Post
[CODE
Now option '-o outfile' allows to output the results directly into file, not only on stdout. With option '-d' you get many debug lines to check.

BR, Toni

Tried under msys:

$ ./convert_sgp_modelfile_to_vbic.pl bfs17.mod -o bfs17_vbic.mod
=== WARNING - device BFS17 NPN: IRB parameter is not supported in vbic
=== WARNING - device BFS17 NPN: parameter irb is not supported in vbic
* ------------------------------------------------------------------------------
* BFS17:
* ------------------------------------------------------------------------------
.model BFS17 NPN ( 1
+ rcx=2.68 rci=0 gamm=1.0e-11 vo=0 qco=0 rbx=1.2
+ rbi=3.0e-01 re=5.0e-01 is=4.8e-16 nf=1.008 nr=1.01 fc=8.9e-01
+ cje=1.325e-12 pe=7.0e-01 me=2.2e-01 cjc=4.2e-13 cjep=6.3e-13 pc=6.1e-01
+ mc=2.4e-01 cjcp=0 ps=7.5e-01 ms=0 ibei=4.816617e-18 nei=1.008
+ iben=7.49e-15 nen=1.762 ibci=1.25e-17 nci=1.01 ibcn=2.0e-16 ncn=1.042
+ vef=5.668458e+01 ver=8.2482664 ikf=1.9e-01 nkf=5.0e-01 ikr=9.32e-02 tf=5.694e-11
+ xtf=6.8398e+01 vtf=6.0e-01 itf=7.0e-01 tr=1.0e-09 td=2.08696e-11 ea=1.11
+ eaie=1.11 eaic=1.11 eane=1.11 eanc=1.11 xis=3 xii=1.4
+ xin=1.4 kfn=1.0e-15 afn=1
+ )
* ------------------------------------------------------------------------------
But the -o option has no file generated.


Same with
$ perl convert_sgp_modelfile_to_vbic.pl bfs17.mod -o bfs17_vbic.mod


Kind Regards,
Dietmar
  Reply With Quote
Old 22nd February 2019, 08:07 PM   #108
astx is offline astx  Austria
diyAudio Member
 
Join Date: Jan 2011
Location: Tyrol / Austria
Installing and using ngspice - an opensource simulator
First options, than modelfile....



Double slash is irrelevant, thx for reporting.
__________________
Hint: have a look at first post of my threads for an updated index!
  Reply With Quote
Old 22nd February 2019, 10:46 PM   #109
keantoken is offline keantoken  United States
diyAudio Member
 
keantoken's Avatar
 
Join Date: Aug 2006
Location: Texas
I don't think we can decide which xin expression is correct without consulting an expert. Colin McAndrews wrote both the original script AND that PDF you used to correct the original script. Perhaps Colin knows which one is correct? That said, the default value is 3, so the PDF expression gives a closer value to the default.
__________________
The Kmultiplier rail filter! -=- The Simple Kuartlotron Superbuffer!
Need something built, repaired or modded? PM me and ask what I can do!
  Reply With Quote
Old 23rd February 2019, 10:10 AM   #110
astx is offline astx  Austria
diyAudio Member
 
Join Date: Jan 2011
Location: Tyrol / Austria
Installing and using ngspice - an opensource simulator
Bugfixes!
Revision now:$Id: convert_sgp_modelfile_to_vbic.pl 1603 2019-02-23 11:07:48Z sta $

  • fix shebang
  • fix missing level parameter
BR, Toni

P.S.: example output:
Code:
* ------------------------------------------------------------------------------
* KSC1845E_kq: icrating=0.05 mfg=Fairchild vceo=120
* ------------------------------------------------------------------------------
.model KSC1845E_kq npn ( level=9
+ rcx=1 rci=250 gamm=2.0e-06 vo=500 qco=0 rbx=1.2092e+01
+ rbi=1.44908e+02 re=1.5 is=1.075431e-13 nf=1 nr=1 fc=5.0e-01
+ cje=1.8e-11 pe=7.300286e-01 me=3.619943e-01 cjc=4.525739e-12 cjep=0 pc=5.0e-01
+ mc=3.659045e-01 cjcp=0 ps=7.5e-01 ms=0 ibei=1.790296e-16 nei=1
+ iben=1.98107e-13 nen=2 ibci=7.927984e-15 nci=1 ibcn=1.8378e-11 ncn=1.5
+ vef=4.547994e+01 ver=1.527354e+01 ikf=5.5e-02 nkf=6.6e-01 ikr=1.90546e-02 tf=4.2e-10
+ xtf=1 vtf=0 itf=2.0e-02 tr=0 td=0 ea=1.1809
+ eaie=1.1809 eaic=1.1809 eane=1.1809 eanc=1.1809 xis=3 xii=1.2719
+ xin=1.2719 kfn=0 afn=1
+ )
* ------------------------------------------------------------------------------

* ------------------------------------------------------------------------------
* KSA992F_kq: icrating=0.05 mfg=Fairchild vceo=120
* ------------------------------------------------------------------------------
.model KSA992F_kq pnp ( level=9
+ rcx=1.0e-01 rci=100 gamm=2.0e-07 vo=500 qco=0 rbx=1.6084e+01
+ rbi=1.23916e+02 re=3.0e-01 is=5.7544e-14 nf=1 nr=9.5e-01 fc=5.0e-01
+ cje=1.3e-11 pe=8.55e-01 me=4.104e-01 cjc=2.732866e-12 cjep=6.192234e-12 pc=5.0e-01
+ mc=3.497e-01 cjcp=0 ps=8.0e-01 ms=3.3e-01 ibei=1.653088e-16 nei=1
+ iben=5.7544e-15 nen=1.5 ibci=1.589613e-14 nci=9.5e-01 ibcn=1.8378e-14 ncn=1
+ vef=2.862935e+01 ver=1.250379e+01 ikf=2.98e-01 nkf=5.0e-01 ikr=5.25e-02 tf=4.2e-10
+ xtf=5.0e-01 vtf=0 itf=5 tr=0 td=0 ea=1.1603
+ eaie=1.1603 eaic=1.1603 eane=1.1603 eanc=1.1603 xis=3 xii=1.7151
+ xin=1.7151 kfn=0 afn=1
+ )
* ------------------------------------------------------------------------------
Attached Files
File Type: zip convert_sgp_modelfile_to_vbic.zip (5.1 KB, 3 views)
__________________
Hint: have a look at first post of my threads for an updated index!
  Reply With Quote

Reply


Installing and using ngspice - an opensource simulatorHide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NGSPICE UltimateX86 Software Tools 4 1st December 2014 06:03 PM
Help with esl simulator pforeman Planars & Exotics 6 13th July 2014 03:56 AM
Cab/Mic simulator Mishung Analog Line Level 0 14th November 2010 02:13 PM
DAT Simulator jman 31 Instruments and Amps 4 1st February 2009 01:44 PM
who got the best simulator prorms Solid State 5 26th December 2006 05:39 AM


New To Site? Need Help?

All times are GMT. The time now is 05:11 PM.


Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 14.29%
vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2019 DragonByte Technologies Ltd.
Copyright ©1999-2019 diyAudio
Wiki