示例#1
0
            void InitReceiveData()
            {
                if (CurrentMode.Mode == MILSTD_188.Mode.D_4800N)
                {
                    this.Interleaver = new Interleaver_188_110A_4800();
                }
                else
                {
                    this.Interleaver = new Interleaver_188_110A(CurrentMode.InterleaverColumns, CurrentMode.InterleaverRows);
                }
                this.TotalPatternsInBlock = CurrentMode.BlockLength / (CurrentMode.ProbeDataSymbols + CurrentMode.UnknownDataSymbols);
                this.ProbeCounter         = 0;
                this.ProbeTarget          = new IQ[CurrentMode.ProbeDataSymbols];
                this.Probe = new int[CurrentMode.ProbeDataSymbols];

                this.DataBlock = new int[CurrentMode.UnknownDataSymbols];
                this.FECBuffer = new byte[Interleaver.Length];
                this.OutputData.Clear();

                this.DataScrambler = new LFSR_188_110A();
                if (CurrentMode.Mode == MILSTD_188.Mode.D_4800N)
                {
                    this.FECDecoder = null;
                }
                else
                {
                    this.FECDecoder = new VitDecoder(ConvEncoderType.Truncate, FECEncoderRate * CurrentMode.RepeatDataBits, FECEncoderConstraint, FECEncoderPoly, -1, 8, 0);
                }
                this.ProbeCorr = new Correlator(CORR_TYPE.NONE, CurrentMode.ProbeDataSymbols, CurrentMode.ProbeDataSymbols, 0, 0, 0, 0);
                this.Decoder   = new IQDecoder(CurrentMode.BitsPerSymbol, CurrentMode.BitsToSymbolTable, Constellation.IQTable_8PSK, EncodingType.SCRAMBLE_ADD);
                this.Decoder.StartCorrectionProcess(CurrentMode.UnknownDataSymbols + CurrentMode.ProbeDataSymbols);
            }
示例#2
0
            public TxModem(MILSTD_188.Mode modemMode, float processingFreq, float outputFreq, float[] symbolFilter, float[] outputFilter)
            {
                this.ModemMode = modemMode;
                // Set up all the required parameters
                MILSTD188_110B.modemModes[ModemMode].GetModeInfo(out ModemMode, out D1, out D2, out PreambleSize, out InterleaverRows,
                                                                 out InterleaverColumns, out UnknownDataSymbols, out ProbeDataSymbols, out BlockLength,
                                                                 out RepeatDataBits, out BitsPerSymbol, out MGDTable);

                if (modemMode == MILSTD_188.Mode.D_4800N)
                {
                    this.DataInterleaver = new Interleaver_188_110A_4800();
                }
                else
                {
                    this.DataInterleaver = new Interleaver_188_110A(InterleaverColumns, InterleaverRows);
                }
                this.DataInterleaver.Init();
                this.DataScrambler     = new LFSR_188_110A();
                this.PreambleScrambler = new SyncScrambler();
                if (modemMode == MILSTD_188.Mode.D_4800N)
                {
                    this.FECEncoder = null;
                }
                else
                {
                    this.FECEncoder = new ConvEncoder(ConvEncoderType.Truncate, FECEncoderRate * RepeatDataBits, FECEncoderConstraint, FECEncoderPoly, -1, 8);
                }

                this.Encoder      = new IQEncoder(BITS_PER_SYMBOL, Constellation.Table_1_to_1, Constellation.IQTable_8PSK, EncodingType.SCRAMBLE_ADD);
                this.Modulator    = new IQModulator(CARRIER_FREQ, CARRIER_FREQ, NUM_FREQ, processingFreq, SYMBOLRATE, symbolFilter);
                this.OutputBuff   = new float[(int)(processingFreq / SYMBOLRATE)];
                this.OutputFilter = new FIR(outputFilter, (int)(processingFreq / outputFreq));

                this.FlushModulatorLength = 0;
                if (symbolFilter != null)
                {
                    FlushModulatorLength += (symbolFilter.Length * 2);
                }
                if (outputFilter != null)
                {
                    FlushModulatorLength += (outputFilter.Length * 2);
                }

                this.TotalPatternsInBlock = BlockLength / (ProbeDataSymbols + UnknownDataSymbols);

                // FEC Size and Counter - reinitialize FEC on interleaver boundaries
                FECBuffer  = new byte[this.DataInterleaver.Length];
                FECLength  = this.DataInterleaver.Length / (FECEncoderRate * RepeatDataBits);
                FECCounter = 0;     // Re-initialize FEC coder on interleaver boundaries.
            }
