PDA

View Full Version : Little code help


Fishbulb2
01/05/2008, 10:59 AM
Hey guys,
I have an AC jr and need some help writing a program for it. This is my first attempt at it. I have my main lights called LT1 and my auto top off doser called EVAP. The kalk stirrer is called STIR. I want the auto top off to only turn on if the main lights are off. Then the kalk stirrer should stir for 1 minute each hour. I also only want the EVAP to run if the kalk stirrer is not on and the pH remains below 8.6 and remain off for 5 minutes should it turn off. How would I write this code. What I have now did not really work.
Would this work

If Timer LT1 = OFF Then EVAP ON
If Timer LT1 = OFF Then STIR ON
OSC 001/059 ON/OFF Then STIR ON
If Timer STIR = ON Then EVAP OFF
If pH > 8.6 Then EVAP OFF
If pH < 8.6 Then EVAP ON
Max Change 005 M Then EVAP OFF
If Timer STIR = OFF Then EVAP ON
If Timer LT1 = ON Then EVAP OFF
If Timer LT1 = ON Then STIR OFF

I'm sure this isn't the most efficient way to do this. Any help will be appreciated.

FB



[/list]

dhoch
01/05/2008, 01:09 PM
I would revise a little bit

If Timer LT1 = OFF Then EVAP ON
If Timer LT1 = OFF Then STIR ON // You don't want this statement at all
OSC 001/059 ON/OFF Then STIR ON
If pH > 8.6 Then EVAP OFF // put the evap off statements at the end
If pH < 8.6 Then EVAP ON // this statement is redundant
Max Change 005 M Then EVAP OFF // I belive sequentially this needs to be last.
If Timer STIR = ON Then EVAP OFF
If Timer STIR = OFF Then EVAP ON // this statement is redundant
// I would change these to default time statements... by default they are off
If Timer LT1 = ON Then EVAP OFF
If Timer LT1 = ON Then STIR OFF

With these changes it would look like:

// default state of evap is off
If Time > 12:00 Then EVAP OFF
// default state is of the Stir is oscilating 1 min on 59 mins off
OSC 001/059 ON/OFF Then STIR ON
// If lights are on then stirer should be off
If Timer LT1 = ON Then STIR OFF
// If lights are off then evap state should be on
If Timer LT1 = OFF Then EVAP ON
// If the pH gets too high turn the EVAP off
If pH > 8.6 THEN Evap OFF
// If the Stirrer is on Turn the EVAP OFF
If Timer STIR = ON Then EVAP OFF
// finally max change statement
Max Change 005 M Then EVAP OFF

From 10 statements to 7

Dave

Fishbulb2
01/05/2008, 02:24 PM
Thanks for the help Dave. I wasn't too clear about what statements were necessary and which weren't I will enter this in today and see how it works tonight.

One last question. So simple I don't even think it was covered in the manual. How do you program an outlet to always be on? As in no timer. I want my return pump to be constantly on with only be turned off during feed mode?

thanks again.
FB

dhoch
01/05/2008, 02:30 PM
If Time > 12:00 THEN RET ON

This sets a default state for this...

you can see this and other programing examples here:
http://www.danj.com/reef/status.php

Dave

Fishbulb2
01/06/2008, 09:03 PM
Hello again dhoch,
One more quick question. Why did you decide to use If Time > 12:00 as opposed to if time > 00:00 like the user manual? Did this better for some reason?

dhoch
01/07/2008, 04:44 AM
no... there is no functional difference... you could use time > 01:23 and it wouldn't matter.

Dave

pgordemer
01/07/2008, 08:49 AM
Timer names can not be 4 characters only 3.