Angular Dispersion (UMA, ARTA/TAMS)

Some optical devices require measurement at wavelength-dependent sample and detector angles (angular dispersion). While the Cary UMA and OMT Solutions ARTA/TAMS PE attachments suit this purpose, software support is required for this unusual mode. To this end, we have added the ability to import and export Excel workbooks. While XL functions DO NOT REQUIRE EXCEL and are easier to implement than Excel ActiveX COM, COM ultimately offers the most powerful FilmStar-Excel solutions.

All FilmStar programs include the XL functions highlighted below in the Cary UMA sample code and support a built-in Excel viewer.  The same methods (scroll down) applies to ARTA/TAMS accessories, replacing the awkward approach required by UV Winlab.

Other Excel-based solutions: The Spectra Collector is recommended for typical multiple angle scans. When dealing with single scans, Spectra..Open and Spectra..Save As support Excel XLS format.

' UMATestXL.bas For FilmStar MEASURE Mcary5U.exe (UMA)
' Use as general template for QA procedure development
' Download WaveAngles.xls
' Modified 06/28/18 for FTG Excel Viewer

Option Explicit
Option Base 1
Dim Wave!(), AngSmp!(), AngDet!(), AngPol() As Variant
Dim DatP!(), RefP!(), nWav& ' data

Const nScans = 3 ' number of sample scans

Sub Main
    Dim i&, j&, nRow&, iScan%
    If Not XLopen("C:\Winfilm\Measure\WaveAngles.xls",, True) Then End
    XLinfo nRow     ' how many rows?
    nWav = nRow - 1 ' account for header row
    ReDim Wave!(nWav), AngSmp!(nWav), AngDet!(nWav), AngPol(nWav)
    ReDim DatP!(nWav), RefP!(nWav)
    For i = 1 To nWav
        Wave(i) = XLcell(i + 1, 1)
        AngSmp(i) = XLcell(i + 1, 2)
        AngDet(i) = XLcell(i + 1, 3)
        AngPol(i) = XLcell(i + 1, 4) ' "P", "S", "N" or 0-360°
    Next i
    MsgBox "100% reference: remove optic", vbInformation, "UMA Test"
    For i = 1 To nWav
        SetUMA 0, 180, 45   ' detector 180°, polarizer 45°
        RefP(i) = Reading(Wave(i))
       'SetUMA 0, 180, "S" ' detector 180°, Polarizer "S"
       'RefS(i) = Reading(Wave(i))
    Next i
    AxesDraw
    XLclose ' close workbook object before opening new
    For iScan = 1 To nScans
        MsgBox "Sample #" & CStr(iScan) & " scan: mount optic", _
        vbInformation, "UMA Test"
        ' next line allows manual alignment
        UMAConfig "Carefully align Sample #" & CStr(iScan) ' optional title
        For i = 1 To nWav
            SetUMA AngSmp(i), AngDet(i), AngPol(i)
            DatP(i) = Reading(Wave(i))/RefP(i)
        Next i
        Spectrum_X = Wave: Spectrum_Y = DatP
        AxesDraw
        Replot
        XLnew nWav+1, 5, "UMAScan" & CStr(iScan)
        XLwrite 1, 1, "Wave (nm)": XLwrite 1, 2, _
          "Sample°": XLwrite 1, 3, "Detect°"
        XLwrite 1, 4, "Pol°": XLwrite 1, 5, "% Trns"
        For i = 1 To nWav
            j = i + 1
            XLwrite j, 1, Wave(i), 1
            XLwrite j, 2, AngSmp(i), 3
            XLwrite j, 3, AngDet(i), 3
            XLwrite j, 4, AngPol(i), 1
           'XLwrite j, 5, 100 * DatP(i), 3
            XLwrite j, 5, 100 * DatP(i)/iScan, 3 ' verifies Test Mode
        Next i
    Next iScan
    On Error Resume Next
    Kill "C:\Winfilm\Spectra\UMAScanTest.xls"
    XLsave "C:\Winfilm\Spectra\UMAScanTest.xls"
    XLclose
    XLview "C:\Winfilm\Spectra\UMAScanTest.xls"
