Click here to Skip to main content
15,845,785 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

i have code which ginves me the max and min of the speed of some fan , but when i ruf this code the speed can go more than max , for example : the max is 100 , and the speed is 110.
so i need to let the speed moves between max and min .

What I have tried:


senveolp_ret.Max_sp  = interpolate_2k(poly_test[i].Max_sp  , closetPolygon.Max_sp, distance);
senveolp_ret.Min_sp  = interpolate_2k(poly_test[i].Min_sp  , closetPolygon.Min_sp, distance);
// her i get max and min
Posted
Updated 1-Feb-18 1:55am
Comments
Richard MacCutchan 1-Feb-18 5:26am    
And?
CPallini 1-Feb-18 5:30am    
Please restate more clearly your question. I don't get you.
BaselAla 1-Feb-18 6:19am    
so i think the error is in my software files , becuase there are more than one channel to it.
i thank you for your time (:
nv3 1-Feb-18 8:55am    
Apparently you are determining the max and min speed by feeding in a bunch of values and doing a polygon interpolation. That however just gives you an approximation and the real maximum speed can be higher. You should re-think your algorithm and what you really want to achieve with it.

1 solution

So something is wrong - but what? Maybe your fan has to much speed or some bug in your code. At first: check the input and provide some logging with a fix.

I would search a good place in the code and write it this way by providing some output
C++
//HACK: limiting the speed
if( speed > 100 ) {
  printf("speed %ld is too high. Settting max to 100", speed );
  speed = 100;
}
Nevertheless you should find the real cause of your issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900