开云体育


Re: Modeling Constant Power Load with AC Source in LTspice

 

  • Would a smoother soft-transition function (instead of if()) work better?

Smoother functions are almost always better, in terms of stability and avoiding instability.
  • Are there other tricks to avoid convergence failures near zero crossing?
What zero crossing?? If it is an .AC analysis that you're doing, there are no zero-crossings.? There are no time-varying waveforms in .AC analysis.? Signals are assumed to be single-frequency, therefore they represent the amplitudes of sine waves, but there are no sine waves anywhere in the simulation when you are doing an .AC analysis.? A "1V" sinusoidal signal in .AC analysis is represented by the quantity "1", not by a time-varying sine wave.
?
That can also lead to confusion about whether a "1V" signal is an RMS level or a peak level.? The truth is that it doesn't matter.? You get to decide, as long as you are consistent about it.? If you decide that "1V" is the RMS amplitude, then everything is RMS.? If you decide that "1V" is the peak amplitude - or even peak-to-peak - then that is what it is and everything else in the simulation is measured the same way.? Because everything is strictly linear, it makes no difference.? Just be consistent about it, and you're OK.
?
So -- if you think you are experiencing difficulty because of zero crossings of sine waves, you are not.? There are no sine waves in the simulation itself.
?
Andy
?


Re: Modeling Constant Power Load with AC Source in LTspice

 

On Tue, Apr 29, 2025 at 03:48 PM, <thunderboy.johnson86@...> wrote:
  • Where P is set dynamically using an if() function:

  • P = if(V(vout)<5,5,500)

I am not sure how that relates to the circuit elements and their equations that you used.? But note that the formula for P has a significant discontinuity at V(vout) = 5.? The discontinuity also means the derivative is not a continuous function, and that is (almost by definition) the recipe for instability.
?
SPICE wants all functions and their first derivatives to be continuous everywhere.
?
Andy
?


Re: Modeling Constant Power Load with AC Source in LTspice

 
Edited

On Tue, Apr 29, 2025 at 03:48 PM, <thunderboy.johnson86@...> wrote:

I'm trying to model a constant power load fed by a single-phase AC source in LTspice. I seem to run into convergence failure when I run transient analysis

LTspice has a constant power load already.? See:
?
However, that is intended for .TRAN or .OP or .DC analysis, and I do not know how well it behaves for .AC analysis.? Maybe it's just fine, or maybe not.? .AC analysis is strictly linear with constant unvarying circuit elements, and a constant power load needs to vary dynamically as a function of the signal amplitude - therefore making it nonlinear (and non-constant).? It seems like that could be a real problem for .AC analysis.
?
(I am assuming that you did actually mean .AC analysis, and not time-varying signals, right?)
?
Your question implies a possible interaction between the load and the rest of the circuit.? Maybe the interaction between your circuit and the load's need to vary, result in the stability problem?? That is just a guess.
?
For a better answer, considering uploading your simulation to the group for all to see.? As always, check the guidelines on this group's webpage before attempting to upload anything.
?
Andy
?


Modeling Constant Power Load with AC Source in LTspice

 

Hi all,

I'm trying to model a constant power load fed by a single-phase AC source in LTspice. I seem to run into convergence failure when I run transient analysis

What I’m doing:

  • I’m using a behavioral current source with this formula:
    I = P/V(vout)

  • Where P is set dynamically using an if() function:

  • P = if(V(vout)<5,5,500)

My goal:

  • Accurately simulate a constant power source behavior under AC voltage?
  • But without simulation instability

Questions:

  • Has anyone successfully built a robust CPL model under AC excitation in LTspice?

  • Would a smoother soft-transition function (instead of if()) work better?

  • Are there other tricks to avoid convergence failures near zero crossing?


Re: Making a PWM a continuous voltage source

 

try this
/g/LTspice/files/z_yahoo/Examples/Apps/pwm4_Pulse.zip


Re: Making a PWM a continuous voltage source

 

