上一篇:ADS 使用教程(六)Optimization in ADS
这一节,我们来了解一下蒙特卡洛(Monte Carlo)仿真。
在ADS(Advanced Design System)中,蒙特卡洛仿真(Monte Carlo Simulation)用于分析电路在参数变化或不确定性情况下的性能。蒙特卡洛仿真通过对电路参数进行多次随机采样和仿真,帮助工程师评估电路在制造公差、温度变化、老化等因素影响下的稳定性和可靠性。
在上一节中,我们进行了优化,得到了一组基本上满足设计需求的组件值。在这一节中,我们设定一些公差来观察一些仿真效果,并且判断一下在这些公差存在的前提下,我们是否可以实现很好的电路性能。
首先,为了避免对之前的设计造成影响,我们需要复制一个Cell副本。在ADS主界面中,我们在“TestBench_MyFilter”上单击鼠标右键,然后选中“Copy Cell”:
点击后出现Copy Cell窗口:
可以看到,在复制时是默认没有层次结构的,只会复制当前选定的单元。而Hierarchy选项则包含了层次结构,会复制当前选定单元及其子单元。Hierarchy and all referenced items选项则包含层次结构和所有引用项,会复制当前选定单元、其子单元以及所有引用的项。此时我们选择“Hierarchy”,并将New Name命名为“TestBench_MyFilter_MC”和“Design1_MC”(在稍旧一点版本的ADS中,name不会自动更新,会出现一个黄色感叹号,这是提示说当前明明已经存在,需要进行重命名,但在新版本的ADS中(如2024update2),会自动在原Cell的名称后面加入版本后缀(如_v1)):
点击“OK”,我们可以看到我们又创建了两个新的Cell。打开新创建的TestBench的schematic,可以看到里面的子电路已经是复制后的新的Cell了:
此时我们可以删除OPTIM、GOALs。
蒙特卡洛仿真总共分为两个步骤:
第一个步骤就是更改Library Palettes,修改为“Optim/Stat/DOE”,然后选中,在设计中放入蒙特卡洛控制器:
首先,我们需要定义SimInstanceName,由于我们已经有一个Instance“SP1”了,所以我们将其修改为“SP1”(要加引号)。蒙特卡洛仿真可以运行在任何类型的分析上,像S参数仿真、DC仿真、瞬态仿真等。然后,我们需要定义一下NumIters(迭代次数),由于蒙特卡洛是一个统计模拟器,素以根据迭代次数的不同,模拟得到的分布值会有所不同,此次为了演示其功能,所以设定为250,在实际仿真的过程中,可能需要远高于250次的迭代次数。Seed表示随机种子,未指定值时使用默认的随机种子,如果需要重现相同的随机数序列,则需要设置特定的种子值。SaveSolns=yes,意味着迭代中的每次仿真结果都会被保存下来。SaveSpecs=yes,表示每次仿真结果的规格都会被保存。SaveRandVars=yes,意味着每次仿真中使用的随机变量值都会被保存。UpdateDataset=no,表示不更新数据集。SaveAllIterations=yes,表示所有迭代的结果都会被保存。UseAllSpecs=yes表示所有定义的规格都会被使用。StatusLevel=2,表示中等详细程度的状态信息。RerunTrials="",指重新运行试验,由于未指定具体试验,故这里留空。
第二个步骤是将统计可变性分配到组件中,我们点击“Simulate – Simulation Variables Setup”,然后我们选择“Statistics”选项卡,然后勾选我们需要仿真的参数:
其中,我们可以定义其类型,此次实验均选择“Gaussian”:
- Gaussian(正态分布):正态分布(高斯分布)是一种连续概率分布,数据在均值左右对称分布,大多数数据点集中在均值附近,远离均值的数据点较少。常用于模拟元件参数的制造公差和随机误差,例如电阻、电容、电感的制造公差。
- Lognormal(对数正态分布):对数正态分布是指变量的对数值服从正态分布。数据点在正方向上偏移,适合描述正值变量。常用于模拟具有正偏斜的参数,例如晶体管的漏电流、某些功率器件的参数。
- Uniform(均匀分布):均匀分布是一种连续分布,所有数据点在指定范围内的可能性相同。常用于模拟在一定范围内随机分布的参数,例如电阻或电容的均匀公差。
- Discrete(离散分布):离散分布是指变量只取离散值,每个值都有特定的概率。常用于模拟开关状态、数字电路中的逻辑电平等离散参数。
也可以定义格式,此次实验我们均选择“+/- stddev”:
- +/- stddev:表示参数的标准差以绝对值表示。例如,如果均值为10 pF,标准差为1 pF,那么参数的值会在9 pF到11 pF之间波动。
- +/- stddev %:表示参数的标准差以百分比表示。例如,如果均值为10 pF,标准差为10%,那么参数的值会在9 pF到11 pF之间波动(即10 pF的正负10%)。
在偏移量一栏,ADS默认将其设为原数据的5%,我们也可以根据需要自行修改。
然后点击“OK”。接下来我们点击进行仿真,接着我们插入Rectangle Plot,分别展示dB(S(2,1))和dB(S(1,1)),同时我们添加delay(2,1)来观察延迟情况:
我们可以看到,此时得到的plot不再是单一曲线,而是由不同条件下仿真得到的结果的汇总。
然后保存结果即可。
(To be continued......)