¿ªÔÆÌåÓý

Date

Re: LTSpive IV vs XVII voltage generators

 

Excellent catch.? Bravo!? This question is closed.


---In LTspice@..., <imbvlad@...> wrote :

I remember I noticed this but also that there was an entry in the
changelog about this and, sure enough, here it is:

04/24/18 Corrected the behavior of SINE voltage and current sources
when Ncycles is specified and revised the help to match.

--

Vlad


Re: LTSpive IV vs XVII voltage generators

 

I remember I noticed this but also that there was an entry in the
changelog about this and, sure enough, here it is:

04/24/18 Corrected the behavior of SINE voltage and current sources
when Ncycles is specified and revised the help to match.

--

Vlad
______________________
ltspicegoodies.ltwiki.org -- holding, among others:
a universal analog/digital filter, block-level models
for power electronics (and not only), math blocks
with a more stream-lined approach, some digital
ADC, DAC, (synchronous-)counter, JKflop, etc.


Re: Edge triggered b-source logic and integrated averaging in LTspice

 

Hello analogspiceman,

Thanks for your uploaded example "sampled_average_expanded.asc".
I have now a better understanding after I plotted V(4), V(3) , V(x) and V(s) in one plot.


Best regards,
Helmut


---In LTspice@..., <helmutsennewald@...> wrote :

Hello analogspiceman,

Thanks a lot for ths idea of a "sampled" average.

I have made an example with your formulas. Please check my circuit.

I wonder a little bit were the integration really starts and stops compared to the sample clock pulse.

Files > Temp
sampled_average.zip

Best regards,
Helmut


Re: Frequency calc durung trans sim

 

Agreed.? (Although Mike is brilliant he can be very stubborn once his mind is closed.)


---In LTspice@..., <helmutsennewald@...> wrote :

Hello analogspiceman,

I have been aware of this command, but it would be a nightmare to download a few thousands of my schematics, modify it and upload it again. I would also loose the time stamp which is a good indicator for me whether an example may be easier due to new features or more experience. I simply have rated this reset to minimum size as a bad design decision.

Best regards,
Helmut


---In LTspice@..., <analogspiceman@...> wrote :

Hello Helmut,

Mike added a command line switch to automatically resize text when an old file is opened with this switch, but it is a lot of trouble to use and it often only fixes some of the text.


---In LTspice@..., <helmutsennewald@...> wrote :

Hello eT,

Have you tried my older eyamples before?

freq_meter_test1.zip, freq_meter_test2.zip

Don't wonder about the small size of characters in these files. When Mike implemented the variable size of characters, he decided to set the text of all older schematics to a minimum size. This has been a really bad decision. You should manually change the size of all text to the new default for better readability.

Best regards,
Helmut


Re: Frequency calc durung trans sim

 

Hello analogspiceman,

I have been aware of this command, but it would be a nightmare to download a few thousands of my schematics, modify it and upload it again. I would also loose the time stamp which is a good indicator for me whether an example may be easier due to new features or more experience. I simply have rated this reset to minimum size as a bad design decision.

Best regards,
Helmut


---In LTspice@..., <analogspiceman@...> wrote :

Hello Helmut,

Mike added a command line switch to automatically resize text when an old file is opened with this switch, but it is a lot of trouble to use and it often only fixes some of the text.


---In LTspice@..., <helmutsennewald@...> wrote :

Hello eT,

Have you tried my older eyamples before?

freq_meter_test1.zip, freq_meter_test2.zip

Don't wonder about the small size of characters in these files. When Mike implemented the variable size of characters, he decided to set the text of all older schematics to a minimum size. This has been a really bad decision. You should manually change the size of all text to the new default for better readability.

Best regards,
Helmut


Re: How to include component values in LTSpice trace formulas

 

¿ªÔÆÌåÓý

Correction. Replace ^ by **, and the last number should be 10**(-15).? It may be possible to work round the '1F' problem by changing it to '1C/1V', which is '1 coulomb per volt'.

John Woodgate OOO-Own Opinions Only
J M Woodgate and Associates 
Rayleigh, Essex UK
On 2018-11-17 21:38, John Woodgate jmw@... [LTspice] wrote:

Click on the title of the plot of the voltage (V(n005) for example) across your capacitor and change? the expression? to V(n005)^2*10^(-7)/2, if your capacitor is 100 nF. The y-axis is in terms of volt-squared, because LTspice doesn't know that the '10^(-7)' is a capacitor.? It ought to be plotted in joules if you multiply it by 1F/1J (1 farad/1joule), but it doesn't work because LTspice recognizes '1F' as '1 femto', i.e. 1-^(-15).


Re: How to include component values in LTSpice trace formulas

 

¿ªÔÆÌåÓý

You should first of all, read the Help. It is very information-intensive, so it needs reading carefully and reading several time. There is a special way of treating capacitors that do unusual things or are charged in unusual ways, which is at the end of the Help page on Capacitors:

There is also a general nonlinear capacitor available. Instead of specifying the capacitance, one writes an expression for the charge.

LTspice will compile this expression and symbolically differentiate it with respect to all the variables, finding the partial derivative's that correspond to capacitances.

Syntax: Cnnn n1 n2 Q= [ic=] [m=]

There is a special variable, x, that means the voltage across the device. Therefore, a 100pF constant capacitance can be written as

Cnnn n1 n2 Q=100p*x

A capacitance with an abrupt change from 100p to 300p at zero volts can be written as

Cnnn n1 n2 Q=x*if(x<0,100p,300p)

I have assumed from your message that your capacitor value is not constant. If it is constant, just put its value in the expression. You can do this even just with Waveform Arithmetic (see the Help!). Click on the title of the plot of the voltage (V(n005) for example) across your capacitor and change? the expression? to V(n005)^2*10^(-7)/2, if your capacitor is 100 nF. The y-axis is in terms of volt-squared, because LTspice doesn't know that the '10^(-7)' is a capacitor.? It ought to be plotted in joules if you multiply it by 1F/1J (1 farad/1joule), but it doesn't work because LTspice recognizes '1F' as '1 femto', i.e. 1-^(-15).

John Woodgate OOO-Own Opinions Only
J M Woodgate and Associates 
Rayleigh, Essex UK
On 2018-11-17 19:31, douglas.fay@... [LTspice] wrote:

?

Just joined the group and don't know how to search whether this has already been addressed - guidance on that would be appreciated!


But here's my question: I would like to be able to define a trace for the energy stored in a capacitor using the formula E= 1/2 * V^2 * C. But I can't find how to include component values such as capacitance, C, in the trace formulas. Is there a way to do this?


Thanks - Doug


Re: LTSpive IV vs XVII voltage generators

 

Small correction to my reply --

In LTspice IV, at the end of Ncycles, the output of the source suddenly reverted to Voffset or Ioffset, not necessarily to zero.

Regards,
Andy



Re: Frequency calc durung trans sim

 

Hello Helmut,

Mike added a command line switch to automatically resize text when an old file is opened with this switch, but it is a lot of trouble to use and it often only fixes some of the text.


---In LTspice@..., <helmutsennewald@...> wrote :

Hello eT,

Have you tried my older eyamples before?

freq_meter_test1.zip, freq_meter_test2.zip

Don't wonder about the small size of characters in these files. When Mike implemented the variable size of characters, he decided to set the text of all older schematics to a minimum size. This has been a really bad decision. You should manually change the size of all text to the new default for better readability.

Best regards,
Helmut


Re: LTSpive IV vs XVII voltage generators

 

Larry wrote about changed behavior between LTspice IV and LTspice XVII, when a sine wave voltage or current source has Ncycles.

? ? "I assume this was done intentionally or is this possibly an error."

Looking at LTspice's Help, I think it was an old bug that has finally been found and fixed.? The way it behaves now, is the way it was always SUPPOSED to be.

