Keyboard Shortcuts
Likes
- LTspice
- Messages
Search
Re: Text substitution in .meas files Solved, thanks to Vlad
#meas
Vlad,
toggle quoted message
Show quoted text
That's what I was trying to achieve, perfect. Many thanks Neil -----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Vlad Sent: 22 February 2021 20:37 To: [email protected] Subject: Re: [LTspice] Text substitution in .meas files Hello Neil I am using a .meas file to run after the simulation completes. As thisIf I understand correctly, you want something like this: .meas t1 param 6.3m .meas t2 param 7.3m .meas a avg v(x) from t1 to t2 .meas b rms i(v1) from t1 to t2 . . . Alternatively, you can define t1 and t2 as parameters: .param t1=6.3m t2=7.3m but then you'd have to re-run the simulation so that the .PARAMs are recalculated. With .MEAS they will be available only inside the .MEAS script. Looking at the values for t1 and t2 (as you exemplified), maybe you need these to be calculated for (say) a period of some frequency. Then you can more easily define them as: .meas freq param 1k .meas delay param 0.3/f .meas t1 param 6/f+delay .meas t2 param 7/f+delay If the frequency, itself, is a variable to be determined from measurements, then you could also use this: .meas tmp1 find time when v(x)=0 cross=13 ; or some other trigger .meas tmp2 find time when v(x)=0 cross=15 .meas f param 1/(tmp2-tmp1) ; and now continue with t1, t2, etc -- Vlad ______________________ ltspicegoodies.ltwiki.org v2: quite universal analog/digital filter, power electronics, signal processing, easy to work with math functions, digital models, and rants. |
Re: BJT Parameters
¿ªÔÆÌåÓýOn 23/02/2021 02:24, alan victor wrote:I am afraid you missed my point. First, I never said I would use s parameters to emulate a non linear aspect of the model. However, the point of the validation exercise is to satisfy the criteria that the s parameters of the non linear model... Spice model... operating in a linear manner meet the s parameters of the measured device. Many of them do... spot on. And other models fail miserably.While we're missing points, you forgot to point to where S-parameters for the 2N3904 can be found. Of the thousands of different types of transistors in existence, probably fewer than 1% of them have published S-parameters. I agree about a starting point in the absence of non-linear parameters. But since these designs can only really be optimised by non-linear analysis, you need the non-linear parameters anyway - S-parameter analysis provides no information relating to how much power you're going to get, for example. Having said that, the great advantage of design by S-parameters is that linear analysis is orders of magnitude faster than non-linear analysis.
-- Regards, Tony |
Re: Noise source in Transient analysis
#NOISE
¿ªÔÆÌåÓýOn 23/02/2021 06:36, Andy I wrote:WHS wrote, "There were reports at one time that 2 or more rand() functions were random but very well correlated with each other. Has this been corrected?"Don't forget that there is a Control Panel setting to randomise the mc() function by using the system clock to seed the generator. This is a sticky setting, so it stays set or unset until you change it. Control Panel > Hacks! > "Use the clock to reseed..." -- Regards, Tony |
Re: Noise source in Transient analysis
#NOISE
WHS wrote, "There were reports at one time that 2 or more rand() functions were random but very well correlated with each other. Has this been corrected?"
What is there to correct? The rand() function is a deterministic function.? That is by design.? You give it an argument, and it converts it to a semi-random result.? It is not a random-sequence generator, like a linear-feedback-shift-register.? No, not like that.? Given the same argument x, rand(x) always returns the same result, every time.? That's how it should work, and that's how it does work. The way to use two rand() functions in the same simulation and have them different, is to assure that their arguments are significantly different.? For example, use rand(time) and rand(-time).? Or rand(time+1e6).? Or rand(time*1e6).? Or something else.? Use your head to choose something that is different for each function's argument. As another simple example, if one rand() function uses argument values between 1.0 and 1e9, make the second rand()'s argument go from 1e9 to 2e9.? Now the two functions generate a different sequence of semi-random values. Andy |
Re: Noise source in Transient analysis
#NOISE
There were reports at one time that 2 or more rand() functions were random but very well correlated with each other. Has this been corrected?
|
Re: BJT Parameters
Hi Tony,?
Thanks for the feedback.? I am afraid you missed my point. First, I never said I would use s parameters to emulate a non linear aspect of the model. However, the point of the validation exercise is to satisfy the criteria that the s parameters of the non linear model... Spice model... operating in a linear manner meet the s parameters of the measured device. Many of them do... spot on. And other models fail miserably.? Second point, the use of s parameters actually can produce a very excellent STARTING point for successful non linear design. I have applied such techniques to both power amplifiers and one and two port oscillators.? Again, I emphasize they provide an excellent initialized starting condition. That is to say, ?find embedding networks, matching elements and resonator development in oscillator applications.? Alan? |
Re: MOSFET subcircuit drain and gate currents used in dependent source equation - faults
#MOSFET
Thank you, Vlad
|
Re: BJT Parameters
On 22/02/2021 20:47, alan victor wrote:
The approach I have taken is to gather the 2 port s parameters for a box full of say 3904. Then use the s data with a waveform arithmetic statement in LTSpice to get ft. As ft is an extrapolation of the low frequency gain on a 6dB per octave slope, it is pretty fast to evaluate. Recall, it is just a function of gm and Cbe; unity short circuit current gain crossing point. It does assist in validating the quality of some BIP models. I usually take the s data at the collector current where advertised ft peaks.I'd be interested to know whose S-parameter data you've got for 2N3904? Overall, your suggestion isn't worth much because S-parameters only model linear devices. The whole point about SPICE models is that they model the non-linear characteristics of devices. As a by-product they can also re-produce the S-parameters if the SPICE model is good. The converse is simply wishful thinking. -- Regards, Tony |
Re: MOSFET subcircuit drain and gate currents used in dependent source equation - faults
#MOSFET
B1 out 0 V=I(R:U1:1)You need to use the numeric order of the pin, i.e. if the subcircuit was defined as: .subckt xxx a b c then using i(r:u1:a) will fail. -- Vlad ______________________ ltspicegoodies.ltwiki.org v2: quite universal analog/digital filter, power electronics, signal processing, easy to work with math functions, digital models, and rants. |
Re: MOSFET subcircuit drain and gate currents used in dependent source equation - faults
#MOSFET
Hello
BB, thanks for the tip on capturing and viewing subcircuit parameters!Mike, himself, has said that the pin currents are not known before parsing, and since that implies parsing behavioural sources with their expressions, too, it's not possible to use the currents into pins as used by Ix(), but they can be plotted if you know the subcircuit. For example: .subckt xxx 1 2 3 r1 1 2 1 r2 2 3 1 .ends xxx B1 out 0 V=I(R:U1:1) This is valid and will simulate. If the subcircuit has many nested subcircuits, it gets funnier and funnier. And if the subcircuit is encrypted, you're out of luck. So the best way, tested through time, is the series zero valued voltage source. -- Vlad ______________________ ltspicegoodies.ltwiki.org v2: quite universal analog/digital filter, power electronics, signal processing, easy to work with math functions, digital models, and rants. |
Re: Text substitution in .meas files
#meas
Hello Neil
I am using a .meas file to run after the simulation completes. As this hasIf I understand correctly, you want something like this: .meas t1 param 6.3m .meas t2 param 7.3m .meas a avg v(x) from t1 to t2 .meas b rms i(v1) from t1 to t2 . . . Alternatively, you can define t1 and t2 as parameters: .param t1=6.3m t2=7.3m but then you'd have to re-run the simulation so that the .PARAMs are recalculated. With .MEAS they will be available only inside the .MEAS script. Looking at the values for t1 and t2 (as you exemplified), maybe you need these to be calculated for (say) a period of some frequency. Then you can more easily define them as: .meas freq param 1k .meas delay param 0.3/f .meas t1 param 6/f+delay .meas t2 param 7/f+delay If the frequency, itself, is a variable to be determined from measurements, then you could also use this: .meas tmp1 find time when v(x)=0 cross=13 ; or some other trigger .meas tmp2 find time when v(x)=0 cross=15 .meas f param 1/(tmp2-tmp1) ; and now continue with t1, t2, etc -- Vlad ______________________ ltspicegoodies.ltwiki.org v2: quite universal analog/digital filter, power electronics, signal processing, easy to work with math functions, digital models, and rants. |
Re: MOSFET subcircuit drain and gate currents used in dependent source equation - faults
#MOSFET
BB, thanks for the tip on capturing and viewing subcircuit parameters! ? When I add those 0V sources, I¡¯ll do a side by side comparison with a version that uses the model currents. Appreciate the heads up! |
Re: BJT Parameters
Hi Jim,?
The approach I have taken is to gather the 2 port s parameters for a box full of say 3904. Then use the s data with a waveform arithmetic statement in LTSpice to get ft. As ft is an extrapolation of the low frequency gain on a 6dB per octave slope, it is pretty fast to evaluate. Recall, it is just a function of gm and Cbe; unity short circuit current gain crossing point. It does assist in validating the quality of some BIP models. I usually take the s data at the collector current where advertised ft peaks.? Alan? |
Re: MOSFET subcircuit drain and gate currents used in dependent source equation - faults
#MOSFET
If you want to view the .subcircuit values in the waveform viewer, you can (even though you cannot seem to use them in the circuit as you wanted) go to Tools-->Control Panel-->Save Defaults and click to add the subcircuit voltages and currents. You can then plot them in the waveform viewer (one BIG caveat is that your .raw file will become quite large...). I had hoped this would allow you to use the values, but it didn't seem to help. The 0 voltage sources works fine, but you will see some VERY small differences between the 0V source voltage and that produced by the Ix(M1:D) in the plotter. It's easiest to see them by plotting the difference (in this case, less than a milliamp) between the two values.
BB |
Re: MOSFET subcircuit drain and gate currents used in dependent source equation - faults
#MOSFET
This is as good an explanation as I could have hoped for. ?I really appreciate your insight on this... it makes sense. ?Perhaps it¡¯s just a missing feature in LTspice, or perhaps it¡¯s by design somehow.? I have used 0V supplies in the past for current detection. ?In this case I just went for a quick calculation, and it worked until I tried a subcircuit and found this hitch. ?I guess I learned something in the process, but I think I¡¯ll go back with using the 0V supply as a reliable method. ?Thanks for the nudge. ;-)
|
Re: BJT Parameters
¿ªÔÆÌåÓýYou mean like those ¡°grab bags¡± that can be gotten for a pittance at a swap meet? ?Got a bunch of those and now they are mixed in with good stock :=(( Wonder where those that are marked with the Motorola logo might fall. What ever.Thanks Jim
|
Re: BJT Parameters
I think Helmut's recommendation in this case would be to use the PSpice docs.? Helmut used PSPCREF.pdf which can be downloaded from many places on the net.? Then turn to the chapter on BJTs and read all about it.? There are pages of equations that describe how the Gummel-Poon model behaves.? But I think it does not answer your question directly; you still have to do the work.
The problem is that parameters such as Beta and Ft are best for making lab measurements of transistors, not for modeling them.? SPICE model parameters are for modeling them but not for measuring them.? There is some overlap but not a lot. ? ? "For example, the model COULD represent a minimum gain device or it could represent a ¡°typical¡± device or any of a number of other choices." In my experience, virtually all models for simple parts like BJTs are "typical".? The only time I've seen anything else, is when they were specified to be "best-case" and "worst-case" or other labels.? Without such a label, I would always assume typical.? But also remain skeptical because every model can be bad right from the start, or a poor selection from the distribution of parts, or an example of typical from 25 years ago before the process shifted. Andy |