¿ªÔÆÌåÓý

Re: PWL sources (was but not related to: "Discrete data points in plot view")


 

¿ªÔÆÌåÓý

eewiz, I think Bonkers was mixing absolute timing with relative timing notation.

If you delete all of the + signs at the beginning of the lines, it makes pretty good sense, as absolute times.

?

It took me a long time to get it through my head that relative time notation made the job a lot easier!


Dave

?

From: [email protected] <[email protected]> On Behalf Of eewiz
Sent: Saturday, July 08, 2023 6:34 PM
To: [email protected]
Subject: EXTERNAL: Re: [LTspice] Discrete data points in plot view

?

Hello Christoph,

?

Bonkers may be leading you down the primrose path.

If you follow Bonkers' advice the length of bit[1] will be twice the length of bit[0] and the length of bit[2] will be three times the length of bit[0].

The slew rate will also progress to 2 times and then 3 times longer...

?

This is all you need to make a PWL file with relative timing.

0??? 0?????????????? at 0 time its 0 volts.
+750n??? 10 ??? take 750ns to go from 0V to 10V with a linear slope.
+100u??? 10???? stay at 10V for 100us.
+1.5u??? -10???? take 1.5us to go from 10V to -10V with a linear slope.
+58u??? -10????? stay at -10V for 58us.
+1.5u??? 10????? take 1.5us to go from -10V to 10V with a linear slope.
+100u??? 10???? stay at 10V for 100us.

Rinse and Repeat...

?

If you would prefer to work with parameters instead of numbers, be my guest.

It took me just several minutes to copy and past what I needed in Excel to create a file that's 14,582 lines long.

As I made it, I made some changes to add some discontinuities on a periodic basis and then paste, paste, paste some more.

My file runs for about 583ms.

If I had known of the REPEAT syntax at the time, I could have made use of it but, cut and paste is easy, LTspice syntax is not.

?

Bonkers wrote:

Hi Christoph,?

Firstly, you can easily repeat cycles of your 32 points, even just using Notepad, if you adopt the +xxx option for the timestamp (relative timing).?
Secondly, PWL means it is linearly interpolated between the defined points.? If you want "crisp" edges, then you need excel, or libreoffice calc, or whatever.?
Essentially you need 2 PWL values per point, to get nice square data.?
The time deltas are normally just 2 values - bit period, and slew time.?
so, to make a datastream, like "101" :?

time? ? ? ? ? ? ? ? ? ? ? value
0? ? ? ? ? ? ? ? ? ? ? ? ? ?0
+tslew? ? ? ? ? ? ? ? ? ?bit[0] say 5V
+tbit? ? ? ? ? ? ? ? ? ? ? same
+tbit+tslew? ? ? ? ? ? bit[1] say 0V?
+2x tbit? ? ? ? ? ? ? ? ? same
+2x tbit +tslew? ? ? bit[2] say 5V
+ 3x tbit? ? ? ? ? ? ? ? ?same
+ 3x tbit? +tslew? ? ?next bit
...
etcetera.?
really easy to do in a spreadsheet, then select the 2 columns, paste to notepad, save as PWL.

All for now

Join [email protected] to automatically receive all group messages.