lineZcalc2 
qsl.net/zs1agx/antenna

lineZcalc2.exe is for .net 3.5 x86 build CRC32 7973B779

lineZcalc2.exe is a Full Trust program; it reads from two .dat files, but creates or writes no files.
These .dat files are text files that can be added to or modified with text editor for cable type or antenna Z.


Various additional functions (seldom used) are available by right clicks (when "User" not selected):

*Cable characteriser, right click on VF
*Balanced line calculator, right click on lineZ	, then can right click "wire diameter"		
*Antenna feedline calculator, needs lineZlen.dat file, right click on length
	after "OK" from feedline calculator, can right click Frequency main form (be sure to set feeder length)
	
When "User" selected, the dB loss/100 foot must be specified for the Frequency to be used for calculation.

If the label says 'metres', type in metres value
if the label says 'feet', type in feet value

if the label says 'metres', and you wish to type in a value of 100 feet, then type in 100f (or 100feet or 100')
if the label says 'feet', and you wish to type in a value of 100 metres, then type in 100m (or 100 metres)

-----------------
This program uses method EDN April 13th 2006 pg79; three cable loss (at 1,10,100Mhz/100ft) are required for calculation,
a "User" cable setting allows for expert mode and the exact impedance and VF of cable can be specified instead. [Notice
that any program actually guesses at the cable line impedance otherwise].

The program is fairly simple, there being more range checking than calculation. Some complex number arithmetic relies on the
complex structure. The use of a structure allows changing of a copy without altering the original number.


   
    ' hyperbolics:
    Friend Function sinh(ByVal k As ccomplex) As ccomplex
        Dim a As Single = k.Real
        Dim b As Single = k.Imaginary
        'sinh(a + j b) = .5 * (exp(a)-exp(-a))*cos(b) + j * .5 *(exp(a)+exp(-a))*sin(b)

        Dim res As Single = 0.5 * (Math.Exp(a) - Math.Exp(-a)) * Math.Cos(b)
        Dim resi As Single = 0.5 * (Math.Exp(a) + Math.Exp(-a)) * Math.Sin(b)
        Return New ccomplex(res, resi)

    End Function
    Friend Function cosh(ByVal k As ccomplex) As ccomplex
        Dim a As Single = k.Real
        Dim b As Single = k.Imaginary
        'cosh(a + j b) = .5 * (exp(a)+exp(-a))*cos(b) + j * .5 * (exp(a)-exp(-a))*sin(b)

        Dim res As Single = 0.5 * (Math.Exp(a) + Math.Exp(-a)) * Math.Cos(b)
        Dim resi As Single = 0.5 * (Math.Exp(a) - Math.Exp(-a)) * Math.Sin(b)
        Return New ccomplex(res, resi)
    End Function
	
    Friend Function tanh(ByVal k As ccomplex) As ccomplex
        Dim s As ccomplex = sinh(k)
        Dim c As ccomplex = cosh(k)
        Dim res As ccomplex = s / c
        Return res
    End Function

    Friend Function atanh(ByVal k As ccomplex) As ccomplex
        ' 
        Dim t As ccomplex = 1 + k
        Dim b As ccomplex = 1 - k
        Dim dv As ccomplex = (t / b)

        Dim rl As Single = Math.Log(modl(dv))
        Dim a1 As Single = dv.Imaginary
        Dim b1 As Single = dv.Real
        Dim im As Single = Math.Atan2(a1, b1) ' '(a1, b1)
        Dim tmp As New ccomplex(rl, im)
        ' 
        Return 0.5 * tmp
    End Function
   
    Friend Function csqrt(ByVal k As ccomplex) As ccomplex
        If k.Imaginary = 0 Then
            ccomplex.ierr = True
            '  Debug.Print("ierr " + ierr.ToString)
            Return New ccomplex(0, 0)
        End If
        Dim mdl As Single = modl(k)
        Return New ccomplex(Math.Sqrt((mdl + k.Real) / 2), _
         (k.Imaginary / Math.Sqrt(k.Imaginary * k.Imaginary)) * Math.Sqrt((mdl - k.Real) / 2))
    End Function
	
    Friend Function modl(ByVal k As ccomplex) As Single
        Return Math.Sqrt(k.Real * k.Real + k.Imaginary * k.Imaginary)
     End Function
	 
    ' complex numbers:
    Friend Structure complex
        ' from web clscomplex DuPreez
        Friend Real As Single
        Friend Imaginary As Single
        Friend Shared ierr As Boolean

        Friend Sub New(ByVal fReal As Single, ByVal fImaginary _
              As Single)
            Real = fReal
            Imaginary = fImaginary
        End Sub
       
        Public Shared Operator +(ByVal cOp1 As ccomplex, ByVal cOp2 _
            As ccomplex) As ccomplex
            Return (New ccomplex(cOp1.Real + cOp2.Real, _
             cOp1.Imaginary + cOp2.Imaginary))
        End Operator
        Public Shared Operator +(ByVal cOp As Single, ByVal cOp2 _
          As ccomplex) As ccomplex
            Return (New ccomplex(cOp + cOp2.Real, cOp2.Imaginary))
        End Operator

        Public Shared Operator -(ByVal cOp1 As ccomplex, ByVal cOp2 _
              As ccomplex) As ccomplex
            Return (New ccomplex(cOp1.Real - cOp2.Real, _
               cOp1.Imaginary - cOp2.Imaginary))
        End Operator

        Public Shared Operator -(ByVal cOp As Single, ByVal cOp2 _
           As ccomplex) As ccomplex
            Return (New ccomplex(cOp - cOp2.Real, -cOp2.Imaginary))
        End Operator

        Public Shared Operator *(ByVal cOp1 As ccomplex, ByVal cOp2 As  _
              ccomplex) As ccomplex
            Return (New ccomplex(cOp1.Real * cOp2.Real - _
               cOp1.Imaginary * cOp2.Imaginary, cOp1.Real * _
               cOp2.Imaginary + cOp2.Real * cOp1.Imaginary))
        End Operator

        Public Shared Operator *(ByVal Op1 As Single, ByVal cOp2 As  _
             ccomplex) As ccomplex
            Return (New ccomplex(Op1 * cOp2.Real, Op1 * cOp2.Imaginary))
        End Operator

        Public Shared Operator /(ByVal cOp1 As ccomplex, ByVal cOp2 As  _
              ccomplex) As ccomplex
            If ((cOp2.Real = 0.0F) And (cOp2.Imaginary = 0.0F)) Then
                ccomplex.ierr = True
                Return (New ccomplex(1000000.0, 1000000.0)) ' error!
            End If
            Dim fReal As Single = (cOp1.Real * cOp2.Real + _
               cOp1.Imaginary * cOp2.Imaginary) / (cOp2.Real * _
               cOp2.Real + cOp2.Imaginary * cOp2.Imaginary)
            Dim fImaginary As Single = (cOp2.Real * _
               cOp1.Imaginary - cOp1.Real * cOp2.Imaginary) / _
               (cOp2.Real * cOp2.Real + cOp2.Imaginary * _
               cOp2.Imaginary)
            Return (New ccomplex(fReal, fImaginary))
        End Operator
		
        Public Shared Operator /(ByVal cOp As Single, ByVal cOp2 As  _
             ccomplex) As ccomplex
            If ((cOp2.Real = 0.0F) And (cOp2.Imaginary = 0.0F)) Then
                ccomplex.ierr = True
                Return (New ccomplex(1000000.0, 1000000.0)) ' error!
            End If
            Dim fReal As Single = (cOp * cOp2.Real) / (cOp2.Real * _
               cOp2.Real + cOp2.Imaginary * cOp2.Imaginary)
            Dim fImaginary As Single = (-cOp * cOp2.Imaginary) / _
               (cOp2.Real * cOp2.Real + cOp2.Imaginary * _
               cOp2.Imaginary)
            Return (New ccomplex(fReal, fImaginary))
        End Operator


    End Structure


