Interesting Feature: Increment Operator '+'

In a recent post to this forum, @archbugaboo pointed out an “increment operator” using the character ‘+’. Didn’t know it existed.

I’ve only tested inside the PWL attribute of a Voltage source. It does work as @archbugaboo indicated.

Here is what my experiments have revealed:

  • It appears to ONLY work on time values in the PWL.
    For example: PWL 0 0 10m 0 +1u 1 +10m 1 +1u 0
    will cause the voltage to be
    • 0V @ 0s
    • 0V @ 10ms
    • 1V @ 10.001ms.
    • 1V @ 20.001ms
    • 0V @ 20.002ms
  • It doesn’t work with voltage values. A ‘+’ voltage voltage is a positive voltage at that value.
  • The increment operator works with the last stated time value. Therefore, the time increment is cumulative. This effect is noticeable if the PWL uses repeated waveforms with a potential time shift error. Using an absolute time value in the PWL attribute may help to reduce time shift errors. For example using PWL 0 0 10m 0 +1u 1 20m 1 +1u 0 will reduce the time shift error by 1us.
  • The increment operator also works inside file of the FILE directive of the PWL attribute.
  • A decrement operator (‘-’) for time value is available. However, the effect appears to provide bizarre results. Probably because it is confusing for time to go backwards in a .tran simulation.

If you find other effects or other directives/attributes to use the increment operator, please add to this posting.

Len

2 Likes

Hello Len

At least as far as the LTspice group is concerned, “this is known”. The - is probably an uncaught bug since, as you point out, it doesn’t make sense to go back in time. I remember once the tline allowed negative delays and the simulation ran but, with strange results, and I only realized later on because the values came as a result of calculations (my favourite bugs). Also, the increment can only be for time since the values can be both positive and negative; it’s difficult (if not impossible) to determine whether +1 it’s an increment to the value, or the value, itself.

Vlad

1 Like