Keyboard Shortcuts
Likes
- LTspice
- Messages
Search
Re: Calculate average value of a waveform under specific conditions using .meas command
On Wed, May 7, 2025 at 03:10 AM, Tony Casey wrote:
I don't see why you have to specify small time intervals if your simulation has achieved steady state - each cycle will be essentially the same, so a full display of only 2 cycles will be ample - search by derivative will always find the transition. Don't make things more complicated than they need to be.That is true, IF Ankit wants to know only the long-term average of the voltage waveform.? But this is for a thesis project, so I assume it is somewhat research related, and he might want to know things to a greater level of detail.? Such as, what is the average voltage over the short time interval when the inductor current is increasing, versus when it is decreasing, or when it is zero.? I don't know the reasons why, but I think it makes sense that he might need to know to that level of detail. ?
Andy
?
? |
Re: Calculate average value of a waveform under specific conditions using .meas command
I question whether taking the derivatives of the waveform is good or bad.? Since there is ringing, it might manifest itself as large spikes in the derivative, which could mess up those .MEAS calculations.
?
We can just about see the ringing in the uploaded photo (screenplot from LTspice, green waveform).? It is barely there, but depending on the ringing frequency, their di/dt could be quite large.
?
Andy
?
? |
Re: Dual Active bridge
On Wed, May 7, 2025 at 05:04 AM, John Woodgate wrote:
Wow!? Which schematic was that?? What makes our simulations so utterly different?
?
I used dd.asc with UIC removed.? The input current from V9 is hardly sinusoidal.? If you had sinusoidal current, then something must be wrong.
?
My simulation's input voltage is 100 V (of course), but the average input current is 6.159 A, not 8 A DC.? Its waveform peaks at around +105 A (that's not a typo!) and at -23 A (yes, power going back into the voltage source).? Those peaks are quite narrow.? It is definitely not "roughly sinuoidal".
?
The RMS current from V9 is 12.6 A, which includes both the DC portion and the AC component which represents instantaneous power going both ways.
?
The important thing is, do the numbers make sense?? Do they add up?
?
In my simulation, they do.? Using Alt-Left-Click on V9, LTspice plots the instantaneous power (V*I) waveform of V9.? Then using Ctrl-Left-Click on the waveform label at the top of the plot, it says the Average Power is -597.32 W.? That is the power dissipated by V9, meaning that V9 sources +597.32 W to the circuit.
?
Doing the same thing with the load (R1), LTspice shows 458.39 W dissipated by the load.
?
The difference is 597-32 - 458.39 = 138.93 W that V9 sources but does not reach the load.? That is not so bad.? It's not ideal, of course, but nothing is perfect.? I think a lot of power is lost due to short-circuit current through the FETs.
?
Doing the same thing to each of the MOSFETs on the right side (M4, M5, M6, M7) shows that each of them dissipates (loses as heat) approx. 32.4 W, adding up to 129.6 W lost in those four FETs.? That compares favorably with the 138.93 W total power that did not make it from V9 into R1.? It shows that the four FETs on the right side caused most of the power loss.? You can improve that.
?
Ah, of course!? That is what makes your simulation so much different than mine.
?
If it stalls, then it is still simulating, right?? If it is still simulating, then there won't be an error message (yet).? It would be great if LTspice always times out after a while, but when should it time out?? Apparently it thinks it is still making positive progress.??From what you wrote earlier, I think LTspice 24 was heading towards a "timestep too small" error, but not reaching it.? That rarely happens.? Usually when it is heading towards a "timestep too small" situation, it positively reaches it, and aborts.? Apparently it saves itself before that happens.? Hmm. ?
LTspice XVII does not stall at any point, with or without Rser-1 ohm.
?
It would be interesting to see why LTspice 24 simulates badly whereas LTspice XVII does not.
?
Andy
?
? |
Re: Dual Active bridge
Set Lp = 2,3mH Ls=5,1mH Llkg=76uH . Imagn=magnetizing current =8% of primary peak current, Llkg = 3% of Lp (values chosen for 30KHz).
Imagn/Ipeak may be a little bit higher, i.e. 15%
A small gap between the upper and lower Bridge MOS will prevent from cross-conducting current spikes. At present, currents are overlapping.?
Also check the phase angles between the primary and secondary side bridge drive pulses to achieve?output voltage, as desired.
-----
Udo |
Re: Dual Active bridge
¿ªÔÆÌåÓýWithout UIC, it runs under version 24.1.8. The
input voltage is 100 V, the input current is 8 A DC plus 8A peak
roughly sinusoidal (so the current goes from 0 to 16 A). The
output voltage is 132 V DC and the output current is 3 A. So I
think the input power is quite a lot bigger than the output
power, which is not what is wanted. But I have 1 ohm in series
with V9 to limit the inrush current. Without the 1 ohm, it still
stalls after a few hundred microseconds, with no error message. On 2025-05-07 01:18, Andy I via
groups.io wrote:
--
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 |
Re: Calculate average value of a waveform under specific conditions using .meas command
On Wed, May 7, 2025 at 12:40 PM, Tony Casey wrote:
I don't see why you have to specify small time intervals if your simulation has achieved steady state - each cycle will be essentially the same, so a full display of only 2 cycles will be ample - search by derivative will always find the transition. Don't make things more complicated than they need to be.Dear Tony, I am new to LTspice, and everyone is trying to help me with my query. You have put time in providing me solutions and so has Andy. I am thankful to both of you. You are again correct, problems should be solved with as little complications as possible. With Regards, Ankit |
Re: Calculate average value of a waveform under specific conditions using .meas command
¿ªÔÆÌåÓýOn 07/05/2025 08:13, ankitk.ace via
groups.io wrote:
I believe I will have to finding the maximums and minimums localized to a specific time interval (example: 10 ms to 11 ms) and then do the rest. Your answer too is a clever solution just like what Andy suggested, however, with a different approach and a little bit of tweaking at my end because the inductor current rises and falls exponentially (due to parasitics).The rise and fall characteristics are only 2nd order effects - linear or exponential, it makes little difference. If you actually plot the derivative of the waveform, you get very pronounced spikes at the start and finish of transitions. Try it and you'll see. I don't see why you have to specify small time intervals if your simulation has achieved steady state - each cycle will be essentially the same, so a full display of only 2 cycles will be ample - search by derivative will always find the transition. Don't make things more complicated than they need to be. -- Regards, Tony |
Re: Calculate average value of a waveform under specific conditions using .meas command
On Wed, May 7, 2025 at 12:00 AM, Tony Casey wrote:
.MEAS MaxdV max d( I(L_filter_dc)) ; max +v derivativeDear Tony, ?
Thank you for answering again. I believe I will have to finding the maximums and minimums localized to a specific time interval (example: 10 ms to 11 ms) and then do the rest. Your answer too is a clever solution just like what Andy suggested, however, with a different approach and a little bit of tweaking at my end because the inductor current rises and falls exponentially (due to parasitics). With Regards, Ankit |
Re: LTSpice, easy uF / uH with UTF16 saved schematic
Also, the comments in the two new uploaded files are somewhat misleading.
?
"u" is always ASCII 0x75, when encoded with the normal ANSI character set.
?
"?" is extended ASCII 0xB5, when encoded as a single byte with the ANSI character set.
?
LTspice transforms a leading "u" to a "?" when it is on a schematic and used as a units multiplier, unless you have changed that setting in LTspice's Settings / Control Panel.? So the default action in LTspice is to convert 0x75 to 0xB5 (that is, to convert 'u' to '?') when it is on a schematic and used that way.?
LTspice can be changed to the exact opposite behavior, where it treats a "u" as a "u" and converts a "?" to a "u", when it is found on a schematic and used as a units multiplier.
?
Some programs misinterpret the extended ASCII character 0xB5, turning it into a different 1-byte or 2-byte character that it thinks should be similar.? When saved and later read back into LTspice, or saved and read by other text editing programs, in most cases it will appear to be a corrupt letter or pair of letters, of one form or another, and not as a "?" anymore.? I have now seen three different incorrect "substitute" characters for a "?", where none of them work when the schematic or SPICE Netlist file is read back into LTspice.
?
LTspice's handling of UTF* files is somewhat unconventional.? That is a grey area and best avoided, in my opinion.
?
Andy
? |
Re: LTSpice, easy uF / uH with UTF16 saved schematic
On Tue, May 6, 2025 at 10:21 PM, wai wai wrote:
That lacks backwards compatibility to anyone using an older version of LTspice.? (Yes, there are still some out there with old XP computers who do not wish to - or can't - upgrade to a newer LTspice.)? Also, I am unsure whether the native Mac version yet supports "Unicode" schematics.? (I think it does.)? If not, they would be unable to open said schematics. ?
Furthermore, LTspice's "Unicode" has proven to be a much bigger headache than anyone imagined.? Most problems with it have finally died down now, but I am sure they will still arise.? With an alphabet of some 150,000 characters, it is a thousand problems just waiting to happen.
?
The easier solution, is this one:
?
This problem with '?' rarely ever happens anymore, now that the group migrated from Yahoo to Groups.io.? Since people should never email LTspice schematics by cut-and-pasting raw text, that isn't a problem either, or it should not be.? For person-to-person emails, attaching an LTspice schematic (as an attached file) works great, as does attaching a .ZIP file.? For schematics sent to this group, uploading the LTspice schematic works great, and that is what everyone should do.? So there should be no issue anymore, unless you do things wrong.
?
By the way, LTspice is not spelled "LTSpice".? Also, files should only be uploaded to the "Temp" folder.? Always navigate to that folder first, before clicking the "+New/Upload" button.? Just like it says in the group's guidelines.
?
Andy
?
?
? |
LTSpice, easy uF / uH with UTF16 saved schematic
LTspice default will save schematic (*.asc) as ANSI ASCII file.?
uH or uF, the "u" is extended ASCII "0xB5", "mu" (?) to mean micro, see the glitching and comments, /g/LTspice/topic/opa_square_wave_generator/112608874 ?
LTspice XVII save such schematic, "0xB5" will be saved as ANSI text file, open the file by editor, and/or copy/paste to HTML or translation, the UTF8 capable application will see double bytes as treated as UTF8/UTF16 etc.
The solution, to force LTspice to save schematic to be UTF8 or UFT16, just add some local "char" (double bytes) to the schematic, and then LTSpice will be saved files as UTF16 by default.
?
this is example of output of the solution,
SYMATTR InstName C2 SYMATTR Value 1?f TEXT 112 160 Left 2 ;1uF = 1Ϥ ?
|
Re: Simulation of MMC 3-Level on Ltspice
Bouzid.wis,
?
I am having trouble trying to understand how this circuit works.
?
In the upper submodule, it seems like M1 can not do much, because C1 would charge and then not pass any more current, so that closing M1 does not add any more change.? But I think it is not as simple as that.? There are multiple current paths here, including through the capacitors and through the diodes that bypass the FETs.
?
Can you describe how each submodule was supposed to pull the output either up, or down?
?
Is there a minimum frequency limit for the sinusoidal signal you want to synthesize?
?
As drawn here, the two submodules are not symmetrical to each other.? But maybe that was just a personal choice about how the schematic was made.
?
I am only guessing here, but it looks like maybe you have one of the submodules inverted.? When the voltage V(ControlA) approaches +1V, the FETs with the DC path (M2 and M4) are both OFF while the two with series capacitors and no DC path (M1 and M3) are both ON.? So very little current can flow through L2 or L3, to or from the load.? When V(ControlA) approaches -1V, it is the opposite:? both DC-path FETS are ON, resulting in lots of current in L2 and then out L3 without making it to the output load.? In both cases, the output gets nothing.? Check your connections because I think it is not right.
?
But as far as SPICE goes, I think it simulates OK.
?
FYI, there are easier ways to generate triangle waves.? The normal voltage source with PULSE is ideal for this.
? ? Vm Tri_up 0 PULSE (-1 1 0 50u 50u 0 100u)
? ? Vn Tri_dwn 0 PULSE (1 -1 0 50u 50u 0 100u)
or
? ? .param RF=0.5/fs? ; Rise and Fall time
? ? Vm Tri_up 0 PULSE (-1 1 0 {RF} {RF} 0 {2*RF})
? ? Vn Tri_dwn 0 PULSE (1 -1 0 {RF} {RF} 0 {2*RF})
But it doesn't hurt to do it the way you did.
?
Andy
?
? |
Re: Dual Active bridge
On Tue, May 6, 2025 at 05:12 PM, John Woodgate wrote:
Using computer #1 today, so it is lowly LTspice XVII.? Not LTspice 24. ?
You night have been hit by a yet-to-be-fixed bug - er, I mean side effect they added in version 24.1.x.
?
Andy
? |
Re: Dual Active bridge
On Tue, May 6, 2025 at 05:33 PM, <arhamishtiaq42@...> wrote:
That is a somewhat difficult question for me to answer.? Maybe others can speak to this better than I can. ?
But I think the answer is "yes", I think it is normal.
?
Because the waveforms are not sinusoidal and the voltage and current waveforms are so very different from each other, you can not use Vrms*Irms to estimate power.? You must multiply V(time) by I(time) at every moment in time, then average the product over time.? And when you do that, you find that the power into the primary = 593 W, even though its Vrms * Irms = 95.6 * 12.9 = 1233 VA.
?
(I am still wondering where you got 40 A from.? My simulations did not come close.)
?
I think the only way for the primary current to be around 500 W / 100 V = 5 A, is if the transformer's primary current was also a square wave and in-phase with the voltage there.
?
The energy source (V9) provides 597 W, the transformer passes 593 W, and the load (R1) dissipates 458 W.? These are from simulating your third schematic, dd.asc, without UIC, and waiting until after the initial transients die out.
?
Andy
?
? |
Re: Dual Active bridge
On Tue, May 6, 2025 at 06:35 PM, John Woodgate wrote:
I think that problem goes away if you get rid of the UIC.? There is no need for UIC here.? Don't use it unless it is needed.? Change:
? ? .tran 0 100m 0 uic
to:
? ? .tran 0 100m 0?
or:
? ? .tran 100m
or even this:
? ? .tran 10m ?
I do not think you can expect to see V*I at either primary or secondary to be only a little more than Vout*Iout.? Both waveforms very non-sinusoidal and in different ways from one another.? Thus, Average(V(time)*I(time)) does not come even close to Vrms*Irms.? I think you need to accept that the RMS current can not be calculated by dividing the power by the RMS current.? Math just doesn't work that way, so long as the waveforms are neither DC nor sinusoidal.
?
? |
Re: Dual Active bridge
¿ªÔÆÌåÓýIt should not be much larger than output
current x output voltage/input voltage. That is, power out/input
voltage. But I already told you that there is a very large
inrush current because of the large capacitor across the
zero-impedance source V9. The other capacitors also charge when
the associated FET switches off. On 2025-05-06 22:33, arhamishtiaq42 via
groups.io wrote:
--
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 |
Re: Simulation of MMC 3-Level on Ltspice
I don't know if this matters in your simulation, but you have started with much less than a sine wave.? 9 ms is less than one-half cycle of 50 Hz.? The output waveform does not seem right, however.
?
Be careful about using multiple net names on the same net.? In SPICE, every net can have only one net name ("Label" in LTspice).? One of your nets has at least three names assigned to it.? Most of the time LTspice figures it out, but sometimes it does not.
?
Andy
? |
Re: Simulation of MMC 3-Level on Ltspice
On Tue, May 6, 2025 at 03:53 PM, <Bouzid.wis@...> wrote:
Remember to use English only in this group. ?
Translation:? "I have uploaded the ltspice file under the name M2C single-phase SPWM112 to Temp"
?
Note:? The actual filename is "M2C single phase SPWM112.asc".
?
Andy
? |
Re: 90nm CMOS technology
On Tue, May 6, 2025 at 05:15 PM, John Woodgate wrote:
That is true, and it's something I often remind people about.
?
Sure you could grab some random "90nm" model file and play around with it, but don't use it to model any actual circuits that you plan on building.? When you build it, you need to know the model details from your FAB house.? They hold the recipe.? They set the process that determines how the transistors come out of the oven.? It won't be the same as those from another 90nm foundry.
?
Some of them were much older than that, going on 20 years now.? At some point in someone's distant past, those models worked for THEM with the ICs THEY were getting from some foundry which might not exist anymore.? When you go to build your ICs, you will need to get models for the 90nm FAB process you use.? Best to start with them instead of fooling yourself by borrowing someone else's model that does not represent today's reality.
?
? |
Re: 90nm CMOS technology
¿ªÔÆÌåÓýTo be clear, Andy has found some contributed
information, which is 5 years old. LTspice itself has no data on
fabrication technology. My advice still stands; contact the
foundry. On 2025-05-06 22:13, John Woodgate
wrote:
--
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 |