### Author Topic: LTspice syntax problem  (Read 7800 times)

0 Members and 1 Guest are viewing this topic.

#### Faringdon

• Super Contributor
• Posts: 2069
• Country:
##### LTspice syntax problem
« on: February 24, 2024, 07:29:19 pm »
Hi,
How do i make the time of a "Pulse" source equal to the voltage of a node in LTspice?
The attached LTspice wont work. Do you know how to solve?
'Perfection' is the enemy of 'perfectly satisfactory'

#### SiliconWizard

• Super Contributor
• Posts: 14717
• Country:
##### Re: LTspice syntax problem
« Reply #1 on: February 25, 2024, 09:42:51 pm »
As we already explained in an earlier thread, you can't have *parameters* in a simulation that are time-dependent, even less so depending on a node voltage or on a current. Parameters can only be constants for the whole simulation; the simulator can step parameters over some range though - in this case, it will just launch as many simulations as there are steps, every time with a new constant value for said parameters. Not at all what you want here.

Also as we explained earlier, you can use an arbitrary voltage source for this. A sin function combined with some thresholding function could get you a voltage-dependent pulse width generator.

Alternatively, you can look at one of the "modulate" models in the "Special Functions".

The following users thanked this post: Faringdon

#### Ian.M

• Super Contributor
• Posts: 12936
##### Re: LTspice syntax problem
« Reply #2 on: February 25, 2024, 10:17:01 pm »
Yep. It was https://www.eevblog.com/forum/eda/ltspice-if-statement-syntax/ three weeks ago . . .

I wonder if our O.P. also struggles with object permanence?

The following users thanked this post: Faringdon

#### Zero999

• Super Contributor
• Posts: 19659
• Country:
• 0999
##### Re: LTspice syntax problem
« Reply #3 on: February 25, 2024, 10:54:11 pm »
Oh well, last time I did this with a comparator. Now lets try a behavioural voltage source.

The following users thanked this post: Faringdon

#### Zero999

• Super Contributor
• Posts: 19659
• Country:
• 0999
##### Re: LTspice syntax problem
« Reply #4 on: February 25, 2024, 11:13:19 pm »

Oh well, for fun, here's another way.

The following users thanked this post: SiliconWizard, Faringdon

#### Ian.M

• Super Contributor
• Posts: 12936
##### Re: LTspice syntax problem
« Reply #5 on: February 26, 2024, 01:34:47 am »
LTC (now AD) have a chip for that.  The LTC6992-1 TimerBlox VCPWM does the core of what our O.P. wants, both in LTspice and real life!

Input and output voltage scaling is left as an exercise for the user . . .

The following users thanked this post: Faringdon

#### Zero999

• Super Contributor
• Posts: 19659
• Country:
• 0999
##### Re: LTspice syntax problem
« Reply #6 on: February 29, 2024, 10:05:34 pm »