Keyboard Shortcuts
Likes
Search
Passing a Mosfet Value as a parameter to a hierarchical subcircuit
Hi,
?
I want to make my own block for a bidirectional mosfet. I can set up the .asc file with two mosfets in it and draw the .asy file.
?
I want to do something like add MOS=IPB107N20N3 in the PARAMS section on the Navigate/Edit Schematic Block but it moans at me about not being able to resolve the parameter.
?
.asc and .asy file, hopefully, in the temp directory in a bit as bimos.zip
?
Thanks for any help.
?
Per |
开云体育.PARAM can only be used to pass numbers. From the Help: To invoke parameter substitution and expression evaluation, enclose the expression in curly braces. The enclosed expression will be replaced with the floating-point value. Your .ASC is incomplete, anyway. There are
no supply voltages and no simulation directive. Your.ASY has no
attributes. Maybe that is OK, but maybe not. On 2025-05-05 18:03, Per wrote:
--
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 |
Thanks for the reply. That's a big not going to happen then. :-(
?
As an aside the .asc file is 'linked' to the .asy file. It does not need a simulation directive. You drop the .asy on the schematic and off you, don't, go. Yes you could have internal supplies but otherwise you would link them in hopefully with net labels or pins/ports.
?
Either I am wrong or I think you know that one. |
开云体育I've never heard of that procedure. Let's see
what others say. On 2025-05-05 20:22, Per wrote:
--
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 |
Not quite. LTspice also knows string parameters, which were introduced extactly for the purpose discussed here.
?
Best Regards,
Mathias
?
On Mon, May 5, 2025 at 07:16 PM, John Woodgate wrote:
|
开云体育NOW It does, but not all are running the latest version(s) ? From: [email protected] <[email protected]>
On Behalf Of Mathias Born via groups.io
Sent: Monday, May 05, 2025 12:38 PM To: [email protected] Subject: EXTERNAL: Re: [LTspice] Passing a Mosfet Value as a parameter to a hierarchical subcircuit ? Not quite. LTspice also knows string parameters, which were introduced extactly for the purpose discussed here. ? Best Regards, Mathias ? On Mon, May 5, 2025 at 07:16 PM, John Woodgate wrote:
|
开云体育So the Help needs to be updated, ASAP. On 2025-05-05 20:37, Mathias Born via
groups.io wrote:
--
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 |
It's already in there. In great detail.
?
On Mon, May 5, 2025 at 10:36 PM, John Woodgate wrote:
|
开云体育OK, so it's MY Help that needs to be updated.
I will see. On 2025-05-05 22:02, Mathias Born via
groups.io wrote:
--
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 |
开云体育Well, I now have 24.1.8, but the Help still says: The enclosed expression will be replaced with the floating-point value. On 2025-05-05 22:24, John Woodgate
wrote:
--
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 |
On Mon, May 5, 2025 at 01:03 PM, Per wrote:
Then it appears you know how to add .PARAMs to your symbol already.? That wasn't clear, because the uploaded symbol does not have any parameters added to it yet. ?
However, if you are using anything before the latest versions of LTspice, parameter values must be numeric only, so attempting to do a parameter assignment "MOS=IPB107N20N3" will fail, unless IPB107N20N3 is another parameter whose value is numeric.? The rest of this message is for people who are not running the latest version of LTspice.
?
You can still use PARAMs to change or set the model of a transistor, by defining the transistor models with numeric names.? For example:
?
.SUBCKT IPB107N20N3_L0 drain gate source ...
...
.ENDS
...
.SUBCKT AnotherFET drain gate source
...
.ENDS
?
.model 1 AKO: IPB107N20N3_L0
.model 2 AKO: AnotherFET
.model 3 AKO: ...
...
.PARAM MOS=1
?
But don't forget that both NMOS symbols inside your "bimos.asc" schematic must have their Prefix values changed from "MN" to "X", to make them work with that Infineon SPICE model which is a .SUBCKT model.? Also, if you use the Infineon model named just "IPB107N20N3", that model requires a special MOSFET symbol with 5 pins.? I hope you are aware of how those models are supposed to work.
?
Andy
?
? |
On Mon, May 5, 2025 at 03:30 PM, John Woodgate wrote:
It was OK.? But it probably was not clear exactly what was going on, at first glance.? We are so accustomed to seeing only top-level schematics that we forget there are other kinds, in LTspice-land. ?
Per's .ASC schematic file is a lower-level hierarchical schematic.? It is not meant to be run by itself.? It is meant to be "called" by a higher-level schematic.
?
The .ASY symbol file that accompanies it is the symbol that represents that lower-level schematic.? Symbols for lower-level blocks are supposed to have no Attributes, no simulation commands, and maybe no power supplies.? In that regard, everything appears to have been done correctly.
?
?
? |
On Mon, May 5, 2025 at 05:38 PM, John Woodgate wrote:
It would not surprise me if they did not catch every instance in the Help that needed to be changed. ?
You ought to point out where you saw that in the Help.
?
Andy
?
? |
开云体育Well, it's hardly hidden away. It's the third short paragraph in the .PARAM help: To invoke parameter substitution and expression evaluation, enclose the expression in curly braces. The enclosed expression will be replaced with the floating-point value. On 2025-05-05 23:00, Andy I via
groups.io wrote:
--
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 |
On Mon, May 5, 2025 at 06:22 PM, John Woodgate wrote:
There is some chance that statement is still correct as it stands, though maybe confusing. ?
Evaluating a parameter's value from its formula would apply only to parameters and formulas that can evaluate to numbers.? If a parameter holds a text string, then I think it does not need to be evaluated because the string itself IS the value.? Enclosing such a parameter inside curly braces feels like it is unnecessary and should not be done.
?
OTOH, if you can build expressions that use non-numerical parameters (e.g., ModelName+".sub"), then curly braces might be needed, and then that Help statement should be modified.
?
?
? |
开云体育Very possibly. I think that the new feature of .PARAM, to pass strings, needs to be clearly explained in the .PARAM Help, as, for example: ?.PARAM can be used in two ways: 1. To pass a numerical value [Some text] 2. To pass a string [Some text] On 2025-05-05 23:38, Andy I via
groups.io wrote:
--
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 |
That's not the 24.1.8 help, then. You must have looked at an older version.
?
On Tue, May 6, 2025 at 12:22 AM, John Woodgate wrote:
|
开云体育You are right. 24.1.8 has not installed
itself. On 2025-05-06 07:17, Mathias Born via
groups.io wrote:
--
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 |
Apologies for setting things off and thanks for the additional replies. I upgraded to 24.1.8 and now it is working. I did have {MOS} set as the mosfet type for M1 and M2 in my subcircuit so it just ran after the upgrade with no complaints. I haven't checked it out fully but fingers crossed. Not sure about the 5 pin mosfet model for the Si7336ADP. It is listed in the 3 pin symbol mosfet picker. |