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.

  • 1
    \$\begingroup\$ I don't think you can just change the prefix however you want. SPICE gives a special meaning to each prefix, and it's not really open to change. \$\endgroup\$
    – The Photon
    Commented Feb 23, 2019 at 15:18
  • \$\begingroup\$ P is apparently the prefix for a transmission line, so when you use P it thinks you're trying to define a transmission line rather than a diode. \$\endgroup\$
    – The Photon
    Commented Feb 23, 2019 at 15:19
  • \$\begingroup\$ @ThePhoton you are right. I changed P back to D and now the simulation runs. However voltages and currents are constant. The pulse modulation of the current generator inside the photodiode seems to be disabled. \$\endgroup\$
    – bodokaiser
    Commented Feb 23, 2019 at 15:24
  • \$\begingroup\$ You need to use X for a subcircuit model. There are tutorials out there on how to do it. \$\endgroup\$
    – The Photon
    Commented Feb 23, 2019 at 15:28
  • \$\begingroup\$ I had to remove every SYMATTR command in psd.asy and change SymbolType CELL to SymbolType BLOCK. Can you put this together in an answer? \$\endgroup\$
    – bodokaiser
    Commented Feb 23, 2019 at 15:34

1 Answer 1


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?.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.