Fan speed algorithm












1












$begingroup$


I'm a programmer an I think my problem related to mathematics!
I want when CPU have a static percentage of load (for example $10%$) fan also have static rpm (Rotations per minute). But for now I have very change in fan speed when CPU have a static percentage of load.
I try the follow algorithm and have this problem:



if (temp > max_temp)
speed := full_speed
else if (temp < min_temp)
speed := min_speed
else
speed := min_speed +
(full_speed - min_speed)*((temp - min_temp)/(max_temp - min_temp))









share|cite|improve this question











$endgroup$












  • $begingroup$
    It appears that this code uses temperature rather than load (which I think is better). How often do you adjust the speed (i.e., run this code)? - And how granular are your temp sensor and your speed actor?
    $endgroup$
    – Hagen von Eitzen
    Feb 5 '15 at 14:14












  • $begingroup$
    @HagenvonEitzen Thanks for your attention, I can't use CPU load because CPU frequency can change (And meaning of cpu load change), I run this code for ever and temp sensor and speed actor acts immediately.
    $endgroup$
    – Daniyal
    Feb 5 '15 at 14:20


















1












$begingroup$


I'm a programmer an I think my problem related to mathematics!
I want when CPU have a static percentage of load (for example $10%$) fan also have static rpm (Rotations per minute). But for now I have very change in fan speed when CPU have a static percentage of load.
I try the follow algorithm and have this problem:



if (temp > max_temp)
speed := full_speed
else if (temp < min_temp)
speed := min_speed
else
speed := min_speed +
(full_speed - min_speed)*((temp - min_temp)/(max_temp - min_temp))









share|cite|improve this question











$endgroup$












  • $begingroup$
    It appears that this code uses temperature rather than load (which I think is better). How often do you adjust the speed (i.e., run this code)? - And how granular are your temp sensor and your speed actor?
    $endgroup$
    – Hagen von Eitzen
    Feb 5 '15 at 14:14












  • $begingroup$
    @HagenvonEitzen Thanks for your attention, I can't use CPU load because CPU frequency can change (And meaning of cpu load change), I run this code for ever and temp sensor and speed actor acts immediately.
    $endgroup$
    – Daniyal
    Feb 5 '15 at 14:20
















1












1








1





$begingroup$


I'm a programmer an I think my problem related to mathematics!
I want when CPU have a static percentage of load (for example $10%$) fan also have static rpm (Rotations per minute). But for now I have very change in fan speed when CPU have a static percentage of load.
I try the follow algorithm and have this problem:



if (temp > max_temp)
speed := full_speed
else if (temp < min_temp)
speed := min_speed
else
speed := min_speed +
(full_speed - min_speed)*((temp - min_temp)/(max_temp - min_temp))









share|cite|improve this question











$endgroup$




I'm a programmer an I think my problem related to mathematics!
I want when CPU have a static percentage of load (for example $10%$) fan also have static rpm (Rotations per minute). But for now I have very change in fan speed when CPU have a static percentage of load.
I try the follow algorithm and have this problem:



if (temp > max_temp)
speed := full_speed
else if (temp < min_temp)
speed := min_speed
else
speed := min_speed +
(full_speed - min_speed)*((temp - min_temp)/(max_temp - min_temp))






optimization algorithms recursive-algorithms algorithmic-game-theory scoring-algorithm






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Feb 7 '15 at 6:49







Daniyal

















asked Feb 5 '15 at 14:11









DaniyalDaniyal

1092




