fn calculate_available_power(&self, temperature: Celsius, time_delta: Seconds) -> Watts {
        let controller_params = &self.config.policy_params.controller_params;
        let temperature_error = controller_params.target_temperature.0 - temperature.0;
        let error_integral = clamp(
            self.state.error_integral.get() + temperature_error * time_delta.0,
            controller_params.e_integral_min,
            controller_params.e_integral_max,
        );
        self.state.error_integral.set(error_integral);

        let p_term = temperature_error * controller_params.proportional_gain;
        let i_term = error_integral * controller_params.integral_gain;
        let power_available = controller_params.sustainable_power.0 + p_term + i_term;

        Watts(power_available)
    }
/// A PID control algorithm that uses temperature as the measured process variable, and
/// available power as the control variable. Each call to the function will also
/// update the state variable `error_integral` to be used on subsequent iterations.
A PID control algorithm that uses temperature as the measured process variable, and
available power as the control variable. Each call to the function will also
update the state variable `error_integral` to be used on subsequent iterations.
A PID control algorithm that uses temperature as the measured process variable and available power as the control variable . Each call to the function will also update the state variable ` error_integral ` to be used on subsequent iterations .
fn calculate_available_power(&self, temperature: Celsius, time_delta: Seconds) -> Watts {
        let controller_params = &self.config.policy_params.controller_params;
        let temperature_error = controller_params.target_temperature.0 - temperature.0;
        let error_integral = clamp(
            self.state.error_integral.get() + temperature_error * time_delta.0,
            controller_params.e_integral_min,
            controller_params.e_integral_max,
        );
        self.state.error_integral.set(error_integral);
        let p_term = temperature_error * controller_params.proportional_gain;
        let i_term = error_integral * controller_params.integral_gain;
        let power_available = controller_params.sustainable_power.0 + p_term + i_term;
        Watts(power_available)
    }
fn calculate_available_power ( & self , temperature : Celsius , time_delta : Seconds ) -> Watts { let controller_params = & self . config . policy_params . controller_params ; let temperature_error = controller_params . target_temperature . 0 - temperature . 0 ; let error_integral = clamp ( self . state . error_integral . get ( ) + temperature_error * time_delta . 0 , controller_params . e_integral_min , controller_params . e_integral_max , ) ; self . state . error_integral . set ( error_integral ) ; let p_term = temperature_error * controller_params . proportional_gain ; let i_term = error_integral * controller_params . integral_gain ; let power_available = controller_params . sustainable_power . 0 + p_term + i_term ; Watts ( power_available ) }
A PID control algorithm that uses temperature as the measured process variable, and
available power as the control variable.
A PID control algorithm that uses temperature as the measured process variable and available power as the control variable .
&self
temperature
Celsius
time_delta
Seconds