Keyboard Shortcuts
Likes
- LTspice
- Messages
Search
Re: .MEAS Failure
开云体育On 24/02/2025 15:34, Andy I via
groups.io wrote:
No, I think you're just introducing accuracy into the equality test. The LTspice just takes the two closest data points and performs linear interpolation to establish when the expression is true. It might not be absolutely correct. The smaller the time steps (or whatever the x-axis quantity is, because the same expression could be plotted in .DC analysis), the better the accuracy. Whether the search criterion can be precisely expressed internally in binary format is another topic. -- Regards,
Tony |
Re: .MEAS Failure
On Mon, Feb 24, 2025 at 09:30 AM, Tony Casey wrote:
So, try:I thought the general rule was to avoid testing with equalities.? That voltage will never be 1.00000000000000 exactly. ?
But maybe I am confused or remember wrongly.
?
Andy |
Re: .MEAS Failure
开云体育On 24/02/2025 06:54, eewiz via
groups.io wrote:
This .MEAS will fail because LTspice doesn't test for inequalities. It test for equalities. You are looking for a single instance in time - the answer cannot be an interval. Assuming you can actually plot V(XSW11:X1:Qc,XSW11:X1:Qe), do you actually see any time when its value is less than 1? Also, when you have complex expressions that fail, the procedure for debugging them is to simplify, so you can home in on which part is failing. "FAIL'ed diagnostic is not very helpful! So, try: .MEAS TRAN T1 when V(XSW11:X1:Qc,XSW11:X1:Qe)=1 cross=1 That will tell you when the expression is first true, but not the trajectory. Or: .MEAS TRAN T2 when V(XSW11:X1:Qc,XSW11:X1:Qe)=1 fall=1 .MEAS TRAN T3 when V(XSW11:X1:Qc,XSW11:X1:Qe)=1 rise=1 If both .MEASs succeed and T2 < T3, then V(XSW11:X1:Qc,XSW11:X1:Qe) < 1 between T2 and T3, ∴ T2 to T3 is your desired interval. If T3 succeeds but not T2, then the expression is true from time = 0 to T3, but not afterwards. You can extend the logic to find the other possibilities. If?V(XSW11:X1:Qc,XSW11:X1:Qe) is periodic, then there may be other intervals when the expression is true. .MEAS is not well suited to this kind of thing, although you can set the rise= or fall= qualifiers to different values in multiple .MEASs. N.B. You could also plot: if(V(XSW11:X1:Qc,XSW11:X1:Qe)<1,1,0) ..in a separate pane in the waveform viewer, which will plot multiple intervals when the expression is true. It sounds like this might be more useful for you. -- Regards, Tony |
Re: Initial conditions for inductor current in .TRAN UIC analysis - follow up
On Mon, Feb 24, 2025 at 09:11 AM, John Woodgate wrote:
That is actually normal for SPICE syntax.? Specifying UIC tells SPICE to definitely use that IC setting.? No paradox.
?
There may be some difference in the details, between how different SPICE programs handle it.? But I think it is basically like this:? Specifying initial conditions (either IC= or .IC) works differently depending on whether UIC is also used.? Without UIC, SPICE applies the initial conditions, lets the circuit converge, then it might remove the enforcing conditions and lets it converge again.? Therefore, whether or not it does the second step, it starts with a self-consistent set of voltages and currents.? Whereas, when you add UIC, SPICE omits trying to converge.? It just accepts the initial conditions you specify (including 0 for any not specified), and accepts them as is.? ?No attempt to solve the network equations with those conditions.? Therefore it is almost guaranteed to "burp" when the transient simulation begins.? You got what you asked for, even if it is garbage.
?
I can't guarantee that what I described above happens in all SPICE programs, but this was my understanding, from decades ago.
?
It does count as an "initial condition".? But it needs to be taken with care. ?
? |
Re: Initial conditions for inductor current in .TRAN UIC analysis - follow up
On Mon, Feb 24, 2025 at 06:11 AM, John Woodgate wrote:
On the face of it, setting IC of L1 = 10, but also specifying UIC is paradoxical. I suppose IC = 10 doesn't count as an 'initial condition' despite the name. Evidence of this is the huge voltage spike at t = 0, which presumably is the way that the 10 A current is produced instantaneously.No, IC=10 at inductor component level does count as inductor's current initial condition for .TRAN UIC analysis. Indeed the v1 voltage spike at 2nd datapoint (not at the first) changes according that IC= initial condition. Check the result for instance changing IC=10 to IC=1. ?
It basically affects the value of the derivative di/dt at the 2nd datapoint.
?
Carlo. |
Re: Initial conditions for inductor current in .TRAN UIC analysis - follow up
On Mon, Feb 24, 2025 at 05:46 AM, Andy I wrote:
Ah ok, got it. ?
Yes, I'm aware of it. With a non-zero inductor's Rser, the special implementation employs a Nortonized equivalent circuit in order to reduce the MNA system's matrix size (the inductor's current is no longer an unknown of the linear system).
?
Carlo.
?
? |
Re: Initial conditions for inductor current in .TRAN UIC analysis - follow up
开云体育On the face of it, setting IC of L1 = 10, but
also specifying UIC is paradoxical. I suppose IC = 10 doesn't
count as an 'initial condition' despite the name. Evidence of
this is the huge voltage spike at t = 0, which presumably is the
way that the 10 A current is produced instantaneously. On 2025-02-24 13:46, Andy I via
groups.io wrote:
--
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 |
intuition behind a solution to crashing time domain simulation
#Time-step-too-small
Hello ,I have the following file which is presenting an error shown below
When I added the following spice command it ran no problem.
Is there a manual an intuition regarding why this spice command solved the problem?
Ltspice file is attached.
Thanks.
spice command solution
.options cshunt =10f gshunt=10n abstol=10n vntol=1m
/g/LTspice/files/Temp/PID_section_united_AC_separate.zip
?
error:
Start Time: Mon Feb 24 15:55:30 2025
solver = Normal Maximum thread count: 32 tnom = 27 temp = 27 method = trap Direct Newton iteration for .op point succeeded. Warning: Simulation tolerance relaxed to achieve convergence from 8.1172440660751147e-08? Convergence Failure: ?Time step too small; time = 8.11724e-08, timestep = 1.25e-19: trouble with instance "u1:DSC1" Simulation Failed: Iteration limit reached
Total elapsed time: 1.041 seconds.
|
Re: Initial conditions for inductor current in .TRAN UIC analysis - follow up
On Mon, Feb 24, 2025 at 06:38 AM, Carlo wrote:
Note that you neglected to include the Title line or command.? The first line of any SPICE Netlist that is suitable for running, is always ignored. ?
You can copy-and-paste this netlist into a schematic.? But it should not be run by itself in batch mode, or results could be meaningless.
?
I think you should stop quibbling about transient behavior when UIC is specified.? You may never get agreement between different SPICE programs about this, and you may not even get what seems to you to be sensible behavior from a nonsense simulation.? Be aware that LTspice's construct with an inductor having non-zero series resistance Rser, is a special implementation that did not exist in traditional SPICE.? I do not know (at least at this moment) how it is constructed internally and exactly what makes it behave the way that it does.? For all I know, it might be a Nortonized equivalent circuit, not a Thevenin (L+R in series), which would be consistent with the fact that the L+Rser does not add a node to the netlist.? "LTspice uses proprietary circuit simulation technology to simulate this physical inductor without any internal nodes."
?
You seem to be very intent on trying to prove the behavior incorrect.? Please stop trying to do that.? You will only drive yourself (and us) crazy.
?
Whenever UIC is used, results might appear to be incorrect.? Internal to LTspice, they are not.? FYI, this has been argued over 23 years of this group's existence.
I am sure it is not garbage, and it should not be changed.? But its understanding may be clouded and mysterious. ?
Andy
? |
Re: using LTSPICE symbols for representation of spice netlist of OPAMP
On Mon, Feb 24, 2025 at 05:44 AM, john23 wrote:
It just does!? The 5 listed pins connect to the MyAD797.? The 6th pin does not; it remains internal. ?
This is how subcircuits work.? The .SUBCKT command defines the name of the subcircuit and its external pins.? The contents of the subcircuit typically contain many more nodes than the few that are called out as pins on the .SUBCKT command.
?
It is not unusual for a subcircuit to have dozens or hundreds of nodes, but only a few of them are listed on the .SUBCKT command.? All the ones that are not listed on the .SUBCKT command are internal to the subcircuit and are effectively not seen by the external circuit when you call or use the subcircuit with its X-element instance.
?
Look at any op-amp's subcircuit and you will see what I mean.? Take the AD797's subcircuit.? It has internal nodenames 1, 2, 98, 31, 44, 47, 9, 22, 5, 4, ... and I could go on and on for several more.? But its .SUBCKT command lists only these six: 1, 2, 99, 50, 38, and 14.? The rest of the nodes are internal to its subcircuit.
?
Please read up about how .SUBCKTs work in SPICE.? LTspice's Help description is rather inadequate for that, I am afraid, and assumes that the reader has a basic understanding about SPICE subcircuits.
?
Andy
? |
Re: 12AU7 tube heater model
On Mon, Feb 24, 2025 at 03:35 AM, John Woodgate wrote:
Well, I've given you the formula, but I'm not sure of how to write the command in LTspice syntax. I hope an expert will help. It's true, I think,? that LTspice needs to convert the resistor to a B source. Gotcha ! Eventually I found the issue: the symbol/operator for the square is ** and not ^. Therefore I used the following behavioral current source B1 for the single 6.3V/150mA heater:
?
B1 r 0 I= -0.0009*V(r)**2 + 0.0245*V(r) + 0.0314
?
I'll upload the .asc schematic using a 12AU7 tube SUBCKT with no heater (NH12AU7) plus the "external" single heater model.
|
Re: .MEAS Failure
On Mon, Feb 24, 2025 at 05:12 AM, eewiz wrote:
Now that IS incorrect syntax.? Should be:
You can't subtract nodenames themselves.? You can only subtract their voltages or currents.
?
FYI, I would not think the original syntax was the problem.? V(node1,node2) ought to work everywhere, as should V(node1)-V(node2).
?
Andy
?
?
|
Initial conditions for inductor current in .TRAN UIC analysis - follow up
After a few years, I came to ngspice and did some test to look better at strange behavior seen on LTspice .TRAN analysis for a simple circuit involving a current source across an inductor. Namely:
?
I1 0 v1 10
L1 v1 0 10u IC=10 Rser=1m .tran 10n 1m uic .ic V(v1)=0 .backanno .end ?
LTspice returns a spike of 20kA for the I(L1) current at timestamp t=0. I realized that ngspice for .TRAN UIC analysis does not include in the analysis's output such t=0 timestamp at all. Btw, one can check the MNA linear system it solves at each step and indeed there is no such system defined at t=0. The index 0 element of any .TRAN UIC analysis's output vector just refers to the first timestamp after t=0.
?
I did another try with ngspice by changing the .ic directive to .ic V(v1)=-15. Exact the same result: as expected the .ic initial condition on v1 node voltage does not affect the solution at all since there is no capacitor across that node and GND.
?
I believe LTspice .TRAN UIC analysis's output at t=0 timestamp is actually garbage. Maybe Mike had a good reason for that, however I hope ADI will fix it in future releases.
?
Ps: to get rid of this one can use the .options Thev_induc=1 directive forcing LTspice to employ the Thevenin equivalent for the finite-difference time-integration method used (e.g. Backward-Euler).
?
Carlo.
? |
Re: 12AU7 tube heater model
开云体育Well, I've given you the formula, but I'm not
sure of how to write the command in LTspice syntax. I hope an
expert will help. It's true, I think,? that LTspice needs to
convert the resistor to a B source. On 2025-02-24 09:52, Carlo wrote:
--
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 |
Re: using LTSPICE symbols for representation of spice netlist of OPAMP
Hello Andy,you define a subcircuit called MyAD797 with 5 pins.
inside the SUBCKT command you define X.
If I understand correctly X is an instance of AD797 subckt.
X has 6 pins
How does X connects to the MyAD797?
Thanks.
.SUBCKT MyAD797 In+ In- V+ V- Out X ?In+ In- V+ V- Out Decomp ?AD797 |
Re: .MEAS Failure
Thanks but that's not the answer.
.MEAS TRAN TooLow1 find V(XSW11:X1:Qc-XSW11:X1:Qe) when V(XSW11:X1:Qc-XSW11:X1:Qe)<1
Measurement "toolow1" FAIL'ed
Total elapsed time: 679.255 seconds.
?
XSW11 is a schematic that resides 1 level below a symbol on the main schematic.
X1 is a schematic that resides 1 level below a symbol on the XSW11 schematic.
Two levels deep all together.
?
All for now
?
?
Sent:?Monday, February 24, 2025 at 3:33 AM
From:?"mhx via groups.io" <mhx@...> To:[email protected] Subject:?Re: [LTspice] .MEAS Failure Did you already try ` V(XSW11:X1:Qc)-V(XSW11:X1:Qe)` instead of `V(XSW11:X1:Qc,XSW11:X1:Qe)` ?
-marcel ? |
Re: 12AU7 tube heater model
开云体育I think you have made the heater a current
generator, rather than a temperature-dependent resistor as I
posted, On 2025-02-24 09:09, Carlo wrote:
--
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 |
Re: 12AU7 tube heater model
Thanks to John W. advice, starting from Figure 35.14 into Radio Designer's Handbook 4th ed, I came to the following quadratic interpolation for the single heater in the range 3 - 8V:
I = -0.0009*V^2 + 0.0245*V + 0.0314
?
R-squared value is 0.9998 (note that the above formula returns the heater's current in Ampere and one gets it by dividing the A-curve in that figure by factor 2). I did a simple test using a behavioral current source B1 referencing the above quadratic function with a DC sweep voltage source across it.
?
V1 r 0 4
B1 r 0 I=-0.0009*V(r)^2 + 0.0245*V(r) + 0.0314
.dc V1 3 8 500m .backanno .end ?
The weird thing is that the current through B1 stays fixed at 1A. I tried adding Rpar=1Meg across the B1 behavioral current source without luck.
?
What is actually going on ?
? |