0
\$\begingroup\$

I'm new at the ngspice simulator and I don't understand this line of a Netlist that I found

Vn 1 n1 dc 0V ac 1mV trrandom(1 5us 0s 125m 0m) 

if the random signal is only used in the transient simulation why did they keep the ac signal with an amplitude of 1mV ?

\$\endgroup\$
1
  • \$\begingroup\$ I don't understand the (Independent Sources for Voltage) and (dependent Sources for Voltage) part of your question. I think it has nothing to do with dependency. Hopefully, my answer clarifies. \$\endgroup\$
    – Huisman
    Commented May 1, 2020 at 8:57

1 Answer 1

0
\$\begingroup\$

It's just in the manual :

4.1.8 Randomvoltagesource
The TRRANDOM option yields statistically distributed voltage values, derived from the ngspice random number generator. These values may be used in the transient simulation directly within a circuit, e.g. for generating a specific noise voltage, but especially they may be used in the control of behavioral sources […] to simulate the circuit dependence on statistically varying device parameters. A Monte-Carlo simulation may thus be handled in a single simulation run.

You should read the line as follows:

Vn 1 n1 dc 0V ac 1mV trrandom(1 5us 0s 125m 0m) 
--
name of voltage source

Vn 1 n1 dc 0V ac 1mV trrandom(1 5us 0s 125m 0m) 
   ----
nodes the voltage source is connected to

Vn 1 n1 dc 0V ac 1mV trrandom(1 5us 0s 125m 0m) 
        -----
type and value of voltage source for transient analysis

Vn 1 n1 dc 0V ac 1mV trrandom(1 5us 0s 125m 0m) 
              ------
AC amplitude for ac analysis

Vn 1 n1 dc 0V ac 1mV trrandom(1 5us 0s 125m 0m) 
        +++++        --------------------------
adds statistically distributed voltage values to the DC of 0V (the +++ part)

According the specification of TRRANDOM(TYPE TS <TD <PARAM1 <PARAM2>>>) in your example

  • the noise is uniformly distributed
  • the duration of an individual voltage value is 5 us
  • time delay parameter is not used
  • the noise has an amplitude of 125mV
  • the noise has an offset of 0mV
\$\endgroup\$
5
  • \$\begingroup\$ Thank you for your clarifications it helped me a lot, just to make sure I understood well, does it means that we generate an ac sinusoïdal signal (with an amplitude of 1mV) to which we will superimpose a random signal (a uniformly distributed noise with an amplitude of 125mV ? this kind of source is allowed only for transient or ac simulations .noise simulation doesn't work with it ? \$\endgroup\$
    – assia_sia
    Commented May 1, 2020 at 13:30
  • \$\begingroup\$ @asssi transient analysis =/= AC analysis. trrandom only applies to transient analysis. If you want a sinusoidal signal, you should do something like Vn 1 n1 SINE 0mV 1mV 1kHz trrandom(1 5us 0s 125m 0m) \$\endgroup\$
    – Huisman
    Commented May 1, 2020 at 14:28
  • \$\begingroup\$ As you noticed I left out the ac 1mV part, because it does not affect transient analysis \$\endgroup\$
    – Huisman
    Commented May 1, 2020 at 14:29
  • \$\begingroup\$ @asssi I'm not completely sure how the TS and TD work. You'd better make a noise source (like Vn 2 1 dc 0V trrandom(1 5us 0s 125m 0m)) and check whether it satisfies and then put a SINE voltage source (like Vn 1 0 sine 0mV 1mV 1kHz) in series. \$\endgroup\$
    – Huisman
    Commented May 1, 2020 at 14:31
  • \$\begingroup\$ I got it thank you it is not my purpose to have a sinusoidal signal to which we superimpose a random signal, now that I unserstood what you said and I have checked the rest of the netlist which contains two types of simulations .tran 0.1m 5m 0m 1u .ac dec 1000 1 10Meg \$\endgroup\$
    – assia_sia
    Commented May 2, 2020 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.