def lin_cancel_simulation(params: dict, sigma, h_si, h_s) -> np.ndarray: system_model = PreviousSystemModel( sigma, params['gamma'], params['phi'], params['PA_IBO_dB'], params['PA_rho'], params['LNA_IBO_dB'], params['LNA_rho'], h_si, params['h_si_len'], h_s, params['h_s_len'], params['TX_IQI'], params['PA'], params['LNA'], params['RX_IQI']) system_model.set_lna_a_sat( params['lin_n'], params['LNA_IBO_dB'], ) system_model.transceive_si(params['lin_n']) h_lin = fd.ls_estimation(system_model.x[0:int(params['lin_n'] / 2)], system_model.y, params['h_si_len']) system_model.transceive_si_s(params['lin_n'], ) yCanc = fd.si_cancellation_linear( system_model.x[0:int(params['lin_n'] / 2)], h_lin) cancelled_y = system_model.y - yCanc s_hat = cancelled_y * h_s.conj() / (np.abs(h_s)**2) d_hat = m.demodulate_qpsk(s_hat) d_hat_len = d_hat.shape[0] error = np.sum(system_model.d_s[0:d_hat_len] != d_hat) return error
def non_cancel_simulation(param: dict, sigma, h_si, h_s) -> np.ndarray: system_model = PreviousSystemModel( sigma, params['gamma'], params['phi'], params['PA_IBO_dB'], params['PA_rho'], params['LNA_IBO_dB'], params['LNA_rho'], h_si, params['h_si_len'], h_s, params['h_s_len'], ) system_model.set_lna_a_sat( params['lin_n'], params['LNA_IBO_dB'], ) system_model.transceive_si_s( params['lin_n'], ) s_hat = system_model.y * h_s.conj() / (np.abs(h_s)**2) d_hat = m.demodulate_qpsk(s_hat) d_hat_len = d_hat.shape[0] error = np.sum(system_model.d_s[0:d_hat_len] != d_hat) return error
def previous_non_lin(params: dict, sigma, h_si, h_s) -> PreviousNNModel: training_samples = int(np.floor(params['n'] * params['trainingRatio'])) test_n = params['n'] - training_samples system_model = PreviousSystemModel( sigma, params['gamma'], params['phi'], params['PA_IBO_dB'], params['PA_rho'], params['LNA_IBO_dB'], params['LNA_rho'], h_si, params['h_si_len'], h_s, params['h_s_len'], params['TX_IQI'], params['PA'], params['LNA'], params['RX_IQI']) system_model.set_lna_a_sat( test_n, params['LNA_IBO_dB'], ) system_model.transceive_si(params['n']) previous_nn_model = PreviousNNModel(params['h_si_len'], params['p_nHidden'], params['p_learningRate']) previous_nn_model.learn(system_model.x[0:int(params['n'] / 2)], system_model.y, params['p_trainingRatio'], params['h_si_len'], params['p_nEpochs'], params['p_batchSize']) system_model.transceive_si_s(test_n, ) previous_nn_model.cancel( system_model.x[0:int(test_n / 2)], system_model.y, params['h_si_len'], ) s_hat = previous_nn_model.cancelled_y * h_s.conj() / (np.abs(h_s)**2) d_hat = m.demodulate_qpsk(s_hat) d_hat_len = d_hat.shape[0] error = np.sum(system_model.d_s[0:d_hat_len] != d_hat) previous_nn_model.error = error return previous_nn_model
for trials_index in tqdm(range(params['SNR_AVERAGE'])): h_si = m.channel(1, params['h_si_len']) h_s = m.channel(1, params['h_s_len']) for sigma_index, sigma in enumerate(sigmas): logging.info("SNR_AVERAGE_index:" + str(trials_index)) logging.info("sigma_index:" + str(sigma_index)) system_model = PreviousSystemModel( sigma, params['gamma'], params['phi'], params['PA_IBO_dB'], params['PA_rho'], params['LNA_IBO_dB'], params['LNA_rho'], h_si, params['h_si_len'], h_s, params['h_s_len'], ) system_model.transceive_si(params['n']) previous_nn_model = PreviousNNModel(params['h_si_len'], params['nHidden'], params['learningRate']) previous_nn_model.learn(system_model.x[0:int(params['n'] / 2)], system_model.y, params['trainingRatio'], params['h_si_len'], params['nEpochs'],
"n_hidden": 17, "learning_rate": 0.004, "training_ratio": 0.8, "batch_size": 32, "nEpochs": 20 } # データを生成する snrs_db = np.linspace(params['SNR_MIN'], params['SNR_MAX'], params['SNR_NUM']) sigmas = m.sigmas(snrs_db) # SNR(dB)を元に雑音電力を導出 h_si = m.channel(1, params['h_si_len']) for sigma_index, sigma in enumerate(sigmas): system_model = PreviousSystemModel() system_model.transceive_si( params['n'], 0, params['gamma'], params['phi'], params['PA_IBO_dB'], params['PA_rho'], params['LNA_IBO_dB'], params['LNA_rho'], h_si, params['h_si_len'], ) plt.figure() plt.scatter(system_model.y.real,