Post Go back to editing

Error message: LTspice says that there is 'more than one sub-circuit definition with this name, which is ill-formed.'

Category: Software
Product Number: LTSPICE
Software Version: 24.1.10

Dear LTSPICE-Team,

I am using two different components in my circuit. One Buck-Regulator and one linear regulator (LDO). In the two subcircuit-files of the two components are further local subcircuits defined which have the same name. Therefore LTSPICE throws the error message. LTSPICE XVII throwed no error message. When I change the name of one local subcircuit the error is gone. Below I have tried to visualise the situation. The behaviour of LTSPICE is very confusing for me. I would expect, that the subcircuit 'LOCAL_FUNKTION' is only valid in the scope of the respective component file. 

SUBCKT BUCK_REGULATOR and SUBCKT LDO_REGULATOR should be globally defined while SUBCKT LOCAL_FUNCTION should only be valid in a local scope. Is it possible to change the LTSPICE-behaviour accordingly? 

My example:

File 1:

.SUBCKT BUCK_REGULATOR...

...

.SUBCKT LOCAL_FUNCTION

...

end file 1

File 2:

.SUBCKT LDO_REGULATOR...

...

.SUBCKT LOCAL_FUNCTION

...

end file 2

Best regards, Thomas

Parents
  • Hi  ,

    The absence of an error is not proof that something worked.

    Remember, a netlist does not have hierarchy or scope other than line by line; a SPICE netlist is completely flat and non-ordered. LTspice, on the other hand, gives you scope and hierarchy in its schematic editor, a very useful and popular feature. LTspice's syntax checker and netlister essentially must evaluate your schematic and hierarchy and flatten all into a simulateable (flat) netlist. If LTspice must guess your intentions without clear instruction, the determinism of LTspice is lost. There's no error, but at what cost? Older versions of LTspice actually did this, giving you the impression that all is fine, when in fact it was flipping a coin. Now, you get an error.

    That said:

    Your request is essentially asking LTspice to netlist thus:

    BUCK_REGULATOR.LOCAL_FUNCTION

    and 

    LDO_REGULATOR.LOCAL_FUNCTION

    What if you also have 

    LOCAL_FUNCTION

    defined on your schematic? Is that:

    GLOBAL.LOCAL_FUNCTION

    Since scope must be determined, each call to those subcircuits is now:

    X1 1 2 BUCK_REGULATOR.LOCAL_FUNCTION

    X2 3 4 LDO_REGULATOR.LOCAL_FUNCTION

    X3 5 6 GLOBAL...

    The netlister would have to analyze a schematic for all instances of the sub and determine if scope is necessary, then add text to make each instance unique, and then produce a netlist with subcircuit names (which do not match the original schematic). Once done, the syntax checker must go through again and see that it all worked out. It would do what you are doing, changing the names, but less cleanly.

    For models, you can use:

    .options allow_ambiguous_models

    Which enables coin-flipping behavior in LTspice re models.

    mike

Reply
  • Hi  ,

    The absence of an error is not proof that something worked.

    Remember, a netlist does not have hierarchy or scope other than line by line; a SPICE netlist is completely flat and non-ordered. LTspice, on the other hand, gives you scope and hierarchy in its schematic editor, a very useful and popular feature. LTspice's syntax checker and netlister essentially must evaluate your schematic and hierarchy and flatten all into a simulateable (flat) netlist. If LTspice must guess your intentions without clear instruction, the determinism of LTspice is lost. There's no error, but at what cost? Older versions of LTspice actually did this, giving you the impression that all is fine, when in fact it was flipping a coin. Now, you get an error.

    That said:

    Your request is essentially asking LTspice to netlist thus:

    BUCK_REGULATOR.LOCAL_FUNCTION

    and 

    LDO_REGULATOR.LOCAL_FUNCTION

    What if you also have 

    LOCAL_FUNCTION

    defined on your schematic? Is that:

    GLOBAL.LOCAL_FUNCTION

    Since scope must be determined, each call to those subcircuits is now:

    X1 1 2 BUCK_REGULATOR.LOCAL_FUNCTION

    X2 3 4 LDO_REGULATOR.LOCAL_FUNCTION

    X3 5 6 GLOBAL...

    The netlister would have to analyze a schematic for all instances of the sub and determine if scope is necessary, then add text to make each instance unique, and then produce a netlist with subcircuit names (which do not match the original schematic). Once done, the syntax checker must go through again and see that it all worked out. It would do what you are doing, changing the names, but less cleanly.

    For models, you can use:

    .options allow_ambiguous_models

    Which enables coin-flipping behavior in LTspice re models.

    mike

Children
No Data