On Tue, Apr 29, 2025 at 05:59 AM, Christoph wrote:
I tried the statement: PWL REPEAT FOREVER ( | one_period.txt) ENDREPEAT from the undocumentedcommands section of the wiki to no avail.
The "|" (pipe symbol) gives an error.
I do not understand why the "|" character is there in the LTwiki page for "Undocumented LTspice".? I am sure that was a typo.? As far as I know, the pipe character is never used anywhere in LTspice netlists.
?
My best guess (in message 147247 which was a reply in 2023 to a question from you) is that the author of that LTwiki page had intended to write it this way:
... PWL REPEAT FOREVER ( <t1> <v1> ... <tn> <vn> | file=<file spec> ) ENDREPEAT
where the "|" character does not mean to literally type the pipe character there.? In that setting, "|" means "OR", as in, "use either this, or this".? And then somewhere along the way, that line was edited down and the meaning was lost.? His examples, just a few lines lower on that page, show the correct syntax.
?
Unfortunately we can't ask AnalogSpiceman for clarification because he passed on from this world in 2020.
?
Andy
?
?


Re: Making a PWM a continuous voltage source

 

开云体育

On 29/04/2025 11:58, Christoph via groups.io wrote:
Is it possible to make a PWM signal a continuous voltage source ?

I have these PWL points in a file but  simulating this I have transient response and decay behaviour. I would like to do a FFT on the filter output signal
and the presence of these spoil the FFT picture. Using a sine as a voltage source it behaves like an infinite signal while the PWL from file is always finite, seems so.

I tried the statement: PWL REPEAT FOREVER ( | one_period.txt) ENDREPEAT from the undocumentedcommands  section of the wiki to no avail.
The "|" (pipe symbol) gives an error.
Try removing the pipe. That part of the documentation is confusing. The example showing the pipe doesn't mean you should add it. Using the syntax from the other clearer example:

PWL REPEAT FOREVER ( file=one_period.txt ) ENDREPEAT

See: PWL_Example

--
Regards,
Tony


Making a PWM a continuous voltage source

 

Is it possible to make a PWM signal a continuous voltage source ?

I have these PWL points in a file but simulating this I have transient response and decay behaviour. I would like to do a FFT on the filter output signal
and the presence of these spoil the FFT picture. Using a sine as a voltage source it behaves like an infinite signal while the PWL from file is always finite, seems so.

I tried the statement: PWL REPEAT FOREVER ( | one_period.txt) ENDREPEAT from the undocumentedcommands section of the wiki to no avail.
The "|" (pipe symbol) gives an error.

--
Christoph


Re: LTspice 24.1.7 program exit

 

On Mon, Apr 28, 2025 at 04:41 AM, Mathias Born wrote:
I can't reproduce this. All I get when I run this netlist is an error message about the file "standard.dio" not being found.\
Perhaps you forgot to substitute your computer's "path" to the standard.dio file, in the ".lib" statement.? Obviously, eT edited that line to remove his computer's unique path.
?
I'd be quite interested in any evidence that could substantiate this claim.
?
And with "before", I take it you don't mean LTspiceXVII, ...
I did mean LTspice XVII, and LTspice III and LTspice IV.
... because I had that crashing multiple times per hour on bad days. ...
You must have had incredibly bad days or very unique schematics/netlists (or something unique about your computer), because I rarely ever ever saw LTspice III or IV or XVII crash.? Occasionally (a few times a year) it would hang and I had to manually crash it, but it did not crash itself.? If I recall correctly, that happened ONLY while it was trying to plot a particularly difficult (very 'dense') set of waveforms, but never during a simulation or editing schematics.? Now I use the word "never" which might be incorrect.? But I can truly not remember a time when LTspice III or LTspice IV or LTspice XVII crashed when simulating or preparing to simulate something.? There were ways to make simulations fail, but not to make the program itself fail and fall over.
?
I also note there are group members here who reported they could get theirs to crash, but I don't recall others being able to replicate it.? (Now there may have been exceptions where a new program release did, but it was quickly fixed, causing its memory to fall through the holes in my brain.)
?
Andy
?


