Author Topic: Logical problem  (Read 10294 times)

karen

  • Newbie
  • Posts: 18
  • I love YaBB 1G - SP1!
    • View Profile
Logical problem
« on: December 12, 2002, 11:31:27 AM »
' heater control function

    ' SETIO heater  or CLRIO Heater based on the
    '  value of ADC(1)/10  
 
IF ADC(1)/10 < 15 SETIO HEATER
ENDIF

IF ADC(1)/10 > 17 CLRIO HEATER
ENDIF




thanks for all the help that you have given me i would like your knowlege. i just have one more question  for you.  the above statement works great in theory but the problem is the heater works ok when it reaches 17 the heater cuts off and the value at ADC(1) rises by 10.  this means the liquid cools too much because it takes too long for the number to return to 15.  how can i compensate for the increase by ten is there any way to subtract 10 from the upper value.  so

heats to 17 heater turns off 0.5 of a second later
value rises to 27 at ADC(1) need to subtract 10
so the numer cools from 17 to 15 then repeat again

thanks karen ???
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: Logical problem
« Reply #1 on: December 12, 2002, 12:39:29 PM »
Sorry, I really didn't quite get what you mean. What is 27? Is it value at ADC(1) or is it ADC(1)/10?

You don't have to divide by 10 if it does not serve your purpose, why not:

IF ADC(1) < 155 SETIO HEATER
ENDIF

IF ADC(1) > 175 CLRIO HEATER   '
ENDIF

In the above the value is adjusted so that heater only turn off when value of ADC(1) is greater than 175, and turn on when the value is less than 155  which is equivalent to ADC(1)/10 = 17.5  or 15.5 (of course, TBASIC does not support floating point so this is just for illustration purpose only).

If you want a 0.5second delay, you can always turn on a relay that in turns energize a 0.5s timer. When the timer times out the output can be turned off by either the [CLEAR] function or by "CLRIO Heater" statement in another custom function.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

karen

  • Newbie
  • Posts: 18
  • I love YaBB 1G - SP1!
    • View Profile
Re: Logical problem
« Reply #2 on: December 12, 2002, 01:25:41 PM »
what happens is there is a fluctuation in the reading because when heater turns off so there is increase in voltage and then this in turn affects the adc(1) so that is the 27

thanks
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »