Campbell Scientific AVW200 AVW200-series Vibrating Wire Interfaces - Page 102

Displacement1i=Coef13*i-2*Digits^2 + Coef13*i-1*Digits + Coef13*i

Page 102 highlights

Appendix H. Additional Programming Examples PortSet(1,1) 'Enable Mux1 For i = 1 To 16 'Do the following for each of 16 sensors: PulsePort(2,1000) 'Provide pulse to advance to next channel on Mux1 Delay (0,100,mSec) AVW200(VWResults,ComRS232,0,15,Mux(1),1,1,1,2500,3500,2,_60Hz,1,0) 'Make VW measurement VWFreq1(i) = Mux(1) 'Assign vw frequency to the VWFreq1 variable Amp1(i) = Mux(2) 'Assign signal amplitude to Amp1 variable Sig2Noise1(i) = Mux(3) 'Assign signal to noise ratio to Sig2Noise1 variable FreqOfNoise1(i) = Mux(4) 'Assign frequency of competing noise to FreqOfNoise1 variable DecayRatio1(i) = Mux(5) 'Assign signal decay ratio to DecayRatio1 variable Digits = (VWFreq3(i)/1000)^2 * 1000 'Convert frequency to Digits Temp1(i) = (1/(A + B*LN(Mux(6)) + C*(LN(Mux(6)))^3)-273.15)*1.8+32 'Convert resistance to temp F. 'Calculate displacement (inches) from Digits and calibration polynomial Displacement1(i)=Coef1(3*i-2)*Digits^2 + Coef1(3*i-1)*Digits + Coef1(3*i) Next i PortSet(1,0) 'Reset and Disable Mux1 PortSet(3,1) 'Enable Mux2 For i = 1 To 16 'Do the following for each of 16 sensors: PulsePort(4,1000) 'Provide pulse to advance to next channel on Mux2 AVW200(VWResults,ComRS232,0,15,Mux(1),1,1,1,2500,3500,2,_60Hz,1,0) 'Make VW measurement VWFreq2(i) = Mux(1) 'Assign vw frequency to the VWFreq2 variable Amp2(i) = Mux(2) 'Assign signal amplitude to Amp2 variable Sig2Noise2(i) = Mux(3) 'Assign signal to noise ratio to Sig2Noise2 variable FreqOfNoise2(i) = Mux(4) 'Assign frequency of competing noise to FreqOfNoise2 variable DecayRatio2(i) = Mux(5) 'Assign signal decay ratio to DecayRatio2 variable Digits = (VWFreq2(i)/1000)^2 * 1000 'Convert frequency to Digits Temp2(i) = (1/(A + B*LN(Mux(6)) + C*(LN(Mux(6)))^3)-273.15)*1.8+3 'Convert resistance to temp F. 'Calculate displacement (inches) from Digits and calibration ploynomial Displacement2(i) = Coef2(3*i-2)*Digits^2 + Coef2(3*i-1)*Digits + Coef2(3*i) Next i PortSet(3,0) 'Reset and Disable Mux2 PortSet(5,1) 'Enable Mux3 For i = 1 To 9 'Do the following for each of 9 sensors: PulsePort(6,1000) 'Provide pulse to advance to next channel on Mux3 AVW200(VWResults,ComRS232,0,15,Mux(1),1,1,1,2500,3500,2,_60Hz,1,0) VWFreq3(i) = Mux(1) 'Assign vw frequency to the VWFreq2 variable Amp3(i) = Mux(2) 'Assign signal amplitude to Amp2 variable Sig2Noise3(i) = Mux(3) 'Assign signal to noise ratio to Sig2Noise2 variable FreqOfNoise3(i) = Mux(4) 'Assign frequency of competing noise to FreqOfNoise2 variable DecayRatio3(i) = Mux(5) 'Assign signal decay ratio to DecayRatio2 variable Digits = (VWFreq3(i)/1000)^2 * 1000 'Convert frequency to Digits Temp3(i) = (1/(A + B*LN(Mux(6)) + C*(LN(Mux(6)))^3)-273.15)*1.8+3 'Convert resistance to temp F. 'Calculate displacement (inches) from Digits and calibration ploynomial Displacement3(i) = Coef3(3*i-2)*Digits^2 + Coef3(3*i-1)*Digits + Coef3(3*i) Next i PortSet(5,0) 'Reset and disable Mux3 H-10

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112

