Exemple #1
0
        /// <summary>
        /// Updates the parameter to be adapted acording to the given input and time/iteration.
        /// Follows a discrete-time extremum seeking adaptation law.
        /// </summary>
        /// <param name="u">The input signal.</param>
        /// <param name="t">The current time/iteration.</param>
        /// <returns>The updated parameter value.</returns>
        public float UpdateParameter(float u, float t)
        {
            // Clear states variable
            states.Clear();

            // Get gradient estimate
            float[] duArr = estimator.Update(u, t);

            // Update parameter estimate
            float thetaBar = optimiser.Update(duArr);

            // Add excitation dither
            theta = thetaBar + dither.Update(t);

            // Clamping
            if (theta > thetaMax)
            {
                theta = thetaMax;
            }
            else if (theta < thetaMin)
            {
                theta = thetaMin;
            }

            // Add data to states
            states.AddRange(duArr);
            states.Add(thetaBar);

            return(theta);
        }
Exemple #2
0
        /// <summary>
        /// Updates the parameter to be adapted acording to the given input and time/iteration.
        /// Follows a discrete-time extremum seeking adaptation law.
        /// </summary>
        /// <param name="u">The input signal.</param>
        /// <param name="t">The current time/iteration.</param>
        /// <returns>The updated parameter value.</returns>
        public float UpdateParameter(float u, float t)
        {
            // Clear states variable
            states.Clear();

            // Filter input signal
            float uf = filter.Update(u);

            // Get derivatives estimates
            float[] duArr = estimator.Update(uf, t);

            // Update parameter estimate
            float thetaBar = optimiser.Update(duArr);

            // Add excitation dither
            theta = thetaBar + dither.Update(t);

            // Clamping
            if (theta > thetaMax)
            {
                theta = thetaMax;
            }
            else if (theta < thetaMin)
            {
                theta = thetaMin;
            }

            // Add data to states
            states.Add(uf);
            states.AddRange(duArr);
            states.Add(thetaBar);

            return(theta);
        }