Meaning of gshunt

 

Hi,
This topic can be closed. I translated the description incorrectly (conductance vs. resistance)...
Thanks.
Marco


Re: LTspice 24.1.7 program exit

 

Thanks! That was the missing piece.
The topology checker removes I1 and then the dc-sweep accesses that, which may or may not cause a crash. Will be fixed.
?
Best Regards,
Mathias
?
On Mon, Apr 28, 2025 at 10:54 AM, Tony Casey wrote:

On 27/04/2025 00:57, John Woodgate via groups.io wrote:
It doesn't crash version 24.0.11, but it's a nonsense .ASC, isn't it? LTspice can't find I1, presumably because it's shorted.
It crashes in 24.1.4, too.

The "expanded" netlist is:

LTspice 24.1.4 for Windows
Circuit: I:\tony\Desktop\Test.cir
Start Time: Mon Apr 28 10:51:01 2025
??? --- Expanded Netlist ---
V1 ADJ 0 DC=0
.model D D()

.end

solver = Normal
Maximum thread count: 32
tnom = 27
temp = 27
method = modified trap

--
Regards,
Tony


Re: LTspice 24.1.7 program exit

 

开云体育

I have to say that, while I did not try very large or complicated simulations, I never had LTspiceXVII crash.

On 2025-04-28 09:46, Mathias Born via groups.io wrote:
I'd be quite interested in any evidence that could substantiate this claim.
?
And with "before", I take it you don't mean LTspiceXVII, because I had that crashing multiple times per hour on bad days. Fortunately, we now have people on the helm who deeply care about quality and robustness.
?
Best Regards,
Mathias
?
On Sun, Apr 27, 2025 at 11:22 PM, Andy I wrote:
LTspice was very robust before, and rarely crashed even when errors happened.? Some of the recent changes (24.1.x) made it less robust.? Hopefully ADI can restore what was lost.
?
Andy
?
--
Best wishes John Woodgate RAYLEIGH Essex OOO-Own Opinions Only If something is true: * as far as we know - it's science *for certain - it's mathematics *unquestionably - it's religion

Virus-free.


Re: Meaning of gshunt

 

I have found the mistake. I translated the description incorrectly (conductance vs. resistance)


Re: LTspice 24.1.7 program exit

 

开云体育

On 27/04/2025 00:57, John Woodgate via groups.io wrote:
It doesn't crash version 24.0.11, but it's a nonsense .ASC, isn't it? LTspice can't find I1, presumably because it's shorted.
It crashes in 24.1.4, too.

The "expanded" netlist is:

LTspice 24.1.4 for Windows
Circuit: I:\tony\Desktop\Test.cir
Start Time: Mon Apr 28 10:51:01 2025
??? --- Expanded Netlist ---
V1 ADJ 0 DC=0
.model D D()

.end

solver = Normal
Maximum thread count: 32
tnom = 27
temp = 27
method = modified trap

--
Regards,
Tony


Re: LTspice 24.1.7 program exit

 

I'd be quite interested in any evidence that could substantiate this claim.
?
And with "before", I take it you don't mean LTspiceXVII, because I had that crashing multiple times per hour on bad days. Fortunately, we now have people on the helm who deeply care about quality and robustness.
?
Best Regards,
Mathias
?
On Sun, Apr 27, 2025 at 11:22 PM, Andy I wrote:

LTspice was very robust before, and rarely crashed even when errors happened.? Some of the recent changes (24.1.x) made it less robust.? Hopefully ADI can restore what was lost.
?
Andy
?


Meaning of gshunt

 

Hi,
?
First of all: Many thanks to all forum members. The group is really very helpful and detailed.
?
I have read several times that gshunt, for example, can be used for convergence problems. According to the description, this is a resistance of a node to ground. Why is it chosen so small? Logically, I would have estimated it to be very large in order to minimise the influence of the ground potential.
?
Thanks in advance,

