summaryrefslogtreecommitdiff
path: root/cesar/cp2/pwl/doc/scilab/src/estimateBP.sce
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/cp2/pwl/doc/scilab/src/estimateBP.sce')
-rw-r--r--cesar/cp2/pwl/doc/scilab/src/estimateBP.sce27
1 files changed, 27 insertions, 0 deletions
diff --git a/cesar/cp2/pwl/doc/scilab/src/estimateBP.sce b/cesar/cp2/pwl/doc/scilab/src/estimateBP.sce
new file mode 100644
index 0000000000..2f81a1ff9e
--- /dev/null
+++ b/cesar/cp2/pwl/doc/scilab/src/estimateBP.sce
@@ -0,0 +1,27 @@
+// SPiDCOM Technologies.
+// NĂ©lio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+//Estimate the beacon period using the synchronisation of the PWL.
+//This shall use a function to generate the ACL frequency.
+
+// The function phy_clock_get_zero_cross_captured_date shall be written in
+// function of the test which is being done.
+// WARN : Import the file containing the function before using this script.
+
+// compute the estimation of the ACL period.
+// @param date_ntb the matrix containing the previous zc cross.
+// @param bp_ntb the beacon period in ntb clock base.
+// @param zc ntb the acl zero cross.
+// @return the [per, date_ntb']
+function [res] = cp_pwl_estimate_beacon_period (date_ntb, bp_ntb, zc_ntb)
+
+date_ntb(1) = phy_clock_get_zero_cross_captured_date (date_ntb(2));
+diff_ntb = modulo((date_ntb(1) - date_ntb(2)), bp_ntb + 10000);
+per_ntb = (4-(diff_ntb / zc_ntb)) * zc_ntb + diff_ntb;
+
+res = [per_ntb, date_ntb'];
+return res;
+
+endfunction