The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 11:34pm
Pages: 1
Send Topic Print
How to vary a design variable in normal distribution form in ocean script? (Read 828 times)
indra0804
Junior Member
**
Offline



Posts: 14
India
How to vary a design variable in normal distribution form in ocean script?
Feb 18th, 2014, 5:28am
 
Hi experts,

I want to vary a circuit design variable in the form of a normal distribution in ocean script ie. if for the 1st sim, the design variable 'cap' is 100fF, then may be in the 2nd sim, the value of 'cap' gets modified to say '100.5fF' or something like that as per normal distribution specs.

So, my question is, whether there is any function available in ocean for simulating normal distribution? I tried to find in the ocean reference manual, but couldn't find. Only thing that I could find is 'random' function which can generate random values in a certain range, but thats not quite the thing that I am looking for...Please help..!! And I don't want variation in a ordered manner, otherwise I could have used parametric analysis, but I want change in the form of some distribution.

Regards,

Indra
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: How to vary a design variable in normal distribution form in ocean script?
Reply #1 - Feb 18th, 2014, 10:51am
 
Hi Indra,
does this thread help?
- B O E
Back to top
 
 
View Profile   IP Logged
Andrew Beckett
Senior Fellow
******
Offline

Life, don't talk to
me about Life...

Posts: 1742
Bracknell, UK
Re: How to vary a design variable in normal distribution form in ocean script?
Reply #2 - Feb 18th, 2014, 4:17pm
 
Or if you really don't want to do it with Monte Carlo, maybe this code will help:

Code:
/* abRandomNormal.il

Author     A.D.Beckett
Group      Custom IC (UK), Cadence Design Systems Ltd.
Language   SKILL
Date        
Modified  
By        

Uses Box-Muller method to produce random numbers with
a normal distribution (mean 0, std dev 1).

Call abRandomNormal() multiple times to get such a sequence.

***************************************************

SCCS Info: @(#) abRandomNormal.il 11/30/12.14:22:28 1.1

*/

;------------------------------------------------------------------------
; Store math constants (such as PI) as properties on this symbol
;------------------------------------------------------------------------
(defMathConstants 'abRandomNormal)

/***************************************************************
*                                                              *
*                       (abRandomNormal)                       *
*                                                              *
*  Return a random number with normal distribution using the   *
*                      Box-Muller method                       *
*                                                              *
***************************************************************/
(defun abRandomNormal ()
  (let ((max (rightshift -1 1)) U V)
    (setq U (quotient (float (random max)) max))
    (setq V (quotient (float (random max)) max))
    ;--------------------------------------------------------------------
    ; could generate two independent numbers
    ; the other would use cos instead of sin
    ;--------------------------------------------------------------------
    (times (sqrt (times -2 (log U)))
           (cos (times 2 (getqq abRandomNormal PI) V)))
    )
  )

/***************************************************************
*                                                              *
*             (abTestRandomNormal numPoints bins)              *
*                                                              *
*   Function for testing - uses ViVA's plotting functions to   *
*  produce a histogram and also compute the mean and std dev   *
*      to ensure that with enough points it looks normal       *
*               (e.g numPoints 100000, bins 100)               *
*                                                              *
***************************************************************/

(defun abTestRandomNormal (numPoints bins)
  (let (x y wave)
    (setq x (drCreateVec 'intlong numPoints))
    (setq y (drCreateVec 'double numPoints))
    (for i 0 numPoints
         (drAddElem x i)
         (drAddElem y (abRandomNormal))
         )
    (setq wave (drCreateWaveform x y))
    (awvPlotWaveform (newWindow) (list (histo wave bins nil nil)))
    (printf "Mean=%g\nStd Dev=%g\n" (average wave) (stddev wave))
    )
  ) 

Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.