End Sub
Similar procedures can be implemented in Excel VBA, using MEASURE as server. Results can also be displayed in FSPlot, either as a line graph or labeled points using Annotations. This is an excellent exercise for improving BASIC skills.

As shown below, the same functions can be implemented in PerkinElmer instruments with ARTA/TAMS attachments. Sample and detector angles are varied with FilmStar BASIC comAux commands. If currently using ARTA/TAMS with UV Winlab, you are not getting the full potential of your investment. The code below has been developed in cooperation with OMT Solutions and can be downloaded here.

Option Explicit
DefInt I-N
DefSng A-H, O-Z
' Test for ARTA and TAMS accessories; please contact
' FTG Software if the code does not work as expected
Const kComPort = 4 ' change as required
Const delay = .2   ' change if necessary

Sub Main
    comAuxPortOpen kComPort, "9600,N,8,1", 0
    Wait delay
    If SetInit() Then   ' some test values
        Wait delay
        If Not SetSample(30) Then comAuxPortClose: End
        Wait delay
        If Not SetDetector(60) Then comAuxPortClose: End
        Wait delay
        If Not SetSample(-45) Then comAuxPortClose: End
        Wait delay
        If Not SetDetector(-90) Then comAuxPortClose: End
	Wait delay
    End If
PortClose:
    comAuxPortClose
End Sub

Function SetInit As Boolean
    SetInit = False
    comAuxSend "A"
    If comAuxWaitString("AC", 3) Then
        If Not comAuxWaitString("AE", 90) Then
            MsgBox "Initialize timeout", vbExclamation, "Detector Stage"
            Exit Function
        End If
    Else
        MsgBox "Initialize failed", vbExclamation, "Detector Stage"
        Exit Function
    End If
    Wait .2
    comAuxSend "B"
    If comAuxWaitString("BC", 3) Then
        If comAuxWaitString("BE", 60) Then
           SetInit = True
        Else
           MsgBox "Initialize timeout", vbExclamation, "Sample Stage"
           Exit Function
        End If
    Else
        MsgBox "Initialize failed", vbExclamation, "Sample Stage"
        Exit Function
    End If
End Function

Function SetSample(ByVal Angle) As Boolean ' -180 to 180
    Dim t$
    t$ = "Sample Angle " & CStr(Angle) & "°"
    SetSample = False
    Select Case Angle
    Case -180 To 180
        comAuxSend "Y"
        If comAuxWaitString("YC", 3) Then
            comAuxSend CStr(Int(100 * Angle)) & vbCr
            If comAuxWaitString("YE", 60) Then
                SetSample = True
            Else
                MsgBox "Rotation timeout", vbExclamation, t$
            End If
        Else
            MsgBox "Rotation failed", vbExclamation, t$
        End If
    Case Else
        MsgBox "Invalid angle setting", vbExclamation, t$
    End Select
End Function

Function SetDetector(ByVal Angle) As Boolean ' 10 to 350
    Dim t$
    t$ = "Detector Angle " & CStr(Angle) & "°"
    SetDetector = False
    Select Case Angle
    Case 10 To 350, -180 To -10
        If Angle < 0 Then Angle = Angle + 360
            comAuxSend "X"
            If comAuxWaitString("XC", 3) Then
                comAuxSend CStr(Int(100& * Angle)) & vbCr
                If comAuxWaitString("XE", 60) Then
                    SetDetector = True
                Else
                    MsgBox "Rotation timeout", vbExclamation, t$
                End If
            Else
                MsgBox "Rotation failed", vbExclamation, t$
            End If
    Case Else
        MsgBox "Invalid angle setting", vbExclamation, t$
    End Select
End Function

Need to upgrade or automate but have little time or inclination to deal with FilmStar BASIC code? In that case contact FTG Software to discuss turnkey solutions.

Back to Technical Issues

Copyright © 2023 FTG Software Associates
Last updated on January 31, 2023