Appendix H.
Additional Programming Examples
PortSet(1,1)
'Enable Mux1
For i = 1 To 16
'Do the following for each of 16 sensors:
PulsePort(2,1000)
'Provide pulse to advance to next channel on Mux1
Delay (0,100,mSec)
AVW200(VWResults,ComRS232,0,15,Mux(1),1,1,1,2500,3500,2,_60Hz,1,0)
'Make VW measurement
VWFreq1(i) = Mux(1)
'Assign vw frequency to the VWFreq1 variable
Amp1(i) = Mux(2)
'Assign signal amplitude to Amp1 variable
Sig2Noise1(i) = Mux(3)
'Assign signal to noise ratio to Sig2Noise1 variable
FreqOfNoise1(i) = Mux(4)
'Assign frequency of competing noise to FreqOfNoise1 variable
DecayRatio1(i) = Mux(5)
'Assign signal decay ratio to DecayRatio1 variable
Digits = (VWFreq3(i)/1000)^2 * 1000
'Convert frequency to Digits
Temp1(i) = (1/(A + B*LN(Mux(6)) + C*(LN(Mux(6)))^3)-273.15)*1.8+32
'Convert resistance to temp F.
'Calculate displacement (inches) from Digits and calibration polynomial
Displacement1(i)=Coef1(3*i-2)*Digits^2 + Coef1(3*i-1)*Digits + Coef1(3*i)
Next i
PortSet(1,0)
'Reset and Disable Mux1
PortSet(3,1)
'Enable Mux2
For i = 1 To 16
'Do the following for each of 16 sensors:
PulsePort(4,1000)
'Provide pulse to advance to next channel on Mux2
AVW200(VWResults,ComRS232,0,15,Mux(1),1,1,1,2500,3500,2,_60Hz,1,0)
'Make VW measurement
VWFreq2(i) = Mux(1)
'Assign vw frequency to the VWFreq2 variable
Amp2(i) = Mux(2)
'Assign signal amplitude to Amp2 variable
Sig2Noise2(i) = Mux(3)
'Assign signal to noise ratio to Sig2Noise2 variable
FreqOfNoise2(i) = Mux(4)
'Assign frequency of competing noise to FreqOfNoise2 variable
DecayRatio2(i) = Mux(5)
'Assign signal decay ratio to DecayRatio2 variable
Digits = (VWFreq2(i)/1000)^2 * 1000
'Convert frequency to Digits
Temp2(i) = (1/(A + B*LN(Mux(6)) + C*(LN(Mux(6)))^3)-273.15)*1.8+3
'Convert resistance to temp F.
'Calculate displacement (inches) from Digits and calibration ploynomial
Displacement2(i) = Coef2(3*i-2)*Digits^2 + Coef2(3*i-1)*Digits + Coef2(3*i)
Next i
PortSet(3,0)
'Reset and Disable Mux2
PortSet(5,1)
'Enable Mux3
For i = 1 To 9
'Do the following for each of 9 sensors:
PulsePort(6,1000)
'Provide pulse to advance to next channel on Mux3
AVW200(VWResults,ComRS232,0,15,Mux(1),1,1,1,2500,3500,2,_60Hz,1,0)
VWFreq3(i) = Mux(1)
'Assign vw frequency to the VWFreq2 variable
Amp3(i) = Mux(2)
'Assign signal amplitude to Amp2 variable
Sig2Noise3(i) = Mux(3)
'Assign signal to noise ratio to Sig2Noise2 variable
FreqOfNoise3(i) = Mux(4)
'Assign frequency of competing noise to FreqOfNoise2 variable
DecayRatio3(i) = Mux(5)
'Assign signal decay ratio to DecayRatio2 variable
Digits = (VWFreq3(i)/1000)^2 * 1000
'Convert frequency to Digits
Temp3(i) = (1/(A + B*LN(Mux(6)) + C*(LN(Mux(6)))^3)-273.15)*1.8+3
'Convert resistance to temp F.
'Calculate displacement (inches) from Digits and calibration ploynomial
Displacement3(i) = Coef3(3*i-2)*Digits^2 + Coef3(3*i-1)*Digits + Coef3(3*i)
Next i
PortSet(5,0)
'Reset and disable Mux3
H-10