001 package edu.nrao.sss.model.resource.vla; 002 003 import java.math.BigDecimal; 004 import java.util.SortedSet; 005 import java.util.TreeSet; 006 007 import edu.nrao.sss.measure.Frequency; 008 import edu.nrao.sss.measure.FrequencyUnits; 009 import edu.nrao.sss.measure.TimeDuration; 010 import edu.nrao.sss.model.resource.CorrelationProductGroupAbs; 011 import edu.nrao.sss.model.resource.CorrelatorBaseband; 012 import edu.nrao.sss.model.resource.CorrelatorSubbandAbs; 013 014 /** 015 * A subband of a VLA correlator baseband. 016 * <p> 017 * 2008-Mar-11, PM: 018 * <i>B.Butler and M.Rupen suggested that the SSS programming staff 019 * </i>not<i> spend a lot of time trying to put the WIDAR and VLA 020 * correlators under the same blanket. They suggested that, instead, 021 * we write special code for the short amount of time that we'll be 022 * dealing with the VLA. Therefore, this class may not see much use, 023 * if any, and has not been given the proper amount of QA attention.</i> 024 * <p> 025 * <b>Version Info:</b> 026 * <table style="margin-left:2em"> 027 * <tr><td>$Revision: 2287 $</td></tr> 028 * <tr><td>$Date: 2009-05-07 13:54:58 -0600 (Thu, 07 May 2009) $</td></tr> 029 * <tr><td>$Author: dharland $ (last person to modify)</td></tr> 030 * </table></p> 031 * 032 * @author David M. Harland 033 * @since 2008-03-11 034 */ 035 public class VlaSubband 036 extends CorrelatorSubbandAbs 037 { 038 private static final Frequency MIN_BW = 039 new Frequency("195312.5", FrequencyUnits.HERTZ); 040 041 private static final Frequency MAX_BW = 042 new Frequency("50000000.0", FrequencyUnits.HERTZ); 043 044 //TODO construct w/ default attribute values? 045 046 //============================================================================ 047 // FREQUENCY 048 //============================================================================ 049 050 public Frequency getMinimumBandwidth() 051 { 052 //VLA correlator basebands have only one subband, so if this subband 053 //belongs to a baseband, its minimum is the baseband's width. 054 CorrelatorBaseband bb = getContainer(); 055 return bb == null ? MIN_BW.clone() : bb.getBandwidth(); 056 } 057 058 public Frequency getMaximumBandwidth() 059 { 060 //VLA correlator basebands have only one subband, so if this subband 061 //belongs to a baseband, its maximum is the baseband's width. 062 CorrelatorBaseband bb = getContainer(); 063 return bb == null ? MAX_BW.clone() : bb.getBandwidth(); 064 } 065 066 public boolean hasDiscreteBandwidths() { return true; } 067 068 public SortedSet<Frequency> getAllowableBandwidths() 069 { 070 SortedSet<Frequency> bws = new TreeSet<Frequency>(); 071 CorrelatorBaseband bb = getContainer(); 072 073 if (bb != null) 074 { 075 bws.add(bb.getBandwidth()); 076 } 077 else 078 { 079 double minHz = MIN_BW.toUnits(FrequencyUnits.HERTZ).doubleValue(); 080 081 bws.add(new Frequency(new BigDecimal(minHz), 082 FrequencyUnits.HERTZ).normalize()); 083 084 minHz *= 4.0; 085 086 double maxHz = MAX_BW.toUnits(FrequencyUnits.HERTZ).doubleValue(); 087 088 //Only non-negative powers-of-two multiples of min are allowed 089 for (double hertz = minHz; hertz <= maxHz; hertz *= 2.0) 090 { 091 bws.add(new Frequency(new BigDecimal(hertz), 092 FrequencyUnits.HERTZ).normalize()); 093 } 094 } 095 096 return bws; 097 } 098 099 //============================================================================ 100 // QUANTIZATION 101 //============================================================================ 102 103 /** Always returns an empty set. */ 104 public SortedSet<Integer> getAllowableRequantizations() 105 { 106 return new TreeSet<Integer>(); 107 } 108 109 /** Does nothing. */ 110 public void setRequantization(int bits) { } 111 112 //============================================================================ 113 // CORRELATION PRODUCTS 114 //============================================================================ 115 116 /** Always returns <i>null</i>. */ 117 protected VlaCorrProdGrp makeCorrelationProductGroup() 118 { 119 return null; 120 } 121 } 122 123 //============================================================================ 124 // DUMMY CLASSES 125 //============================================================================ 126 127 class VlaCorrProdGrp 128 extends CorrelationProductGroupAbs 129 { 130 protected void recalculateChannels() { needToRecalcChannels = false; } 131 132 @Override public TimeDuration getMinimumTotalIntegrationTime() 133 { 134 return null; 135 } 136 137 @Override public TimeDuration getTotalIntegrationTime() { return null; } 138 139 @Override public void setTotalIntegrationTime(TimeDuration td) { } 140 }