' Self-Noise of an electromagnetic Seismograph
' Version for a large screen with 1600 * 1200 Pixels or more
OpenW # 1, 100, 100, 1340, 950, -1
AutoRedraw = 1
FontName = "Courier"
FontSize = 14
Global Double acp1, acp2, ampl0, ampl1, ampl2, bw6, bwout, dens0, dens1, dens2
Global Double elp0, f, fin, flog, frel, fun, h0, h1, h2, logom, p0, p0q, p1q, p2q
Global Double iaq, idq, inq, irq, lnm, lnmd, mass, omega, omega0, p, r2, r2q, r2zq
Global Double ra, raq, rd, rk, rs, rsaq, rsq, rszq, sigma, sigq, smq, u2q, uaq
Global Double udq, unq, urq, usq, x, yd1, yd2, yl, zq, nocheins
Global Int i, k, typ, mk
Global String ende$, n$, ok$, op$, text$
Print
Print " Electronic noise of an el-dyn seismometer with op-amp preamplifier"
Print
Print "             July 1995     updated March 2010     E.W."
Print
Dim per(20), a(20), b(20)
'
' Seismometer
'
'p0 = 0.5 '        free period (s)
'mass = 0.5 '      seismic mass (kg)
'sigma = 200 '     transducer constant (Vs/m)
'rs = 5000 '       coil resistance (Ohms)
'h0 = 0.1 '        mechanical (open-circuit) damping, fract. of crit.
'h1 = 0.2 '        desired closed-circuit damping, fract. of crit.
'
' read seismometer parameters from file EMS.par
Open "EMS.par" for Input As # 7
Line Input # 7, text$
p0 = Val(text$)
Line Input # 7, text$
mass = Val(text$)
Line Input # 7, text$
sigma = Val(text$)
Line Input # 7, text$
rs = Val(text$)
Line Input # 7, text$
h0 = Val(text$)
Line Input # 7, text$
h1 = Val(text$)
Line Input # 7, text$
text$ = Left$(text$, InStr(text$, " "))
Close # 7
'
omega0 = 2 * PI / p0 ' angular eigenfrequency
sigq = sigma ^ 2
rd = sigq / (2 * mass * omega0 * h1)
smq = (sigma / mass) ^ 2
rsq = rs ^ 2
rk = sigq / (2 * mass * omega0)
h2 = h0 + rk / rs
ra = rk / (h1 - h0) - rs
raq = ra ^ 2
r2 = rs + ra
r2q = r2 ^ 2
rsaq = (r2 / ra) ^ 2
udq = 0.017 * rd
idq = 0.017 / rd
iaq = 0.017 / ra
usq = 0.017 * rs
uaq = 0.017 * ra
u2q = 0.017 * r2
'
If ra < 0
  Print " Damping "; Round(h2, 3); " with shorted coil is insufficient"
  Print " Use stronger magnet, smaller mass, or longer free period"
  Stop
  ra = 0
  Print
  '  Print
  '  Print " When diagram is complete: continue with mouse button 1, end with 2"
Else
  Print " External damping resistor is "; Round(ra / rs, 3); " times coil resistance"
  Print
  Print " Use inverting op-amp input if ratio is <1, otherwise noninverting input"
  '  Print
  '  Print " When diagram is complete: continue with mouse button 1, end with 2"
  Print
EndIf
'
' USGS Low Noise Model (Peterson 1993)
'
For k = 0 To 20
  Read per(k), a(k), b(k)
Next k
Data 0.1,-162.36,5.64
Data 0.17,-166.7,0
Data 0.4,-170,-8.3
Data 0.8,-166.4,28.9
Data 1.24,-168.6,52.48
Data 2.4,-159.98,29.81
Data 4.3,-141.1,0
Data 5,-71.36,-99.77
Data 6,-97.26,-66.49
Data 10,-132.18,-31.57
Data 12,-205.27,36.16
Data 15.6,-37.65,-104.33
Data 21.9,-114.37,-47.1
Data 31.6,-160.58,-16.28
Data 45,-187.5,0
Data 70,-216.47,15.7
Data 101,-185,0
Data 154,-168.34,-7.61
Data 328,-217.43,11.9
Data 600,-258.28,26.6
Data 10000,-346.88,48.75
'
noisedef:
Print
Print " To be plotted:"
Print " Total electronic noise, incl. source resistor [e],  or"
Print "     equiv. seismic acceleration power density [pa], or"
Print "     equiv. seismic   velocity   power density [pv], or"
Print " equiv. rms seismic acceleration in 1/6 decade [aa], or"
Print " equiv. rms seismic   velocity   in 1/6 decade [av], or"
Print "                                          quit [q]"
Print
Repeat
  Input "                                 your choice:  ";n$
Until n$ = "e" Or n$ = "pa" Or n$ = "pv" Or n$ = "aa" Or n$ = "av" Or n$ = "q"
If n$ = "q"
  End
EndIf
Repeat
  Cls
  Print
  Print " explanation of symbols used in the figure:"
  Print " h0 = mechanical damping   h1 = desired total damping   rc = coil resistance"
  Print " g = generator constant    rl = external load resistance"
  Print " --- inverting circuit     +++ noninverting circuit"
  '
  '
  ' op-amp noise
  '
  Print
  Print
  Print " Which op-amp?"
  Print " 1 = LT1028, 2 = LT1007, 3 = LT1001, 4 = LT 1012, 5 = LT1250"
  Print " 6 = only voltage noise 100 nV/rHz, 7 = only current noise 100 pA/rHz"
  Print " 8 = no semiconductor noise (i.e. only resistor noise)"
  Print " 9 = LM 194/394 (National Semiconductor) at 100 uA collector current"
  Print " 10 = OP07,    >10: interactive specification"
  Print " 0 = quit, -1 = back to 'plot type' menu"
  Input typ
  If typ = 0
    End
  Else If typ = -1
    GoTo noisedef
  EndIf
  '
  ' noise data for some Linear Technology OpAmps (see Linear Data Books)
  Print
  ' DEFTEXT , , , 6
  fun = 1.0E-06
  fin = fun
  Select typ
  Case 1
    ' voltage noise in nV^2/Hz and 1/f corner frequency
    op$ = "LT1028"
    unq = 0.85 ^ 2
    fun = 3.5
    ' same for current noise in pA^2/Hz
    inq = 0.9 ^ 2
    fin = 250
  Case 2
    op$ = "LT1007"
    unq = 3 ^ 2
    fun = 2
    inq = 0.3 ^ 2
    fin = 120
  Case 3
    op$ = "LT1001"
    unq = 10 ^ 2
    fun = 4
    inq = 0.1 ^ 2
    fin = 70
  Case 4
    op$ = "LT1012"
    unq = 14 ^ 2
    fun = 2.5
    inq = 0.006 ^ 2
    fin = 120
  Case 5
    op$ = "LT1250"
    unq = 40 ^ 2
    inq = 0.004 ^ 2
    fin = 10
  Case 6
    op$ = "Un=100"
    unq = 10000
    inq = 0
  Case 7
    op$ = "In=100"
    unq = 0
    inq = 10000
  Case 8
    op$ = "NoNoise"
    unq = 0
    inq = 0
  Case 9
    op$ = "LM194/394 @ 100 uA"
    unq = 1.5 ^ 2
    fun = 0.01
    inq = 0.2 ^ 2
    fin = 0.4
