示例#1
0
        /// <summary>
        /// Check if the given Pd0Subsystem is equal to this object.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            //Check for null and compare run-time types.
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            Pd0Subsystem p = (Pd0Subsystem)obj;

            return(this.SsConfig.SubSystem.Code == p.SsConfig.SubSystem.Code &
                   this.NumBeams == p.NumBeams &
                   this.NumBins == p.NumBins &
                   this.BinSize == p.BinSize &
                   this.Blank == p.Blank &
                   this.NumPings == p.NumPings);
        }
示例#2
0
        /// <summary>
        /// Generate a subsystem based off the information in the ensemble.
        /// </summary>
        /// <param name="ens">Ensemble.</param>
        /// <returns>Subsystem Configuraiton based off the ensemble.</returns>
        public SubsystemConfiguration GenSubsystem(DataSet.Ensemble ens)
        {
            // Create a default subsystem config
            SubsystemConfiguration ss = new SubsystemConfiguration();

            int   beams    = 4;
            int   bins     = 30;
            float blank    = 0.0f;
            float binSize  = 1.0f;
            int   numPings = 1;

            // If the ensemble contains a configuration, use it as default
            if (ens.IsEnsembleAvail)
            {
                ss       = ens.EnsembleData.SubsystemConfig;
                beams    = ens.EnsembleData.NumBeams;
                bins     = ens.EnsembleData.NumBins;
                numPings = ens.EnsembleData.DesiredPingCount;
            }

            if (ens.IsAncillaryAvail)
            {
                blank   = ens.AncillaryData.FirstBinRange;
                binSize = ens.AncillaryData.BinSize;
            }

            // Generate a PD0 Subsystem
            Pd0Subsystem pd0Ss = new Pd0Subsystem(ss, beams, bins, binSize, blank, numPings);

            // If no entry yet, then add the first entry
            if (_ssList.Count == 0)
            {
                // Add the new entry in the dict
                SubsystemConfiguration newSsConfig = pd0Ss.SsConfig;
                newSsConfig.SubsystemConfigIndex = (byte)0;
                newSsConfig.CepoIndex            = (byte)0;
                newSsConfig.SubSystem.Index      = (ushort)0;

                _ssList.Add(pd0Ss, newSsConfig);

                return(newSsConfig);
            }

            // Check if it already exist in the dict
            foreach (var pd0SsFound in _ssList.Keys)
            {
                if (pd0SsFound == pd0Ss)
                {
                    return(_ssList[pd0SsFound]);
                }
            }

            // Add the new entry in the dict
            SubsystemConfiguration newSubsystemConfig = pd0Ss.SsConfig;

            newSubsystemConfig.SubsystemConfigIndex = (byte)_ssList.Count;
            newSubsystemConfig.CepoIndex            = (byte)_ssList.Count;
            newSubsystemConfig.SubSystem.Index      = (ushort)_ssList.Count;

            _ssList.Add(pd0Ss, newSubsystemConfig);

            return(newSubsystemConfig);
        }