Files
x11ma/script/test/X11MA_beamline.ipm
gac-x11ma 0f8956cafe
2025-09-03 16:52:53 +02:00

2347 lines
52 KiB
Plaintext

Attribute VB_Name = "Module2"
'Option Explicit
'#uses "epics.ipm"
'#uses "X11MA_main_functions.ipm"
Rem /* Return Codes */
Rem #define EZCA_OK 0
Rem #define EZCA_INVALIDARG 1
Rem #define EZCA_FAILEDMALLOC 2
Rem #define EZCA_CAFAILURE 3
Rem #define EZCA_UDFREQ 4
Rem #define EZCA_NOTCONNECTED 5
Rem #define EZCA_NOTIMELYRESPONSE 6
Rem #define EZCA_INGROUP 7
Rem #define EZCA_NOTINGROUP 8
Rem for epcis communication
Global EpicsErrorID As Long
Global linrotID1 As Single
Global linrotID2 As Single
Function getEnergy() As Double
Dim pv As String
pv="X11MA-PGM:rbkenergy"
r=ezcaGet(pv,ezcaDouble,1,getEnergy)
End Function
Function putEnergy(ByVal v As Double)
Dim pv As String
Dim v1 As Double
IDMono = 0 ' use Id + Mono
'IDMono = 1 ' use only ID
If IDMono = 0 Then
Rem linrotID1=0 means normal 1-19 is rotating mode
If v>91 And v<2500 Then
If opID = 1 Then
pv="X11PHS:alldone"
v1=0
r=ezcaPut(pv,ezcaDouble,1,v1)
pv="X11PHS-E:GO.A"
r=ezcaPut(pv,ezcaDouble,1,v)
End If
If opID=2 Then
pv="X11PHS:alldone"
v1=0
r=ezcaPut(pv,ezcaDouble,1,v1)
pv="X11PHS-E:GO.A"
r=ezcaPut(pv,ezcaDouble,1,v)
End If
If opID=3 Then
pv="X11PHS:alldone"
v1=0
r=ezcaPut(pv,ezcaDouble,1,v1)
pv="X11PHS-E:GO.A"
r=ezcaPut(pv,ezcaDouble,1,v)
End If
Else
write_logfile(1,"Energy out of range (91-2500) :"+Format(v))
End If
End If
If IDMono = 1 Then
If activeID = 1 Then putID1Energy(v)
If activeID = 2 Then putID2Energy(v)
If activeID = 3 Or polswitchmode= 2 Then
putID1Energy(v)
putID2Energy(v)
End If
End If
End Function
Function putID1Energy(ByVal v As Double)
Dim pv As String
pv="X11MA-ID1:ENERGY"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID2Energy(ByVal v As Double)
Dim pv As String
pv="X11MA-ID2:ENERGY"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getID1rbkEnergy() As Double
Dim pv As String
pv="X11MA-ID1:ENERGY-READ"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID1rbkEnergy)
End Function
Function getID2rbkEnergy() As Double
Dim pv As String
pv="X11MA-ID2:ENERGY-READ"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID2rbkEnergy)
End Function
Function getID1Motor() As Double
Rem 0 = off, 1 = on
Dim pv As String
pv="X11MA-ID1-GAP:MOTOR-PWR"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID1Motor)
End Function
Function getID2Motor() As Double
Rem 0 = off, 1 = on
Dim pv As String
pv="X11MA-ID2-GAP:MOTOR-PWR"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID2Motor)
End Function
Function getID1taper() As Double
Rem 0 = error, 1 = ok
Dim pv As String
pv="X11MA-ID1-GAP:TAPER-ERR"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID1taper)
End Function
Function getID2taper() As Double
Rem 0 = error, 1 = ok
Dim pv As String
pv="X11MA-ID2-GAP:TAPER-ERR"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID2taper)
End Function
Function getID1control() As Double
Rem 0 = SLS control, 1 = experiment
Dim pv As String
pv="X11MA-ID1-GAP:SCTRL"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID1control)
End Function
Function getID2control() As Double
Rem 0 = SLS control, 1 = experiment
Dim pv As String
pv="X11MA-ID2-GAP:SCTRL"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID2control)
End Function
Function getID1status() As Double
Rem 0 = ok
Rem 1 = Warning
Rem 2 = Error
Rem 3 = Not available
Dim pv As String
pv="X11MA-ID1-USER:STATUS"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID1status)
End Function
Function getID2status() As Double
Rem 0 = ok
Rem 1 = Warning
Rem 2 = Error
Rem 3 = Not available
Dim pv As String
pv="X11MA-ID2-USER:STATUS"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID2status)
End Function
Function getID1error() As Double
Rem B0 (1) = PLC (Taper, Motor controller, Limitswitch....)
Rem B1 (2) = Encoders (cabel, not referenced)
Rem B2 (4) = FeedForward (PS off, PS defect, FF ausgeschaltet)
Rem B3 (8) = Operator COntrol
Rem B4 (16)= Moving Timeout (moving longer then 120 sec)
Rem B5 (32)= Interlock (Orbit, Temperature...)
Dim pv As String
pv="X11MA-ID1-USER:ERROR-SOURCE"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID1error)
End Function
Function getID2error() As Double
Rem B0 (1) = PLC (Taper, Motor controller, Limitswitch....)
Rem B1 (2) = Encoders (cabel, not referenced)
Rem B2 (4) = FeedForward (PS off, PS defect, FF ausgeschaltet)
Rem B3 (8) = Operator COntrol
Rem B4 (16)= Moving Timeout (moving longer then 120 sec)
Rem B5 (32)= Interlock (Orbit, Temperature...)
Dim pv As String
pv="X11MA-ID2-USER:ERROR-SOURCE"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getID2error)
End Function
Function getPolID1() As Double
Dim pv As String
Dim d As Double
pv="X11MA-ID1:MODE"
r=ezcaGet(pv,ezcaDouble,1,getPolID1)
If getPolID1=0 Then
Rem linear mode
pv="X11MA-ID1:ALPHA"
r=ezcaGet(pv,ezcaDouble,1,ID1alpha)
Select Case ID1alpha
Case 0
getPolID1=3
Case 90
getPolID1=4
Case Else
getPolID1=5
End Select
End If
End Function
Function getPolID2() As Double
Dim pv As String
Dim d As Double
pv="X11MA-ID2:MODE"
r=ezcaGet(pv,ezcaDouble,1,getPolID2)
If getPolID2=0 Then
Rem linear mode
pv="X11MA-ID2:ALPHA"
r=ezcaGet(pv,ezcaDouble,1,ID2alpha)
Select Case ID2alpha
Case 0
getPolID2=3
Case 90
getPolID2=4
Case Else
getPolID2=5
End Select
End If
End Function
Function getID1alpha() As Double
Dim pv As String
pv="X11MA-ID1:ALPHA"
r=ezcaGet(pv,ezcaDouble,1,getID1alpha)
End Function
Function getID2alpha() As Double
Dim pv As String
pv="X11MA-ID2:ALPHA"
r=ezcaGet(pv,ezcaDouble,1,getID2alpha)
End Function
Function putID1alpha(ByVal v As Double)
Dim pv As String
pv="X11MA-ID1:ALPHA"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID2alpha(ByVal v As Double)
Dim pv As String
pv="X11MA-ID2:ALPHA"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putPolID1(ByVal n As Single)
Rem pol = 1 : Mode =1, alpha = 0 circ +
Rem pol = 2 : Mode =2, alpha = 0 circ -
Rem pol = 3 : Mode =0, alpha = 0 lin hor
Rem pol = 4 : Mode =0, alpha = 90 lin vert
Rem pol = 5 : Mode =0, alpha = ? lin rot
Dim pv1 As String
Dim pv2 As String
Dim v1 As Double
Dim v2 As Double
pv1="X11MA-ID1:MODE"
pv2="X11MA-ID1:ALPHA"
Select Case n
Case 1
v1=1
r=ezcaPut(pv1,ezcaDouble,1,v1)
Case 2
v1=2
r=ezcaPut(pv1,ezcaDouble,1,v1)
Case 3
v1=0
v2=0
r=ezcaPut(pv1,ezcaDouble,1,v1)
r=ezcaPut(pv2,ezcaDouble,1,v2)
Case 4
v1=0
v2=90
r=ezcaPut(pv1,ezcaDouble,1,v1)
r=ezcaPut(pv2,ezcaDouble,1,v2)
Case 5
v1=0
v2=ID1alpha
r=ezcaPut(pv1,ezcaDouble,1,v1)
sleep(1)
r=ezcaPut(pv2,ezcaDouble,1,v2)
End Select
End Function
Function putPolID2(ByVal n As Single)
Rem pol = 1 : Mode =1, alpha = 0 circ +
Rem pol = 2 : Mode =2, alpha = 0 circ -
Rem pol = 3 : Mode =0, alpha = 0 lin hor
Rem pol = 4 : Mode =0, alpha = 90 lin vert
Rem pol = 5 : Mode =0, alpha = ? lin rot
Dim pv1 As String
Dim pv2 As String
Dim v1 As Double
Dim v2 As Double
pv1="X11MA-ID2:MODE"
pv2="X11MA-ID2:ALPHA"
Select Case n
Case 1
v1=1
r=ezcaPut(pv1,ezcaDouble,1,v1)
Case 2
v1=2
r=ezcaPut(pv1,ezcaDouble,1,v1)
Case 3
v1=0
v2=0
r=ezcaPut(pv1,ezcaDouble,1,v1)
r=ezcaPut(pv2,ezcaDouble,1,v2)
Case 4
v1=0
v2=90
r=ezcaPut(pv1,ezcaDouble,1,v1)
r=ezcaPut(pv2,ezcaDouble,1,v2)
Case 5
v1=0
v2=ID2alpha
r=ezcaPut(pv1,ezcaDouble,1,v1)
sleep(1)
r=ezcaPut(pv2,ezcaDouble,1,v2)
End Select
End Function
'Function putlinrotmodeID1(ByVal v As Single)
' linrotID1=v
' 'addMessage 0,"lin = "+Format(v)
'End Function
'Function putlinrotID1(ByVal v As Double)
'Dim E As Double
'Dim g As Double
'Dim c As Double
'Dim alpha As Double
'Dim alphadeg As Double
'Dim Kz0 As Double
'Dim Kx0 As Double
'Dim phi As Double
'Dim calcshift As Double
'Dim calcgap As Double
'Dim D0(19) As Double
'Dim D1(19) As Double
'Dim D2(19) As Double
'Dim D3(19) As Double
'Dim linrot_dummy(19) As Double
'Dim E_index As Double
'Dim E_b As Double
'Dim setgap As Double
'Dim setshift As Double
'Dim rot_index As Integer
'Const pi = 4*Atn(1)
' linrot_dummy(1)=0
' linrot_dummy(2)=5
' linrot_dummy(3)=10
' linrot_dummy(4)=15
' linrot_dummy(5)=20
' linrot_dummy(6)=25
' linrot_dummy(7)=30
' linrot_dummy(8)=35
' linrot_dummy(9)=40
' linrot_dummy(10)=45
' linrot_dummy(11)=50
' linrot_dummy(12)=55
' linrot_dummy(13)=60
' linrot_dummy(14)=65
' linrot_dummy(15)=70
' linrot_dummy(16)=75
' linrot_dummy(17)=80
' linrot_dummy(18)=85
' linrot_dummy(19)=90
' another intermim solution until it exist in epics ..... April 2005
' E=v 'Energy so far only calculated between 250 and 900
' If E<270 Or E> 900 Then
' Begin Dialog UserDialog 1000,100,260,77 ' %GRID:10,7,1,1
' Text 50,7,170,21,"value out of range",.Text1
' OKButton 70,35,110,21
' End Dialog
' Dim scanerror4 As UserDialog
' Dialog scanerror4
' Exit Function
' End If
'transform energy to index variable
' E=E-269
'separate energy
' E_index=Int(E)
' E_b=E-E_index
'get index for rotation angle for me lin hor = lin rot 0, for Thomas lin hor = lin rot 90
' rot_index=Abs(linrotID1-20)
'read gap value
' alphadeg=linrot_dummy(rot_index)
'
' setgap=ID1_linrot_gap(E_index,rot_index)
' setshift=ID1_linrot_shift(E_index,rot_index)
' If E_b > 0 Then
' setgap=setgap+(ID1_linrot_gap(E_index+1,rot_index)-ID1_linrot_gap(E_index,rot_index))*E_b
' setshift=setshift+(ID1_linrot_shift(E_index+1,rot_index)-ID1_linrot_shift(E_index,rot_index))*E_b
' End If
'write_logfile(0,"Energy= "+Format(v))
'write_logfile(0,"alpha = "+Format(alphadeg))
'write_logfile(0,"Gap = "+Format(setgap))
'write_logfile(0,"shift = "+Format(setshift))
' putID1gap(setgap)
' putID1shift(setshift)
' Exit Function
Rem JUne 2004, carbon edge
'Const pi = 4*Atn(1)
'Const A0=1037.16
'Const A1=55.0409
'Const A2=-.107249
'Const B0=893.493
'Const B1=48.114
'Const B2=-0.155832
Rem 0 degree
'D0(1) = 1037.16
'D1(1) = 55.0409
'D2(1) = -.107249
Rem 15 degree
'D0(4) = 936.083
'D1(4) = 35
'D2(4) = -.122725
Rem 30 degree
'D0(7) = 931.841
'D1(7) = 28.4438
'D2(7) = -.131614
Rem 45 degree
'D0(10) = 931.982
'D1(10) = 26.5728
'D2(10) = -.138108
Rem 60 degree
'D0(13) = 928.233
'D1(13) = 28.1553
'D2(13) = -.143727
Rem 75 degree
'D0(16) = 917.418
'D1(16) = 34.0431
'D2(16) = -.149344
Rem 90 degree
'D0(19) = 893.493
'D1(19) = 48.114
'D2(19) = -.155832
Rem July 2004, 15 degree steps
'Const A0=967.671
'Const A1=55.3418
'Const A2=-.111755
'Const B0=963.21
'Const B1=41.6492
'Const B2=-0.144587
Rem 0 degree
'D0(1) = 967.671
'D1(1) = 55.3418
'D2(1) = -.111755
Rem 15 degree
'D0(2) = 964.34
'D1(2) = 36.0006
'D2(2) = -.122648
Rem 30 degree
'D0(3) = 969.04
'D1(3) = 27.9542
'D2(3) = -.128563
Rem 45 degree
'D0(4) = 971.366
'D1(4) = 25.0622
'D2(4) = -.1328
Rem 60 degree
'D0(5) = 971.27
'D1(5) = 25.7036
'D2(5) = -.136564
Rem 75 degree
'D0(6) = 969.012
'D1(6) = 30.2084
'D2(6) = -.140302
Rem 90 degree
'D0(7) = 963.21
'D1(7) = 41.6492
'D2(7) = -.144587
'linrot_dummy(1)=0
'linrot_dummy(2)=15
'linrot_dummy(3)=30
'linrot_dummy(4)=45
'linrot_dummy(5)=60
'linrot_dummy(6)=75
'linrot_dummy(7)=90
Rem July 2004, fit version 2
'linrot_dummy(1)=0
'linrot_dummy(2)=5
'linrot_dummy(3)=10
'linrot_dummy(4)=15
'linrot_dummy(5)=20
'linrot_dummy(6)=25
'linrot_dummy(7)=30
'linrot_dummy(8)=35
'linrot_dummy(9)=40
'linrot_dummy(10)=45
'linrot_dummy(11)=50
'linrot_dummy(12)=55
'linrot_dummy(13)=60
'linrot_dummy(14)=65
'linrot_dummy(15)=70
'linrot_dummy(16)=75
'linrot_dummy(17)=80
'linrot_dummy(18)=85
'linrot_dummy(19)=90
' Rem 0 deg
' D0(1)=964.52
' D1(1)=3780.63
' D2(1)=57.1361
' D3(1)=-0.112269
' Rem 5 deg
' D0(2)=963.018
' D1(2)=768.341
' D2(2)=46.2253
' D3(2)=-0.115758
' Rem 10 deg
' D0(3)=962.932
' D1(3)=-458.937
' D2(3)=39.6977
' D3(3)=-0.119137
'
' Rem 15 deg
' D0(4)=963.637
' D1(4)=-972.257
' D2(4)=35.2368
' D3(4)=-0.122121
'
' Rem 20 deg
' D0(5)=965.124
' D1(5)=-1567.26
' D2(5)=31.9063
' D3(5)=-0.124629
' Rem 25 deg
' D0(6)=967.464
' D1(6)=-2721.6
' D2(6)=29.2988
' D3(6)=-0.126681
' Rem 30 deg
' D0(7)=970.742
' D1(7)=-4697.93
' D2(7)=27.2086
' D3(7)=-0.128325
'
' Rem 35 deg
' D0(8)=974.088
' D1(8)=-6943.2
' D2(8)=25.6448
' D3(8)=-0.12976
'
' Rem 40 deg
' D0(9)=977.397
' D1(9)=-9375.37
' D2(9)=24.5203
' D3(9)=-0.131037
'
' Rem 45 deg
' D0(10)=980.557
' D1(10)=-11887.7
' D2(10)=23.7802
' D3(10)=-0.132199
'
' Rem 50 deg
' D0(11)=983.448
' D1(11)=-14362.2
' D2(11)=23.3933
' D3(11)=-0.133279
'
' Rem 55 deg
' D0(12)=985.406
' D1(12)=-16288.2
' D2(12)=23.4158
' D3(12)=-0.134402
'
' Rem 60 deg
' D0(13)=987.112
' D1(13)=-18151
' D2(13)=23.7566
' D3(13)=-0.135458
'
' Rem 65 deg
' D0(14)=977.397
' D1(14)=-9375.37
' D2(14)=24.5203
' D3(14)=-0.131037
'
' Rem 70 deg
' D0(15)=988.712
' D1(15)=-20912.4
' D2(15)=25.603
' D3(15)=-0.137563
'
' Rem 75 deg
' D0(16)=988.442
' D1(16)=-21724.4
' D2(16)=27.2317
' D3(16)=-0.138646
'
' Rem 80 deg
' D0(17)=987.331
' D1(17)=-22117.8
' D2(17)=29.4733
' D3(17)=-0.139773
'
' Rem 85 deg
' D0(18)=985.231
' D1(18)=-22058.9
' D2(18)=32.51
' D3(18)=-0.140973
'
' Rem 90 deg
' D0(19)= 982.066
' D1(19)= -21599.7
' D2(19)= 36.5915
' D3(19)= -0.142255
'
' 'addMessage 0,"lin = "+Format(linrotID1)
'addMessage 0,"Energy= "+Format(v)
'calc gap
' E=v 'Energy so far only calculated between 250 and 900
'
' If E<250 Or E> 900 Then
' Begin Dialog UserDialog 1000,100,260,77 ' %GRID:10,7,1,1
' Text 50,7,170,21,"value out of range",.Text1
' OKButton 70,35,110,21
' End Dialog
' Dim scanerror3 As UserDialog
' Dialog scanerror3
' Exit Function
' End If
Rem fit version 1 June 2004
'alphadeg=linrot_dummy(linrotID1)
'calcgap = 1/D2(linrotID1)*Log((D0(linrotID1)/E-1)/D1(linrotID1))
'calc shift
'If linrotID1 = 7 Then
' calcshift = 28.150
'Else
' g = 2.42/0.000511
' c = 1.239842E-6 * 2 * g*g/(56.3/1000)
' alpha = (90-alphadeg)/360 * 2 * pi
' Kz0 = Sqr(2*(c/A0*(1+A1*Exp(A2*calcgap))-1))
' Kx0 = Sqr(2*(c/B0*(1+B1*Exp(B2*calcgap))-1))
' phi = 2 *Atn(1/Sqr(Tan(alpha) * Kx0/Kz0))
' calcshift = (phi/(2*pi)) * 56.3
'End If
Rem Calculation of gap and shift for UE56 ID1 in linear mode
Rem 2nd version, Date: 22.07.04
Rem fit model In first version: y= 1/A2*ln((A0/x-1)/A1), y=gap, x=photon energy
Rem New fit model y = 1/A3*ln((A0/x+A1/x^2-1)/A2)
Rem Gap And shift have To be known As functions from Energy (E) And
Rem polarization angle In degree (alphadeg)
' calcgap = 1/D3(linrotID1)*Log((D0(linrotID1)/E + D1(linrotID1)/(E*E)-1)/D2(linrotID1))
'
' alphadeg=linrot_dummy(linrotID1)
'
' If linrotID1 = 19 Then
' calcshift = 28.150
' Else
' g = 2.42/0.000511
' c = 1.239842E-6 * 2 * g*g/(56.3/1000)
' alpha = (90-alphadeg)/360 * 2 * pi
' enz=(D0(1)+Sqr(D0(1)^2+4*D1(1)+4*D1(1)*D2(1)*Exp(D3(1)*calcgap)))/(2*(1+D2(1)*Exp(D3(1)*calcgap)))
' Kz0 = Sqr( 2*(c/enz-1))
' enx=(D0(19)+Sqr(D0(19)^2+4*D1(19)+4*D1(19)*D2(19)*Exp(D3(19)*calcgap)))/(2*(1+D2(19)*Exp(D3(19)*calcgap)))
' Kx0 = Sqr( 2*(c/enx-1))
' phi = 2 *Atn(1/Sqr(Tan(alpha) * Kx0/Kz0))
' calcshift = (phi/(2*pi)) * 56.3
' End If
'
'
' 'addMessage 0,"Energy= "+Format(E)
' 'addMessage 0,"alpha = "+Format(alphadeg)
' 'addMessage 0,"Gap = "+Format(calcgap)
' 'addMessage 0,"shift = "+Format(calcshift)
' putID1gap(calcgap)
' putID1shift(calcshift)
'End Function
'Function putlinrotmodeID2(ByVal v As Single)
' linrotID2=v
' 'addMessage 0,"lin = "+Format(v)
'End Function
Function putlinrotID2_old(ByVal v As Double)
Exit Function
Dim E As Double
Dim g As Double
Dim c As Double
Dim alpha As Double
Dim alphadeg As Double
Dim Kz0 As Double
Dim Kx0 As Double
Dim phi As Double
Dim calcshift As Double
Dim calcgap As Double
Dim D0(19) As Double
Dim D1(19) As Double
Dim D2(19) As Double
Dim D3(19) As Double
Dim linrot_dummy(19) As Double
Const pi = 4*Atn(1)
linrot_dummy(1)=0
linrot_dummy(2)=5
linrot_dummy(3)=10
linrot_dummy(4)=15
linrot_dummy(5)=20
linrot_dummy(6)=25
linrot_dummy(7)=30
linrot_dummy(8)=35
linrot_dummy(9)=40
linrot_dummy(10)=45
linrot_dummy(11)=50
linrot_dummy(12)=55
linrot_dummy(13)=60
linrot_dummy(14)=65
linrot_dummy(15)=70
linrot_dummy(16)=75
linrot_dummy(17)=80
linrot_dummy(18)=85
linrot_dummy(19)=90
' another intermim solution until it exist in epics ..... April 2005
E=v 'Energy so far only calculated between 250 and 900
If E<270 Or E> 900 Then
Begin Dialog UserDialog 1000,100,260,77 ' %GRID:10,7,1,1
Text 50,7,170,21,"value out of range",.Text1
OKButton 70,35,110,21
End Dialog
Dim scanerror4 As UserDialog
Dialog scanerror4
Exit Function
End If
'transform energy to index variable
E=E-269
'separate energy
E_index=Int(E)
E_b=E-E_index
'get index for rotation angle for me lin hor = lin rot 0, for Thomas lin hor = lin rot 90
rot_index=Abs(linrotID2-20)
'read gap value
alphadeg=linrot_dummy(rot_index)
setgap=ID2_linrot_gap(E_index,rot_index)
setshift=ID2_linrot_shift(E_index,rot_index)
If E_b > 0 Then
setgap=setgap+(ID2_linrot_gap(E_index+1,rot_index)-ID2_linrot_gap(E_index,rot_index))*E_b
setshift=setshift+(ID2_linrot_shift(E_index+1,rot_index)-ID2_linrot_shift(E_index,rot_index))*E_b
End If
'write_logfile(0,"Energy= "+Format(v))
'write_logfile(0,"alpha = "+Format(alphadeg))
'write_logfile(0,"Gap = "+Format(setgap))
'write_logfile(0,"shift = "+Format(setshift))
putID2gap(setgap)
putID2shift(setshift)
Exit Function
Rem JUne 2004, carbon edge
'Const pi = 4*Atn(1)
'Const A0=1037.16
'Const A1=55.0409
'Const A2=-.107249
'Const B0=893.493
'Const B1=48.114
'Const B2=-0.155832
Rem 0 degree
'D0(1) = 1037.16
'D1(1) = 55.0409
'D2(1) = -.107249
Rem 15 degree
'D0(4) = 936.083
'D1(4) = 35
'D2(4) = -.122725
Rem 30 degree
'D0(7) = 931.841
'D1(7) = 28.4438
'D2(7) = -.131614
Rem 45 degree
'D0(10) = 931.982
'D1(10) = 26.5728
'D2(10) = -.138108
Rem 60 degree
'D0(13) = 928.233
'D1(13) = 28.1553
'D2(13) = -.143727
Rem 75 degree
'D0(16) = 917.418
'D1(16) = 34.0431
'D2(16) = -.149344
Rem 90 degree
'D0(19) = 893.493
'D1(19) = 48.114
'D2(19) = -.155832
Rem July 2004, 15 degree steps
'Const A0=967.671
'Const A1=55.3418
'Const A2=-.111755
'Const B0=963.21
'Const B1=41.6492
'Const B2=-0.144587
Rem 0 degree
'D0(1) = 967.671
'D1(1) = 55.3418
'D2(1) = -.111755
Rem 15 degree
'D0(2) = 964.34
'D1(2) = 36.0006
'D2(2) = -.122648
Rem 30 degree
'D0(3) = 969.04
'D1(3) = 27.9542
'D2(3) = -.128563
Rem 45 degree
'D0(4) = 971.366
'D1(4) = 25.0622
'D2(4) = -.1328
Rem 60 degree
'D0(5) = 971.27
'D1(5) = 25.7036
'D2(5) = -.136564
Rem 75 degree
'D0(6) = 969.012
'D1(6) = 30.2084
'D2(6) = -.140302
Rem 90 degree
'D0(7) = 963.21
'D1(7) = 41.6492
'D2(7) = -.144587
'linrot_dummy(1)=0
'linrot_dummy(2)=15
'linrot_dummy(3)=30
'linrot_dummy(4)=45
'linrot_dummy(5)=60
'linrot_dummy(6)=75
'linrot_dummy(7)=90
Rem July 2004, fit version 2
linrot_dummy(1)=0
linrot_dummy(2)=5
linrot_dummy(3)=10
linrot_dummy(4)=15
linrot_dummy(5)=20
linrot_dummy(6)=25
linrot_dummy(7)=30
linrot_dummy(8)=35
linrot_dummy(9)=40
linrot_dummy(10)=45
linrot_dummy(11)=50
linrot_dummy(12)=55
linrot_dummy(13)=60
linrot_dummy(14)=65
linrot_dummy(15)=70
linrot_dummy(16)=75
linrot_dummy(17)=80
linrot_dummy(18)=85
linrot_dummy(19)=90
Rem 0 deg
D0(1)=964.52
D1(1)=3780.63
D2(1)=57.1361
D3(1)=-0.112269
Rem 5 deg
D0(2)=963.018
D1(2)=768.341
D2(2)=46.2253
D3(2)=-0.115758
Rem 10 deg
D0(3)=962.932
D1(3)=-458.937
D2(3)=39.6977
D3(3)=-0.119137
Rem 15 deg
D0(4)=963.637
D1(4)=-972.257
D2(4)=35.2368
D3(4)=-0.122121
Rem 20 deg
D0(5)=965.124
D1(5)=-1567.26
D2(5)=31.9063
D3(5)=-0.124629
Rem 25 deg
D0(6)=967.464
D1(6)=-2721.6
D2(6)=29.2988
D3(6)=-0.126681
Rem 30 deg
D0(7)=970.742
D1(7)=-4697.93
D2(7)=27.2086
D3(7)=-0.128325
Rem 35 deg
D0(8)=974.088
D1(8)=-6943.2
D2(8)=25.6448
D3(8)=-0.12976
Rem 40 deg
D0(9)=977.397
D1(9)=-9375.37
D2(9)=24.5203
D3(9)=-0.131037
Rem 45 deg
D0(10)=980.557
D1(10)=-11887.7
D2(10)=23.7802
D3(10)=-0.132199
Rem 50 deg
D0(11)=983.448
D1(11)=-14362.2
D2(11)=23.3933
D3(11)=-0.133279
Rem 55 deg
D0(12)=985.406
D1(12)=-16288.2
D2(12)=23.4158
D3(12)=-0.134402
Rem 60 deg
D0(13)=987.112
D1(13)=-18151
D2(13)=23.7566
D3(13)=-0.135458
Rem 65 deg
D0(14)=977.397
D1(14)=-9375.37
D2(14)=24.5203
D3(14)=-0.131037
Rem 70 deg
D0(15)=988.712
D1(15)=-20912.4
D2(15)=25.603
D3(15)=-0.137563
Rem 75 deg
D0(16)=988.442
D1(16)=-21724.4
D2(16)=27.2317
D3(16)=-0.138646
Rem 80 deg
D0(17)=987.331
D1(17)=-22117.8
D2(17)=29.4733
D3(17)=-0.139773
Rem 85 deg
D0(18)=985.231
D1(18)=-22058.9
D2(18)=32.51
D3(18)=-0.140973
Rem 90 deg
D0(19)= 982.066
D1(19)= -21599.7
D2(19)= 36.5915
D3(19)= -0.142255
'addMessage 0,"lin = "+Format(linrotID1)
'addMessage 0,"Energy= "+Format(v)
'calc gap
E=v 'Energy so far only calculated between 250 and 900
If E<250 Or E> 900 Then
Begin Dialog UserDialog 1000,100,260,77 ' %GRID:10,7,1,1
Text 50,7,170,21,"value out of range",.Text1
OKButton 70,35,110,21
End Dialog
Dim scanerror3 As UserDialog
Dialog scanerror3
Exit Function
End If
Rem fit version 1 June 2004
'alphadeg=linrot_dummy(linrotID2)
'calcgap = 1/D2(linrotID2)*Log((D0(linrotID2)/E-1)/D1(linrotID2))
'calc shift
'If linrotID2 = 7 Then
' calcshift = 28.150
'Else
' g = 2.42/0.000511
' c = 1.239842E-6 * 2 * g*g/(56.3/1000)
' alpha = (90-alphadeg)/360 * 2 * pi
' Kz0 = Sqr(2*(c/A0*(1+A1*Exp(A2*calcgap))-1))
' Kx0 = Sqr(2*(c/B0*(1+B1*Exp(B2*calcgap))-1))
' phi = 2 *Atn(1/Sqr(Tan(alpha) * Kx0/Kz0))
' calcshift = (phi/(2*pi)) * 56.3
'End If
Rem Calculation of gap and shift for UE56 ID1 in linear mode
Rem 2nd version, Date: 22.07.04
Rem fit model In first version: y= 1/A2*ln((A0/x-1)/A1), y=gap, x=photon energy
Rem New fit model y = 1/A3*ln((A0/x+A1/x^2-1)/A2)
Rem Gap And shift have To be known As functions from Energy (E) And
Rem polarization angle In degree (alphadeg)
calcgap = 1/D3(linrotID2)*Log((D0(linrotID2)/E + D1(linrotID2)/(E*E)-1)/D2(linrotID2))
alphadeg=linrot_dummy(linrotID2)
If linrotID2 = 19 Then
calcshift = 28.150
Else
g = 2.42/0.000511
c = 1.239842E-6 * 2 * g*g/(56.3/1000)
alpha = (90-alphadeg)/360 * 2 * pi
enz=(D0(1)+Sqr(D0(1)^2+4*D1(1)+4*D1(1)*D2(1)*Exp(D3(1)*calcgap)))/(2*(1+D2(1)*Exp(D3(1)*calcgap)))
Kz0 = Sqr( 2*(c/enz-1))
enx=(D0(19)+Sqr(D0(19)^2+4*D1(19)+4*D1(19)*D2(19)*Exp(D3(19)*calcgap)))/(2*(1+D2(19)*Exp(D3(19)*calcgap)))
Kx0 = Sqr( 2*(c/enx-1))
phi = 2 *Atn(1/Sqr(Tan(alpha) * Kx0/Kz0))
calcshift = (phi/(2*pi)) * 56.3
End If
'addMessage 0,"Energy= "+Format(E)
'addMessage 0,"alpha = "+Format(alphadeg)
'addMessage 0,"Gap = "+Format(calcgap)
'addMessage 0,"shift = "+Format(calcshift)
putID2gap(calcgap)
putID2shift(calcshift)
End Function
'Function getlinearMode() As Double
'Dim pv As String
'pv="X11MA-ID1:POLAR"
' pv="X11MA-ID1:ALPHA"
' r=ezcaGet(pv,ezcaDouble,1,getlinearMode)
'End Function
'Function putlinearMode(ByVal v As Double)
'Dim pv As String
'pv="X11MA-ID1:POLAR"
' pv="X11MA-ID1:ALPHA"
' r=ezcaPut(pv,ezcaDouble,1,v)
'End Function
Function donemove() As Double
Rem 1: done move
Rem 0: moving
Dim pv As String
sleep_f(1) 'in order to reduce trafic on the IOC
pv="X11PHS:alldone"
r=ezcaGet(pv,ezcaDouble,1,donemove)
'donemove=1
End Function
Function injection() As Double
Rem 0 no injection
Rem 1 injection
Dim pv As String
Rem checking for top-up injection
pv="ARIMA-KIN:TRG-ENABLE"
r=ezcaGet(pv,ezcaDouble,1,injection)
Rem checking for big injection (no real top-up)
'If getRingstatus=2 Or getRingstatus=3 Then
' injection=1
'Else
' injection=0
'End If
End Function
Function getRingstatus() As Double
Rem ACOAU-ACCU:OP-MODE kann Werte zwischen 0 und 5 annehmen:
Rem # rule from 24.8.04
Rem If (PCT beam current <0.09) -> State 0: "Machine Down"
Rem Else If (GUN Trigger OFF) -> State 1: "Inj. Stopped"
Rem Else If (INJ_MODE == Normal) -> State 2: "Accumulating."
Rem Else If !(reached Top-Up Current) -> State 3: "Accumulating"
Rem Else If (OP-READY == Wait) -> State 4: "Top-up ready"
Rem Else If (OFB off) -> State 5: "Light-Available" (former State 4)
Rem Else -> State 6: "Light Available" (former State 5)
Dim pv As String
pv="ACOAU-ACCU:OP-MODE"
EpicsErrorID=ezcaGet(pv,ezcaDouble,1,getRingstatus)
End Function
Function keithley_new_read (v As Double,ByRef Keithley1a As Double,ByRef Keithley2a As Double, ByRef Keithley3a As Double) As Integer
Rem for the new hardware trigger and new Keithley phyton program
Rem v = 0 Keithley1
Rem v = 1 Keithley2
Rem v = 2 Keithley 1+2
Rem v = 3 Keithley 1+2+3
Dim pv1 As String
Dim pv2 As String
Dim pv3 As String
Keithley1a=0.0
Keithley2a=0.0
Keithley3a=0.0
Rem official channel names are X11MA-KEI10:READOUT but there is a converter
pv1="X11Keithley1-read"
pv2="X11Keithley2-read"
pv3="X11Keithley3-read"
Select Case v
Case 0
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
Case 1
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Case 2
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Keithley3a=Keithley2a/Keithley1a
'r=ezcaGet(pv3,ezcaDouble,1,Keithleynorm)
Case 3
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv3,ezcaDouble,1,Keithley3a)
End Select
End Function
Function keithley_analog_trigger
Rem trigger ADC
Dim v As Double
pv="X11MA-ES1-10ADC:TRG.PROC"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley_analog_done() As Double
Rem returns 0 if done, 1 if still reading
'pv="X11MA-ES1-10ADC:BUSY"
pv="X11MA-ES1:CADC1BUSY"
keithley_analog_done=1
r=ezcaGet(pv,ezcaDouble,1,keithley_analog_done)
End Function
Function keithley1_trigger_doinit() As Double
Dim v As Double
Rem set Keithley1 waiting for trigger
pv="X11MA-KEI10:DOINIT"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley2_trigger_doinit() As Double
Rem set Keithley2 waiting for trigger
Dim v As Double
pv="X11MA-KEI11:DOINIT"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley1_new_trigger
Rem hardware trigger via box
Dim v As Double
pv="X11MA-KEI10:DOTRIGGER"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley2_new_trigger
Rem hardware trigger via box
Dim v As Double
pv="X11MA-KEI11:DOTRIGGER"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley1_new_fetch
Rem hardware trigger via box
Dim v As Double
pv="X11MA-KEI10:DOFETCH"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley2_new_fetch
Rem hardware trigger via box
Dim v As Double
pv="X11MA-KEI11:DOFETCH"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley1_new_done() As Double
Rem returns 0 if done, 1 if busy
pv="X11MA-KEI10:BUSY"
keithley1_new_done=0
r=ezcaGet(pv,ezcaDouble,1,keithley1_new_done)
End Function
Function keithley2_new_done() As Double
Rem returns 0 if done, 1 if busy
pv="X11MA-KEI11:BUSY"
keithley2_new_done=0
r=ezcaGet(pv,ezcaDouble,1,keithley2_new_done)
End Function
Function get_keithley1_mode() As Double
Rem v=0 def setting
Rem v=1 pull curr fast
Rem v=2 pull curr medi
Rem v=3 pull curr slow
Rem v=4 trig setting
Rem v=5 trigger extern
Rem v=6 trigger TLIN
Rem v=7 trigger BUS
Rem v=8 pol volt medi
Rem v=9 not running
pv="X11MA-KEI10:USER_MODE"
r=ezcaGet(pv,ezcaDouble,1,get_keithley1_mode)
If get_keithley1_mode = 0 Then get_keithley1_mode=9
End Function
Function get_keithley2_mode() As Double
Rem v=0 def setting
Rem v=1 pull curr fast
Rem v=2 pull curr medi
Rem v=3 pull curr slow
Rem v=4 trig setting
Rem v=5 trigger extern
Rem v=6 trigger TLIN
Rem v=7 trigger BUS
Rem v=8 pol volt medi
Rem v=9 not running
pv="X11MA-KEI11:USER_MODE"
r=ezcaGet(pv,ezcaDouble,1,get_keithley2_mode)
If get_keithley2_mode = 0 Then get_keithley2_mode=9
End Function
Function get_keithley3_mode() As Double
Rem v=0 def setting
Rem v=1 pull curr fast
Rem v=2 pull curr medi
Rem v=3 pull curr slow
Rem v=4 trig setting
Rem v=5 trigger extern
Rem v=6 trigger TLIN
Rem v=7 trigger BUS
Rem v=8 pol volt medi
Rem v=9 not running
pv="X11MA-KEI12:USER_MODE"
r=ezcaGet(pv,ezcaDouble,1,get_keithley3_mode)
If get_keithley3_mode = 0 Then get_keithley3_mode=9
End Function
Function keithley_trigger (v As Double) As Integer
Rem trigger keithley
Rem v=0 keithley1
Rem v=1 keithley2
Rem v=2 keithley1+2
Dim pv As String
Dim pv1 As String
trigger_keithley=0
pv="X11Keithleys:GO.PROC"
pv1="X11Keithleys:OPT"
r=ezcaPut(pv1,ezcaDouble,1,v)
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function keithley_read(v As Double,ByRef Keithley1a As Double,ByRef Keithley2a As Double,ByRef Keithleynorma As Double) As Integer
Rem v = 0 : Keithley1
Rem v = 1 : Keithley2
Rem v = 2 : Keithley 1 + 2
Rem v = 3 : Keithley1 + 2 + 3
Rem v = 4 : Keithley1 + 2, norm, 4 analog
Dim pv1 As String
Dim pv2 As String
Dim pv3 As String
Dim pv4 As String
Dim pv5 As String
Dim pv6 As String
Dim pv7 As String
Dim pv8 As String
pv1="X11Keithley1-read"
pv2="X11Keithley2-read"
pv3="X11Keithleys:NORM"
pv4="X11Keithley3-read"
Rem additional analog, new system
pv5="X11MA-ES1:CADC1"
pv6="X11MA-ES1:CADC2"
pv7="X11MA-ES1:CADC3"
pv8="X11MA-ES1:CADC4"
Keithley1a=0.0
Keithley2a=0.0
Keithleynorma=0.0
Analog1=0.0
Analog2=0.0
Analog3=0.0
Analog4=0.0
Select Case v
Case 0
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
Case 1
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Case 2
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv3,ezcaDouble,1,Keithleynorma)
Case 3
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv4,ezcaDouble,1,Keithleynorma)
Case 4
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv3,ezcaDouble,1,Keithleynorma)
r=ezcaGet(pv5,ezcaDouble,1,Analog1)
r=ezcaGet(pv6,ezcaDouble,1,Analog2)
r=ezcaGet(pv7,ezcaDouble,1,Analog3)
r=ezcaGet(pv8,ezcaDouble,1,Analog4)
End Select
End Function
Function keithley_read_XFMR(v As Double,ByRef Keithley1a As Double,ByRef Keithley2a As Double,ByRef Keithleynorma As Double, ByRef Analog1 As Double, ByRef Analog2 As Double, ByRef Analog3 As Double, ByRef Analog4 As Double) As Integer
Rem v = 0 : Keithley1
Rem v = 1 : Keithley2
Rem v = 2 : Keithley 1 + 2
Rem v = 3 : Keithley1 + 2 + 3
Rem v = 4 : Keithley1 + 2, norm, 4 analog
Dim pv1 As String
Dim pv2 As String
Dim pv3 As String
Dim pv4 As String
Dim pv5 As String
Dim pv6 As String
Dim pv7 As String
Dim pv8 As String
pv1="X11Keithley1-read"
pv2="X11Keithley2-read"
pv3="X11Keithleys:NORM"
pv4="X11Keithley3-read"
Rem additional analog
'pv5="X11MA-ES1-KEITH4:V"
'pv6="X11MA-ES1-KEITH5:V"
'pv7="X11MA-ES1-KEITH6:V"
'pv8="X11MA-ES1-KEITH7:V"
Rem additional analog, new system
pv5="X11MA-ES1:CADC1"
pv6="X11MA-ES1:CADC2"
pv7="X11MA-ES1:CADC3"
pv8="X11MA-ES1:CADC4"
Keithley1a=0.0
Keithley2a=0.0
Keithleynorma=0.0
Analog1=0.0
Analog2=0.0
Analog3=0.0
Analog4=0.0
Select Case v
Case 0
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
Case 1
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Case 2
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv3,ezcaDouble,1,Keithleynorma)
Case 3
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv4,ezcaDouble,1,Keithleynorma)
Case 4
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv3,ezcaDouble,1,Keithleynorma)
r=ezcaGet(pv5,ezcaDouble,1,Analog1)
r=ezcaGet(pv6,ezcaDouble,1,Analog2)
r=ezcaGet(pv7,ezcaDouble,1,Analog3)
r=ezcaGet(pv8,ezcaDouble,1,Analog4)
End Select
End Function
Function keithley_done() As Double
Rem returns 1 if done, 0 if still reading
pv="X11Keithleys:alldone"
keithley_done=0
r=ezcaGet(pv,ezcaDouble,1,keithley_done)
End Function
Function putADC_integration(ByVal v As Double)
Dim pv As String
pv="X11MA-ES1-10ADC:AVG"
'pv="X11MA-ES1:BUFFER_6_0"
'v=v*10 '(Input In ms)
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getADC_integration() As Double
Dim pv As String
pv="X11MA-ES1-10ADC:AVG"
'pv="X11MA-ES1:BUFFER_6_0"
r=ezcaGet(pv,ezcaDouble,1,getADC_integration)
'getADC_integration=getADC_integration/10 '(ms)
End Function
Function keithley_analog(v As Double, ByRef Keithley1a As Double, ByRef Keithley2a As Double, ByRef Keithleynorma As Double, ByRef Analog1 As Double, ByRef Analog2 As Double, ByRef Analog3 As Double, ByRef Analog4 As Double) As Integer
Rem v = 0 : Keithley1
Rem v = 1 : Keithley2
Rem v = 2 : Keithley 1 + 2
Rem v = 3 : Keithley1 + 2 + 3
Rem change for X-FMR to Io and TEY Analog new A/D converter 25.11.2008
'pv1="X11MA-ES1:CADC5"
'pv2="X11MA-ES1:CADC6"
'pv3="X11MA-ES1:CADC7"
Rem change for normal XMCD to Io and TEY Analog new A/D converter 25.11.2008
pv1="X11MA-ES1:CADC1"
pv2="X11MA-ES1:CADC2"
pv3="X11MA-ES1:CADC3"
'pv1="X11MA-ES1-KEITH1:V"
'pv2="X11MA-ES1-KEITH2:V"
'pv3="X11MA-ES1-KEITH3:V"
Rem additional analog
pv5="X11MA-ES1:CADC1"
pv6="X11MA-ES1:CADC2"
pv7="X11MA-ES1:CADC3"
pv8="X11MA-ES1:CADC4"
Keithley1a=0.0
Keithley2a=0.0
Keithleynorma=0.0
Analog1=0.0
Analog2=0.0
Analog3=0.0
Analog4=0.0
Select Case v
Case 0
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
Case 1
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Case 2
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Keithleynorma=Keithley2a/Keithley1a
Case 3
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
r=ezcaGet(pv3,ezcaDouble,1,Keithleynorma)
Case 4
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Keithleynorma=Keithley2a/Keithley1a
r=ezcaGet(pv5,ezcaDouble,1,Analog1)
r=ezcaGet(pv6,ezcaDouble,1,Analog2)
r=ezcaGet(pv7,ezcaDouble,1,Analog3)
r=ezcaGet(pv8,ezcaDouble,1,Analog4)
End Select
End Function
Function getUmon() As Double
Dim pv As String
pv="X11MA-ES1-PEEM:UMON"
'pv="X11MA-ES1-PEEM:UMONraw" for the not calibrated
r=ezcaGet(pv,ezcaDouble,1,getUmon)
End Function
Function getImon() As Double
Dim pv As String
pv="X11MA-ES1-PEEM:IMON"
'pv="X11MA-ES1-PEEM:IMONraw" for the not calibrated
r=ezcaGet(pv,ezcaDouble,1,getImon)
End Function
Function putXMCDMag (ByVal v As Double)
Dim ps As String
pv="X11MA-XMCD:I-SETraw"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getXMCDMag() As Double
Dim pv As String
pv="X11MA-XMCD:Ireadout"
r=ezcaGet(pv,ezcaDouble,1,getXMCDMag)
End Function
Function putIDmotors(v As Double) As Integer
Rem 0 = off, 1 = on, 2 = auto
pv="X11MA-ID1:ONOFF"
r=ezcaPut(pv,ezcaDouble,1,v)
pv="X11MA-ID2:ONOFF"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getID1offset() As Double
Dim pv As String
pv="X11MA-ID1:ENERGY-OFFS"
r=ezcaGet(pv,ezcaDouble,1,getID1offset)
End Function
Function getID2offset() As Double
Dim pv As String
pv="X11MA-ID2:ENERGY-OFFS"
r=ezcaGet(pv,ezcaDouble,1,getID2offset)
End Function
Function getID1gap() As Double
Dim pv As String
pv="X11MA-ID1-GAP:READ"
r=ezcaGet(pv,ezcaDouble,1,getID1gap)
End Function
Function getID2gap() As Double
Dim pv As String
pv="X11MA-ID2-GAP:READ"
r=ezcaGet(pv,ezcaDouble,1,getID2gap)
End Function
Function getID1shift() As Double
Dim pv As String
pv="X11MA-ID1-SHIFT:READ"
r=ezcaGet(pv,ezcaDouble,1,getID1shift)
End Function
Function getID2shift() As Double
Dim pv As String
pv="X11MA-ID2-SHIFT:READ"
r=ezcaGet(pv,ezcaDouble,1,getID2shift)
End Function
Function putID1offset(ByVal v As Double)
Dim pv As String
pv="X11MA-ID1:ENERGY-OFFS"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID2offset(ByVal v As Double)
Dim pv As String
pv="X11MA-ID2:ENERGY-OFFS"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID1gap(ByVal v As Double)
Dim pv As String
pv="X11MA-ID1-GAP:SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID2gap(ByVal v As Double)
Dim pv As String
pv="X11MA-ID2-GAP:SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID1shift(ByVal v As Double)
Dim pv As String
pv="X11MA-ID1-SHIFT:SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID2shift(ByVal v As Double)
Dim pv As String
pv="X11MA-ID2-SHIFT:SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID1harmonic(ByVal v As Double)
Rem 0 : not existing
Rem 1 : 1st
Rem 2 : 2nd
Rem 3 : 3rd
Rem 4 : 4th
Rem 5 : 5th and so on, in use up to 3
Dim pv As String
pv="X11MA-ID1:HARMONIC"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putID2harmonic(ByVal v As Double)
Rem 0 : not existing
Rem 1 : 1st
Rem 2 : 2nd
Rem 3 : 3rd
Rem 4 : 4th
Rem 5 : 5th and so on, in use up to 3
Dim pv As String
pv="X11MA-ID2:HARMONIC"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getID1harmonic() As Double
Rem 0 : not existing
Rem 1 : 1st
Rem 2 : 2nd
Rem 3 : 3rd
Rem 4 : 4th
Rem 5 : 5th and so on, in use up to 3
Dim pv As String
pv="X11MA-ID1:HARMONIC"
r=ezcaGet(pv,ezcaDouble,1,getID1harmonic)
End Function
Function getID2harmonic() As Double
Rem 0 : not existing
Rem 1 : 1st
Rem 2 : 2nd
Rem 3 : 3rd
Rem 4 : 4th
Rem 5 : 5th and so on, in use up to 3
Dim pv As String
pv="X11MA-ID2:HARMONIC"
r=ezcaGet(pv,ezcaDouble,1,getID2harmonic)
End Function
Function opengapID1()
Dim pv As String
Dim v As Double
pv="X11MA-ID1-GAP:OPEN"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function opengapID2()
Dim pv As String
Dim v As Double
pv="X11MA-ID2-GAP:OPEN"
v=1
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putChopper(ByVal v As Double)
Rem 0 : "closed"
Rem 1 : "opened"
Dim pv As String
pv="X11MA-ES1-CHOPP:TRG"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getChopper() As Double
Rem 0 : "closed"
Rem 1 : "opened"
Dim pv As String
pv="X11MA-ES1-CHOPP:TRG"
r=ezcaGet(pv,ezcaDouble,1,getChopper)
End Function
Function getgirder(ByRef po1 As Double, ByRef po2 As Double,ByRef po3 As Double,ByRef po4 As Double,ByRef po5 As Double) As Double
Dim pv(5) As String
pv(1)="X11MA-HG:X1"
pv(2)="X11MA-HG:Y1"
pv(3)="X11MA-HG:PITCH1"
pv(4)="X11MA-HG:YAW1"
pv(5)="X11MA-HG:ROLL1"
r=ezcaGet(pv(1),ezcaDouble,1,po1)
r=ezcaGet(pv(2),ezcaDouble,1,po2)
r=ezcaGet(pv(3),ezcaDouble,1,po3)
r=ezcaGet(pv(4),ezcaDouble,1,po4)
r=ezcaGet(pv(5),ezcaDouble,1,po5)
End Function
Function putgirder_all(ByVal po1 As Double, ByVal po2 As Double,ByVal po3 As Double,ByVal po4 As Double,ByVal po5 As Double)
Dim pv(5) As String
pv(1)="X11MA-HG:X_SET"
pv(2)="X11MA-HG:Y_SET"
pv(3)="X11MA-HG:PITCH_SET"
pv(4)="X11MA-HG:YAW_SET"
pv(5)="X11MA-HG:ROLL_SET"
r=ezcaPut(pv(1),ezcaDouble,1,po1)
r=ezcaPut(pv(2),ezcaDouble,1,po2)
r=ezcaPut(pv(3),ezcaDouble,1,po3)
r=ezcaPut(pv(4),ezcaDouble,1,po4)
r=ezcaPut(pv(5),ezcaDouble,1,po5)
End Function
'Function putgirder_rel(ByVal po1 As Double, ByVal po2 As Double,ByVal po3 As Double,ByVal po4 As Double,ByVal po5 As Double)
'Dim pv(5) As String
'Dim pv1 As String
'Dim v As Double
' pv(1)="ARIAL-GIR:DDX.VAL"
' pv(2)="ARIAL-GIR:DDY.VAL"
' pv(3)="ARIAL-GIR:DDROLL.VAL"
' pv(4)="ARIAL-GIR:DDPITCH.VAL"
' pv(5)="ARIAL-GIR:DDYAW.VAL"
' pv1="ARIAL-GIR:CFD.VAL"
'
' r=ezcaPut(pv(1),ezcaDouble,1,po1)
' r=ezcaPut(pv(2),ezcaDouble,1,po2)
' r=ezcaPut(pv(3),ezcaDouble,1,po3)
' r=ezcaPut(pv(4),ezcaDouble,1,po4)
' r=ezcaPut(pv(5),ezcaDouble,1,po5)
'
' Rem calculate abs value
' v=1
' r=ezcaPut(pv1,ezcaDouble,1,v)
'
'End Function
Function putgirder_x(ByVal v As Double)
Dim pv As String
pv="X11MA-HG:X_SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putgirder_y(ByVal v As Double)
Dim pv As String
pv="X11MA-HG:Y_SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
'Function putgirder_x_rel(ByVal v As Double)
'Dim pv As String
'Dim pv1 As String
'
' pv="ARIAL-GIR:DDX.VAL"
' pv1="ARIAL-GIR:CFD.VAL"
' r=ezcaPut(pv,ezcaDouble,1,v)
' Rem calculate abs value
' v=1.0
' r=ezcaPut(pv1,ezcaDouble,1,v)
'End Function
'Function move_girder()
'Dim pv As String
'Dim v As Double
'
' pv="ARIAL-GIR:MVALL_3.VAL"
' v=1.0
' r=ezcaPut(pv,ezcaDouble,1,v)
'
'End Function
Function stop_girder()
Dim pv As String
Dim v As Double
pv="X11MA-HG:MOVE_STOP.PROC"
v=0
'r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function done_girder() As Double
Rem 0 = no motor is moving
Rem 1 = one or more motors are moving
Dim pv As String
Dim v As Double
pv="X11MA-HG:MOVN"
r=ezcaGet(pv,ezcaDouble,1,done_girder)
End Function
Function PHS_mode(ByVal v As Double)
Rem set PGM + ID mode
Rem 0: PGM
Rem 1: PGM+ID1
Rem 2: PGM+ID2
Rem 3: PGM+ID1+ID2
Dim pv As String
pv="X11PHS-E:OPT"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getPhaseBump() As Double
Dim pv As String
pv="X11MA-ID-PHASE:SOFTBUMP-RB"
r=ezcaGet(pv,ezcaDouble,1,getPhaseBump)
End Function
Function putPhaseBump(ByVal v As Double)
Dim pv As String
pv="X11MA-ID-PHASE:BUMP"
If Abs(v)<3 Then
r=ezcaPut(pv,ezcaDouble,1,v)
Else
write_logfile(1,"Current for Phasebump to high (-3 to 3 A) :"+Format(v))
End If
End Function
Function donePhaseBump() As Double
Dim pv As String
pv="X11MA-ID-PHASE:BUMP-DONE"
r=ezcaGet(pv,ezcaDouble,1,donePhaseBump)
'donemove=1
End Function
Function getXBPM1(ByRef po1 As Double, ByRef po2 As Double) As Double
Dim pv(2) As String
pv(1)="X11MA-FE-XBPM1:posH"
pv(2)="X11MA-FE-XBPM1:posV"
r=ezcaGet(pv(1),ezcaDouble,1,po1)
r=ezcaGet(pv(2),ezcaDouble,1,po2)
End Function
Function getXBPM2(ByRef po1 As Double, ByRef po2 As Double) As Double
Dim pv(2) As String
pv(1)="X11MA-FE-XBPM2:posH"
pv(2)="X11MA-FE-XBPM2:posV"
r=ezcaGet(pv(1),ezcaDouble,1,po1)
r=ezcaGet(pv(2),ezcaDouble,1,po2)
End Function
Function getID1Bergoz(ByRef po1 As Double, ByRef po2 As Double,ByRef po3 As Double,ByRef po4 As Double) As Double
Dim pv(4) As String
pv(1)="X11MA-ID1-FBPMU:X"
pv(2)="X11MA-ID1-FBPMU:Y"
pv(3)="X11MA-ID1-FBPMD:X"
pv(4)="X11MA-ID1-FBPMD:Y"
r=ezcaGet(pv(1),ezcaDouble,1,po1)
r=ezcaGet(pv(2),ezcaDouble,1,po2)
r=ezcaGet(pv(3),ezcaDouble,1,po3)
r=ezcaGet(pv(4),ezcaDouble,1,po4)
End Function
Function getID2Bergoz(ByRef po1 As Double, ByRef po2 As Double,ByRef po3 As Double,ByRef po4 As Double) As Double
Dim pv(4) As String
pv(1)="X11MA-ID2-FBPMU:X"
pv(2)="X11MA-ID2-FBPMU:Y"
pv(3)="X11MA-ID2-FBPMD:X"
pv(4)="X11MA-ID2-FBPMD:Y"
r=ezcaGet(pv(1),ezcaDouble,1,po1)
r=ezcaGet(pv(2),ezcaDouble,1,po2)
r=ezcaGet(pv(3),ezcaDouble,1,po3)
r=ezcaGet(pv(4),ezcaDouble,1,po4)
End Function
Function getVG10() As Integer
Dim pv As String
Dim DVal As Double
pv="X11MA-OP-VG10:OPEN"
r=ezcaGet(pv,ezcaDouble,1,DVal)
getVG10 = DVal
End Function
Function putVG10(ByVal v As Double)
Rem 0 : "closed"
Rem 1 : "opened"
Dim pv As String
pv="X11MA-EPS-VG10:SET"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getMainPressure() As Double
Dim pv As String
pv="X11MA-ES1-MAIN:PRESSURE"
r=ezcaGet(pv,ezcaDouble,1,getMainPressure)
End Function
Function getGascell() As Double
Dim pv As String
pv="X11MA-OP-GCMT1:PRESSURE"
r=ezcaGet(pv,ezcaDouble,1,getGascell)
End Function
Function putCMURy(ByVal v As Double)
Dim pv As String
pv="X11MA-OP-CM:Ry"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getCMURy() As Double
Dim pv As String
pv="X11MA-OP-CM:oRy"
r=ezcaGet(pv,ezcaDouble,1,getCMURy)
End Function
Function getCM1() As Double
Rem chicane Magnet value for Phasebump
Dim pv As String
pv="X11MA-ID-CM1A:I-SET"
r=ezcaGet(pv,ezcaDouble,1,getCM1)
End Function
Function getCM2() As Double
Rem chicane Magnet value for Phasebump
Dim pv As String
pv="X11MA-ID-CM2A:I-SET"
r=ezcaGet(pv,ezcaDouble,1,getCM2)
End Function
Function getCM3() As Double
Rem chicane Magnet value for Phasebump
Dim pv As String
pv="X11MA-ID-CM3A:I-SET"
r=ezcaGet(pv,ezcaDouble,1,getCM3)
End Function
Function getHP() As Double
Rem chicane Magnet value for Phasebump
Dim pv As String
pv="X11MA-CM2-HP1:BX"
r=ezcaGet(pv,ezcaDouble,1,getHP)
End Function
Function getFEcenterHor() As Double
Rem FrontEnd center horizontal
Dim pv As String
pv="X11MA-FE-SH:ctr"
r=ezcaGet(pv,ezcaDouble,1,getFEcenterHor)
End Function
Function putFEcenterHor(ByVal v As Double)
Rem FrontEnd center horizontal
Dim pv As String
pv="X11MA-FE-SH:ctr"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getFEcenterVer() As Double
Rem FrontEnd center vertical
Dim pv As String
pv="X11MA-FE-SV:ctr"
r=ezcaGet(pv,ezcaDouble,1,getFEcenterVer)
End Function
Function putFEcenterVer(ByVal v As Double)
Rem FrontEnd center vertical
Dim pv As String
pv="X11MA-FE-SV:ctr"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function done_FE() As Double
Rem FrontEnd center horizontal, right panel, done move
Rem 0: moving
Rem 1: stopped
Dim pv1,pv2,pv3,pv4 As String
Dim v1 As Double
Dim v2 As Double
Dim v3 As Double
Dim v4 As Double
sleep_f(1)
pv1="X11MA-FE-SH1:TR2.DMOV"
pv2="X11MA-FE-SH1:TR1.DMOV"
pv3="X11MA-FE-SV1:TR2.DMOV"
pv4="X11MA-FE-SV1:TR1.DMOV"
r=ezcaGet(pv1,ezcaDouble,1,v1)
r=ezcaGet(pv2,ezcaDouble,1,v2)
r=ezcaGet(pv3,ezcaDouble,1,v3)
r=ezcaGet(pv4,ezcaDouble,1,v4)
v1=v1+v2+v3+v4
If v1=4 Then done_FE=1 Else done_FE=0
End Function
Function getTBTsetField() As Double
Rem Strasbourg XMCD chamber
Rem set value for Magnetic field
Dim pv As String
pv="X11MA-LSCI632:MFIELD"
r=ezcaGet(pv,ezcaDouble,1,getTBTsetField)
End Function
Function getTBTrdkField() As Double
Rem Strasbourg XMCD chamber
Rem readback value for Magnetic field
Dim pv As String
pv="X11MA-LSCI632:RBKMFIELD"
r=ezcaGet(pv,ezcaDouble,1,getTBTrdkField)
End Function
Function getTBTdone() As Double
Rem Strasbourg XMCD chamber
Rem done setting field
Rem 0: Done
Rem 1: Busy
Dim pv As String
pv="X11MA-LSCI632:busy"
r=ezcaGet(pv,ezcaDouble,1,getTBTdone)
End Function
Function putTBTdone(ByVal v As Double)
Rem Strasbourg XMCD chamber
Rem done setting field
Rem 0: Done
Rem 1: Busy
Dim pv As String
pv="X11MA-LSCI632:busy"
r=ezcaPut(pv,ezcaDouble,1,getTBTdone)
End Function
Function putTBTsetField(ByVal v As Double)
Rem Strasbourg XMCD chamber
Rem set value for Magnetic field
Dim pv As String
pv="X11MA-LSCI632:MFIELD"
r=ezcaPutCallback(pv,ezcaDouble,1,v)
End Function
Function ackTBTwarning
Rem Strasbourg XMCD chamber
Rem acknowledgement that Turbo is switched off
Dim pv As String
Dim v As Double
v=0
pv="X11MA-LSCI632:WARNING"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function startTBTset
Rem Strasbourg XMCD chamber
Rem sets the Magnetic field to the value defined with putTBTsetField
Rem 1. switch heater
Rem 2. wait 20 sec
Rem 3. sets current
Rem 4. switch heater
Dim pv As String
Dim v As Double
v=1
pv="X11MA-LSCI632:setfield-go.PROC"
r=ezcaPutCallback(pv,ezcaDouble,1,v)
End Function
Function startTBTscan
Rem Strasbourg XMCD chamber
Rem sets the Magnetic field to the value defined with putTBTsetField
Rem 1. switch heater when used the first time, otherwise direct
Rem 2. wait 20 sec
Rem 3. sets current
Rem 4. not swichting the heater
Rem Note that one has to switch the heater later manualy
Dim pv As String
Dim v As Double
v=1
pv="X11MA-LSCI632:scanfield-go.PROC"
r=ezcaPutCallback(pv,ezcaDouble,1,v)
End Function
Function putTBTstring(ByVal v As Double)
Rem Strasbourg XMCD chamber
Rem set value for Magnetic field
Dim pv As String
pv="X11MA-LSCI632:MFIELD"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
'Function setTBT_PSH_off
Rem Strasbourg XMCD chamber
Rem Set the GPIB message in the sin_new channel
Rem Send the command
'Dim pv As String
'Dim v As String
' v="s PSH 0" + Chr$(0) +Chr$(13) + Chr$(10)
' pv="X11MA-LSCI632:sin_new"
' r=ezcaPut(pv,ezcaString,1,v)
'Dim v2 As Double
' v2=1
' pv="X11MA-LSCI632:clr-go.PROC"
' r=ezcaPutCallback(pv,ezcaDouble,1,v2)
'End Function
Function putAnalog1(ByVal v As Double)
Dim pv As String
pv="X11MA-ES1-AO1:V"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putOTF_autoname(ByVal v As Double)
Rem YYMMDD for the otf scan files names
Dim pv As String
pv="X11MA-OTF:FTSTAMP"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getOTF_autonum()
Rem number for the otf scan file names
Dim pv As String
pv="X11MA-OTF:FID"
r=ezcaGet(pv,ezcaDouble,1,OTF_autonum)
End Function
Function putOTF_autonum(ByVal v As Double)
Rem number for the otf scan file names
Dim pv As String
pv="X11MA-OTF:FID"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putOTF_path(ByVal vs As String)
Rem not working
Dim pv As String
pv="X11MA-OTF:FNAME"
r=ezcaPut(pv,ezcaString,1,vs)
End Function
Function getOTF_path() As String
Rem not working
Dim pv As String
pv="X11MA-OTF:FNAME"
r=ezcaGet(pv,ezcaString,1,getOTF_path)
End Function
Function putOTF_Estart(ByVal v As Double)
Rem start energy for otf
Dim pv As String
pv="X11MA-OTF:E1"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putOTF_Eend(ByVal v As Double)
Rem end energy for otf
Dim pv As String
pv="X11MA-OTF:E2"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putOTF_time(ByVal v As Double)
Rem time for otf scan in minutes
Dim pv As String
pv="X11MA-OTF:TIME"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function startOTF
Rem start otf scan
Rem 0 = "Stop"
Rem 1 = "Start" or "moving"
Dim v As Integer
Dim pv As String
pv="X11MA-OTF:GO"
v=1
r=ezcaPut(pv,ezcaShort,1,v)
End Function
Function stopOTF
Rem start otf scan
Rem 0 = "Stop"
Rem 1 = "Start" or "moving"
Dim v As Integer
Dim pv As String
pv="X11MA-OTF:GO"
v=0
r=ezcaPut(pv,ezcaShort,1,v)
End Function
Function getOTF_done() As Double
Rem status of otf scan
Rem 0 = "Done"
Rem 1 = "Moving"
Dim pv As String
pv="X11MA-OTF:GO"
r=ezcaGet(pv,ezcaDouble,1,getOTF_done)
End Function
Function getOTF_analog(ByRef Keithley1a As Double,ByRef Keithley2a As Double,ByRef Keithleynorma As Double) As Integer
Dim pv1 As String
Dim pv2 As String
Dim pv3 As String
Dim pv4 As String
Dim pv5 As String
Dim pv6 As String
Dim pv7 As String
Dim pv8 As String
pv1="X11MA-ES1:CADC1"
pv2="X11MA-ES1:CADC2"
Keithley1a=0.0
Keithley2a=0.0
Keithleynorma=0.0
r=ezcaGet(pv1,ezcaDouble,1,Keithley1a)
r=ezcaGet(pv2,ezcaDouble,1,Keithley2a)
Keithleynorma=Keithley2a/Keithley1a
End Function
Function putMono_integration(ByVal v As Double)
Dim pv As String
pv="X11MA-PGM:CERBK.N"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function putMono_speed_normal
Dim pv As String
pv="X11MA:m1.VELO"
v=0.01
r=ezcaPut(pv,ezcaDouble,1,v)
pv="X11MA:m2.VELO"
v=0.01
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function getMono_integration() As Double
Dim pv As String
'pv="X11MA-PGM:CERBK.N"
'r=ezcaGet(pv,ezcaDouble,1,getMono_integration)
End Function
Function open_chopper
Rem for fast chopper from RESOXS group
Dim pv As String
Dim v As Double
v=0
pv="X11MA-ES-PP:BO8"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function
Function close_chopper
Rem for fast chopper from RESOXS group
Dim pv As String
Dim v As Double
v=1
pv="X11MA-ES-PP:BO8"
r=ezcaPut(pv,ezcaDouble,1,v)
End Function