Marco


Re: LTspice 24.1.7 program exit

 

I can't reproduce this. All I get when I run this netlist is an error message about the file "standard.dio" not being found.
?
Best Regards,
Mathias
?
On Sat, Apr 26, 2025 at 07:56 PM, eetech00 wrote:

The following circuit configuration was unintentional, but caused an LTspice program exit upon simulation run.
?
* Generated by LTspice 24.1.7 for Windows.
I1 0 0 1m
D1 0 0 D
V1 ADJ 0 0
.model D D
.lib (path removed)\standard.dio
.dc I1 2u 2m 100n
.backanno
.end
?


Re: Vin vs. Load - YX logarithmic plot

 

开云体育

Thanks a lot Dave, it looks exactly like what I need.

?

J

?

From: <[email protected]> on behalf of "Bell, Dave via groups.io" <Dave.Bell@...>
Reply to: <[email protected]>
Date: Sunday, 27 April 2025 at 23:34
To: "[email protected]" <[email protected]>
Subject: Re: [LTspice] Vin vs. Load - YX logarithmic plot
Resent from: <Dave.Bell@...>
Resent date: Sun, 27 Apr 2025 14:34:08 -0700

?

Jurek, are you looking for something like a solar panel I/V curve?

Maybe look at the SA Sim.zip I just uploaded.

?

Dave

?

From: [email protected] <[email protected]> On Behalf Of jerzy przezdziecki via groups.io
Sent: Sunday, April 27, 2025 1:27 PM
To: [email protected]
Subject: EXTERNAL: [LTspice] Vin vs. Load - YX logarithmic plot

?

Hello, I would like to create a simulation of overcurrent protection circuit — a graph where the Y-axis shows the current drop (in Amperes), and the X-axis shows a linear increase of voltage in the range of 15–50 V.

I expect a logarithmic curve of the current decreasing from 1.2 A down to 0 A as the voltage increases. I used the .step param function (.step param Vin 12 50 1), but that’s not what I’m looking for.

?

How should I define such a graph?

?

Thanks Jurek


Re: LTspice 24.1.7 program exit

 

开云体育

On 27/04/2025 23:22, Andy I via groups.io wrote:
LTspice was very robust before, and rarely crashed even when errors happened.? Some of the recent changes (24.1.x) made it less robust.? Hopefully ADI can restore what was lost.
I haven't got to 24.1.7 yet, but I've not noticed any increased propensity to crash, so far. But then, I still have 24.0.12 and 17.1.15 running alongside 24.1.x.

I still use 24.0.12 as default for the same reasons as I have highlighted in my posts. I don't like it when backward compatibility is compromised. New features are great, provided nothing gets broken in the process. Some of the things that were broken at first have now been fixed, but IMHO the fixes should have been applied before release. LTspice is not a disruptive start-up; it doesn't need to break things, then fix them quick. Leave that to the others.

If LTspice gets a reputation for breaking, it will lose users. Simple.

--
Regards,
Tony


Re: Vin vs. Load - YX logarithmic plot

 

开云体育

Jurek, are you looking for something like a solar panel I/V curve?

Maybe look at the SA Sim.zip I just uploaded.

?

Dave

?

From: [email protected] <[email protected]> On Behalf Of jerzy przezdziecki via groups.io
Sent: Sunday, April 27, 2025 1:27 PM
To: [email protected]
Subject: EXTERNAL: [LTspice] Vin vs. Load - YX logarithmic plot

?

Hello, I would like to create a simulation of overcurrent protection circuit — a graph where the Y-axis shows the current drop (in Amperes), and the X-axis shows a linear increase of voltage in the range of 15–50 V.

I expect a logarithmic curve of the current decreasing from 1.2 A down to 0 A as the voltage increases. I used the .step param function (.step param Vin 12 50 1), but that’s not what I’m looking for.

?

How should I define such a graph?

?

Thanks Jurek