开云体育

Passing a Mosfet Value as a parameter to a hierarchical subcircuit


 

OK I'm still flummoxed...
?
"Not quite. LTspice also knows string parameters, which were introduced extactly for the purpose discussed here."
?
Mathias. Can you give an example?


 

Per, what kind of transistor models are you using, and trying to pass into a subcircuit?
?
Are they .MODEL models?? Or are they defined by a block of netlist lines surrounded by .SUBCKT ... .ENDS?
?
Andy
?


 

Face Palm... Sorry. I finaly twigged it having found the help. Doh.
?
For anyone else text is passed by enclosing in inverted thingies.
?
In a subcircuit pop up on the .PARAMS box write something like MOS="Si7336ADP"
?
Presumably also applies to a raw .params statement on a schematic.
?
The model in the subcircuit should have the parameter you want to pass, in the above case MOS set to {MOS}
?
The help states curly braces are no longer required but it seems that they are.
?
My subcircuit reads,
?
.subckt bimos D1 D2 G S
D1 N001 G RB496KA
D2 G N001 RB496KA
M1 D1 N001 S S {MOS}
M2 D2 N001 S S {MOS}
.ends bimos
?
?
?
?


 

Oh. The transistor models are just the normal 3 Pin nmos devices.
?
MN
M1
?
With Value set to {MOS} and using a name from the list you get when you "Pick New Mosfet"
?
Overall the idea (need) is to reuse the subcircuit but choosing different devices without fixing the subcircuit and this time, famous last words, it seems like it is going to work.
?
Again thanks for the help.


 

Curly braces are needed here in order to avoid an ambiguity. Because you might also have
?
.model MOS ...
?
?
?
On Wed, May 7, 2025 at 08:38 PM, Per wrote:

The help states curly braces are no longer required but it seems that they are.
?
My subcircuit reads,
?
.subckt bimos D1 D2 G S
D1 N001 G RB496KA
D2 G N001 RB496KA
M1 D1 N001 S S {MOS}
M2 D2 N001 S S {MOS}
.ends bimos
?
?
?
?


 

On Wed, May 7, 2025 at 02:42 PM, Per wrote:
Oh. The transistor models are just the normal 3 Pin nmos devices.
?
MN
M1
That is not quite what I meant.
?
When you open the model for each MOSFET, and look at its contents, does it look like this?
.model MyNMosfet NMOS(...)
Or does it look like this?
.subckt MyNMosfet d g s
R1 ...
C2 ...
M3 ...
.model ...
.ends MyNMosfet
?
If you are using only the MOSFETs that come with LTspice's "Pick New MOSFET"? menu, then they are the first kind.? But maybe you were using some models that you downloaded from a manufacturer or from somewhere on the Internet, and they could be either kind.
?
Unfortunately, your bimos.asc hierarchical schematic can not accept both kinds of MOSFET models.? That is not your fault.
?
Andy
?


 

Yes/Nope.... They are the LTSpice provided "Pick one of These".? I have not yet ventured into other models as provided by manufacturers. I'm not even sure I want to and if I did I would go mad and think about adding them into the "Pick one of These" file.
?
For the moment I will give you kind people a rest.


 

开云体育

Don't even think abut trying to do that. It would make your version of LTspice unique, even if you could do it. Instead, make your own library files for such devices, i.e. My MOSFETS etc.

On 2025-05-08 00:24, Per wrote:
think about adding them into the "Pick one of These" file.
?
--
Best wishes John Woodgate RAYLEIGH Essex OOO-Own Opinions Only If something is true: * as far as we know - it's science *for certain - it's mathematics *unquestionably - it's religion

Virus-free.


 

开云体育

The way to add your own MOSFET models to LTspice without changing the installation files is to paste them into ..\Documents\LTspice\user.mos. They then appear in the "Pick New MOSFET" list.

The problem with this is that the selection of devices is so seamless, that it is impossible to tell at a glance whether a device is in the "standard" library, or your personal one. So the problem of sharing schematics with non-standard models isn't solved. A partial solution to this is to label "your own" models with "Mfg=Mine". By default, this is placed at the end of the model entry field, where it cannot be seen without scrolling or making the selection dialogue full screen. But the device parameters can actually be listed in any order in the model, so "Mfg=Mine" could be placed at the beginning, where it would be more easily seen.

--
Regards,
Tony

On 08/05/2025 09:57, John Woodgate via groups.io wrote:

Don't even think abut trying to do that. It would make your version of LTspice unique, even if you could do it. Instead, make your own library files for such devices, i.e. My MOSFETS etc.


 

开云体育

On 08/05/2025 10:21, Tony Casey wrote:
The way to add your own MOSFET models to LTspice without changing the installation files is to paste them into ..\Documents\LTspice\user.mos. They then appear in the "Pick New MOSFET" list.

The problem with this is that the selection of devices is so seamless, that it is impossible to tell at a glance whether a device is in the "standard" library, or your personal one. So the problem of sharing schematics with non-standard models isn't solved. A partial solution to this is to label "your own" models with "Mfg=Mine". By default, this is placed at the end of the model entry field, where it cannot be seen without scrolling or making the selection dialogue full screen. But the device parameters can actually be listed in any order in the model, so "Mfg=Mine" could be placed at the beginning, where it would be more easily seen.

--
Regards,
Tony

On 08/05/2025 09:57, John Woodgate via groups.io wrote:
Don't even think abut trying to do that. It would make your version of LTspice unique, even if you could do it. Instead, make your own library files for such devices, i.e. My MOSFETS etc.
Actually, I forgot... the "Mfg=Mine" parameter may be at the end, but the parameters are re-ordered, and "Mine" appears on the left in the Manufacturer column.

--
Regards,
Tony