Home > Community > Forums > Custom IC SKILL > Multiple variable MonteCarlo simulation in OCEAN

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Multiple variable MonteCarlo simulation in OCEAN 

Last post Tue, Jun 17 2014 2:37 PM by pranucci. 3 replies.
Started by Alex Vasjanov 20 Dec 2013 12:09 AM. Topic has 3 replies and 1401 views
Page 1 of 1 (4 items)
Sort Posts:
  • Fri, Dec 20 2013 12:09 AM

    • Alex Vasjanov
    • Top 500 Contributor
    • Joined on Wed, Sep 25 2013
    • Vilnius, Lithuania
    • Posts 17
    • Points 250
    Multiple variable MonteCarlo simulation in OCEAN Reply

    Hello,

     I've been wondering, is there any way of doing multiple variable Monte Carlo simulations using OCEAN programming language? Monte Carlo simulations from ADE provide only a singe parameter to be swept, but what about several? Is that even possible?

     

    My guess is that it might be impossible due to the specifics of the algorithm that is implemented, but I might be mistaking.

     

     Regards,

    Aleksandr

     

    • Post Points: 20
  • Fri, Dec 20 2013 1:12 AM

    Re: Multiple variable MonteCarlo simulation in OCEAN Reply

     Alexsandr,

    Unfortunately you didn't mention which version you're using, but my guess from how you have phrased your question that it's IC5141?

    There's no reason in spectre why you can't sweep any number of variables outside of the monte carlo analysis - but ADE (and OCEAN) limit what is directly supported. That said, there is nothing to prevent you doing:

    foreach(temp list(-40 27 80)
      foreach(vdd list(1.6 1.8 2.0)
        desVar("temp" temp)
        desVar("vdd" vdd)
        monteRun(...)
        ... process monte carlo results ...
      )
    )

    That will work fine. Given that the monte carlo run itself would normally dominate, the cost of the overhead running several separate simulations for sweeping the other variables is low.

    Regards,

    Andrew.

    • Post Points: 20
  • Tue, Jun 17 2014 11:08 AM

    • pranucci
    • Not Ranked
    • Joined on Tue, Jun 17 2014
    • Posts 2
    • Points 10
    Re: Multiple variable MonteCarlo simulation in OCEAN Reply

    Andrew,

    I'm trying something similar in IC5141. I just want to run monte carlo inside of a paramter sweep. I have the following code:

    VIN_List='("5.0")
    temp_List='("25" "125")
    BG_code_List='("6")
    CL_code_List='("0")

    number = 0

    fprintf(myPort "number,VIN, BG_code, CL_code, temp, VBG, VREF, Voffset, Iout_DC\n")

    foreach(VIN VIN_List
                desVar("pvdd" VIN)
    foreach(BG_CODE BG_code_List
                desVar(      "BG_code" BG_CODE    )
    foreach(CL_CODE CL_code_List
                desVar(      "CL_code" CL_CODE    )
    foreach(temp temp_List
                    temp(temp)

                    monteCarlo( ?numIters "5" ?startIter "1"
                        ?analysisVariation 'mismatch
                        ?sweptParam "None"
                        ?sweptParamVals "27"  
                        ?saveData t
                        ?nomRun "yes"
                        ?append nil
                        ?saveProcessParams t
                        )
                    monteExpr( "VBG" "VDC(\"/BG_2036\")" )
                    monteExpr( "VREF" "VDC(\"/VREFA\")" )
                    monteExpr( "Voffset" "(VDC(\"/DRAIN\") - VDC(\"/IREF\"))" )
                    monteExpr( "Iout_dc" "IDC(\"/V17/MINUS\")" )
                    monteRun()


    number=number+1

    printf("***** %d *****\n" number)

    Right now I am just simply trying to run two different temperatures and the issue is that I WILL get 10 monte carlo runs, however, the mcdata file I get has identical results for the first 5 runs and the second 5 runs which I believe means that the monte carlo sweeps are ignoring my attempt to set the 'temp' variable. I have the same issue trying to set any other variable in the sweep - every monte carlo run appears to be the same regardless of the desVar statement.

    Here's the mcdata file for this run:

    1.23223 0.405017 0.000328546 0.504977 1.23223 0.405017 0.000328546 0.504977    
    1.21931 0.401064 0.000453496 0.492068 1.21931 0.401064 0.000453496 0.492068    
    1.22453 0.402812 -0.000109186 0.523377 1.22453 0.402812 -0.000109186 0.523377    
    1.22864 0.404161 0.000559947 0.491905 1.22864 0.404161 0.000559947 0.491905    
    1.2225 0.402226 0.000660994 0.487249 1.2225 0.402226 0.000660994 0.487249     

    I'm using 4 monteExpressions and the second 4 columns are identical to the first 4.

    Any idea what's going on?

    Thanks,

    Paul

    • Post Points: 5
  • Tue, Jun 17 2014 2:37 PM

    • pranucci
    • Not Ranked
    • Joined on Tue, Jun 17 2014
    • Posts 2
    • Points 10
    Re: Multiple variable MonteCarlo simulation in OCEAN Reply

    After reading a bunch of your posts on this i was actually able to solve my problem.

    The mcdata file always appears to erase and then overwrite the previous parametric run with the new data and then keep repeating so instead of relying on that file I just printed the results from each run into my own file using your abstats.il script.

    Here's the code for general interest:

    load("/(directory path)/abStats.il")

    /* standard setup stuff here */

     VIN_List='("5.0" "2.7")
    temp_List='("-40" "125")
    BG_code_List='("6" "7")
    CL_code_List='("0" "1")

    number = 0

    fprintf(myPort "iteration,VIN, BG_code, CL_code, temp, VBG, VREF, Voffset, Iout_DC\n")

    foreach(VIN VIN_List
                desVar("pvdd" VIN)
    foreach(BG_CODE BG_code_List
                desVar(      "BG_code" BG_CODE    )
    foreach(CL_CODE CL_code_List
                desVar(      "CL_code" CL_CODE    )
    foreach(temp temp_List
                    temp(temp)

                    monteCarlo( ?numIters "5" ?startIter "1"
                        ?analysisVariation 'mismatch
                        ?sweptParam "None"
                        ?sweptParamVals "27"  
                        ?saveData nil
                        ?nomRun "yes"
                        ?append nil
                        ?saveProcessParams t
                        )
                    monteExpr( "VBG" "VDC(\"/BG_2036\")" )
                    monteExpr( "VREF" "VDC(\"/VREFA\")" )
                    monteExpr( "Voffset" "(VDC(\"/DRAIN\") - VDC(\"/IREF\"))" )
                    monteExpr( "Iout_dc" "IDC(\"/V17/MINUS\")" )
                    monteRun()

    results=abReadMonteData(strcat(openResults() "/monteCarlo"))
    VBG_results=results->datatab[sprintf(nil "VBG_%s" temp)]
    VREF_results=results->datatab[sprintf(nil "VREF_%s" temp)]
    Voffset_results=results->datatab[sprintf(nil "Voffset_%s" temp)]
    Iout_dc_results=results->datatab[sprintf(nil "Iout_dc_%s" temp)]

    /* right here I had to use the sprintf() expression so that it searches for VBG_25 and not just VBG */

    number=number+1

    printf("***** %d *****\n" number)

    /* match i range up to number of MC iterations */

    for( i 0 results->N - 1
    fprintf(myPort "%d,%s,%s,%s,%s,%5f,%5f,%5e,%5f\n" i+1 VIN BG_CODE CL_CODE temp VBG_results[i] VREF_results[i] Voffset_results[i] Iout_dc_results[i])))

    /* print out i+1 for iteration number to match it up with the actual monte carlo iteration */   

                ))))
    close(myPort)

    • Post Points: 5
Page 1 of 1 (4 items)
Sort Posts:
Started by Alex Vasjanov at 20 Dec 2013 12:09 AM. Topic has 3 replies.