Online Spin Flip

From Hall A Wiki
Revision as of 00:07, 4 October 2008 by Jinhuang (Talk | contribs)

Jump to: navigation, search

This main page of Spin Flip Control System for Hall A He3 Polarized Target.

Introduction

Spin Flip System is designed for controlling Hall A Polarized He3 Target automatically flip spin direction during experiment run time. The physics goal is to reduce systematic false asymmetry, driven by experiment Transversity and d2n.

Core functions for this system are

  1. Control the target spin flip consequence
  2. Acquire and Record target spin state
  3. Output target spin related information into DAQ system, therefore data stream
  4. Interaction with human (Target Operator)
  5. Communicate with related target software/hardware

For quick learning this system, please read Shift Worker Quick Start.

Physics of Spin Flip

Main Article : How to Measure Spin

Please also refer to Thesis of Xiaochao Zheng, Charpter 4 Polarized He3 Target

System Structure

Spin Flip System Diagram

As Shown in the Spin Flip System Diagram, Spin flip system work closely with target hardware installations and DAQ system. This system is divided into 4 levels:

  1. User interface : Display system status to user and take user command. Also notify user if an exception has occurred. User interface is based on Labview v7.1 environment.
  2. Core : The core layer generate and execute a spin flip command on target, collect the respond, decide target status. If an exception occurred, it will try to handle the situation. Meanwhile, target information will be send to both user and DAQ.
  3. Flip Confirmation : During a flip, target will radiate an NMR signal will be collected and processed through the pick-up coil, Lock-In Amplifier and a signal analyzer. The output will be current spin state, which is feed into system status manager.
  4. Failure Detection : This layer will monitor status of Quarter-Wave Plate, which control laser polarization. It will ensure laser polarization is keep pumping the target in the correct direction.

User Interface

This section serve as a manual to all the GUIs.

Main Control

The main control signal provide a access point to every parts of the system. Also it controls the generation spin flip sequence.

Main Control

Following sections will tour through all the controls in the order of left to right and up to down .

System Control Subpanel

  • status indicator

The first control is the status indicator. There are 4 different states:

  1. Initializing
  2. Ready to Flip
  3. Flipping
  4. Error (the control will flash)

Left click of this control will show system status manager.

  • Fool Proof Lock

If the lock is pressed down, it will show text "I'm Expert". Then every function & module will be accessible. Otherwise, it will show text "I'm Rookie". In this case user is only allowed to view the system status and clear errors.

The recommended setting for shift works are "I'm Rookie".

  • Reset All

Warning : this function will affect target polarization and direction. Stop data taking before apply.

This button will try to load the system back to default status by executing following command in sequence:

  1. turn off run simulation
  2. Look for all quarter-wave plates connected, and automatically calibrate them. This process could take minutes depending on number of plates installed.
  3. Ask for NMR sweep settings and reinitialize
  4. Reboot EPICS interface
  5. Start Auto Flip
  6. Show sweep status
  7. Show Log
  8. Do a Flip to synchronize target hardware and logic electronics.

System Status Subpanel

  • Sequence ID : This number will increase 1 after every rebooting this main control.
  • Flip Count : Count of flips since last reboot.
  • Last Reboot At : Time stamp when this code started running
  • X Heart Beat : Heart Beat light of each thread with in this system. If one of them is halt, the whole code should be rebooted.

Spin Subpanel

  • Spin Direction Indicator :

This indicator shows current spin state. There are three states:

Spin1.png Spin0.png Spin-1.png
spin of target is PARALLEL to holding magnetic field spin of target is UNKNOWN spin of target is ANTIPARALLEL to holding magnetic field
Value=+1 Value=0 Value=-1
AKA spin up AKA spin unknon AKA spin down

This is "expected spin", which is calculated by assuming every flip is successful since last calibration. If the NMR signal do not agree with this expectation, an error will be generated.

  • Under Flip Indicator : Whether the target is under a flip
  • Flip Now! Button : Execute A Flip Immediately, if system status is "Ready to Flip"

Automatic Flip Subpanel

  • Auto Flip Set switch : Turn On or Pause Auto Flip.
  • Auto Flip Indicator : Indicates whether auto flip is alive. There are two states of this indicator:
  1. Auto Flip Alive
  2. Auto Flip Suspended

Warning: When an error occurred, auto flip sequence will be paused and "Auto Flip", although "Auto Flip Set" switch is still on "ON" position. There are to method to recover auto flip sequence after the error is cleared:

  1. Turn "Auto Flip Set" switch "OFF" then "ON" again
  2. Wait 10min, then if there is no new error, flip sequence will recover automatically
  • Flip Interval box : Time interval between two automatic flips. If their value is changed, waiting progress will be cleared to 0%.

