Пример #1
0
func main() {

	N := 2048
	begin := time.Now()
	var ofdm customchips.OFDM
	ofdm.InitializeChip()
	ofdm.NPoint = N

	// fmt.Printf("\n OFDM = %v", ofdm)
	/// Input
	inCHA := gocomm.NewComplex128AChannel()
	// inCH := gocomm.NewComplex128Channel()
	var dataArray gocomm.SComplex128AObj

	x := sources.RandNCVec(N, 1)
	dataArray.Ch = x
	dataArray.MaxExpected = 1
	inCHA <- dataArray
	go ofdm.Ifft(inCHA)
	go ofdm.Fft(ofdm.PinByName("outputPin0").Channel.(gocomm.Complex128AChannel))
	outCHA := ofdm.PinByName("outputPin1").Channel.(gocomm.Complex128AChannel)
	data := <-outCHA
	/// Analyse
	fmt.Printf("\nX=%f", x[0:16])
	fmt.Printf("\nOutput=%f", data.Ch[0:16])
	// xcap := dsp.ExtFFT_C(data.Ch, N)
	// fmt.Printf("\nXcap=%f", xcap[0:16])

	fmt.Printf("\nTime Elapsed : %v\n", time.Since(begin))
}
Пример #2
0
func main() {

	N := 20 /// 20 samples
	L := 4  /// 5tap channel
	begin := time.Now()

	var cdma core.CDMA
	cdma.InitializeChip()
	cdma.SetSpreadCode(vlib.NewOnesC(L), true)

	samples := vlib.VectorC(sources.RandNCVec(N, 1))
	var data gocomm.SComplex128Obj
	/// METHOD A
	data.Ts = 1
	data.TimeStamp = 0
	data.MaxExpected = N
	data.Message = ""
	for i := 0; i < N; i++ {
		data.Next(samples[i])
		chips := cdma.SpreadFn(data)
		output := cdma.DeSpreadFn(chips)
		fmt.Printf("\nTxSymbol %v ", data)
		// fmt.Printf("\nTx %v ", chips)
		fmt.Printf("\nRxSymbol %v ", output)
	}

	/// METHOD B
	// dataArray.MaxExpected = samples.Size()
	// inCHA := gocomm.NewComplex128Channel()
	// outputPin := filter.PinByID(1)

	// go filter.Filter(inCHA)
	// go chipset.Sink(outputPin)
	// /// Actual data pushing
	// for i := 0; i < N; i++ {
	// 	dataArray.MaxExpected = N
	// 	dataArray.Ch = samples[i]
	// 	inCHA <- dataArray
	// }

	//fmt.Printf("\nFilter Residues %v", filter.FilterMemory)

	//  Of code
	fmt.Printf("\nTime Elapsed : %v\n", time.Since(begin))
}