1092












  • $begingroup$
    It appears that this code uses temperature rather than load (which I think is better). How often do you adjust the speed (i.e., run this code)? - And how granular are your temp sensor and your speed actor?
    $endgroup$
    – Hagen von Eitzen
    Feb 5 '15 at 14:14












  • $begingroup$
    @HagenvonEitzen Thanks for your attention, I can't use CPU load because CPU frequency can change (And meaning of cpu load change), I run this code for ever and temp sensor and speed actor acts immediately.
    $endgroup$
    – Daniyal
    Feb 5 '15 at 14:20




















  • $begingroup$
    It appears that this code uses temperature rather than load (which I think is better). How often do you adjust the speed (i.e., run this code)? - And how granular are your temp sensor and your speed actor?
    $endgroup$
    – Hagen von Eitzen
    Feb 5 '15 at 14:14












  • $begingroup$
    @HagenvonEitzen Thanks for your attention, I can't use CPU load because CPU frequency can change (And meaning of cpu load change), I run this code for ever and temp sensor and speed actor acts immediately.
    $endgroup$
    – Daniyal
    Feb 5 '15 at 14:20


















$begingroup$
It appears that this code uses temperature rather than load (which I think is better). How often do you adjust the speed (i.e., run this code)? - And how granular are your temp sensor and your speed actor?
$endgroup$
– Hagen von Eitzen
Feb 5 '15 at 14:14






$begingroup$
It appears that this code uses temperature rather than load (which I think is better). How often do you adjust the speed (i.e., run this code)? - And how granular are your temp sensor and your speed actor?
$endgroup$
– Hagen von Eitzen
Feb 5 '15 at 14:14














$begingroup$
@HagenvonEitzen Thanks for your attention, I can't use CPU load because CPU frequency can change (And meaning of cpu load change), I run this code for ever and temp sensor and speed actor acts immediately.
$endgroup$
– Daniyal
Feb 5 '15 at 14:20






$begingroup$
@HagenvonEitzen Thanks for your attention, I can't use CPU load because CPU frequency can change (And meaning of cpu load change), I run this code for ever and temp sensor and speed actor acts immediately.
$endgroup$
– Daniyal
Feb 5 '15 at 14:20












1 Answer
1






active

oldest

votes


















0












$begingroup$

This is a control problem rather than mathematics, but as there is no Control SE we might as well discuss it here.



In the absence of limiting you need to adjust the fan speed to achieve whatever you desire, I will assume you wish to control the temperature $c$ to a set value $c_{dem}$ by varying the fan speed $v$.



One of the simplest ways of doing this is using proportional control, this would use approximate knowledge of the relationship between the fan speed and temperature $c=f(v)$, then set the fan speed accordingly. The problem with this is that the relationship between fan speed and temperature is not fixed but depends on a number of factors you don't know, like the ambient temperature and the processor loading.



The next simplest way of approaching this is derivative control (which is what I would recomend), where the rate of change of fan speed is set proportional to the temperature error:$$
v'=k(c-c_{set})
$$
With such a control law the fan speed arrives at a constant value when the temperature error is zero. There is a problem here in choosing an appropriate gain $k$ in that we don't know the relationship between fan speed and temperature. You will probably need to find an acceptable gain by trial and error.



The control law will need to be discretised for use in your code, this should give you something like:$$
v_{new}=v_{old}+k Delta t (c-c_{set})
$$
where $Delta t$ is the control loop update time step.






share|cite|improve this answer









$endgroup$














    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1134907%2ffan-speed-algorithm%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    This is a control problem rather than mathematics, but as there is no Control SE we might as well discuss it here.



    In the absence of limiting you need to adjust the fan speed to achieve whatever you desire, I will assume you wish to control the temperature $c$ to a set value $c_{dem}$ by varying the fan speed $v$.



    One of the simplest ways of doing this is using proportional control, this would use approximate knowledge of the relationship between the fan speed and temperature $c=f(v)$, then set the fan speed accordingly. The problem with this is that the relationship between fan speed and temperature is not fixed but depends on a number of factors you don't know, like the ambient temperature and the processor loading.



    The next simplest way of approaching this is derivative control (which is what I would recomend), where the rate of change of fan speed is set proportional to the temperature error:$$
    v'=k(c-c_{set})
    $$
    With such a control law the fan speed arrives at a constant value when the temperature error is zero. There is a problem here in choosing an appropriate gain $k$ in that we don't know the relationship between fan speed and temperature. You will probably need to find an acceptable gain by trial and error.



    The control law will need to be discretised for use in your code, this should give you something like:$$
    v_{new}=v_{old}+k Delta t (c-c_{set})
    $$
    where $Delta t$ is the control loop update time step.






    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      This is a control problem rather than mathematics, but as there is no Control SE we might as well discuss it here.



      In the absence of limiting you need to adjust the fan speed to achieve whatever you desire, I will assume you wish to control the temperature $c$ to a set value $c_{dem}$ by varying the fan speed $v$.



      One of the simplest ways of doing this is using proportional control, this would use approximate knowledge of the relationship between the fan speed and temperature $c=f(v)$, then set the fan speed accordingly. The problem with this is that the relationship between fan speed and temperature is not fixed but depends on a number of factors you don't know, like the ambient temperature and the processor loading.



      The next simplest way of approaching this is derivative control (which is what I would recomend), where the rate of change of fan speed is set proportional to the temperature error:$$
      v'=k(c-c_{set})
      $$
      With such a control law the fan speed arrives at a constant value when the temperature error is zero. There is a problem here in choosing an appropriate gain $k$ in that we don't know the relationship between fan speed and temperature. You will probably need to find an acceptable gain by trial and error.



      The control law will need to be discretised for use in your code, this should give you something like:$$
      v_{new}=v_{old}+k Delta t (c-c_{set})
      $$
      where $Delta t$ is the control loop update time step.






      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        This is a control problem rather than mathematics, but as there is no Control SE we might as well discuss it here.



        In the absence of limiting you need to adjust the fan speed to achieve whatever you desire, I will assume you wish to control the temperature $c$ to a set value $c_{dem}$ by varying the fan speed $v$.



        One of the simplest ways of doing this is using proportional control, this would use approximate knowledge of the relationship between the fan speed and temperature $c=f(v)$, then set the fan speed accordingly. The problem with this is that the relationship between fan speed and temperature is not fixed but depends on a number of factors you don't know, like the ambient temperature and the processor loading.



        The next simplest way of approaching this is derivative control (which is what I would recomend), where the rate of change of fan speed is set proportional to the temperature error:$$
        v'=k(c-c_{set})
        $$
        With such a control law the fan speed arrives at a constant value when the temperature error is zero. There is a problem here in choosing an appropriate gain $k$ in that we don't know the relationship between fan speed and temperature. You will probably need to find an acceptable gain by trial and error.



        The control law will need to be discretised for use in your code, this should give you something like:$$
        v_{new}=v_{old}+k Delta t (c-c_{set})
        $$
        where $Delta t$ is the control loop update time step.






        share|cite|improve this answer









        $endgroup$



        This is a control problem rather than mathematics, but as there is no Control SE we might as well discuss it here.



        In the absence of limiting you need to adjust the fan speed to achieve whatever you desire, I will assume you wish to control the temperature $c$ to a set value $c_{dem}$ by varying the fan speed $v$.



        One of the simplest ways of doing this is using proportional control, this would use approximate knowledge of the relationship between the fan speed and temperature $c=f(v)$, then set the fan speed accordingly. The problem with this is that the relationship between fan speed and temperature is not fixed but depends on a number of factors you don't know, like the ambient temperature and the processor loading.



        The next simplest way of approaching this is derivative control (which is what I would recomend), where the rate of change of fan speed is set proportional to the temperature error:$$
        v'=k(c-c_{set})
        $$
        With such a control law the fan speed arrives at a constant value when the temperature error is zero. There is a problem here in choosing an appropriate gain $k$ in that we don't know the relationship between fan speed and temperature. You will probably need to find an acceptable gain by trial and error.



        The control law will need to be discretised for use in your code, this should give you something like:$$
        v_{new}=v_{old}+k Delta t (c-c_{set})
        $$
        where $Delta t$ is the control loop update time step.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Feb 6 '15 at 9:05









        Conrad TurnerConrad Turner

        2,8522611




        2,8522611






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1134907%2ffan-speed-algorithm%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bressuire

            Cabo Verde

            Gyllenstierna