Tutorials, news, snippets, and other various musings about the electrical engineering industry.
Quick Tutorial: Adding a Random Noise Source in PSpice
Injecting random noise into your circuit in PSpice has typically been a challenging task due to the additional PWL source needed and the creation and configuration of that source’s file for transient simulations. In the latest release of PSpice (16.6 hotfix 022), PSpice now supports a variety of Randomization functions to make this and some other situations a whole lot easier.
In this post, we’ll run through the three different randomization functions that are now supported, and when and how you can use them.
This will be the one that most people want to use; it works in transient simulations and returns a random value (between 0 and 1) at every solved time point.
Let’s run through a quick example where we want to have a 1V DC signal with 0.2V peak to peak of noise centered on the DC signal (so 1V +/- 0.1V).
To accomplish this, we’ll use the RND function and offset it by -0.5V to center the random values at 0V with a +/- of 0.5V. To decrease the magnitude of the random variations, we’ll divide by 5 to limit it to 0V +/- 0.1V for a total peak to peak range of 0.2V centered on 0V.
Now put that in series with our 1V DC source to add them together and end up with the desired output:
For the noise source (E1), we used the EVALUE part from the ABM library and modified the contents of the EXPR field that is visible when the part is placed to (RND-0.5)/5. The look of the part is also changed to remove the input pins which are not used in this example.
Note that a copy of this design is included at the bottom of this post as random_noise-2014-02-14T19-44.zip if you’d like to give this a try yourself.
Here we can see the resulting ‘noisy’ signal which we can use to test our circuit’s response to the less ideal input. This is so much easier than it used to be!
The RNDR function will probably not be used as frequently but it allows the user to get a single random value for an entire transient or DC simulation run. Like the RND function, it also returns a value between 0 and 1 but unlike the RND function, it only picks one value for the entire simulation run and uses it throughout.
Note in the schematic that everything is the same except the random function name has changed to RNDR.
The transient output now picks a single value (in this case, -0.06) and applies that for the duration of the simulation.
The RNDC randomization function is used where you are sweeping through some variable or parameter (Monte Carlo, Temperature Sweep, etc.) but want to have some variation from one swept run to the next.
In this example, we’ll sweep a variable called SWEEP from 1 to 50 with a sweep step size of 1. This parameter is not used anywhere in the circuit so it will have no effect on the results, only the RNDC random function will be responsible for differences. This will run 50 simulations of the circuit with the only variation being the RNDC function which should cause a different value to be picked for each swept variable run.
In the results, you can see that the X-axis is no longer the Time because we’re not doing a transient simulation but is now the swept parameter, SWEEP.
Introducing this randomization to swept simulation runs gives you the ability to more easily create the effect of applying a tolerance to your voltage source during Monte Carlo runs which is a functionality that is frequently requested but it difficult to model.
When you want to have some random transient noise, you no longer have to go off and create then configure interesting random noise waveforms to use in transient simulations; and when you want to tolerance a voltage source for a Monte Carlo simulation, you no longer have to wire together strange circuits to effectively apply a tolerance to a source. You can now use the three randomization functions, RND, RNDR and RNDC to do all the work for you and simplify the setup that needs to be done.
The random number seed value does not change from one simulation run to the next so if you want to have it present you with ‘new’ random noise instead of the same noise each time, you will need to change the random number seed. It can be done presently in the options file with the line:
.options RNDSEED=<value between 0 and 1>
In the included random_noise-2014-02-14T19-44.zip file at the end of this post, you will see how to set up that option file if you don’t already know how.
Cadence has released a number of Quarterly Interim Releases (QiR’s) since V16.6 was initially released. To find out what Hotfix corresponds to which QiR, here’s the schedule:
- QiR #1 comes with Hotfix s001 – December 2012
- QiR #2 comes with Hotfix s006 – April 2013
- QiR #3 comes with Hotfix s013 – July 2013
- QiR #4 comes with Hotfix s016 – September 2013
- QiR #5 comes with Hotfix s022 – January 2014