If I need to set beta to a custom value, is it possible to make a customized transistor with a beta of my choice? In other words, can I edit a ready or generic transistor's beta and save it as a custom transistor? How can I do that?
-
\$\begingroup\$ Are you using LTSpice? Or? \$\endgroup\$– jonkCommented Sep 24, 2017 at 16:19
-
\$\begingroup\$ yes using LTSpice \$\endgroup\$– user1245Commented Sep 25, 2017 at 0:50
-
2\$\begingroup\$ Then there is a VERY easy method using "ako". You can reference another model without having to actually copy it and just modify whatever parameter you want. You can even make it part of a stepped parameter. I see that there is an answer here now on the topic. \$\endgroup\$– jonkCommented Sep 25, 2017 at 0:52
3 Answers
The other answers are OK, but there is a much easier way to do what you want, and it is not documented in the official guide.
It is the AKO
"mode" (AKO stands for "A Kind Of") of the .MODEL
directive.
If you define a model like this:
.MODEL MyModelName AKO: 2N2222
MyModelName
will represent an NPN exactly equal to the 2N2222. For example:
.MODEL PN2222 AKO: 2N2222
You can also vary some parameters from the "base" component:
.MODEL MyBJT AKO: 2N2222 (Bf=400)
makes MyBJT
a 2N2222 with a gain of 400.
Here is an hastily conceived simulation that shows what I told you:
As you can see, I just changed the value of Bf for the "AKO model" and this reflected on the output characteristics as you would expect from that change.
This trick (AKO aliases) can be found in the undocumented LTSpice page of the LTwiki.
-
\$\begingroup\$ A right, I totally forgot about that one, it can also be fun to use in hacks together with parameter stepping. Does it still work with XVII? \$\endgroup\$– PlasmaHHCommented Sep 25, 2017 at 9:24
-
\$\begingroup\$ @PlasmaHH Can't say for sure. I tried installing the new version, but had some issues because of my needs. LTspiceIV could be made "portable" under Windows by configuring the environment variable "APPDATA". The new version insists on creating stuff in the user profile, despite any changes in other env vars. Therefore I postponed its "installation". I don't really need the few new features they added. \$\endgroup\$ Commented Sep 25, 2017 at 18:57
-
1\$\begingroup\$ Well, how do I create a Q1 transistor of type "MyBJT"? When I place a transistor, LTSpice adds one with a default "NPN" type. I can only change it to some of the standard ones (e.g. BC548) by choosing "Pick a new transistor" button in the properties dialog. How can I freely edit the type? Thanks. \$\endgroup\$ Commented Jan 31, 2023 at 12:44
The built-in transistors can be found in the file lib/cmp/standard.bjt
in the LTSpice installation directory.
You can copy one entry as a single SPICE directive into your circuit, rename it, and change the Bf
parameter:
(To select a custom transistor model for a component, use Ctrl+right click.)
You could also add the new entry to the standard.bjt
file, but then your .asc
file would no longer work anywhere else, or after an update.
-
1\$\begingroup\$ +1 for explaining how to set a custom model (e.g. my_2N2222) for a part. \$\endgroup\$ Commented Feb 27, 2023 at 18:52
Open the transistor file (standard.bjt) and locate the transistor of your choice. Now take that line and insert it into a .model statement in your schematic and change whatever parameter you like.
Note that while you can add that transistor to the .bjt file, I would recommend against it as it will likely be overwritten by a ltspice update cycle.