예제 #1
0
real IntegraleDeterministico::gauss()
{
    resetIntegral();

    real omega1 = ((real)128.)/225;
    real omega23 = ((322+13*sqrt((real)70))/900);
    real omega45 = ((322-13*sqrt((real)70))/900);

    real xi23 = ( ((real)1) /3)*sqrt(5-2*sqrt( (real)(10./7) ));
    real xi45 = ( ((real)1) /3)*sqrt(5+2*sqrt( (real)(10./7) ));

    for (int i = 0; i < intervalli(); i++) {

        real c = (x_i(i+1)+x_i(i))/2.;
        real m = (x_i(i+1)-x_i(i))/2.;

        // http://mathworld.wolfram.com/Legendre-GaussQuadrature.html

        add( m*omega1*f_test(c) ); // root = 0

        add( m*omega23*f_test(c - m*xi23) );
        add( m*omega23*f_test(c + m*xi23) );

        add( m*omega45*f_test(c - m*xi45) );
        add( m*omega45*f_test(c + m*xi45) );
    }

    return getIntegral();
}
예제 #2
0
real IntegraleDeterministico::trapezi()
{
    resetIntegral();

    for (int i = 0; i < intervalli(); i++) {
        add( h()/2 * (f_test(x_i(i)) + f_test(x_i(i+1)) ) );
    }

    return getIntegral();
}
예제 #3
0
real IntegraleDeterministico::simpson()
{
    resetIntegral();

    for (int i = 0; i < intervalli()-1; i+=2) {
        add( h()/3 * (f_test(x_i(i)) + 4*f_test(x_i(i+1)) + f_test(x_i(i+2)) ) );
    }

    return getIntegral();
}
예제 #4
0
//******************************************************************************
void PidController::set(glo_pid_params_t const & params)
{
    if (ki_ != params.ki)
    {
        // If user changes the integral gain then we want to zero out integral so that
        // the controller performance is only a function of the current (new) gains.
        resetIntegral();
    }

    kp_ = params.kp;
    kd_ = params.kd;
    ki_ = params.ki;
    lolimit_ = params.lolimit;
    hilimit_ = params.hilimit;
    integral_lolimit_ = params.integral_lolimit;
    integral_hilimit_ = params.integral_hilimit;
}