Keyboard Shortcuts
Лайки
Пошук
PWL source with indented lines on schematic (was: Repeat a BURST voltage source every 25ms)
Nice implementation, Dennis!
I wish it were possible to indent this in multiple lines *on the schematic representation*, in the value field of a V Source!
Dave
PWL + VALUE_SCALE_FACTOR=30 + REPEAT FOREVER + REPEAT FOR 5 + (0 0 +1n 1 +500u 1 +1n 0 +3m 0) + ENDREPEAT + (+{25m-5*3.5m} 0) + ENDREPEAT
From: LTspice@groups.io <LTspice@groups.io> On Behalf Of
Dennis
Sent: Wednesday, July 03, 2024 8:35 AM To: LTspice@groups.io Subject: EXTERNAL: Re: [LTspice] Repeat a BURST voltage source every 25ms
This can be done with a single PWL source using the undocumented syntax features shown at Undocumented LTspice - LTwiki-Wiki for LTspice
The VALUE_SCALE_FACTOR scales the 0 and 1 levels to 0-30 V. The nested REPEATS are used to generate the requested waveform.
|
Did you try it and it didn't work? Donald. On 2024-07-04 16:01, Bell, Dave wrote:
|
Yes, I did! Now, that said, if there’s a “secret” technique to edit the Value string with the ability to insert line breaks (^M), I’d love it…
From: LTspice@groups.io <LTspice@groups.io>
On Behalf Of Donald H Locker via groups.io
Sent: Thursday, July 04, 2024 2:58 PM To: LTspice@groups.io Subject: EXTERNAL: Re: [LTspice] Repeat a BURST voltage source every 25ms
Did you try it and it didn't work? Donald. On 2024-07-04 16:01, Bell, Dave wrote:
|
Hello,
переключити цитоване повідомлення
Показати цитований текст
The usual "+" at beginning of a line doesn't work for what you are doing?
|
The problem is not the + symbols. The problem is actually that the "Value" attribute for the PWL voltage source does not allow embedded line feed characters. If you type it all on one line, it works fine. if you embed it in a file, it works fine. The best compromise would be to use an include file and replicate the contents of the file on the schematic as a comment.
|
“The "Value" attribute for the PWL voltage source does not allow embedded line feed characters.” Yep, every way I’ve tried, it comes down to that. Self-documentation in LTspice is simple, but not elegant…
From: LTspice@groups.io <LTspice@groups.io> On Behalf Of
BRUCE108
Sent: Friday, July 05, 2024 1:16 PM To: LTspice@groups.io Subject: EXTERNAL: Re: [LTspice] Repeat a BURST voltage source every 25ms
The problem is not the + symbols. The problem is actually that the "Value" attribute for the PWL voltage source does not allow embedded line feed characters. If you type it all on one line, it works fine. if you embed it in a file, it works fine. The best compromise would be to use an include file and replicate the contents of the file on the schematic as a comment. |
I did not follow in lock-step with everything that was said here. But I want to add these thoughts:
Most LTspice symbols give us four available lines for parameters. They are: Value, Value2, SpiceLine, and SpiceLine2. In most cases (except for the exceptions), the four lines become concatenated together when LTspice converts the schematic to the SPICE Netlist. These four lines do NOT use the "+" continuation character. So -- If the text you use with your PWL voltage source can be made to fit within no more than four lines, then you can use them, and make all four lines visible ("X" in the "Vis." column) on the schematic. Then use your mouse to physically move them to get the indentations you desire. It is quite limited, but it sort of works. That is about the best you can do with a schematic symbol for a voltage source. When using all four lines, it is likely that everything gets messed up if you then used Right-click to edit the PWL source's parameters. You'd end up with the special voltage source editor making a mess of the extra lines. If you are willing to forego the voltage source schematic symbol, you can of course make a PWL source using Netlist lines only, and then you can use an unlimited number of lines, and indent them any way you want to. But because they are Netlist lines and not (.asy) symbol lines, you do need to use the "+" continuation characters, when done this way. Netlist lines --> must use "+" Value, Value2, SpiceLine, SpiceLine2 attributes --> do not use "+" I don't follow the part about "only works with time, value pairs". Andy |
(Hmm, Groups.io ate my reply.)
BRUCE108 wrote: "When you use the construction of PWL with a file name, ... It cannot contain the procedural statements" That is correct. A PWL file is a different entity. I missed the fact that you were talking about PWL files, before. PWL files are unique and are for time,data pairs only. Of course one could put the entire voltage source into an external file, and the "line" for that PWL source can span any number of physical lines, and then you would .include that file into your simulation. But I think that doesn't work for Dave's request, which was to have it in a schematic representation. Andy |
On 07/07/2024 23:43, BRUCE108 wrote:
Would defining a .subckt on the schematic containing a PWL source allow you to use the "netlist" version of a specification with the '+' as a line separator?Did you consider putting the whole of the PWL source into an .INCLUDE file? Then you can compose within the freedom of your favourite text editor, and not clutter up the schematic, or need to reduce the font size to something illegible. --
Regards, Tony |
re: "The best you can do is the single line specification, probably in small text so it fits on your page ...".
You can do slightly better, by splitting the long line up into four parts, using the Value2, SpiceLine, and SpiceLine2 attributes. It is very handy having that indented version there as a comment. You can't be absolutely certain they are identical, but you can come close by starting with copy/paste, followed by adding line feeds and indents, being careful not to alter the text itself. (Or the other way around.) Andy |
Hello All,
When creating a PWL.txt file, this also works and is much more intuitive.
An incremental time method of writing "time value" pairs
0 0
+200n -24 +58u -24 +200n 24 +100u 24 +200n -24 +58u -24 +200n 0
All for now
Sent: Sunday, July 07, 2024 at 10:21 AM
From: "BRUCE108 via groups.io" <bgraham@...> To: LTspice@groups.io Subject: Re: [LTspice] Repeat a BURST voltage source every 25ms @Andy I,
When you use the construction of PWL with a file name, as in: PWL file=Pulse.txt The file must contain "time, value" pairs: e.g. (0 0 0.1 1 0.2 0.5 0.5 0 0.7 0.3 1 0) It cannot contain the procedural statements |
Hello All,
I neglected to mention that I created this in Excel using two columns.
It is easy to copy 10 lines into 100, add a wrinkle, copy it all again, add another wrinkle, rinse and repeat, then save as a text file.
All for now Sent: Sunday, July 07, 2024 at 8:35 PM
From: "eewiz via groups.io" <eewiz@...> To: LTspice@groups.io Subject: Re: [LTspice] PWL source with indented lines on schematic (was: Repeat a BURST voltage source every 25ms) Hello All,
When creating a PWL.txt file, this also works and is much more intuitive.
An incremental time method of writing "time value" pairs
0 0
+200n -24 +58u -24 +200n 24 +100u 24 +200n -24 +58u -24 +200n 0
All for now
Sent: Sunday, July 07, 2024 at 10:21 AM
From: "BRUCE108 via groups.io" <bgraham@...> To: LTspice@groups.io Subject: Re: [LTspice] Repeat a BURST voltage source every 25ms @Andy I,
When you use the construction of PWL with a file name, as in: PWL file=Pulse.txt The file must contain "time, value" pairs: e.g. (0 0 0.1 1 0.2 0.5 0.5 0 0.7 0.3 1 0) It cannot contain the procedural statements |
BRUCE108 uploaded three files to a "PWL Example" folder in the "Temp" directory, and a photo to the "PWL with embedded procedural definition" photo album. But appears to have sent no message about them yet.
FYI, one could use the normal voltage-source symbol, instead of generating a new one with the problems that come with auto-generated symbols. It is your preference as to which kind of symbol to use. I prefer using symbols that come with LTspice instead of making new ones. To use the built-in V-source symbol, add a voltage source symbol, then Ctrl-right-click on it, and change Prefix from "V" to "X". Change the value next to the symbol from "V" to "PPWL" which is the name of your subcircuit. Because the voltage source has 2 pins, also add a second pin to your .SUBCKT definition, like this: .subckt PPWL OUT 0 Also FYI, your file "PWL_SUBCKT.txt" is apparently not used and can be omitted. Andy |
On Sun, Jul 7, 2024 at 02:43 PM, BRUCE108 wrote:
Would defining a .subckt on the schematic containing a PWL source allow you to use the "netlist" version of a specification with the '+' as a line separator?This works when placed on the schematic: .subckt PPWL OUT VGND V1 OUT VGND PWL + VALUE_SCALE_FACTOR=30 + REPEAT FOREVER + REPEAT FOR 5 + (0 0 +1n 1 +500u 1 +1n 0 +3m 0) + ENDREPEAT + (+{25m-5*3.5m} 0) + ENDREPEAT .ends You can use the built-in V-source symbol as Andy described: "To use the built-in V-source symbol, add a voltage source symbol, then Ctrl-right-click on it, and change Prefix from "V" to "X". Change the value next to the symbol from "V" to "PPWL" which is the name of your subcircuit. Because the voltage source has 2 pins, also add a second pin to your .SUBCKT definition, like this: .subckt PPWL OUT 0 " In the .subckt code I've shown, I chose to use VGND instead of "0". |
Повідомлення
Меню