Electronics-Related.com
Forums

LT Spice random phase

Started by John Larkin January 29, 2016

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.



-- 

John Larkin         Highland Technology, Inc
picosecond timing   precision measurement 

jlarkin att highlandtechnology dott com
http://www.highlandtechnology.com

On 2016-01-29, John Larkin <jjlarkin@highlandtechnology.com> wrote:
> > > 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. -- \_(&#12484;)_
On 29 Jan 2016 22:23:17 GMT, Jasen Betts <jasen@xnet.co.nz> wrote:

>On 2016-01-29, John Larkin <jjlarkin@highlandtechnology.com> wrote: >> >> >> 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. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
On 1/29/2016 5:45 PM, John Larkin wrote:
> On 29 Jan 2016 22:23:17 GMT, Jasen Betts <jasen@xnet.co.nz> wrote: > >> On 2016-01-29, John Larkin <jjlarkin@highlandtechnology.com> wrote: >>> >>> >>> 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? -- Rick
Den fredag den 29. januar 2016 kl. 23.45.45 UTC+1 skrev John Larkin:
> On 29 Jan 2016 22:23:17 GMT, Jasen Betts <jasen@xnet.co.nz> wrote: > > >On 2016-01-29, John Larkin <jjlarkin@highlandtechnology.com> wrote: > >> > >> > >> 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. >
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
On Fri, 29 Jan 2016 12:42:24 -0800, John Larkin
<jjlarkin@highlandtechnology.com> wrote:

> > >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.
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. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
Den l&#4294967295;rdag den 30. januar 2016 kl. 00.07.57 UTC+1 skrev John Larkin:
> On Fri, 29 Jan 2016 12:42:24 -0800, John Larkin > <jjlarkin@highlandtechnology.com> wrote: > > > > > > >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. > > 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 generator I believe that will give you a 5V +/-10% from run to run -Lasse
On Fri, 29 Jan 2016 15:33:28 -0800 (PST), Lasse Langwadt Christensen
<langwadt@fonz.dk> wrote:

>Den l&#4294967295;rdag den 30. januar 2016 kl. 00.07.57 UTC+1 skrev John Larkin: >> On Fri, 29 Jan 2016 12:42:24 -0800, John Larkin >> <jjlarkin@highlandtechnology.com> wrote: >> >> > >> > >> >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. >> >> 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 generator > >I believe that will give you a 5V +/-10% from run to run > > >-Lasse
That works! Very cool. Thanks. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
On Fri, 29 Jan 2016 16:16:55 -0800, John Larkin
<jjlarkin@highlandtechnology.com> wrote:

>On Fri, 29 Jan 2016 15:33:28 -0800 (PST), Lasse Langwadt Christensen ><langwadt@fonz.dk> wrote: > >>Den l&#4294967295;rdag den 30. januar 2016 kl. 00.07.57 UTC+1 skrev John Larkin: >>> On Fri, 29 Jan 2016 12:42:24 -0800, John Larkin >>> <jjlarkin@highlandtechnology.com> wrote: >>> >>> > >>> > >>> >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. >>> >>> 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 generator >> >>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. -- John Larkin Highland Technology, Inc picosecond timing precision measurement jlarkin att highlandtechnology dott com http://www.highlandtechnology.com
On Fri, 29 Jan 2016 15:00:37 -0800 (PST), Lasse Langwadt Christensen
<langwadt@fonz.dk> wrote:

>Den fredag den 29. januar 2016 kl. 23.45.45 UTC+1 skrev John Larkin: >> On 29 Jan 2016 22:23:17 GMT, Jasen Betts <jasen@xnet.co.nz> wrote: >> >> >On 2016-01-29, John Larkin <jjlarkin@highlandtechnology.com> wrote: >> >> >> >> >> >> 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. >> > >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
Sno-o-o-o-o-ort >:-} ...Jim Thompson -- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: skypeanalog | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.