|
|
| Author |
Message |
ND science forum beginner
Joined: 12 Apr 2006
Posts: 5
|
Posted: Wed Apr 12, 2006 7:44 pm Post subject:
realtime systems, control loop.
|
|
|
can someone rewrite the programm using intergal algo. method. to reduce
the error to almost zero. the programm is for the fan to start auto.
and cool the processor when the temp. gets to the set point or to
maintian a steady state. ( i have a graph temp against time
)
if (MV < SP)
{
cs = gain * ((MV - SP) + iterm * (integral));
}
else
{
cs = gain2 * ((MV - SP) + iterm * (integral));
}
if (cs > 1)
{
pwm_max = 0 ;
t = cs ;
if (t > 100) t = 100 ;
fan_max = t ;
}
else if (cs < 1)
{
t = -cs ;
if (t > 100) t = 100 ;
pwm_max = t ;
fan_max = 0 ;
}
else
{
fan_max = pwm_max = 0;
}
sprintf(buffer2,"MV = %2.1f I= %2.1f SP = %2.1f HEATER = %d FAN =
%d",MV,integral*iterm,SP,pwm_max,fan_max);
moveto(100,50);
outtext(buffer2);
smooth[smooth_pnt++] = yscale(MV) ;
smooth_pnt &= 0x3 ;
posit = (int)((smooth[0] + smooth[1] + smooth[2] + smooth[3])/4) ; |
|
| Back to top |
|
 |
AntiSPAM_g9u5dd43@yahoo.c science forum beginner
Joined: 18 Feb 2006
Posts: 6
|
Posted: Fri Apr 14, 2006 2:02 pm Post subject:
Re: realtime systems, control loop.
|
|
|
On 12 Apr 2006 12:44:07 -0700, "ND" <imondc@hotmail.com> wrote:
| Quote: | can someone rewrite the programm using intergal algo. method. to reduce
the error to almost zero. the programm is for the fan to start auto.
and cool the processor when the temp. gets to the set point or to
maintian a steady state. ( i have a graph temp against time
)
if (MV < SP)
{
cs = gain * ((MV - SP) + iterm * (integral));
}
else
{
cs = gain2 * ((MV - SP) + iterm * (integral));
}
if (cs > 1)
{
pwm_max = 0 ;
t = cs ;
if (t > 100) t = 100 ;
fan_max = t ;
}
else if (cs < 1)
{
t = -cs ;
if (t > 100) t = 100 ;
pwm_max = t ;
fan_max = 0 ;
}
else
{
fan_max = pwm_max = 0;
}
sprintf(buffer2,"MV = %2.1f I= %2.1f SP = %2.1f HEATER = %d FAN =
%d",MV,integral*iterm,SP,pwm_max,fan_max);
moveto(100,50);
outtext(buffer2);
smooth[smooth_pnt++] = yscale(MV) ;
smooth_pnt &= 0x3 ;
posit = (int)((smooth[0] + smooth[1] + smooth[2] + smooth[3])/4) ;
|
How about defining some of the variable so people not familiar
with the details will have a better idea of what it is you are doing?
Let me take a guess:
cs?
MV = Measured Value?
SP = Set Point?
fan_max, pwm_max
integral isn't defined. Is that the piece you need?
error = (MV-SP);
integral += error; |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Wed Jan 07, 2009 10:39 pm | All times are GMT
|
|
UK Solicitor Directory | UK Hotels | Ringtone | Sprint Ringtones | Debt Consolidation
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
Other DeniX Solutions sites:
Electronics forum |
Medicine forum |
Unix/Linux blog |
Unix/Linux documentation |
Unix/Linux forums
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|