BIMA TUNING ALGORITHM ------------------------------------------------------------------------------ Two programs are used. SETFREQ computes the observing frequency (including Doppler shifts), sets the synthesizer, and tunes the receivers on all selected antennas. It spawns independent tuning processes (TUNEANT) to tune each receiver once the synthesizer is set. ----------------------------------- SETFREQ ---------------------------------- 0. Inputs: 0.a.- antenna list (e.g., 1256789A) 0.b.- observing freq, GHz (usually a spectral line freq, e.g. 115.271204) 0.c.- I.F. freq, MHz (frequency in the I.F. at which the specified spectral line appears; e.g., -250 indicates 250 MHz in LSB) 0.d.- source for doppler shift (e.g., NGC1333) 0.e.- catalog in which source can be found (e.g., $UCAT/plambeck.cat) 0.f.- harm - optional override harmonic, used primarily for VLBI where it is essential to keep synthesizer at exactly the same freq throughout the observing run 0.g.- Options: 0.g.1.- allants - tune rcvr even if antenna is "off" 0.g.2.- musttune - perform all receiver tuning steps, needed or not. 0.g.3.- lockonly - phaselock the mm osc, then exit 0.g.4.- xlock - phaselock the xband osc, then exit 0.g.5.- nosearch - set SIS bias to nominal value, then exit 0.g.6.- graybody - optimize SIS bias on gray body, not amb 0.g.7.- maxgain - optimize SIS bias on gain peak, not noise min 1.- Update SIS mixer temperature setpoint for all antennas. 1.a.- In the common block (shared memory), change temperature setpoint for each antenna to "-1"; this prompts task DEREG, which is running independently, to adjust temperature setpoints up or down, usually by 0.1 or 0.2 K, if heater currents are outside the target range. Note: this is the only time the temperature setpoints are allowed to change; if a mixer temperature goes out of regulation while an observation is taking place, it's too bad. 2.- Compute relevant frequencies. 2.a.- Calculate Doppler-shifted LO frequency from observing freq, source VLSR, and I.F. freq. 2.b.- Select frequency band ("B" = 3mm, "D" = 1mm, "E" = 1cm, "F" = 22 GHz) 2.c.- Offset pointing constants for selected frequency band. Change values in common block. 2.d.- If an antenna was previously turned "off" by setfreq (because it failed to phaselock, or because previous freq band was not available on it) turn it "on" now. 2.e.- Refocus antennas (not needed at this time). 2.f.- Choose X-band harmonic. Lowest odd harmonic is the default. 2.g.- Compute LO reference freq (1100-1260 MHz). 2.h.- Set frequency synthesizer. 3.- Spawn separate tuning task (TUNEANT) for each antenna. Wait until all these tasks return. 4.- Deal with failures. 4.a.- If antenna status is "fatal" (e.g., "SIS mixer too hot"), turn off the antenna and sound alarm. 4.b.- If any antenna returns with "bad phaselock" status, switch harmonics. 4.b.1- Do harmonic check on all antennas which have tuned successfully, reject any harmonics where one or more fail to lock. 4.b.2- If another harmonic is available, switch to it, try to tune all antennas; previously tuned antennas should tune quickly, problem antenna(s) will take longer. 4.b.3- Repeat until all antennas have phaselocked and tuned successfully; if problem antenna fails to lock at all harmonics, turn it off and sound alarm. 5.- Make quick total pwr system temperature measurement on the sky with all ants, exit. ----------------------------------- TUNEANT ---------------------------------- 0.- Inputs. 0.a.- Antenna 0.b.- Flags from options keyword in SETFREQ 1.- Open the tuning log for this antenna. 2.- Read relevant numbers (LO freq, X-band freq, band) from common block. 3.- Initial checks and housekeeping. 3.a.- Is telemetry to antenna alive? If time sent back through telemetry loop is not changing, send warning. 3.b.- Are any A/D addresses saturated? If so, neighboring channels may be corrupted. Send warning. 3.c.- Are voltages from power supplies (+/-15V and +5V) OK? If not, warning. 3.d.- Is 2nd LO phaselocked? If not, warning. 3.e.- Send hard reset to DSP chip on frequency offset card in antenna VME rack. 3.f.- Is power level of 70 MHz phaselock reference to mm-lock box OK? (binary indicator from mm lock box). If not, send warning. 3.g.- Is power level of 1100-1260 reference OK? (binary indicator from LO terminator box). If not, warning. 3.h.- Enable mm phaselock sweep, turn on mm osc, turn on 2nd IF amplifier. (normally, all are on already). 3.i.- Increase IF attenuators to 26 dB, to avoid overdriving laser while tuning (a precaution; probably unnecessary). 4.- Select frequency band. 4.a.- Switch phaselock to appropriate LO plate. 4.b.- Switch mixer bias circuit to appropriate SIS mixer. 4.c.- Turn on appropriate HEMT amplifier inside dewar. 4.d.- Confirm that polarization plates are out of the beam. 4.e.- Wait for one telemetry cycle to confirm that all switches are set. 5.- For each antenna, read values used in last tuning for this freq band, e.g., from file lasttune.B. 6.- For each antenna, set currents and attenuation. 6.a.- Set mm LO modulator current to +300 mA (minimum attenuation). 6.b.- If current freq differs from lasttune freq by > 10 MHz, increase LO attenuator to "safe" level (safe level is kept in tuning table for LO plate). 7.- Phaselock the X-band oscillator. 7.a.- Set YIG voltage to predicted value; wait 2 seconds. 7.b.- If voltage readback does not agree, send warning. Note that Xband synchronizer has a "manual/remote" switch which might have been left in the "manual" position. 7.c.- If not phaselocked, send "phaselock bad" error message, exit. 7.d.- Step YIG voltage up or down to zero the error volts. 8.- Phaselock mm oscillator. 8.a.- Look up tuning parameters (mmosc, mmbck, Vop, lgain) in file; fatal error if file cannot be found. 8.b.- Rescale voltages by measured reference voltage. In counts, ref voltage is 32768; measured typically is 32700. 8.b.1.- If reference voltage is < 30000, send fatal warning and exit. 8.b.2.- If reference voltage is < 32600, send warning message. 8.c.- Set mm Gunn oscillator Vop voltage to table value; send warning if readback disagrees with setpoint. 8.d.- Tune mm Gunn backshort. 8.d.1.- Read back current mmbck position; if within delta_mmbck counts of target, skip over next section. 8.d.2.- Tune mmbck to target. 8.d.3.- Send error message if motor is stuck. 8.e.- Tune mm Gunn micrometer. 8.e.1.- If LO freq is unchanged from last tuning, and Gunn is phaselocked, and mmosc is within delta_mmosc of target position, skip to 8.f 8.e.2.- Set loop gain slightly below table value; send warning message if readback disagrees with setting. 8.e.3.- Rapidly tune mmosc motor to beginning of search range, then tune slowly through search range; once locked, step motor until error volts are close to zero. 8.e.4.- If Gunn drops out of lock while zeroing error volts, step through search range again, allowing larger error volts this time. 8.e.5.- If Gunn fails to lock at all, or drops out even with larger search range, send phaselock fault message and exit. 8.f.- Optimize phaselock loop gain. 8.f.1.- Increase loop gain until phasenoise monitor jumps upward suddenly, indicating that the loop is oscillating. 8.f.2.- Back off gain to a stable value. 9.- Set SIS mixer bias. 9.a.- Check mixer block temperature. 9.a.1.- If T < 2K or T > 325K, sensor must be broken; use sensor on refrig 3rd stage instead. 9.a.2.- If T > 8K, mixer is too hot; send fatal error message. 9.a.3.- If mixer temperature differs from lasttune value by < 0.08 K, and Vmxr differs by < 0.2 mV, Imxr differs by < 1 uA, and freq differs by < 10 MHz, skip to step 10. 9.b.- Find nominal mixer voltage and current bias interpolating in table (usually this is 1st peak below energy gap, sometimes 2nd peak. When this happens table contains two entries 1 MHz apart in freq. Table contains entries for 3.5K < T < 7.5K). 9.c.- Set bias voltage to value in table. 9.d.- Set LO attenuator to obtain nominal SIS mixer current. If LO pwr is too low, send warning message. 9.e.- Switch in ambient load. If load does not move, send warning. 9.f.- Set IF attenuator to get 1V from detector in rcvr I.F. box. 9.g.- Find bias for optimal Y-factor 9.g.1.- Record total power while stepping SIS mixer over search range (-0.15--+0.15 V for 3mm, -0.25--+0.25 V for 1 mm). 9.g.2.- Switch out ambient load. If load does not move, send warning. 9.g.3.- Repeat 9.g.1 on sky. 9.g.4.- Compute Y-factor (P_amb/P_sky). Find bias voltage at peak. 9.h.- Set bias voltage to peak found. If max Y-factor is < 1.1, set bias to table value, output warning. 10.- Wrap up. 10.a.- Set IF attenuator to get 2V detector output on sky. 10.b.- Reoptimize mm phaselock loop gain (subsection 8.f) 10.c.- Record all parameters in lasttune file. 10.d.- Return.