Electrical – Custom photodiode symbol in LTSpice ‘syntax error in transmission line statement: “..”’

ltspice

I want to simulate different opamps for use in the transimpedance amplification stage in a position sensing device (PSD) photodiode.

The equivalent circuit for the PSD photodiode is saved in psd.asc. PSD equivalent circuit schematic

The transimpedance amplification schematic is saved in opamp.asc. transimpedance amp schematic

From the standard library I copied diode.asy and added the two light arrows. Furthermore I adjusted the input and output labels and changed the prefix, name letter from D to P.

I was able to select psd as a component in opamp.asc. However when I want to run some transient analysis I get the error message:

Syntax error in coupled transmission line statement: "p1 n0001 0 pd"

I configured the current source in psd.asc to emulate a triangle current response if it matters.

The corresponding LTSpice files are available as Gist.

Best Answer

You aren't allowed to change the prefix letter of a component however you like. Each prefix letter is hard-coded to create a certain type of component, and you can't change that. For example, all diodes must start with "D", and all resistors must start with "R".

By changing the prefix to "P" you told LTSpice that you're placing a transmission line in your circuit, rather than a diode.

But actually, your model is a subcircuit, rather than a single diode. So you must use the "X" prefix rather than "D".

For a more general tutorial on creating subcircuit models and inserting them into other designs, see this old question: How to make LTSpice sub-circuits available globally?.