Signed-off-by: Richard Cochran <[email protected]>
---
config.c | 8 +-------
config.h | 1 -
pi.c | 12 ++++++------
pi.h | 7 -------
ptp4l.c | 1 -
5 files changed, 7 insertions(+), 22 deletions(-)
diff --git a/config.c b/config.c
index 2f184dd..1ae564f 100644
--- a/config.c
+++ b/config.c
@@ -98,6 +98,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_INT("max_frequency", 900000000, 0, INT_MAX),
GLOB_ITEM_DBL("pi_integral_const", 0.0, 0.0, DBL_MAX),
GLOB_ITEM_DBL("pi_integral_exponent", 0.4, -DBL_MAX, DBL_MAX),
+ GLOB_ITEM_DBL("pi_integral_norm_max", 0.3, DBL_MIN, 2.0),
GLOB_ITEM_DBL("pi_integral_scale", 0.0, 0.0, DBL_MAX),
GLOB_ITEM_DBL("pi_proportional_const", 0.0, 0.0, DBL_MAX),
GLOB_ITEM_DBL("pi_proportional_exponent", -0.3, -DBL_MAX, DBL_MAX),
@@ -457,7 +458,6 @@ static enum parser_result parse_global_setting(const char
*option,
const char *value,
struct config *cfg)
{
- double df;
int i, val, cfg_ignore = cfg->cfg_ignore;
unsigned int uval;
unsigned char mac[MAC_LEN];
@@ -548,12 +548,6 @@ static enum parser_result parse_global_setting(const char
*option,
cfg->dds.freq_est_interval = val;
pod->freq_est_interval = val;
- } else if (!strcmp(option, "pi_integral_norm_max")) {
- r = get_ranged_double(value, &df, DBL_MIN, 2.0);
- if (r != PARSED_OK)
- return r;
- *cfg->pi_integral_norm_max = df;
-
} else if (!strcmp(option, "sanity_freq_limit")) {
r = get_ranged_int(value, &val, 0, INT_MAX);
if (r != PARSED_OK)
diff --git a/config.h b/config.h
index 9b9535f..bdfead7 100644
--- a/config.h
+++ b/config.h
@@ -69,7 +69,6 @@ struct config {
struct port_defaults pod;
enum servo_type clock_servo;
- double *pi_integral_norm_max;
int *ntpshm_segment;
unsigned char *ptp_dst_mac;
diff --git a/pi.c b/pi.c
index 0f34f31..35556e1 100644
--- a/pi.c
+++ b/pi.c
@@ -35,9 +35,6 @@
#define FREQ_EST_MARGIN 0.001
-/* These take their values from the configuration file. (see ptp4l.c) */
-double configured_pi_ki_norm_max = 0.3;
-
struct pi_servo {
struct servo servo;
int64_t offset[2];
@@ -55,6 +52,7 @@ struct pi_servo {
double configured_pi_kp_norm_max;
double configured_pi_ki_scale;
double configured_pi_ki_exponent;
+ double configured_pi_ki_norm_max;
};
static void pi_destroy(struct servo *servo)
@@ -165,8 +163,8 @@ static void pi_sync_interval(struct servo *servo, double
interval)
s->kp = s->configured_pi_kp_norm_max / interval;
s->ki = s->configured_pi_ki_scale * pow(interval,
s->configured_pi_ki_exponent);
- if (s->ki > configured_pi_ki_norm_max / interval)
- s->ki = configured_pi_ki_norm_max / interval;
+ if (s->ki > s->configured_pi_ki_norm_max / interval)
+ s->ki = s->configured_pi_ki_norm_max / interval;
pr_debug("PI servo: sync interval %.3f kp %.3f ki %.6f",
interval, s->kp, s->ki);
@@ -206,6 +204,8 @@ struct servo *pi_servo_create(struct config *cfg, int fadj,
int sw_ts)
config_get_double(cfg, NULL, "pi_integral_scale");
s->configured_pi_ki_exponent =
config_get_double(cfg, NULL, "pi_integral_exponent");
+ s->configured_pi_ki_norm_max =
+ config_get_double(cfg, NULL, "pi_integral_norm_max");
if (s->configured_pi_kp && s->configured_pi_ki) {
/* Use the constants as configured by the user without
@@ -216,7 +216,7 @@ struct servo *pi_servo_create(struct config *cfg, int fadj,
int sw_ts)
s->configured_pi_kp_exponent = 0.0;
s->configured_pi_ki_exponent = 0.0;
s->configured_pi_kp_norm_max = MAX_KP_NORM_MAX;
- configured_pi_ki_norm_max = MAX_KI_NORM_MAX;
+ s->configured_pi_ki_norm_max = MAX_KI_NORM_MAX;
} else if (!s->configured_pi_kp_scale || !s->configured_pi_ki_scale) {
if (sw_ts) {
s->configured_pi_kp_scale = SWTS_KP_SCALE;
diff --git a/pi.h b/pi.h
index ff16506..feb3ebe 100644
--- a/pi.h
+++ b/pi.h
@@ -21,13 +21,6 @@
#include "servo.h"
-/**
- * This variable determines the normalized maximum in the formula used to set
- * the integral constant of the PI controller from the sync interval.
- * ki = min(ki_scale * sync^ki_exponent, ki_norm_max / sync)
- */
-extern double configured_pi_ki_norm_max;
-
struct servo *pi_servo_create(struct config *cfg, int fadj, int sw_ts);
#endif
diff --git a/ptp4l.c b/ptp4l.c
index c4d1ce8..b74cda6 100644
--- a/ptp4l.c
+++ b/ptp4l.c
@@ -103,7 +103,6 @@ static struct config cfg_settings = {
.transport = TRANS_UDP_IPV4,
.clock_servo = CLOCK_SERVO_PI,
- .pi_integral_norm_max = &configured_pi_ki_norm_max,
.ntpshm_segment = &ntpshm_segment,
.ptp_dst_mac = ptp_dst_mac,
--
2.1.4
------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel