-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
white_noise()
PSD contributions can be negative
#116
Comments
Can confirm the problem. |
That's weird - I don't see a minus sign in the code you provided. I wonder if openvaf changes the sign of the contribution if it sees the terminals have been swapped. Eg Note that standard ac noise analysis uses the magnitude of the transfer function from the nodes where the noise is injected to the circuit noise output node(s), and thus should be insensitive to whether it's I(a,b) or I(b,a). |
I'm not set up to run these experiments myself today, but I'd be interested to know what you get if you change the second line of the example to |
The sign appears to behave the same for the explicit unary minus or for the flow reversal:
|
There is a preliminary fix in ngspice git branch pre-master-43. |
Thanks for the fix! That does seem to help the case above, but I think there may still be a bug here for other transformations: I(a, b) <+ 2 * white_noise(G * 4 * `P_K * $temperature, "thermal"); I would have expected this to quadruple the noise power (3.3152176e-20), but instead the power merely doubles (1.657609e-20) |
I am not sure, but I would expect factor of 2 for psd and a factor of sqrt(2) for voltage spectral density. An that is what I got. |
I believe that disagrees with the results from this circuit:
I would expect the onoise_spectrum to be the same (a) if I set H1 to a transconductance of However, the results disagree by a factor of 2x. |
onoise_spectrum in ngspice is reported in V^2/Hz. |
Speaking about the original request fro topolarity, because last reply is different: ngspice in default gives onoise_spectrum in V/sqrt(Hz), the voltage spectral density. By 'set sqrnoise' you get power spectral density in V**2/Hz.
//spectral density (unset sqrnoise) // I(a, b) <+ 2 * white_noise(G * 4 * `P_K * $temperature, "thermal"); // I(a, b) <+ white_noise(G * 4 * If we have a factor of 2 what is the same as two contributions to same branch we can assume it is a parallel circuit of two uncorrelated noise sources. The resulting equivalent noise current rising with sqrt(N). |
I was unaware of sqrnoise; I see that topolarity did set that option. |
I am not sure this is a valid way to understand the case. In particular, it seems that the factor of two in fact makes two correlated noise sources. |
I have now checked two commercial simulators using I get different answers for (ns1=1, ns2=2) than for (ns1=2, ns2=1). |
To clarify my previous post: when ns1=ns2=1, the noise for R=1 at T=27 C is ~ 1.66e-20 V^2/Hz ngspice agrees for the baseline and the first case, but the second case matches the first, that is, I get twice the baseline instead of four times. |
@gjcoram : |
My reading of this page from the LRM is that noise processes with the same name would be summed together as uncorrelated noise powers. If they were correlated, you would need to look at the noise amplitudes, but I don't think there is a way to specify them. I think the only way to have correlated noise is to use noise source with a special circuit to contribute its value to different branches. |
I agree with the interpretations above. For this case:
is equivalent to:
And if the contributions had been re-used elsewhere so that there are observable correlations, such as:
then this cannot be reduced to a single independent noise source at all. |
@tcaduser is correct; the noise sources are uncorrelated. And @topolarity is also correct; having the two noise sources is equivalent to having sqrt(2) in front of a single noise source. This would be ns1 = sqrt(1), or ns2 = 2, in my earlier code. |
Noise scaling should work now like @gjcoram explained earlier. Look in the openvaf-reloaded repository. Branches/osdi_0.3 works with ngspice. |
@arpadbuermen - see #137 |
First of all, thanks for a creating such a great tool.
I've been exploring some of the noise support recently and ran into an issue. It seems that the sign of the PSD contribution of
white_noise()
can be negative, depending on the direction of the terminals/flow.Here's an example that I believe shows the problem:
Compile this with
openvaf resistor.va -o resistor.osdi
, and then perform.noise
analysis in a simple circuit:results in:
Tested with:
--enable-osdi
, locally-built)The result looks correct if the
white_noise()
contribution flows intoI(a, b)
instead ofI(b, a)
.The text was updated successfully, but these errors were encountered: