From f58ab13e9b4b21ed78256bad649cfbb8b4c1ed0f Mon Sep 17 00:00:00 2001 From: morgan Date: Wed, 13 Dec 2023 17:14:20 +0800 Subject: [PATCH] improve jitter generation wave_gen: change to gussian jitter distribution wrapper: reduce gtx_jitter to meet real world performance docs: remove noise limitation --- README.md | 1 - src/wrpll_simulation/wave_gen.py | 5 +++-- src/wrpll_simulation/wrpll.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3384bf0..227e6d1 100644 --- a/README.md +++ b/README.md @@ -54,4 +54,3 @@ nix develop
## Limitation -1. The white noise is used to simulate jitter which may result in higher phase noise diff --git a/src/wrpll_simulation/wave_gen.py b/src/wrpll_simulation/wave_gen.py index f67ed6c..a0db5e7 100644 --- a/src/wrpll_simulation/wave_gen.py +++ b/src/wrpll_simulation/wave_gen.py @@ -3,8 +3,9 @@ import numba as nb from numba import njit -def white_noise(low, high, size, seed=None): - return np.random.default_rng(seed).uniform(low, high, size) + +def gussian_jitter(RMS_jitter, size, seed=None): + return np.random.default_rng(seed).normal(0, RMS_jitter/2, size) @njit(fastmath=True) diff --git a/src/wrpll_simulation/wrpll.py b/src/wrpll_simulation/wrpll.py index a0f92c0..4c1dea5 100644 --- a/src/wrpll_simulation/wrpll.py +++ b/src/wrpll_simulation/wrpll.py @@ -1,6 +1,6 @@ import numpy as np from wrpll_simulation.sim import simulation_jit -from wrpll_simulation.wave_gen import white_noise +from wrpll_simulation.wave_gen import gussian_jitter class WRPLL_simulator(): @@ -17,7 +17,7 @@ class WRPLL_simulator(): start_up_delay, i2c_comm_delay=85.6e-6, dcxo_settling_delay=100e-6, - gtx_jitter=370e-15, + gtx_jitter=200e-15, dcxo_freq=125_000_000, dcxo_jitter=95e-15, freq_acquisition_error=100, @@ -38,11 +38,11 @@ class WRPLL_simulator(): # init condition self.gtx_freq = gtx_freq - self.gtx_jitter = white_noise(-gtx_jitter, gtx_jitter, len(self.time), seed) + self.gtx_jitter = gussian_jitter(gtx_jitter, len(self.time), seed) self.dcxo_freq = dcxo_freq - self.h_jitter = white_noise(-dcxo_jitter, dcxo_jitter, len(self.time), seed) - self.m_jitter = white_noise(-dcxo_jitter, dcxo_jitter, len(self.time), seed) + self.h_jitter = gussian_jitter(dcxo_jitter, len(self.time), seed) + self.m_jitter = gussian_jitter(dcxo_jitter, len(self.time), seed) self.N = N self.helper_init_freq = helper_init_freq