Notice : This control will be disabled if Fool Proof Lock is ON.

  • Waiting Progress Bar : If the bar reaches end, an flip command will be executed.
  • X Time Stamp : There are 4 time stamp listed:
  1. Current system time
  2. Time when next automatic flip will happen
  3. Last Flip started time
  4. Last flip ended time

Notice : usually "Last flip ended time" - "Last Flip started time" < 5s

Modules and Functions Subpanel

Notice : This control will be disabled if Fool Proof Lock is ON.

Notice : This control will be disabled if Fool Proof Lock is ON.

  • Changing Pol. Indicator : Whether laser polarization is under changing.
  • Simul. Switch : A toggle switch for whether actually carry on or simulate hardware operation and EPICS communication. If this switch is on, then
  1. There will not be any GPRB operation, which means no RF send to target and no signal read back from Lock-In amplifier.
  2. Every flip will be displayed to be successful.
  3. EPICS communication is shutdown

Notice : This control will be disabled if Fool Proof Lock is ON.

  • Show Log Button : Show Text Log window
  • Generate Report Button : Generate a User Report. User will be prompted to input a short comment, which will be added to top the report.
  • Reboot EPICS Button : Reboot EPICS interface. No window/dialog will be showed.

Notice : This control will be disabled if Fool Proof Lock is ON.

System Status Manager

System Status Manager give target operator an quick overview of the full system. It follows the coloring rule.

System Status Manager GUI

Following sections will tour through all the controls in the order of up to down and left to right.

Error Handling Subpanel

  • Sum of Spin and module check Indicator : This indicator shows OK if both spin check and module check indicator are OK; otherwise, it shows red ERROR.
  • Now Time stamp : System Time
  • System Status Indicator : It's a copy of system status from main control window. There are 4 possible states:
  1. Initializing
  2. Ready to Flip
  3. Flipping
  4. Error (the control will flash)
  • Last Error Box : Last error time and description. During Error State, content of this box will be read out.
  • Open Log Button : Show Text Log window.
  • Clear Error Button : By pressing this button, system status will be cleared from "ERROR" state to "READY to FLIP" state. Alarm will be turned off.

Warning : Clear Error Button do not solve the problem that causing the error. Target Operator should trace to and solve the source of the problem before turn on automatic flip again.

  • Silence Alarm For 1hr Switch : just silent the audio alarm for 1 hour. After 1 hour, it will automatic pop up again.

Spin Check Subpanel

  • Wait/Check Indicator : After every flip, the code will automatically check whether spin measured from different source is consist with each other. During delay of process and communication, this check will be delayed by 30s after each flip. During this delay time, this indicator shows yellow WAIT; otherwise it's CHECKED
  • Sum of 4 Spin check Indicator : After every flip, the code will automatically check whether spin measured from different source is consist with each other. This indicates the check result.

This indicator shows current spin state. There are three states:

Spin1.png Spin0.png Spin-1.png
spin of target is PARALLEL to holding magnetic field spin of target is UNKNOWN spin of target is ANTIPARALLEL to holding magnetic field
Value=+1 Value=0 Value=-1
AKA spin up AKA spin unknon AKA spin down

There are 4 source, from which the system collect target spin information from:

  1. Spin from Count : This is "expected spin", which is calculated by assuming every flip is successful since last calibration.
  2. Spin from NMR Amp. : For different spin state, the Lock-In X-Channel of NMR signal collected during the flip will differ by a sign. Therefore by judging from the sign of NMR resonance peak, target spin direction could be measured.
  3. Spin from Peak Phase : similar principle to above one, however, this indicator judge spin from phase between Lock-In X and Y-Channel at NMR resonance peak
  4. Spin from EPICS : the logic electronics also have a measurement of spin state, utilizing similar principal as "Spin from NMR Amp." Indicator. This hardware signal is read in from a IOC to EPICS system, which is displayed here.
  • Force Change button : force the expected spin change to an arbitary state

Notice : This control will be disabled if Fool Proof Lock is ON.

  • Enbale/Disable button : Enable/Disable check the corresponding spin state

Notice : This control will be disabled if Fool Proof Lock is ON.

Modules Overview Subpanel

  • 'Sum of All Modules Indicator : Whether there is any error in any of modules.
  • Spin Flip/ Auto Flip Alive Indicator : Indicates whether auto flip is active.
  • Spin Flip/ Flip Count : Count of flips since last reboot.
  • Spin Flip/ Last Flip Start/Finish Time : Time mark for a flip

Notice : Above 4 item is copy from main control window

  • NMR Sweep/ Last Sweep Start/Finish Time : Time mark for a NMR sweep. There is one NMR sweep within every flip.

Notice : Above item is copy from sweep status window.

  • EPICS/ Last Epics Read/Write : Time mark for a EPICS operation. EPICS communication should be on a per second basis.
  • Laser/ Changing Pol. Indicator : Whether laser polarization is under changing.
  • Laser/ Motor_Error Indicator : This light will be on if there is any error from the stepper motor, which controls laser polarization.

Notice : Above 3 items is copy from laser polarization control window.

  • NMR Peak Amp./Polarization history plot : history of NMR signal peak height or target polarization. It shows different control depends on code version.

Message Handler

Message Handler keep track and coloring last 100 system message; besides, it also keep all WARNING and ERROR level message in a separate list. It follows the coloring rule.

Notice : to copy the log message, please go to main control widow and open the text log file.

Message Handler

  • Log Debug Switch : Whether or not log debug level of message. These message will help step by step track the running code. However, it could also dramatically increase the number of messages. Therefore, unless there you are debug the code, this switch is recommended to be set to "OFF"
  • Log to File Switch : If it's on, a copy of log message will be saved to disk file. It's recommended to be "ON", and file path will be specified on the right.

Notice : This control will be disabled if Fool Proof Lock is ON.

NMR Sweep Setting and Status

NMR Sweep Status GUI snape shot for Hall A Polarized He3 Target spin flip control

First Order Title

NMR Signal Phase Analysis

The Phase Analysis window double checks the spin state by taking information of both channel of Lock-In Amplifier. It's GUI looks like below: NMR Signal Phase Analysis GUI snape shot for Hall A Polarized He3 Target spin flip control.

  • Phase Range Setup / Spin Up Slide Bar : if the phase of NMR signal peak is in this range, then the final state will be count as spin up.
  • Phase Range Setup / Spin Down Slide Bar : if the phase of NMR signal peak is in this range, then the final state will be count as spin down.
  • NMR Signal Phase Plot : NMR signal phase through all scan
  • NMR Amp. Threshold : If peak of NMR signal is above this level, then, in the view of this GUI, it will be count for a valid spin flip
  • NMR Signal Amplitude Plot : NMR signal amplitude through all scan. The amplitude is calculated by square root sum of square of both Lock-In X and Y Channel (with background subtraction).
  • Peak Amp./mV : the max point of NMR signal in mV
  • Peak Phase /Degree : the phase of NMR signal. It's actually approximated by average of phase of any data point, whose amplitude is above 90% of peak amplitude.
  • Spin Expected : The final spin state is the flip is successful
  • Spin Calculated : the measured spin

Laser Polarization Control

quarter wave plate to convert vertically polarized pumping laser to circular polarized

There is a laser beam used to pumping up target spin toward the direction of laser polarization. Therefore, if the target spin direction is flipped, it's also necessary to change laser polarization.

During the experiment, the pumping laser is first polarized vertically. Then a quarter wave plate, whose optical axis is 45 degree relative to vertical, will be used to convert the laser to circular polarization. By rotating the quarter wave plate 90 degree, the polarization direction of laser will be changed a sign.

This process is motorized: each quarter wave plate is mounted on a rotatable holder driven by a stepper motor. Meanwhile, each motor is connected to a USB motor controller with 4 digits ID number. The following GUI is interface to these controllers:

Lazer Polarization Control GUI snapshot for Hall A Polarized He3 Target spin flip control

All Devices Subpanel

  • Find Devices Button : look for any USB motor controller connected to current computer.
  • Device ID List : ID number list for all USB motor controller. Once you choose one of the device, all the other subpanels will be linked to that device.

Notice : for context below, the chosen plate/motor/controller in Device ID List will be called current plate/motor/ controller.

  • Auto Calibration Button : Automatic find 0 mark on ever plate holder

Notice : For Auto Calibration, there are error (~1 degree) error. Which means the angle read back on computer might be 1 degree off from the one read on the holder marker. This offset is known. However, there are another method to calibrate the motor using the Manual Calibration subpanel.

  • All To Up/Down Pos Button : rotate all plate holder to preset angle marks for spin up/spin down state
  • Moving Indicator : Whether any motor is moving = whether laser polarization is under changing.
  • Error Indicator : This light will be on if there is any error from the stepper motor, which controls laser polarization.

Preset Position/Limit Switch Status Subpanel

Each quarter wave plate holder is calibrated so that we know which angle mark it should be turn to provide a specific laser polarization. Also, there are two limit switches in the holder (currently only switch#2 is connected). Usually if the plate is rotated to an angle marked between 8~12 degree, the switch will be ON. Therefore, it has been used to double check whether the plate has been rotated to correct absolute angle.

This subpanel is designed for user to preset the quarter wave plate angle and expected limit switch status for the holder chosen in Device ID List. The calibrate data could be found on the quarter wave plate calibration page. Also a copy here:

Motor ID Controller ID Description Alignment Angle/Degree Auto calibration Error/Degree Spin Up Read Back/Degree Spin Down Read Back/Degree
1 N/A Not In Use 8.4 0.15 8.25 -81.75
2 N/A Not In Use 8.5 0.40 8.10 -81.90
3 0338 Transverse S Wave 7.5 0.2 7.3 -82.70
4 1474 Transverse P Wave 8.8 0.00 8.80 -81.20
5 1426 Vertical S Wave 10.8 0.40 10.40 -79.60
6 1423 Vertical P Wave 9.8 1.00 8.80 -81.20

  • Motor ID : The sticker attached to the motor
  • Controller ID : ID number of control connected to the motor
  • Alignment Angle : When the mark of Q-wave plate is at this angle, all plates will convert a vertical polarized laser to a circular polarized one. Besides, the polarization direction is the same.
  • Auto calibration error : is the marker angle on the plate holder, while the holder is shown to be rotated to 0 degree on the computer. The reason why it is not 0, is due to non-perfect precision of automatic calibration.
  • Position Up/Down Read Back: The angle setting on the computer for spin state Up/Down.

{| class="wikitable sortable" border="1" frame="hsides" rules="rows" |- ! Motor ID ! Controller ID ! Description ! Alignment Angle/Degree ! Auto calibration Error/Degree ! Spin Up Read Back/Degree ! Spin Down Read Back/Degree |- |1|| N/A || Not In Use || 8.4||0.15||8.25||-81.75 |- |2|| N/A || Not In Use || 8.5||0.40||8.10||-81.90 |- |3|| 0338 || Transverse S Wave || 7.5||-1.50||6.5 (Dec 02, 2008 re-calib)||-83.5 (Dec 02, 2008 re-calib) |- |4|| 1474 || Transverse P Wave || 8.8||0.00||6.5 (Dec 02, 2008 re-calib)||-83.5 (Dec 02, 2008 re-calib) |- |5|| 1426 || Vertical S Wave || 10.8||0.40||10.40||-79.60 |- |6|| 1423 || Vertical P Wave || 9.8||1.00||8.80||-81.20 |}

  • Motor ID : The sticker attached to the motor
  • Controller ID : ID number of control connected to the motor
  • Alignment Angle : When the mark of Q-wave plate is at this angle, all plates will convert a vertical polarized laser to a circular polarized one. Besides, the polarization direction is the same.
  • Auto calibration error : is the marker angle on the plate holder, while the holder is shown to be rotated to 0 degree on the computer. The reason why it is not 0, is due to non-perfect precision of automatic calibration.
  • Position Up/Down Read Back: The angle setting on the computer for spin state Up/Down.

{| class="wikitable sortable" border="1" frame="hsides" rules="rows" |- ! Motor ID ! Controller ID ! Description ! Alignment Angle/Degree ! Auto calibration Error/Degree ! Spin Up Read Back/Degree ! Spin Down Read Back/Degree |- |1|| N/A || Not In Use || 8.4||0.15||8.25||-81.75 |- |2|| N/A || Not In Use || 8.5||0.40||8.10||-81.90 |- |3|| 0338 || Transverse S Wave || 7.5||-1.50||9.00||-81.00 |- |4|| 1474 || Transverse P Wave || 8.8||0.00||8.80||-81.20 |- |5|| 1426 || Vertical S Wave || 10.8||0.40||10.40||-79.60 |- |6|| 1423 || Vertical P Wave || 9.8||1.00||8.80||-81.20 |}

  • Motor ID : The sticker attached to the motor
  • Controller ID : ID number of control connected to the motor
  • Alignment Angle : When the mark of Q-wave plate is at this angle, all plates will convert a vertical polarized laser to a circular polarized one. Besides, the polarization direction is the same.
  • Auto calibration error : is the marker angle on the plate holder, while the holder is shown to be rotated to 0 degree on the computer. The reason why it is not 0, is due to non-perfect precision of automatic calibration.
  • Position Up/Down Read Back: The angle setting on the computer for spin state Up/Down.

  • Up/Down Pos Box : enter the expected angle, which the quarter wave plate should be rotated to, for spin up/down target state.
  • To Up/Down Pos Button : Rotate current plate to that angle specified above
  • preset limit switch status check box table : If the switch #1 or #2 is expected to be ON when the plate rotate to spin up or down state, the check the box; else uncheck it. In the case that the limit switch did respond correctly, an error will be raised.

Movement Subpanel

This subpanel control the speed of current plate by specify the step size and speed of the step motor in the holder. Also one can rotate the plate to an arbitrary angle with Destination Position, Start and stop button.

Current Status Subpanel

This panel monitor status of current quarter wave plate (the one chosen in device ID list).

  • Voltage bar : power supply voltage
  • Temperature bar : temperature of stepper motor driving chip inside the controller box
  • Power Indicator : power status of current motor (NONE/HALF/FULL)
  • Speed Indicator : speed rating of current motor (STOP/ACCELERATING/FULL SPEED)
  • Switch 1/2 Indicator : ON/OFF indicator for limit switch #1/#2
  • RT Error Indicator : not used
  • Working Indicator : not used
  • current position box : angle reading of current plate in degree
  • Firmware Ver box : Firmware version of current controller.

Manual Calibration Subpanel

In case that automatic calibration fails or in special requirement, Manual Calibration Subpanel offer another way to calibrate the motors. Basically, calibration here means convert tic count in stepper motor into angle and adjust the offset, so that the angle calculated in computer is the same as the one read from markers on the plate holder.

How to get more help

There are various of online help:

  • When you move the cursor over the object and stay for a while, a help tip will be popped up.
  • Right click a control, and choose "Description and Tips", a dialog containing a description will be shown. However, usually, description is no more than the tip.
  • For developers and expert users, the Labview code is well commented. To some extent, the Code is the best documentation.

Exception Handling

Exception Handling for spin flip system will be discussed as following.

Preventing an error from happening

It's important to pay attention to warning messages and yellow colored controls. They usually indicates a potential source error. Understanding the source would save some further trouble.

Shift worker HOWTO of Exception Handling

When the system detect an exception, an error will be raised. Then:

To recover to normal state, one should:

  1. click Clear Error button on system status manager to acknowledge the alarm
  2. identify and resolve the source of error
  3. recover the automatic spin flip

Exception Analysis

There are several types of resource for experts to analysis an exception during run time or after

Text Log File

Text Log is a useful resource to trace system history. It's organized in the Message Handler window as well as recorded into a text file (also specified on Message Handler window). Basically, every step the system took, every warning and error message are recorded.

Status Page

Status Page Contain two list of status reports of target control software. They are User Report and Automatic Report.

  • User Report are generated by pressing "generate report" button on target Main Control GUI. It includes following sections:
    • User Comment (If there is any)
    • System Status variable list
    • Screen Shots
    • NMR Signal History
    • a copy of text Log File
  • Automatic Report are automatically generated after every spin flip or once an error occurred. It's a simplified version of user reports.

Logic Electronics

electronical design diagram
timing of spin flip signal

Spin Signal Formation

The target logic electronics is designed as a standalone system, capable of extracting spin state information from target NMR signal induced during spin flip. The significance of this subsystem is that, in some unexpected case that the target computer should be down, these electronics could still keep a record of target spin information and ensure spin signal to DAQ is valid.

As shown in the electrical diagram and timing diagram,

  • Input of this subsystem are
    • RF function generator status signal (TTL Logic)
    • Lock-In X channel of NMR (Analog)
  • Output are
    • 2 NIM logic signal, each stand for on spin state; if both of them is logical 0, then it implies the spin state is unknown
    • One scalar read ctrl signal, which output a 100ns NIM logical 1 pulse during each successful spin flip. Now it's mainly used as counting number of flips.
  • algorithm this electronics is based on, is the spin state of target have a fixed relation with sign of NMR signal.
  • The key component is two Set-Reset Latches which lock down target state once a flip is confirmed

Spin Signal Distribution

The spin signal will be distributed to DAQ system and

  • Read in by ADC and inserted to each event as target spin flag
  • Form Gates for scalars

The signal distribution scheme are

NMR RF Generator--->Target--->Pickup Coil--->Lock-In Amplifier
       |                                           |
       |      /------------------------------------|
       |------|-------------------------------\    |
       |      |                               |    |
 Main Target Electronics                2nd Target Electronics
            |     |                               |
            |     \-------------\                 |
            |                   |                 |
    RHRS Happex DAQ        BigBite ADC-------->LHRS ADC
                                |   
              Scalar Gates Generation @ BigBite DAQ
                                |        |
                        BigBite Scalars  \---->LHRS Scalars