I'd like a sine wave generator to come up at a randon, different phase every time I do a transient run.
Or a pulse generator that has a random startup delay.
Any good way to do this? My tries aren't working.
I'd like a sine wave generator to come up at a randon, different phase every time I do a transient run.
Or a pulse generator that has a random startup delay.
Any good way to do this? My tries aren't working.
So you want a simulation that gives non-repeatable results? That seems counter-productive.
I have a system that has an input that's not synchronized to the system clock. Making that reliable is not counter-productive.
LT Spice doesn't seem to have a mechanism for randomizing a voltage or a time between runs. So voltage {rand(x)} seems to be exactly the same every run, regardless of x. I need x to be time-of-day or something that changes.
That's not too much to ask for.
A parameter that's persistant between runs could be made to work, maybe, if I could increment it. Call it runnum or something.
I don't follow the need for X being random. LTspice has a step function for exactly what you want. It does multiple runs stepping a variable as you specify. There are many, many web resources for LTspice. Or if you get stuck you can ask on the LTspice yahoo group. I've never failed to get a good answer there. Helmut is clearly the expert on this.
Stepping a clock phase may or may not show a problem when it exists. The amount of misalignment required to cause a failure may be very, very small. Better to analyze that sort of thing. Are you concerned about purely digital stuff? Or is there an analog signal that is being sampled using the clock?
can't just keep running it with an input that doesn't have simple relation to the clock so that you sweep through the danger zone?
but then, how many cases to you really hit?
you really need to make stuff like synchronizers safe by design, there's really no way to simulate if it works
-Lasse
From the LT Spice help:
flat(x) Random number between -x and x with uniform distribution
What does that mean? flat(3) always returns -2.992 volts. How can a constant number have a flat distribution?
Ditto gauss(2) always the same!
They do seem to be reseeded every run inside a .step sequence.
try a voltage source with voltage {mc(5,0.1)}
and in tools - controlpanel turn on use the clock to reseed the MC generato r
I believe that will give you a 5V +/-10% from run to run
-Lasse
That works! Very cool. Thanks.
{mc(5n,0.5)} also works as the start delay parameter for a sinewave oscillator, which is what I really want.
Sno-o-o-o-o-ort >:-} ...Jim Thompson
I'm not trying to prove that a synchronizer is safe. I'm trying to visualize and get a feel for a number of possible numerical options. Part of the design involves selecting some integer-ratio frequencies (like 2+13/16 : 1) out of a lot of possibilities of various degrees of messy.
Have something to add? Share your thoughts — no account required.
Ask the community — no account required