Example #1
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.
            }
Example #2
0
            void FillSyncPatterns()
            {
                IQEncoder     Enc       = new IQEncoder(BITS_PER_SYMBOL, Constellation.Table_1_to_1, Constellation.ITable_8PSK, Constellation.QTable_8PSK, EncodingType.SCRAMBLE_ADD);
                SyncScrambler scrambler = new SyncScrambler();

                int SyncSymbolCounter = 0;

                foreach (int BitChanSymb in SyncPreamble)
                {
                    int[] sequence = ChanSymbToTribit[BitChanSymb];
                    scrambler.Init();
                    // repeat sequence 4 times
                    for (int i = 0; i < 4; i++)
                    {
                        foreach (int tribit in sequence)
                        {
                            Enc.Process(tribit, scrambler.DataNext(), SCRAMBLE_MASK, out PreamblePattern[SyncSymbolCounter]);
                            SyncSymbolCounter++;
                        }
                    }
                }

                IQ[] symb75 = new IQ[32];
                foreach (int[] sequence in ChanSymbToTribit)
                {
                    SyncSymbolCounter = 0;
                    scrambler.Init();
                    for (int i = 0; i < 4; i++)
                    {
                        foreach (int tribit in sequence)
                        {
                            Enc.Process(tribit, scrambler.DataNext(), SCRAMBLE_MASK, out symb75[SyncSymbolCounter]);
                            SyncSymbolCounter++;
                        }
                    }
                    SymbDetector.AddTarget(symb75);
                }
            }