'##E#
  Case 10
    op$ = "OP07"
    unq = 10. ^ 2
    fun = 1.
    inq = 0.12 ^ 2
    fin = 50.
  Default
    op$ = "custom"
    Repeat
      Input " voltage noise in nV/rHz: ";unq
      unq = unq ^ 2
      Input " corner frequency of 1/f voltage noise in Hz: ";fun
      Input " current noise in pA/rHz: ";inq
      inq = inq ^ 2
      Input " corner frequency of 1/f current noise in Hz: ";fin
      Input " ok [j,y]  ";ok$
    Until ok$ = "j" Or ok$ = "y"
  EndSelect
  '
  ' one-sixth decade bandwidth
  bw6 = 10 ^ (1 / 12) - 10 ^ (-1 / 12)
  '
  ' prepare diagram
  '
  Cls
  If n$ = "pa"
    Text 190, 10, op$ + "    noise power density in dB re (1 m/s^2)^2/Hz"
  Else If n$ = "pv"
    Text 190, 10, op$ + "    noise power density in dB re (1 m/s)^2/Hz"
  Else If n$ = "aa"
    Text 185, 10, op$ + "    noise amplitude in dB re. 1 m/s^2 rms in 1/6 decade"
  Else If n$ = "av"
    Text 185, 10, op$ + "    noise amplitude in dB re. 1 m/s rms in 1/6 decade"
  Else If n$ = "e"
    Text 150, 10, "total electronic noise in nV/sqr(Hz)    and nV rms in 1/6 decade"
    Box 2 * 350, 2 * 10, 2 * 352, 2 * 12
    PBox 2 * 570, 2 * 10, 2 * 573, 2 * 13
  EndIf
  For i = 20 To 620 Step 100
    Line 2 * i, 2 * 20, 2 * i, 2 * 380
    Text 2 * Min(i - 10, 598), 2 * 395, Str$(0.01 * 10 ^ ((i - 20) / 100))
  Next i
  Text 2 * 50, 2 * 395, "sec"
  For i = 20 To 380 Step 60
    Line 2 * 20, 2 * i, 2 * 620, 2 * i
    If i > 50
      If n$ = "e"
        Text 2 * 25, 2 * (i - 15), Str$(10 ^ ((260 - i) / 60))
      Else
        Text 2 * 25, 2 * (i - 15), Str$(-(280 + i) / 3)
      EndIf
    EndIf
  Next i
  Text 2 * 130, 2 * 30, "per=" + Str$(p0)
  Text 2 * 230, 2 * 30, "mass=" + Str$(mass)
  Text 2 * 330, 2 * 30, "h0=" + Str$(h0)
  Text 2 * 430, 2 * 30, "rc=" + Str$(rs)
  Text 2 * 230, 2 * 50, "g=" + Str$(sigma)
  Text 2 * 130, 2 * 50, "rl=" + Str$(Round(ra))
  Text 2 * 330, 2 * 50, "h1=" + Str$(h1)
  Text 2 * 430, 2 * 50, text$
  '
  '
  ' Loop over frequencies
  '
  DefLine 0, 2
  For flog = -4 To 2 Step 0.05
    f = 10 ^ flog
    p = 1 / f
    omega = 2 * PI * f
    frel = omega / omega0
    bwout = bw6 * f
    p0q = (1 / frel - frel) ^ 2 + 4 * h0 ^ 2
    p1q = (1 / frel - frel) ^ 2 + 4 * h1 ^ 2
    p2q = (1 / frel - frel) ^ 2 + 4 * h2 ^ 2
    zq = (sigq / (mass * omega0)) ^ 2 / p0q
    r2zq = r2q * p1q / p0q
    rszq = rsq * p2q / p0q
    '
    urq = unq * (1 + fun / f)
    irq = inq * (1 + fin / f) * 1.0E-06
    '
    ' 0 = noise with rs only, 1 = inverting input, 2 = noninverting input
    '
    elp0 = urq + usq + rsq * irq
    acp1 = smq * (idq + ((urq + u2q) + irq * r2zq) / zq)
    acp2 = smq * (idq + (usq + rszq * (iaq + irq) + rsaq * urq) / zq + urq / raq)
    ' conversion to decibels of rms amplitude and power density
    ampl0 = 10 * Log10(elp0 * bwout) - 180
    dens0 = 10 * Log10(elp0) - 180
    ampl1 = 10 * Log10(acp1 * bwout) - 180
    dens1 = 10 * Log10(acp1) - 180
    ampl2 = 10 * Log10(acp2 * bwout) - 180
    dens2 = 10 * Log10(acp2) - 180
    '
    ' Low Noise Model for comparison
    '
    lnmd = FN nlnm
    lnm = lnmd + 10 * Log10(bwout)
    If n$ = "pa" Or n$ = "pv" Then
      x = 620 - 100 * (flog + 4)
      yl = 380 - 3 * (220 + lnmd)
      yd1 = 380 - 3 * (220 + dens1)
      yd2 = 380 - 3 * (220 + dens2)
      If n$ = "pv"
        logom = 60 * Log10(omega)
        yl = yl + logom
        yd1 = yd1 + logom
        yd2 = yd2 + logom
      EndIf
      If yl > 20 And yl < 380
        PBox 2 * x - 2, 2 * yl - 2, 2 * x + 2, 2 * yl + 2
      EndIf
      If yl > 50 And yl < 410
        Circle 2 * x, 2 * yl - 60, 1
      EndIf
      If yl > 80 And yl < 440
        Circle 2 * x, 2 * yl - 120, 1
      EndIf
      If yl > 110 And yl < 470
        Circle 2 * x, 2 * yl - 180, 1
      EndIf
      If yl > 140 And yl < 500
        Circle 2 * x, 2 * yl - 240, 1
      EndIf
      If yd1 > 20 And yd1 < 380
        Line 2 * x - 4, 2 * yd1, 2 * x + 4, 2 * yd1
        Line 2 * x - 4, 2 * yd1 + 2, 2 * x + 4, 2 * yd1 + 2
      EndIf
      If yd2 > 20 And yd2 < 380
        Line 2 * x - 4, 2 * yd2, 2 * x + 4, 2 * yd2
        Line 2 * x, 2 * yd2 - 4, 2 * x, 2 * yd2 + 4
      EndIf
    Else If n$ = "aa" Or n$ = "av"
      x = 620 - 100 * (flog + 4)
      yl = 380 - 3 * (220 + lnm)
      yd1 = 380 - 3 * (220 + ampl1)
      yd2 = 380 - 3 * (220 + ampl2)
      If n$ = "av"
        logom = 60 * Log10(omega)
        yl = yl + logom
        yd1 = yd1 + logom
        yd2 = yd2 + logom
      EndIf
      If yl > 20 And yl < 380
        PBox 2 * x - 2, 2 * yl - 2, 2 * x + 2, 2 * yl + 2
      EndIf
      If yd1 > 20 And yd1 < 380
        Line 2 * x - 4, 2 * yd1, 2 * x + 4, 2 * yd1
        Line 2 * x - 4, 2 * yd1 + 2, 2 * x + 4, 2 * yd1 + 2
      EndIf
      If yd2 > 20 And yd2 < 380
        Line 2 * x - 4, 2 * yd2, 2 * x + 4, 2 * yd2
        Line 2 * x, 2 * yd2 - 4, 2 * x, 2 * yd2 + 4
      EndIf
    Else If n$ = "e"
      x = 620 - 100 * (flog + 4)
      yd1 = 380 - 3 * (220 + ampl0)
      yd2 = 380 - 3 * (220 + dens0)
      PBox 2 * x - 2, 2 * yd1 - 2, 2 * x + 2, 2 * yd1 + 2
      Box 2 * x - 2, 2 * yd2 - 2, 2 * x + 4, 2 * yd2 + 2
    EndIf
  Next flog
  DefLine 0, 1
  Text 40, 830, "type c to change op-amp, e or <cr> to end:   "
  Plot 700, 830
  Input ende$
Until ende$ <> "c"
' Repeat
' Sleep
' mk = MouseK
' Until mk
' Repeat
' Sleep
' Until Not MouseK
' Until mk = 2
'
' evaluation of low noise model
Function nlnm
  If p < 0.1 Then
    '    PRINT " No NLNM available, OLNM used"
    Return -168
  Else If p <= 100000
    For k = 0 To 19
      Exit If p < per(k + 1)
    Next k
    Return a(k) + b(k) * Log10(p)
  Else
    Print "No NLNM available"
    Return 0
  EndIf
EndFunc
$DatFile
$ExeName = C:\Dokumente und Einstellungen\Erhard\Eigene Dateien\Gb32\EMSnoise\ems2.Exe
$FileDescription = Beschreibung
$Comments = Autor: Nicht registriert
$CompanyName = Nicht registriert
$LegalCopyright = © 2010 Nicht registriert
$LanguageId = 0407
$FileVersion = %d.%d.%d.%d
$ProductVersion = %d.%d.%d.%d
$DatFile
