discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] gr-Trellis FSM


From: valentac
Subject: [Discuss-gnuradio] gr-Trellis FSM
Date: Fri, 30 Mar 2012 11:43:24 -0700 (PDT)

I've implemented a Manchester Decoder via an FSM using the combined Viterbi
algorithm in gr-trellis, and its working great decoding my signal. However,
I've noticed that after ~1000 times running (see code), I get an error...

what(): fsm::fsm(const char *name): file open error

I'd expect this to happen in case of a buffer overrun or RAM limitation, but
even if I reduce the time between packets, I get the same error. 

Thanks for your help.




***************************************************************
Manchester_FSM_test.py
*************************************************************** 
#!/usr/bin/env python

from gnuradio import gr
from gnuradio import trellis
from gnuradio import eng_notation
import math
import sys
#import fsm_utils
from gnuradio.eng_option import eng_option
from optparse import OptionParser

def main():
        for i in range(2005):
        
x=manchester([1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0,1,0,0,1,1,0,1,0])
                print i


def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,data_in):
    tb = gr.top_block ()


    src = gr.vector_source_s(data_in)

    #src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts
    #s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) #
unpack shorts to symbols compatible with the FSM input cardinality
    #enc = trellis.encoder_bb(f,0) # initial state = 0
    #mod = gr.chunks_to_symbols_sf(constellation,dimensionality)
    va =
trellis.viterbi_combined_sb(f,K,0,-1,dimensionality,constellation,trellis.TRELLIS_EUCLIDEAN)
# Put -1 if the Initial/Final states are not set.
    dst = gr.vector_sink_b();
    tb.connect (src,va,dst)

    tb.run()
   
    return dst.data()


def manchester(data_in):


    fname="fsm_files/manchester_encoder.fsm"


    # system parameters
    f=trellis.fsm(fname) # get the FSM specification from a file (will
hopefully be automated in the future...)

    Kb=64
    bitspersymbol = int(round(math.log(f.I())/math.log(2))) # bits per FSM
input symbol
    K=Kb/bitspersymbol # packet size in trellis steps

    dimensionality = 2
    constellation = [0, 0,0,1,1,0,1,1] 
    if len(constellation)/dimensionality != f.O():
        sys.stderr.write ('Incompatible FSM output cardinality and
modulation size.\n')
        #sys.exit (1)

    
   
(data)=run_test(f,Kb,bitspersymbol,K,dimensionality,constellation,data_in) #
run experiment with different seed to get different noise realizations
    return data

if __name__ == '__main__':
    main()


*************************************************************** 
Manchester_encoder.fsm
*************************************************************** 
2 2 4

0 1
0 1

1 2
1 2

Manchester Encoder
-- 
View this message in context: 
http://old.nabble.com/gr-Trellis-FSM-tp33544924p33544924.html
Sent from the GnuRadio mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]