Code covered by the BSD License  

Highlights from
A Synchronized Mil-Std-188-110B Receiver

image thumbnail

A Synchronized Mil-Std-188-110B Receiver

by

 

12 Nov 2008 (Updated )

Extends the shipping "188" modem. Features a synchronized 1200 bps / short interleave receiver.

mil_std_188110b_initmask_ship(block)
function milstd = mil_std_188110b_initmask_ship(block)
% COMMMILSTD188110B_INITMASK initializes the model variables in the workspace
% It stores the required values in a struct so it can be accessed by
% the different blocks in the model.

% Copyright 2008-2010 The MathWorks, Inc. 
% $Revision: 1.1.6.2 $  $Date: 2006/06/23 19:26:10 $

%-- Get parameters from mask
milstd.rate = str2double(get_param(block,'infRate'));
rates = [4800 2400 1200 600 300 150 75]; % bps  



milstd.idxRate = find(rates == milstd.rate);
milstd.interl = str2double(get_param(block,'intLength'));

interleaverLength =   [4.8 0.6 ]; % seconds, removed 0 it does not exist in model and 4.8 is first!
% interleaverLength = [0 0.6 4.8]; % seconds
milstd.idxInterl = find(interleaverLength == milstd.interl); 

milstd.Preamble_Switch=interleaverLength(milstd.idxInterl)*(1440/40)/0.6   +1;  
% length of preamble in frames of 40 samples each


%-- Set Binary Source Data Rate
set_param([bdroot(gcb) '/Bernoulli Binary Generator'],...
    'Ts',['1/' num2str(milstd.rate)]);
set_param([bdroot(gcb) '/Bernoulli Binary Generator'],...
    'sampPerFrame',[num2str(milstd.rate) '*0.2']);
% parameters for message subsystem
% get_param([bdroot(gcb) '/Message/Buffer'],'ObjectParameters')
set_param([bdroot(gcb) '/Message/Text'],...
    'Ts',['8/' num2str(milstd.rate)]);
set_param([bdroot(gcb) '/Message/Text'],...
    'nsamps',[num2str(milstd.rate) '*0.2']);
set_param([bdroot(gcb) '/Message/Buffer'],...
    'N',[num2str(milstd.rate) '*0.2']);


%-- Init interleaver table
interlMatrixCols= [576 72; ... %2400 bps
                   288 36; ... %1200bps
                   144 18; ... %600bps
                   144 18; ... %300bps
                   144 18];  %150bps
                   
%-- Assign number of rows and columns                   
numRow = 40;
switch milstd.rate
    case 2400
        numCol = interlMatrixCols(1,(milstd.interl==0.6)+1);
    case 1200
        numCol = interlMatrixCols(2,(milstd.interl==0.6)+1);
    case {600,300,150}
        numCol = interlMatrixCols(3,(milstd.interl==0.6)+1);
end

%-- Load interleaver step
%Preallocate memory
loadPosition= zeros(numRow,numCol);
for k = 0:numRow*numCol-1,  
    loadPosition(mod(k*9,numRow)+1,floor(k/numRow)+1) = k+1;
end

%-- Fetch interleaver step
rowPos = 0;
colPos = 0;
colIni = 0;

%Preallocate memory
interTable = zeros(1,numRow*numCol);
for k = 0:numRow*numCol-1,  
    interTable(k+1) = loadPosition(rowPos+1,colPos+1);
    
    rowPos = mod(rowPos+1,numRow);
    colPos = mod(colPos-17,numCol);
    
    if(rowPos == 0)
        colPos = colIni+1;
        colIni = colPos;
    end
end

%-- Output column vector
milstd.interTable = transpose(interTable);

% Creates lookup table for D1 and D2 bits in preamble sequence
% according to MIL-STD-188-110B TABLE XV
% these tables had the 2nd dimension reversed. The gui sets 1= LONG 2=short  RAB
% D1 Lookup table:
milstd.D1Table = ones(7,2);
milstd.D1Table(:,2) = [ 7 6 6 6 6 7 7]';
milstd.D1Table(:,1) = [ 0 4 4 4 4 5 5]';

% D2 Lookup table:
milstd.D2Table = ones(7,2);
milstd.D2Table(:,2) = [6 4 5 6 7 4 5]';
milstd.D2Table(:,1) = [0 4 5 6 7 4 5]';

% Channel symbol mapping for sync preamble
milstd.chSymMapping(:,1) = zeros(8,1);
milstd.chSymMapping(:,2) = [ 0 4 0 4 0 4 0 4]';
milstd.chSymMapping(:,3) = [ 0 0 4 4 0 0 4 4]';
milstd.chSymMapping(:,4) = [ 0 4 4 0 0 4 4 0]';
milstd.chSymMapping(:,5) = [ 0 0 0 0 4 4 4 4]';
milstd.chSymMapping(:,6) = [ 0 4 0 4 4 0 4 0]';
milstd.chSymMapping(:,7) = [ 0 0 4 4 4 4 0 0]';
milstd.chSymMapping(:,8) = [ 0 4 4 0 4 0 0 4]';

%-- Set Bits per channel symbol depending on the rate
switch milstd.rate
    case 2400
        milstd.bitsToSym = 3;
    case 1200
        milstd.bitsToSym = 2;
    case {600,300,150}
        milstd.bitsToSym = 1;
end

%-- Set repetition factor in error correction scheme depending
% on the rate
switch milstd.rate
    case {2400, 1200, 600}
        milstd.repFactor = 1;
        %Set encoder and decoder
        set_param([bdroot(gcb) '/FEC Encoder'],'blockChoice', ...
            'Rate 1/2 FEC Encoder');
        set_param([bdroot(gcb) '/FEC Decoder'],'blockChoice', ...
            'Rate 1/2 FEC Decoder');
    case 300
        milstd.repFactor = 2;
        %Set encoder and decoder to support repetition
        set_param([bdroot(gcb) '/FEC Encoder'],'blockChoice', ...
            'Rate 1/2 FEC Encoder with Repetition');
        set_param([bdroot(gcb) '/FEC Decoder'],'blockChoice', ...
            'Rate 1/2 FEC Decoder with Derepetition');
    case 150
        milstd.repFactor = 4;
        %Set encoder and decoder to support repetition
        set_param([bdroot(gcb) '/FEC Encoder'],'blockChoice', ...
            'Rate 1/2 FEC Encoder with Repetition');
        set_param([bdroot(gcb) '/FEC Decoder'],'blockChoice', ...
            'Rate 1/2 FEC Decoder with Derepetition');
end
%[EOF]

Contact us