Method and apparatus for controlling fan speed
View Patent ↗A method and apparatus for controlling fan speed are provided. The method obtains a first PWM value and a second PWM value of the fan based on the temperature of the server component respectively through a PID regulation algorithm and an open-loop control algorithm, and controls the fan speed based on the larger value of the first PWM value and the second PWM value.
1. A method for controlling fan speed, comprising:
obtaining a temperature of a server component;
obtaining, by a proportion integration differentiation (PID) regulation algorithm, a first pulse width modulation (PWM) value of a fan corresponding to the temperature of the server component based on the temperature of the server component;
obtaining, by an open-loop control algorithm, a second PWM value of the fan corresponding to the temperature of the server component based on the temperature of the server component;
comparing the first PWM value with the second PWM value; and
controlling the fan speed by a larger value of the first PWM value and the second PWM value.
2. The method according to claim 1 , wherein, obtaining, by the PID regulation algorithm, the first PWM value of the fan corresponding to the temperature of the server component based on the temperature of the server component comprises:
calculating a temperature difference between the temperature of the server component and a reference temperature;
calculating a change amount of PWM value of the fan based on the temperature of the server component and the temperature difference; and
adding the change amount of PWM value to a current PWM value of the fan to obtain the first PWM value.
3. The method according to claim 1 , wherein, the open-loop control algorithm comprises a piecewise regulation algorithm or a linear regulation algorithm.
4. The method according to claim 1 , further comprising:
replacing a currently stored PWM value with the larger value of the first PWM value and the second PWM value.
5. The method according to claim 1 , wherein, the second PWM value is smaller than a PWM value actually required for heat dissipation of the server component.
6. An apparatus for controlling fan speed, comprising a processor and a memory having stored thereon instructions, wherein the instructions, when executed by the processor, cause the processor to:
obtain a temperature of a server component;
obtain, by a proportion integration differentiation (PID) regulation algorithm, a first pulse width modulation (PWM) value of a fan corresponding to the temperature of the server component based on the temperature of the server component;
obtain, by an open-loop control algorithm, a second PWM value of the fan corresponding to the temperature of the server component based on the temperature of the server component;
compare the first PWM value with the second PWM value; and
control the fan speed by a larger value of the first PWM value and the second PWM value.
7. The apparatus according to claim 6 , wherein, the instructions cause the processor to:
calculate a temperature difference between the temperature of the server component and a reference temperature;
calculate a change amount of PWM value of the fan based on the temperature of the server component and the temperature difference; and
add the change amount of PWM value to a current PWM value of the fan to obtain the first PWM value.
8. The apparatus according to claim 6 , wherein, the open-loop control algorithm comprises a piecewise regulation algorithm or a linear regulation algorithm.
9. The apparatus according to claim 6 , wherein the instructions further cause the processor to:
replace a currently stored PWM value with the larger value of the first PWM value and the second PWM value.
10. The apparatus according to claim 6 , wherein, the second PWM value is smaller than a PWM value actually required for heat dissipation of the server component.
11. The method according to claim 2 , wherein, the open-loop control algorithm comprises a piecewise regulation algorithm or a linear regulation algorithm.
12. The method according to claim 2 , further comprising:
replacing a currently stored PWM value with the larger value of the first PWM value and the second PWM value.
13. The apparatus according to claim 7 , wherein, the open-loop control algorithm comprises a piecewise regulation algorithm or a linear regulation algorithm.
14. The apparatus according to claim 7 , wherein the instructions further cause the processor to:
replace a currently stored PWM value with the larger value of the first PWM value and the second PWM value.