在筆者從業這麼多年,PCB行業阻抗計算工具都是用Polar公司的阻抗計算工具SI9000,或早期上個版 本SI8000算法
Prolar是老牌公司,但也不斷在推出新的產品,能夠進去去了解一下 https://www.polarinstruments.com/ide
一直以來在我印象裏,好東西都是外國公司創造,但近些年推出【中國製造2025】,中國企業崛起,工具
在一個創新開放的城市,深圳一家創業公司也推出阻抗計算工具了深圳市賽碩爾科技有限公司 測試
你們能夠了解一下 http://www.sisolver.com/ 號稱阻抗理論計算精度超過Prolar. 支持國產,加油優化
一.將單個參數改成Model類作爲參數傳遞spa
原爲單個值參數:3d
改後Mod參數:code
Model參數類orm
''' <summary> ''' 阻抗計算參數(反算) ''' </summary> ''' <remarks></remarks> <Serializable()> _ Public Class MOD_ImpCalcReverseParam Public Sub New(ByVal _ImpCalcParam As MOD_ImpCalcParam, ByVal _Enum_Resize As MOD_EnumImp.ImpCalcResize) Me.ImpCalcParam = _ImpCalcParam Me.Enum_Resize = _Enum_Resize Me.RequestZo = _ImpCalcParam.Zo Me.WS_Sum = Me.ImpCalcParam.W1 + Me.ImpCalcParam.S1 Me.WD_Sum = Me.ImpCalcParam.W1 + Me.ImpCalcParam.D1 Me.SD_Sum = Me.ImpCalcParam.S1 + Me.ImpCalcParam.D1 Me.W1W2_Diff = Me.ImpCalcParam.W1 - Me.ImpCalcParam.W2 Me.CalcMaxCount = 20 Me.ImpAccuracy = 0.01 Me.min = 0.0 Select Case Enum_Resize Case MOD_EnumImp.ImpCalcResize.W1, MOD_EnumImp.ImpCalcResize.W1S1, MOD_EnumImp.ImpCalcResize.W1D1, MOD_EnumImp.ImpCalcResize.W1S1D1, MOD_EnumImp.ImpCalcResize.O1 Me.max = Me.ImpCalcParam.W1 * 4 Case MOD_EnumImp.ImpCalcResize.S1, MOD_EnumImp.ImpCalcResize.S1D1 Me.max = Me.ImpCalcParam.S1 * 4 Case MOD_EnumImp.ImpCalcResize.D1 Me.max = Me.ImpCalcParam.D1 * 4 Case MOD_EnumImp.ImpCalcResize.H1 Me.max = Me.ImpCalcParam.H1 * 4 Case MOD_EnumImp.ImpCalcResize.H2 Me.max = Me.ImpCalcParam.H2 * 4 Case MOD_EnumImp.ImpCalcResize.H3 Me.max = Me.ImpCalcParam.H3 * 4 Case MOD_EnumImp.ImpCalcResize.H4 Me.max = Me.ImpCalcParam.H4 * 4 Case MOD_EnumImp.ImpCalcResize.Er1 Me.max = Me.ImpCalcParam.Er1 * 4 Case MOD_EnumImp.ImpCalcResize.Er2 Me.max = Me.ImpCalcParam.Er2 * 4 Case MOD_EnumImp.ImpCalcResize.Er3 Me.max = Me.ImpCalcParam.Er3 * 4 Case MOD_EnumImp.ImpCalcResize.Er4 Me.max = Me.ImpCalcParam.Er4 * 4 Case MOD_EnumImp.ImpCalcResize.REr Me.max = Me.ImpCalcParam.REr * 4 End Select End Sub ''' <summary> ''' 反算結果OK ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property isOK As Boolean ''' <summary> ''' 阻抗計算參數(正算) ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property ImpCalcParam As MOD_ImpCalcParam ''' <summary> ''' 反算調整類型 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property Enum_Resize As MOD_EnumImp.ImpCalcResize ''' <summary> ''' W與S之和 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property WS_Sum As Double ' ''' <summary> ''' W與D之和 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property WD_Sum As Double ''' <summary> ''' S與D之和 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property SD_Sum As Double ''' <summary> ''' W1與W2差值 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property W1W2_Diff As Double ''' <summary> ''' 要求阻抗值 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property RequestZo As Double ''' <summary> ''' 反算最大次數 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property CalcMaxCount As Double ''' <summary> ''' 反算阻抗精度 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property ImpAccuracy As Double ''' <summary> ''' 最小值 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property min As Double ''' <summary> ''' 最大值 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property max As Double ''' <summary> ''' 獲取反算調整類型的委託 ''' </summary> ''' <returns></returns> ''' <remarks></remarks> Public Function GetImpCalcReverseResizeDelegate() As Action(Of MOD_ImpCalcReverseParam) Dim ReturnReverse As Action(Of MOD_ImpCalcReverseParam) = Nothing Select Case Enum_Resize Case MOD_EnumImp.ImpCalcResize.W1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.max + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff Else ReverseParam.max = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.min + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff End If End Sub) Case MOD_EnumImp.ImpCalcResize.W1D1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.max + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff ReverseParam.ImpCalcParam.D1 = ReverseParam.WD_Sum - ReverseParam.ImpCalcParam.W1 Else ReverseParam.max = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.min + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff ReverseParam.ImpCalcParam.D1 = ReverseParam.WD_Sum - ReverseParam.ImpCalcParam.W1 End If End Sub) Case MOD_EnumImp.ImpCalcResize.W1S1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.max + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff ReverseParam.ImpCalcParam.S1 = ReverseParam.WS_Sum - ReverseParam.ImpCalcParam.W1 Else ReverseParam.max = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.min + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff ReverseParam.ImpCalcParam.S1 = ReverseParam.WS_Sum - ReverseParam.ImpCalcParam.W1 End If End Sub) Case MOD_EnumImp.ImpCalcResize.W1S1D1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.max + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff ReverseParam.ImpCalcParam.S1 = ReverseParam.WS_Sum - ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.D1 = ReverseParam.WD_Sum - ReverseParam.ImpCalcParam.W1 Else ReverseParam.max = ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.W1 = (ReverseParam.min + ReverseParam.ImpCalcParam.W1) * 0.5 ReverseParam.ImpCalcParam.W2 = ReverseParam.ImpCalcParam.W1 - ReverseParam.W1W2_Diff ReverseParam.ImpCalcParam.S1 = ReverseParam.WS_Sum - ReverseParam.ImpCalcParam.W1 ReverseParam.ImpCalcParam.D1 = ReverseParam.WD_Sum - ReverseParam.ImpCalcParam.W1 End If End Sub) Case MOD_EnumImp.ImpCalcResize.S1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.S1 ReverseParam.ImpCalcParam.S1 = (ReverseParam.min + ReverseParam.ImpCalcParam.S1) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.S1 ReverseParam.ImpCalcParam.S1 = (ReverseParam.max + ReverseParam.ImpCalcParam.S1) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.D1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.D1 ReverseParam.ImpCalcParam.D1 = (ReverseParam.min + ReverseParam.ImpCalcParam.D1) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.D1 ReverseParam.ImpCalcParam.D1 = (ReverseParam.max + ReverseParam.ImpCalcParam.D1) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.S1D1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.S1 ReverseParam.ImpCalcParam.S1 = (ReverseParam.min + ReverseParam.ImpCalcParam.S1) * 0.5 ReverseParam.ImpCalcParam.D1 = ReverseParam.SD_Sum - ReverseParam.ImpCalcParam.S1 Else ReverseParam.min = ReverseParam.ImpCalcParam.S1 ReverseParam.ImpCalcParam.S1 = (ReverseParam.max + ReverseParam.ImpCalcParam.S1) * 0.5 ReverseParam.ImpCalcParam.D1 = ReverseParam.SD_Sum - ReverseParam.ImpCalcParam.S1 End If End Sub) Case MOD_EnumImp.ImpCalcResize.O1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.O1 ReverseParam.ImpCalcParam.O1 = (ReverseParam.min + ReverseParam.ImpCalcParam.O1) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.S1 ReverseParam.ImpCalcParam.O1 = (ReverseParam.max + ReverseParam.ImpCalcParam.O1) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.T1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.T1 ReverseParam.ImpCalcParam.T1 = (ReverseParam.max + ReverseParam.ImpCalcParam.T1) * 0.5 Else ReverseParam.max = ReverseParam.ImpCalcParam.T1 ReverseParam.ImpCalcParam.T1 = (ReverseParam.min + ReverseParam.ImpCalcParam.T1) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.H1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.H1 ReverseParam.ImpCalcParam.H1 = (ReverseParam.min + ReverseParam.ImpCalcParam.H1) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.H1 ReverseParam.ImpCalcParam.H1 = (ReverseParam.max + ReverseParam.ImpCalcParam.H1) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.Er1 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.Er1 ReverseParam.ImpCalcParam.Er1 = (ReverseParam.max + ReverseParam.ImpCalcParam.Er1) * 0.5 Else ReverseParam.max = ReverseParam.ImpCalcParam.Er1 ReverseParam.ImpCalcParam.Er1 = (ReverseParam.min + ReverseParam.ImpCalcParam.Er1) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.H2 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.H2 ReverseParam.ImpCalcParam.H2 = (ReverseParam.min + ReverseParam.ImpCalcParam.H2) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.H2 ReverseParam.ImpCalcParam.H2 = (ReverseParam.max + ReverseParam.ImpCalcParam.H2) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.Er2 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.Er2 ReverseParam.ImpCalcParam.Er2 = (ReverseParam.max + ReverseParam.ImpCalcParam.Er2) * 0.5 Else ReverseParam.max = ReverseParam.ImpCalcParam.Er2 ReverseParam.ImpCalcParam.Er2 = (ReverseParam.min + ReverseParam.ImpCalcParam.Er2) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.H3 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.H3 ReverseParam.ImpCalcParam.H3 = (ReverseParam.min + ReverseParam.ImpCalcParam.H3) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.H3 ReverseParam.ImpCalcParam.H3 = (ReverseParam.max + ReverseParam.ImpCalcParam.H3) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.Er3 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.Er3 ReverseParam.ImpCalcParam.Er3 = (ReverseParam.max + ReverseParam.ImpCalcParam.Er3) * 0.5 Else ReverseParam.max = ReverseParam.ImpCalcParam.Er3 ReverseParam.ImpCalcParam.Er3 = (ReverseParam.min + ReverseParam.ImpCalcParam.Er3) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.H4 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.max = ReverseParam.ImpCalcParam.H4 ReverseParam.ImpCalcParam.H4 = (ReverseParam.min + ReverseParam.ImpCalcParam.H4) * 0.5 Else ReverseParam.min = ReverseParam.ImpCalcParam.H4 ReverseParam.ImpCalcParam.H4 = (ReverseParam.max + ReverseParam.ImpCalcParam.H4) * 0.5 End If End Sub) Case MOD_EnumImp.ImpCalcResize.Er4 ReturnReverse = New Action(Of MOD_ImpCalcReverseParam)(Sub(ReverseParam) If ReverseParam.ImpCalcParam.Zo > ReverseParam.RequestZo Then ReverseParam.min = ReverseParam.ImpCalcParam.Er4 ReverseParam.ImpCalcParam.Er4 = (ReverseParam.max + ReverseParam.ImpCalcParam.Er4) * 0.5 Else ReverseParam.max = ReverseParam.ImpCalcParam.Er4 ReverseParam.ImpCalcParam.Er4 = (ReverseParam.min + ReverseParam.ImpCalcParam.Er4) * 0.5 End If End Sub) End Select Return ReturnReverse End Function End Class ''' <summary> ''' 阻抗計算參數(正算) 繼承: 介質層參數+線路層參數+阻焊層參數 ''' </summary> ''' <remarks></remarks> <Serializable()> _ Public Class MOD_ImpCalcParam Inherits MOD_ImpParamDielectric ''' <summary> ''' 計算阻抗值結果 ''' </summary> ''' <value></value> ''' <returns></returns> ''' <remarks></remarks> Public Property Zo() As Double End Class ''' <summary> ''' 阻焊層參數 1/3 ''' </summary> ''' <remarks></remarks> <Serializable()> _ Public Class MOD_ImpParamSolderMask ''' <summary> ''' 基材上阻焊厚度 (與阻抗值大小成反比) ''' </summary> Public Property C1() As Double ''' <summary> ''' 線路上阻焊厚度(與阻抗值大小成反比) ''' </summary> Public Property C2() As Double ''' <summary> ''' 【外層差分阻抗】2條線間距中間阻焊厚度(與阻抗值大小成反比) ''' </summary> Public Property C3() As Double ''' <summary> ''' 阻焊介電常數(與阻抗值大小成反比) ''' </summary> Public Property CEr() As Double End Class ''' <summary> ''' 線路層參數 2/3 繼承: 阻焊層參數 ''' </summary> ''' <remarks></remarks> <Serializable()> _ Public Class MOD_ImpParamSingal Inherits MOD_ImpParamSolderMask ''' <summary> ''' 線路銅厚(與阻抗值大小成反比) ''' </summary> Public Property T1() As Double ''' <summary> ''' 線底線寬(與阻抗值大小成反比) ''' </summary> Public Property W1() As Double ''' <summary> ''' 線頂線寬(與阻抗值大小成反比) ''' </summary> Public Property W2() As Double ''' <summary> ''' 【差分阻抗】線距(與阻抗值大小成正比) ''' </summary> Public Property S1() As Double ''' <summary> ''' 【共面阻抗】線到銅距離(與阻抗值大小成正比) ''' </summary> Public Property D1() As Double ''' <summary> ''' 【共面阻抗】銅皮線底線寬(與阻抗值大小成反比) ''' </summary> Public Property G1() As Double ''' <summary> ''' 【共面阻抗】銅皮線頂線寬(與阻抗值大小成反比) ''' </summary> Public Property G2() As Double ''' <summary> ''' 【層間差分阻抗】2條線路偏移距離(與阻抗值大小成正比) ''' </summary> Public Property O1() As Double End Class ''' <summary> ''' 介質層參數 3/3 繼承: 線路層參數+阻焊層參數 ''' </summary> ''' <remarks></remarks> <Serializable()> _ Public Class MOD_ImpParamDielectric Inherits MOD_ImpParamSingal ''' <summary> ''' H1介質層厚度(與阻抗值大小成正比) ''' </summary> Public Property H1() As Double ''' <summary> ''' H1介電常數(與阻抗值大小成反比) ''' </summary> Public Property Er1() As Double ''' <summary> ''' H2介質層厚度(與阻抗值大小成正比) ''' </summary> Public Property H2() As Double ''' <summary> ''' H2介電常數(與阻抗值大小成反比) ''' </summary> Public Property Er2() As Double ''' <summary> ''' H3介質層厚度(與阻抗值大小成正比) ''' </summary> Public Property H3() As Double ''' <summary> ''' H3介電常數(與阻抗值大小成反比) ''' </summary> Public Property Er3() As Double ''' <summary> ''' H4介質層厚度(與阻抗值大小成正比) ''' </summary> Public Property H4() As Double ''' <summary> ''' H4介電常數(與阻抗值大小成反比) ''' </summary> Public Property Er4() As Double ''' <summary> ''' 【內層差分阻抗】2條線間距中間純膠介電常數(與阻抗值大小成反比) ''' </summary> Public Property REr() As Double End Class
二.寫反射類阻抗計算方法對象
正算代碼實現:
#Region "阻抗計算--------正算" #Region "阻抗模型--------方法名+MOD類參數傳遞(反射直接出結果)" ''' <summary> ''' 反射調用阻抗計算方法並返回結果 ''' </summary> ''' <param name="MethodName"></param> ''' <param name="modParam"></param> ''' <returns></returns> ''' <remarks></remarks> Public Function ImpCalcMenthod(ByVal MethodName As String, ByVal modParam As MOD_ImpCalcParam) As Double Dim result As Double = 0.0 Try Dim type As Type = Assembly.Load("CalcImpModelDLL").[GetType]("CalcImpModelDLL.ImpCalcModel") Dim params_type As Type = GetType(MOD_ImpCalcParam) Dim method As MethodInfo = type.GetMethod(MethodName, New Type() {params_type}) Dim parameters As Object() = New Object() {modParam} result = CType(method.Invoke(Nothing, parameters), Double) Catch End Try modParam.Zo = result Return (result) End Function #End Region #Region "阻抗模型--------方法名+MOD類參數傳遞(反射委託方式)" ''' <summary> ''' 定義阻抗計算委託方法 ''' </summary> ''' <param name="modParam"></param> ''' <returns></returns> ''' <remarks></remarks> Public Delegate Function ImpCalcDelegate(ByVal modParam As MOD_ImpCalcParam) As Double ''' <summary> ''' 獲取阻抗計算的委託方法 ''' </summary> ''' <param name="MethodName"></param> ''' <returns></returns> ''' <remarks></remarks> Public Function GetImpCalcDelegate(ByVal MethodName As String) As ImpCalcDelegate Dim impcalc As ImpCalcDelegate = Nothing Try Dim type As Type = Assembly.Load("CalcImpModelDLL").[GetType]("CalcImpModelDLL.ImpCalcModel") Dim params_type As Type = GetType(MOD_ImpCalcParam) Dim method As MethodInfo = type.GetMethod(MethodName, New Type() {params_type}) impcalc = CType([Delegate].CreateDelegate(GetType(ImpCalcDelegate), method), ImpCalcDelegate) Catch End Try Return impcalc End Function #End Region #End Region
反算代碼實現:
#Region "阻抗計算--------反算" ''' <summary> ''' 深複製 序列化實現 ''' </summary> ''' <typeparam name="T"></typeparam> ''' <param name="RealObject"></param> ''' <returns></returns> Public Function ToClone(Of T)(ByVal RealObject As T) As T Using objectStream As Stream = New MemoryStream() '利用 System.Runtime.Serialization序列化與反序列化完成引用對象的複製 Dim formatter As IFormatter = New BinaryFormatter() formatter.Serialize(objectStream, RealObject) objectStream.Seek(0, SeekOrigin.Begin) Return CType(formatter.Deserialize(objectStream), T) End Using End Function ''' <summary> ''' 反算---循環調用阻抗計算方法並返回反回計算是否成功 ''' </summary> ''' <param name="MethodName"></param> ''' <param name="modParam"></param> ''' <returns></returns> ''' <remarks></remarks> Public Function ImpCalcMenthodReverse(ByVal MethodName As String, ByVal modParam As MOD_ImpCalcParam, Optional ByVal _Enum_Resize As MOD_EnumImp.ImpCalcResize = MOD_EnumImp.ImpCalcResize.W1S1D1) As MOD_ImpCalcReverseParam Dim CalcCount As Integer Dim impcalcDelegate As ImpCalcDelegate = GetImpCalcDelegate(MethodName) Dim modParamClone As MOD_ImpCalcParam = ToClone(Of MOD_ImpCalcParam)(modParam) Dim ReverseParam As MOD_ImpCalcReverseParam = New MOD_ImpCalcReverseParam(modParamClone, _Enum_Resize) Dim ReverseResizeDelegate As Action(Of MOD_ImpCalcReverseParam) = ReverseParam.GetImpCalcReverseResizeDelegate() impcalcDelegate(ReverseParam.ImpCalcParam) While Math.Abs((modParam.Zo - ReverseParam.ImpCalcParam.Zo)) > ReverseParam.ImpAccuracy ReverseResizeDelegate(ReverseParam) impcalcDelegate(ReverseParam.ImpCalcParam) CalcCount += 1 If CalcCount > ReverseParam.CalcMaxCount Then Exit While End If End While If Not CalcCount > ReverseParam.CalcMaxCount Then ReverseParam.isOK = True Else ReverseParam.ImpCalcParam = Nothing ReverseParam.isOK = False End If Return ReverseParam End Function ''' <summary> ''' 反算---循環調用阻抗計算方法並返回計算多種結果(應用於差分線2線中心距調整)能夠獲得多種阻抗匹配結果 ''' </summary> ''' <param name="MethodName"></param> ''' <param name="modParam"></param> ''' <param name="_Enum_Resize"></param> ''' <param name="isNotOK"></param> ''' <returns></returns> ''' <remarks></remarks> Public Function ImpCalcMenthodReverseWhileToList(ByVal MethodName As String, ByVal modParam As MOD_ImpCalcParam, ByVal _Enum_Resize As MOD_EnumImp.ImpCalcResize, Optional ByVal isNotOK As Boolean = False) As List(Of MOD_ImpCalcReverseParam) Dim ReverseParamList As New List(Of MOD_ImpCalcReverseParam) Dim ReverseParam As MOD_ImpCalcReverseParam ReverseParam = ImpCalcMenthodReverse(MethodName, modParam, _Enum_Resize) If ReverseParam.isOK Then ReverseParamList.Add(ReverseParam) End If Return ReverseParamList End Function #End Region
阻抗線調整類型Enum枚舉類:
''' <summary> ''' 反算阻抗枚舉 線寬1 線距2 線到銅4 ''' </summary> ''' <remarks></remarks> Public Enum ImpCalcResize #Region "線路層【線寬,線距,線到銅】調整" ''' <summary> ''' 線寬 調整 ''' </summary> ''' <remarks></remarks> W1 = 1 ''' <summary> ''' 線距 調整 ''' </summary> ''' <remarks></remarks> S1 = 2 ''' <summary> ''' 線寬+線距 調整 ''' </summary> ''' <remarks></remarks> W1S1 = 3 ''' <summary> ''' 線到銅 調整 ''' </summary> ''' <remarks></remarks> D1 = 4 ''' <summary> '''線寬+線到銅 調整 ''' </summary> ''' <remarks></remarks> W1D1 = 5 ''' <summary> ''' 線距+線到銅 調整 ''' </summary> ''' <remarks></remarks> S1D1 = 6 ''' <summary> ''' 線寬+線距+線到銅 調整 ''' </summary> ''' <remarks></remarks> W1S1D1 = 7 ''' <summary> ''' 【層間差分阻抗】2條線路偏移距離 ''' </summary> ''' <remarks></remarks> O1 ''' <summary> ''' 線路銅厚 ''' </summary> ''' <remarks></remarks> #End Region #Region "層疊結構【介質層厚度,介質電常數】調整" T1 ''' <summary> ''' H1介質層厚度 ''' </summary> ''' <remarks></remarks> H1 ''' <summary> ''' H1介電常數 ''' </summary> ''' <remarks></remarks> Er1 ''' <summary> ''' H2介質層厚度 ''' </summary> ''' <remarks></remarks> H2 ''' <summary> ''' H2介電常數 ''' </summary> ''' <remarks></remarks> Er2 ''' <summary> ''' H3介質層厚度 ''' </summary> ''' <remarks></remarks> H3 ''' <summary> ''' H3介電常數 ''' </summary> ''' <remarks></remarks> Er3 ''' <summary> ''' H4介質層厚度 ''' </summary> ''' <remarks></remarks> H4 ''' <summary> ''' H4介電常數 ''' </summary> ''' <remarks></remarks> Er4 ''' <summary> ''' 【內層差分阻抗】2條線間距中間純膠介電常數 ''' </summary> ''' <remarks></remarks> REr #End Region End Enum
三.寫Web服務接口
選擇性挺多的,能夠用WebService,WCF,WebAPI均可能,這裏不貼代碼了。
四.凝問解答
1.爲要什麼封裝爲Web,初衷是什麼 ?
初衷是解決客戶端沒安裝SI9000照樣能夠計算阻抗
現狀:每一個客戶端須要安裝安裝SI9000工具,沒安裝不能計算阻抗.基於此問題思考新方法。
解決方式:經過在在服務端安裝後SI9000,經過Web接口封裝爲服務開放出來供客戶端均可以調用,
獲取阻抗計算結果與反算結果。
2.阻抗計算是調用哪一個DLL計算的 ?
調用了:CalcEngineBEMDll.dll 阻抗計算引擎計算,這個DLL在SI9000安裝目錄裏面
3.若是不安裝SI9000,工程直接調用CalcEngineBEMDll.dll是否能夠計算阻抗呢?
通過筆者測試,不行的,必須安裝SI9000才能夠,
4.那麼安裝SI8000與SI9000的CalcEngineBEMDll.dll計算結果是否相同?
阻抗計算結果是有細微不一樣的,SI8000升級爲SI9000有部份接口參數作了少量優化。
5.若是隻安裝SI8000,卻想擁有SI9000的計算結果是否能夠呢?
固然能夠的,安裝S8000後,將SI9000的CalcEngineBEMDll.dll
替到SI8000的CalcEngineBEMDll.dll就能夠了
6. 阻抗反算是什麼意思?
阻抗反算是:經過指定阻抗值不變,反算出線寬,線距,介質層厚等信息.
7. 阻抗反算計算精度有多高?
精度由反算次數決定+阻抗精確度決定,當阻抗能夠調得出來的狀況下,
反算次數正常狀況下20次,精度能夠高達:0.001歐姆
8. 阻抗反算計算的原理是什麼?
經過二分折半算法與各參數對阻抗的正反比關係計算得出。
1.折半算法能夠baidu.本例子上文代碼中也有寫。
2.參數正反比關係以下:
9.是否有Prolar SI9000全部圖片模型呢?
有啊,這裏整理分享以下:
http://pcbren.cn/ShareFiles/ProlarSI9000阻抗模大圖png無logo.rar
http://pcbren.cn/ShareFiles/ProlarSI9000阻抗模小圖jpg無logo.rar
10.SI9000有多少種阻抗模型,每種阻抗模型對應的參考層與參數是怎麼樣關係?
經筆記整理統計有93種.對應的參考層與參數清單整理以下:
圖片太大小, 能夠經過以下連接查圖片查看
https://images2018.cnblogs.com/blog/733296/201808/733296-20180826191328826-1524965727.png