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) ;
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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) ;
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

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;
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
ND wrote:

Is that an academic exercise? How important is zero error? w much fan power can you save by not undershooting a little bit?
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
yes is an an academic exercise. attached is what is expected. A Real Time Executive Kernel     C functions that control the motor, fan and temperature sensor     Some basic graphics routines
1 Overview You are required to design and implement a programme that will allow the user to set a desired temperature level for the Bytronic Board heating system. The programme must allow users to adjust the temperature setpoint. The programme should also display a graph that shows the both the setpoint and the measured-variable, varying in time. In order to achieve this you are required to produce the following deliverables in the form of a report.
1.    SPECIFCATION 2.    ANALYSIS AND DESIGN 3.    SOLUTION - INCLUDING WORKING CODE
2 Specification You cannot design or develop anything until you know what the user/client/you etc. actually wants it to do. Typical things to include are a general summary of the basic operation e.g. a temperature controller. Accuracy required e.g. 10 degrees Celsius. Response time e.g. must respond to a 10-degree change in less than one minute. Size e.g. must fit in a box no bigger than a matchbox.
Weight e.g. max weight Environmental Specification e.g. must survive driving rain, a drop from 100 metres, and external temperature of 125C. You may also include things like preferred user interface e.g. LED display, or big push buttons. I hope that you have the idea now. What we are trying to do is to write down everything that the end user expects the system to do before we start designing it. You should also produce a Test Specification to go with the Requirements Specification described above. A test specification is a statement of how you intend to prove that your solution really does meet the Requirements Specification. It is normal practice when drawing up a design contract to include both the Requirements and the Test Specifications in the contract documentation. In this way both parties know exactly what they are going to get at the end of the design process, and they have an agreed method of proving it. 3 Analysis and Design There are many different ways to control the temperature. Will you use PID or a simpler solution, such as ON/OFF control? How will you handle long term drift? What operator controls will you use? How often do you need to sample the temperature? I expect to see an analysis of different options for the major aspects of the Requirement Specification. You should then select your preferred options, clearly stating your reasons. This is an attempt to mirror what would happen if this was a commercial contract. A Requirement Specification is just the starting point, from which you start your analysis. This analysis may produce more questions than answers; so regular Design Review meetings should be held that amends the specification. The outcome of this stage will be your Design. A design is not the programme. What is expected at this stage is a paper design that details the essential aspects of how your programme will work, the data flows between major functions, the ISR operations etc. You can use any design methodology that you are comfortable with in order to present your design in the report. thank you
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
ND wrote:

If it's an academic exercise you'll not get much mileage out of asking this group to just write code for you. First, it's just Not Done, and besides -- it's work. Second, your assignment clearly states that your deliverable is an analysis and design, not just a solution. You'll have trouble explaining code that you don't understand, which is what will happen if we take what you say at face value and just rewrite your code.
In general folks will help you through homework, but we won't do it for you. Some of us may have to work with you some day, and if we do we want you to be a self-actuated pitcher-in, not someone who leans back and waits for others to solve their problems. Asking for help on a newsgroup shows initiative. Expecting the newsgroup community to do it all for you shows the wrong kind of initiative.
How about backing off a bit, and asking questions on just the parts that you don't understand? For example, have you determined that on/off control isn't sufficient? PID controllers take more processor resources, create stability problems that on/off controllers don't, and are harder to maintain -- so they're only a good idea if they're really necessary.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
thank you. you dont have to assist if your not intressted. afterall newsgroup community is not just you. i needed some assistance to this issue that is why i mail you initially and you directed me here, why are you asking me to back off instead of putting head together to solve it for me. am surprise?????????????////
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
ND wrote:

"Assist" means "help". I'm willing to _help_ you. I'm not willing to _do_ your work for you. Not for free ever, and your homework never. Based on other's responses to "please do my homework" requests I think they'll act the same.
Rewriting your code so that it works teaches you nothing. It doesn't help you to meet the goal of going to school, which is to learn. It certainly doesn't help the folks who are figuring this stuff out for real and is being graded on the same curve as you.
If none of the above makes any sense to you -- take an ethics class.
--

Tim Wescott
Wescott Design Services
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
ND wrote:

Most of the people who frequent this newsgroup are or were professionals in the field. (Most of the rest couldn't help you anyway.) Some of us tutored our fellows in college. We all feel the way Tim Wescott does: we'll help, but we won't do your homework for you. If you try to do it and are stopped by a detail, tell us about it and we'll give advice. Have you made an attempt to figure out what the code does? That's where you should start.
Jerry
--
Engineering is the art of making what you want from things you can get.

  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Thanks, we all are proffessionals. am a network administrator with 10years experience in IT and worked with microsoft for many years. I dont want you guys to rewrite all the programmes. The uploaded codes are just one tenth of the whole codes. i' ve done almost all the designs. Tim knows, i sent him a copy of the codes. the overveiw infos is just to give you guys a clear picture of what am doing or what i have done.
CS = Control Signal MV = Measured Value SP = Set Point? fan_max, pwm_max
i'll have to define the intregral and run it. thanks antiSPAM that just the kind of ideas i need keep it up!!
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.