summaryrefslogtreecommitdiff
path: root/cesar/cp2/pwl/doc/scilab/estimate_acl_stable.sce
blob: c1cf9c759374dd5d62bd7efe986f43c5c7863096 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPiDCOM Technologies.
// Nélio Laranjeiro
// 16-05-2008
// Cesar project.

// Launch a test to verify the estimation function.

// load the file, containing the function to generate a stable 50hz zero
// cross.
getf ('src/zc_capture_50hz_stable.sce');
getf ('src/estimateBP.sce');

// Initialise the environment.
date_ntb = [240000; 0];
// 50 Hz in ticks.
bp_ntb = 1e6;
zc_ntb = bp_ntb / 4;

// Write the result in a file.
result_file = file('open', 'result_stable.csv', 'unknown');

fprintf (result_file, "Per, Per(ATU), Zc 1, Zc 2\n");
for i = 1:1000
 res = cp_pwl_estimate_beacon_period (date_ntb, bp_ntb, zc_ntb);
 date_ntb(2) = res(2);
 date_ntb(1) = res(3);
 fprintf (result_file, "%d, %d, %d, %d\n", res(1), res(1) / 256, res(3), res(2));
end

// Close the file.
file('close', result_file);