Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
759372ca
Commit
759372ca
authored
Oct 25, 2013
by
Tomasz Wlostowski
Committed by
Alessandro Rubini
Jan 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
softpll: some experiments with PI gains and higher order control loop (wip)
parent
a7da99f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
spll_helper.c
rt/softpll/spll_helper.c
+16
-4
spll_helper.h
rt/softpll/spll_helper.h
+1
-0
spll_main.c
rt/softpll/spll_main.c
+2
-2
No files found.
rt/softpll/spll_helper.c
View file @
759372ca
...
...
@@ -11,16 +11,22 @@
#include "spll_helper.h"
#include "spll_debug.h"
const
int
helper_precomp_coefs
[]
=
{
/*b0*/
60648
,
/*b1*/
60648
,
/*b2*/
0
,
/*a1*/
55760
,
/*a2*/
0
};
void
helper_init
(
struct
spll_helper_state
*
s
,
int
ref_channel
)
{
/* Phase branch PI controller */
s
->
pi
.
y_min
=
5
;
s
->
pi
.
y_max
=
(
1
<<
DAC_BITS
)
-
5
;
s
->
pi
.
kp
=
(
int
)(
0
.
3
*
32
.
0
*
16
.
0
);
// / 2;
s
->
pi
.
ki
=
(
int
)(
0
.
03
*
32
.
0
*
3
.
0
);
// / 2;
s
->
pi
.
kp
=
150
;
//(int)(0.3 * 32.0 * 16.0); // / 2;
s
->
pi
.
ki
=
2
;
//(int)(0.03 * 32.0 * 3.0); // / 2;
s
->
pi
.
anti_windup
=
1
;
/* Phase branch lock detection */
...
...
@@ -29,6 +35,7 @@ void helper_init(struct spll_helper_state *s, int ref_channel)
s
->
ld
.
delock_samples
=
100
;
s
->
ref_src
=
ref_channel
;
s
->
delock_count
=
0
;
}
int
helper_update
(
struct
spll_helper_state
*
s
,
int
tag
,
...
...
@@ -59,6 +66,8 @@ int helper_update(struct spll_helper_state *s, int tag,
err
=
HELPER_ERROR_CLAMP
;
}
// err = biquad_update(&s->precomp, err);
if
((
tag
+
s
->
p_adder
)
>
HELPER_TAG_WRAPAROUND
&&
s
->
p_setpoint
>
HELPER_TAG_WRAPAROUND
)
{
s
->
p_adder
-=
HELPER_TAG_WRAPAROUND
;
...
...
@@ -95,6 +104,9 @@ void helper_start(struct spll_helper_state *s)
pi_init
((
spll_pi_t
*
)
&
s
->
pi
);
ld_init
((
spll_lock_det_t
*
)
&
s
->
ld
);
biquad_init
(
&
s
->
precomp
,
helper_precomp_coefs
,
16
);
spll_enable_tagger
(
s
->
ref_src
,
1
);
spll_debug
(
DBG_EVENT
|
DBG_HELPER
,
DBG_EVT_START
,
1
);
}
rt/softpll/spll_helper.h
View file @
759372ca
...
...
@@ -33,6 +33,7 @@ struct spll_helper_state {
int
delock_count
;
spll_pi_t
pi
;
spll_lock_det_t
ld
;
spll_biquad_t
precomp
;
};
void
helper_init
(
struct
spll_helper_state
*
s
,
int
ref_channel
);
...
...
rt/softpll/spll_main.c
View file @
759372ca
...
...
@@ -28,8 +28,8 @@ void mpll_init(struct spll_main_state *s, int id_ref,
s
->
pi
.
y_max
=
65530
;
s
->
pi
.
anti_windup
=
1
;
s
->
pi
.
bias
=
65000
;
s
->
pi
.
kp
=
1100
;
// / 2;
s
->
pi
.
ki
=
30
;
// / 2;
s
->
pi
.
kp
=
1
500
;
//1
100; // / 2;
s
->
pi
.
ki
=
7
;
//
30; // / 2;
s
->
delock_count
=
0
;
/* Freqency branch lock detection */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment