Esempio n. 1
0
func NewIIDChannel() ChannelParam {
	var result ChannelParam
	result.Ts = -1
	result.Mode = "IID"
	result.pdp = vlib.NewOnesF(1)
	result.Coeff = vlib.NewOnesC(1)
	return result
}
Esempio n. 2
0
func (m *ChannelParam) Validate() {

	if m.Ts == -1 {
		m.Mode = "IID"
	}
	if m.Ts == 0 {
		m.Mode = "AWGN"
	}
	if m.pdp.Size() == 0 && m.Coeff.Size() == 0 {
		m.pdp = vlib.NewOnesF(1)
		m.Coeff = vlib.NewOnesC(1)
	}
	if m.pdp.Size() == 0 && m.Coeff.Size() != 0 {
		m.pdp = vlib.NewOnesF(m.Coeff.Size())
	}
	m.FilterMemory = vlib.NewOnesC(m.Coeff.Size())
	m.TimeStamp = -1
}
Esempio n. 3
0
func DefaultChannel() ChannelParam {
	var result ChannelParam
	result.Ts = 0
	result.Mode = "AWGN"
	result.pdp = vlib.NewOnesF(1)
	result.PowerInDBm = 0
	result.Coeff = vlib.NewOnesC(1)
	return result
}
Esempio n. 4
0
func (s *setup) Run() {
	s.snr_ber = make(map[float64]float64)
	s.snr_block = make(map[float64]float64)
	s.snr_ber1 = make(map[float64]float64)
	s.snr_block1 = make(map[float64]float64)
	hn := vlib.NewOnesF(1)

	spcode := vlib.NewOnesC(s.SF)
	// snr = vlib.VectorF{0, 10, 100}
	// snr = vlib.ToVectorF("0:2:20")
	fmt.Printf("\nSNR : %v", s.snr)
	fmt.Printf("\nhn : %v", hn)
	// linkresult := make(map[float64]float64, 1)
	// linkresult1 := make(map[float64]float64, 1)

	outCH := make([]gocomm.FloatChannel, s.snr.Size())
	// outCH1 := make([]gocomm.FloatChannel, snr.Size())
	fmt.Printf("\n SNR ")
	for i := 0; i < len(s.snr); i++ {
		// blocks := s.snr_block[snr[i]] + 1
		fmt.Printf("%2.2f ", s.snr[i])
	}

	fmt.Printf("\n")
	for i := 0; i < s.snr.Size(); i++ {
		// s.wg.Add(1)
		outCH[i] = gocomm.NewFloatChannel()
		// outCH1[i] = gocomm.NewFloatChannel()
		s.wg.Add(1)
		go s.SimulateLinkFn(s.snr[i], hn, spcode, outCH[i], 0)
		// go s.SimulateLinkFn(snr[i]-2, hn, spcode, outCH1[i], 1)

	}

	s.wg.Wait()

	log.Printf("\nSNR : %v", s.snr)
	log.Printf("\nBER : %v", s.snr_ber)
	log.Printf("\nhn : %v", hn)
	s.Results = string(Print(s.snr_ber, "", ""))
	log.Printf("Result %v", s.Results)
}