电路的计算机仿真目录一.理论讨论1.从最简单的情况开始2.对恒压源的处理3.受控电源的处理4.非线性电路的迭代求解5.电路的时域动态分析二.计算机实现1.编写的程序XLWSpice2.应用举例i)包含二极管的算例ii)RC,RLC电路暂态过程的算例iii)大型电阻网络的计算3.前景展望1.最简单的情况:只有电流源与线性电阻2.电压源的处理0.2000-0.200000001.000000-0.20000.4867-0.16670-0.0200-0.10000000-0.16670.166700000-1.0000000000001.00000-0.0200000.0200000-1.00000-0.10000000.100001.000001.000000000000000001.0000000001.0000-1.0000000001254603等效电导等效电流源在每次迭代中非线性器件可以等效为一个电流源并联一个电阻5.电路的时域动态分析1.编写程序XLWSpice•XiaoLunWenSpice特点:•使用C++语言•代码精简,不含外部库只有一千两百余行•使用高性能线性代数库Eigen进行稀疏矩阵的运算–通过PardisoSupport模块调用IntelMKLPardisoLU进行方程求解(兼顾Eigen的友好接口,MKL的优秀性能)•输入为网表数据,详情见源码注释•输出示例:%%%%%%NONLINEARDCANALYSIS%%%%%%%ABSOLUTECOVERGENCELIMIT:0.0001%RELATIVECOVERGENCELIMIT:0.001%HAVINGNODES:14%NONLINEARDCANALYSISITERATION0%NODEVOLTAGE1,12,0.1228173,0.5810274,0.2961565,0.2456346,0.4469267,0.3579628,0.3179299,0.40178910,0.37083911,0.3501912,0.38760113,0.37341414,0.361802%VOLTAGESOURCESCURRENT0,-1.41897,VSRC1%STOPITERATIONCRITERIAMET%%%%%%NONLINEARDCANALYSIS%%%%%%%ABSOLUTECOVERGENCELIMIT:0.0001%RELATIVECOVERGENCELIMIT:0.001%HAVINGNODES:6%NONLINEARDCANALYSISITERATION0%NODEVOLTAGE1,102,17.33333,23.33334,23.33335,67.33336,12%VOLTAGESOURCESCURRENT0,1.46667,VSRC11,0.533333,VSRC2%STOPITERATIONCRITERIAMET.DC1e-41e-3VSRC11010R125R236I401R5250R2610VSRC26012F053412.算例1:包含晶体二极管的简单电路绝对误差/V绝对误差/V解得节点2的电压时间/s绝对误差/V算例3:RLC电路的暂态过程节点2电压/V电路处在欠阻尼状态,结果与理论值符合良好0.1s步长,求解100步算例4:蔡氏电路012求解10s,步长0.01s可以明显看到蔡氏电路的混沌式的振荡。有“双涡旋”结构算例5:运用于大型电阻网格问题对于大型规律性的电阻网络,LU算法直接求解效果最佳。IntelMKL支持多核并行计算,大大提高求解性能,PardisoLU较Eigen内置SparseLU至少快一倍。BiCGSTAB等迭代求解器,因Eigen库的限制,矢量矩阵乘积无法并行化实验证明对于大型规律性的电阻网络效果很不好,N=750时需要超过50s用大型电阻网格问题的求解作为性能评价测试环境:Intel(R)64Compiler16.0.1.146关键选项/O3/QparallelEigen3.2.8IntelMKL11.3WindowsServer2012R2Intel(R)Core(TM)i5-5200UCPU@2.20GHz8GRAM总体性能令人满意点数N681012204060电阻/Ω0.519400.509750.505920.503280.501390.500350.50015解算时间(PardisoLU)/s0.110.120.120.120.120.130.16点数N8012024032050075010001200解算时间(PardisoLU)/s0.180.260.721.233.127.1013.019.0解算时间(SparseLU)/s0.080.170.931.695.3114.933.754.1直观分析计算结果电势-节点位置图(截取中心部分)电势-节点位置图(横断面)局部放大直观分析计算结果“等势线”可以明显看出电流扩散的各向异性沿00,11方向电阻较小有四万节点,求解仍可以在0.5s内完成3.前景展望参考文献•[1]KincaidDR,CheneyEW.Numericalanalysis:mathematicsofscientificcomputing[M].AmericanMathematicalSoc.,2002.•[2]邱关源,电路(第五版)[M],高等教育出版社•[3]VladimirescuA.TheSPICEBook[M],1994.JohnWiley&Sons,NewYork,1994.•[4]张运华等,数值计算方法与算法(第二版)[M],科学出版社•[5]AtkinsonD,VanSteenwijkFJ.Infiniteresistivelattices[J].AmericanJournalofPhysics,1999,67(6):486-492.•[6]DenardoB,EarwoodJ,SazonovaV.Experimentswithelectricalresistivenetworks[J].AmericanJournalofPhysics,1999,67(11):981-986.•[7]CsertiJ.ApplicationofthelatticeGreen’sfunctionforcalculatingtheresistanceofaninfinitenetworkofresistors[J].AmericanJournalofPhysics,2000,68(10):896-906.