• PCB SI9000阻抗计算引擎Web方式实现方法


    在笔者从业这么多年,PCB行业阻抗计算工具都是用Polar公司的阻抗计算工具SI9000,或早期上个版 本SI8000

    Prolar是老牌公司,但也不断在推出新的产品,可以进去去了解一下   https://www.polarinstruments.com/

    一直以来在我印象里,好东西都是外国公司创造,但近些年推出【中国制造2025】,中国企业崛起,

    在一个创新开放的城市,深圳一家创业公司也推出阻抗计算工具了深圳市赛硕尔科技有限公司 

     大家可以了解一下 http://www.sisolver.com/   号称阻抗理论计算精度超过Prolar. 支持国产,加油

    一.将单个参数改为Model类做为参数传递

           原为单个值参数:

            

           改后Mod参数:

                

              Model参数类

    ''' <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
    View Code

     二.写反射类阻抗计算方法

             正算代码实现:      

    #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
    View Code

             反算代码实现:

    #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
    View Code

          阻抗线调整类型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
    View Code

    三.写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

  • 相关阅读:
    Android学习笔记ActionView
    Android学习笔记添加ActionItem
    Android学习笔记显示和隐藏ActionBar
    Android学习笔记上下文菜单
    Android学习笔记菜单资源文件
    Android学习笔记样式资源文件
    Android学习笔记主题(Theme)资源文件
    Android学习笔记StateListDrawable文件
    Android学习笔记.9.png格式图片
    笔记本外接显示器设置全屏壁纸
  • 原文地址:https://www.cnblogs.com/pcbren/p/9538575.html
Copyright © 2020-2023  润新知