The LTspice IV Help page says that the output before Td or after Ncycles have completed, should be:

? ? V(time) = Voffset?+ Vamp * sin(PI*Phi/180)
? ? I(time) = Ioffset?+ Iamp * sin(PI*Phi/180)

Therefore its steady starting AND ending values should have been the value at that point along the sine wave where it starts and ends, determined by Phi.? Thus the sine wave should be continuous at both ends.? (But even that description is in error, because Ncycles doesn't need to be an integer, and because it doesn't take Theta into account.? That's been fixed in the Help page for LTspice XVII.)

However, LTspice IV's actual behavior differed from this.? Instead of being the steady value given on the Help page (adjusted if necessary if Ncycles is not an integer), it actually shot straight to zero at the end of Ncycles, as you saw.

I would call that a bug in LTspice IV because it clearly doesn't do what the Help says it should have done (for integer Ncycles).

LTspice XVII fixes the bug.

The LTspice XVII Help pages now say, "For times after Ncycles have completed, the voltage (current) is the last voltage (current) when Ncycles have completed.? Note Ncycles does not have to be an integer."? I think that was the intention all along, but LTspice IV was (and is) wrong.

It might be interesting to go back several versions and see if this big appeared at some point or if it was always there.? But I am not currently set up to easily do that.

Regards,
Andy



Re: LTSpive IV vs XVII voltage generators

 

Hello Larry,

I would assume it was done intentionally.? Although there may be arguments for both behaviors, the current behavior seems correct to me.? A simple sine wave is not the only case to consider.? The amplitude may be increasing or decreasing and there may be dc offset.? With all those different cases, having the source just stop at its last value makes the most sense to me.? If going to zero is required, one could always add a pulse source in series with a delay equal to the sine source stop time, a 1ns rise time and a dc value opposite the sine source final value.


---In LTspice@..., <xxw0qe@...> wrote :

I loaded an old circuit that was created in LTspice IV into LTspice XVII today and noticed that the voltage acts differently. Specifying a sine wave voltage source with some number of cycles and some phase so that the ending point is not at 0V the two versions act differently.

Version IV sets all voltage values after the sine wave to 0v where version XVII sets all the values to the last voltage that was specified at the end of the number of cycles.

I assume this was done intentionally or is this possibly an error.

Thanks,
Larry Benko


Re: LTSpive IV vs XVII voltage generators

 

Hello Larry,

I haven't discovered this behavior, because I used sine-burst only a very few times in 17 years. I just checked your reported case and indeed it's different in LTspiceXVII.
It's difficult to say what's better. You can achieve the behavior of LTspiceIV with an additional B-source.

You should report this case to the email address given in the Help->About of LTspiceXVII. Please let us know when you got the answer.

Best regards,
Helmut


Re: How to include component values in LTSpice trace formulas

 

Doug asked:

? ? "I would like to be able to define a trace for the energy stored in a capacitor using the formula E= 1/2 * V^2 * C. But I can't find how to include component values such as capacitance, C, in the trace formulas. Is there a way to do this?"

There is.

First, use .PARAMs to define parameters using those formulas.? This step is not really essential, but it helps to keep things organized.

Then, when you have your (parameter) value calculated, put it within {curly braces}, where the component's value should go.? For example, for a capacitor, right-click on the text where the value would go (originally "C" when you put it on the schematic), and change it to something like {MyCapValue} where MyCapValue is a user-defined parameter that was defined in a .param statement.? Or, I believe you could use {E/(0.5*V(something)**2)}.

Be careful NOT to use "^" to mean exponentiation.? In most places in LTspice, "^" is the operator for XOR.? "**" properly raises one number to an exponent.? See the tables on the Help page for the .PARAM statement.

A pair of curly braces is the way to turn a parameter into a number.? Where SPICE/LTspice expects there to be a number but instead you have a parameter, use curly braces to turn it into a number.

Regards,
Andy



Re: Frequency calc durung trans sim

 

Hello eT,

Have you tried my older eyamples before?

freq_meter_test1.zip, freq_meter_test2.zip

Don't wonder about the small size of characters in these files. When Mike implemented the variable size of characters, he decided to set the text of all older schematics to a minimum size. This has been a really bad decision. You should manually change the size of all text to the new default for better readability.

Best regards,
Helmut


LTSpive IV vs XVII voltage generators

 

I loaded an old circuit that was created in LTSpice IV into LTSpice XVII
today and noticed that the voltage acts differently. Specifying a sine
wave voltage source with some number of cycles and some phase so that
the ending point is not at 0V the two versions act differently.

Version IV sets all voltage values after the sine wave to 0v where
version XVII sets all the values to the last voltage that was specified
at the end of the number of cycles.

I assume this was done intentionally or is this possibly an error.

Thanks,
Larry Benko


Re: Edge triggered b-source logic and integrated averaging in LTspice

 

Hello Vlad,

I noticed that bug and reported it several days ago. Perhaps it would help if you reported it as well. It only is a problem for "B I=" sources that include a defined function and that specify both Rpar and Cpar. Either one alone is okay.


Frequency calc durung trans sim

 

Hi everyone

I'm working on a B device method to calculate the frequency of a square wave during a trans sim.
I'm uploading a file "CalcFreqFromTonToff.zip". Its not a real accurate method but I was hoping
someone could take a look at the schematic and provide thoughts/recommendations?
Appreciate it very much...

thanks

eT


How to include component values in LTSpice trace formulas

 

Just joined the group and don't know how to search whether this has already been addressed - guidance on that would be appreciated!


But here's my question: I would like to be able to define a trace for the energy stored in a capacitor using the formula E= 1/2 * V^2 * C. But I can't find how to include component values such as capacitance, C, in the trace formulas. Is there a way to do this?


Thanks - Doug


Re: Edge triggered b-source logic and integrated averaging in LTspice

 

Hello analogspiceman

These following functions are intended to be used in b-sources. The first
two replicate edge triggered logic such as is used in the a-device DFLOP
clock input. The last function is more complicated as it includes three
behavioral integrators to provide a running integrated average of x
(starting on the falling edge of sampling pulse s) that is then held until
the next rising edge of sampling pulse s. In normal use, x would be an
analog input and the sampling pulse s would be a series of very narrow 1
volt positive digital pulse.

.func up(s) buf( ddt(s)) ; generates pulse on rising edge of s
.func dn(s) buf(-ddt(s)) ; generates pulse on falling edge of s

* The following averages x between sample pulses s
.func ave(x,s) sdt(0,sdt(x,0,dn(s))/sdt(1,0,dn(s)),up(s))

B1 1 0 V= ave(V(x),V(s)) ; source for x and s not shown
It's a nice example on how to use idt() as idt(0, x, y), instead of
the more usual idt(x, 0, y). Still, because we're dealing with
B-sources, I noticed that the output is sensitive to the sampling
clock's time resolution. I tried using a current source with Rpar=1
Cpar=1n to smooth the flow, but apparently I stumbled across a bug:
the simulation won't start and LTspice throws an "Unknown parameter
'1n' [...]". If I don't use the custom function, it works. I tried
with some quick bogus custom functions, and it seems that this only
happens with these, even if the function is x+y. Using any builtin
arithmetic works. Does this happen to you, also? I am using the latest
update (23 oct).

--

Vlad
______________________
ltspicegoodies.ltwiki.org -- holding, among others:
a universal analog/digital filter, block-level models
for power electronics (and not only), math blocks
with a more stream-lined approach, some digital
ADC, DAC, (synchronous-)counter, JKflop, etc.


Re: Edge triggered b-source logic and integrated averaging in LTspice

 

Hello analogspiceman,

Thanks a lot for ths idea of a "sampled" average.

I have made an example with your formulas. Please check my circuit.

I wonder a little bit were the integration really starts and stops compared to the sample clock pulse.

Files > Temp
sampled_average.zip

Best regards,
Helmut