示例#3
0
            public TxModem(MILSTD_188.Mode modemMode, float processingFreq, float outputFreq, float[] symbolFilter, float[] outputFilter)
            {
                this.ModemMode = modemMode;
                // Set up all the required parameters
                MILSTD188_110B_39.modemModes[ModemMode].GetModeInfo(out ModemMode, out D1, out D2, out PreambleSize, out InterleavingDegree,
                                                                    out InterleaverNumBlocks, out BitsPerCodeword, out SyncSymbols, out BlockLength,
                                                                    out RepeatDataBits, out BitsPerSymbol, out BitsToSymbols);

                this.DataRate       = Baudrates[D2];
                this.DiversityArray = Diversity_New[D2];

                this.InputBlockSize = (int)(processingFreq / SYMBOLRATE);

                // For 2400 baud we use RS(14, 10), for all others - RS(7,3)
                int SymbTotal = (DataRate == 2400) ? 14 : 7;
                int SymbData  = (DataRate == 2400) ? 10 : 3;

                DataSymbols = BitsPerCodeword * InterleavingDegree * InterleaverNumBlocks;
                // DataSymbols = TotalBits * RS_BITS * InterleavingDegree * InterleaverNumBlocks;  // The same
                // Here is the magic formula that keeps the incoming and outgoing bitrate:
                //   @ 2400      K = (16 * Int * NumBlocks ) / 9
                //   @ any other K = (4 * Int * NumBlocks ) / 9
                SyncSymbols = (((DataRate == 2400) ? 16 : 4) * InterleavingDegree * InterleaverNumBlocks) / 9;
                SyncLFSR    = new LFSR__188_110B_39(9, 0x0116);
                // Calculate the seed value - the scrambler repeats every 2^9 - 1 = 511 symbols
                // Start with the desired end value and count the (511 - necessary number of symbols)
                int NumShift = 0x1FF - SyncSymbols; if (NumShift < 0)

                {
                    NumShift += 0x1FF;
                }

                SyncLFSR.Init(0x1FF);
                SyncLFSR.Shift(NumShift + 1);
                LSFRSeed = SyncLFSR.Value & 0x1FF;

                this.DataInterleaver = new Interleaver_188_110B_39(InterleavingDegree, InterleaverNumBlocks, RS_BITS, SymbTotal, SymbData);
                this.DataInterleaver.Init();

                this.DiversitySpreader = new DataSpreader <byte>(BitsPerSymbol, this.DiversityArray);
                this.DiversitySpreader.Init();

                this.Encoder = new IQEncoder[NUM_FREQ];
                for (int i = 0; i < NUM_FREQ; i++)
                {
                    Encoder[i] = new IQEncoder(BITS_PER_SYMBOL, Constellation.BitsToPhase_39, Constellation.IQTable_QPSK45,
                                               EncodingType.DIFF_IQ);
                }

                this.Modulator         = new OFDMFFTModulator(CARRIER_FREQ_LO, CARRIER_FREQ_HI, NUM_FREQ, processingFreq, SYMBOLRATE);
                this.PreambleModulator = new IQModulator(CARRIER_FREQ_LO, CARRIER_FREQ_HI, NUM_FREQ, processingFreq, SYMBOLRATE, null);
                this.DopplerTone       = new Generator();
                this.DopplerTone.Init(DOPPLER_FREQ + FREQ_OFFSET, processingFreq, 0);
                this.OutputFilter = new FIR(outputFilter, (int)(processingFreq / outputFreq));

                this.FlushModulatorLength = 20;
                if (symbolFilter != null)
                {
                    FlushModulatorLength += (symbolFilter.Length * 2);
                }
                if (outputFilter != null)
                {
                    FlushModulatorLength += (outputFilter.Length * 2);
                }
            }