Apex Code keeps turning plug to off position

Digicop

Community Member
View Badges
Joined
Feb 4, 2020
Messages
89
Reaction score
26
Location
Rayne, LA
Rating - 0%
0   0   0
After the script runes the first time it turns off the plug instead of leaving it in AUTO, so the script will not run again.

The code reads:

Fallback OFF
Set OFF
If Output ReturnPump = OFF then OFF
When On > 005:00 Then Off
Defer 002:00 Then On
If Sw1 OPEN then ON
If pH < 8.30 then ON
If pH > 8.35 then OFF
If Sw1 CLOSED then OFF
If Sw1 OPEN then ON

Any help would be appreciated.

Ricky
 
Its the "When" statement, its doing exactly what its designed to do...


What are you trying to do/control?
 
Whatever it's for is staying on longer that 5 minutes and the When is moving it to off. You may need to increase the timing if it's expexcted to be on longer, or see what hitting 5 minutes if its not.
 
in general you have some funky logic in there. you have the SW1 on statement twice.....i assume you just want the pump off if the switch is closed, if so just include the closed statement.

I dont think you need "set off"


Trying to deduct what you're trying to do here......
you want to turn of a pump on that feeds kalk when your PH is below a certain threshold and turn it off when above.
SW1 is presumably a level sensor in your kalk container so the pump doesnt run when dry
when the pump is on 5 mins you want it to turn off for 2 mins.....I dont believe apex code works this way.

I would use OSC commands and have lines around whether its on or off based on PH and fluid level below that. It might be possible to do some permutation of this and make it work but OSC is going to be alot more straight forward.
 
Last edited:

IF YOU HAD TO TAKE A REEFING EXAM, WOULD YOU PASS?

  • Yes!

    Votes: 32 45.7%
  • Not yet, but I have one that I want to buy in mind!

    Votes: 9 12.9%
  • No.

    Votes: 26 37.1%
  • Other (please explain).

    Votes: 3 4.3%
Back
Top