GHL Profilux Programmable Logic - AWC Example

BeanAnimal

7500 Club Member
View Badges
Joined
Jul 16, 2009
Messages
9,262
Reaction score
15,533
Rating - 0%
0   0   0
Hi Everyone --

Just a quick post regarding how I plan to do small daily water changes using my Profilux and Maxi 2.2 doser.

Goals:

1 - Run both pump heads (feed and drain) at the same time so that auto top-off is not affected.
2 - Also allow scheduled filling of makeup water using the same dosing head used for AWC fill.
3 - Also allow scheduled draining of sump water using the same dosing head used for AWC drain.

Requirements:
2 Dosing heads.
2 virtual switches
3 virtual dosing pumps
2 Programmable Logic entries

"virtual dosing pumps. Meaning they only exist in software and are not connected to a real dosing pump.
"virtual" switch channels. Meaning they only exist in software and are not connected to a real switch.

Here is the block diagram showing how this is setup .
1754608801609.png


Notes:

Dosing 9 is set to be controlled by Switch 63
Dosing 10 is set to be controlled by Switch 64

Switch 63 is turned on and off by Programmable Logic 02
Switch 64 is turned on and off by Programmable Logic 03

The Schedule set on Dosing pump 31 is for Automatic Water changes. Example 4 x 1000 ml/day.
The Schedule set on Dosing pump 30 is for adding makeup water. Example 4x 40 ml/day to compensate for water removed during auto testing.
The Schedule set on Dosing pump 32 is for removing water from the sump. An example would be to gradually lower salinity if needed. This is not normally schedule.

The logic is simple. If the AWC schedule is active then the programmable logic 02 and 03 are both true, so switched 63 and 64 are "on" and this turns on dosing pumps 9 and 10.

Likewise, if the AWC schedule is not calling for AWC but the FILL schedule is, then programmable logic 02 is true and turns on switch 63. This turns on dosing pump 9.

Lastly, , if the AWC schedule is not calling for AWC but the DRIN schedule is, then programmable logic 03 is true and turns on switch 64. This turns on dosing pump 10.

Flow Rate:
Dosing pump 9 and 10 have different tube lengths so do not pump the same amount per time. In my case the fill pump can do 300 ml/min and the drain pump can only do 240 ml/m.

So that they match, we will set the "desired" flow rate on both pumps to be 240 ml/min. This is VERY important because during an Automatic Water Change both are being run for the same amount of time by a single "virtual" dosing pump.

That means that we also need to set the flow rates on that virtual dosing pump to 240 ml/min. That way their schedules will run the actual dosing pumps for the proper amount of time for the amount of fluid desired.

I hope that makes sense!


Happy Reefing

-BeanAnimal


P.S. -- if there is interest, I can show my actual set that is a bit more complicated. It incorporates several more logical steps to include push buttons to start an AWC, drain 500 ml or add 500 ml as well as a toggle switch that disables AWC (manual override) so I don't have to disable it from the dashboard if I don't want it to run).


P.P.S. -- I would not be the Profilux man that I am without @Lasse and his inspirational Sweedish twerking
 

KStatefan

5000 Club Member
View Badges
Joined
Jun 24, 2015
Messages
5,589
Reaction score
5,013
Location
MHK
Rating - 0%
0   0   0
Looks good

I went with very basic AWC in my setup but use three pumps and waste from display is going to coral "QT" first.
 
Last edited:
OP
OP
B

BeanAnimal

7500 Club Member
View Badges
Joined
Jul 16, 2009
Messages
9,262
Reaction score
15,533
Rating - 0%
0   0   0
I don't really care for automation other than water/dosing. I don't do "maintenance" or other types of automation.

What I have or am implementing in addition to regular scheduled dosing.

1 - physical/virtual button for 5 ml individual doses of Alk, Ca, Mg.
1 - physical/virtual button for 500 ml SW addition (quick makeup for water removal during acclimation)
1 - physical/virtual button for 5 L SW addition (quick makeup for water removal during acclimation)
1 - physical/virtual button for 500 ml drain (to lower salinity slightly)
1 - physical/virtual button for AWC start
1 - physical/virtual switch to suspend AWC (so I don't have to edit schedules).

That is it -- and I can live without any of those, so there is a VERY HIGH chance that the bulk of them never get implemented.

I don't do or like water changes and I never kept up with manual dosing. Now, if the Profilux would scrape the glass and clean the skimmer... well.
 
Last edited:

aalbanez

New Member
View Badges
Joined
Mar 4, 2024
Messages
15
Reaction score
7
Location
United States
Rating - 0%
0   0   0
Hi Everyone --

Just a quick post regarding how I plan to do small daily water changes using my Profilux and Maxi 2.2 doser.

Goals:

1 - Run both pump heads (feed and drain) at the same time so that auto top-off is not affected.
2 - Also allow scheduled filling of makeup water using the same dosing head used for AWC fill.
3 - Also allow scheduled draining of sump water using the same dosing head used for AWC drain.

Requirements:
2 Dosing heads.
2 virtual switches
3 virtual dosing pumps
2 Programmable Logic entries

"virtual dosing pumps. Meaning they only exist in software and are not connected to a real dosing pump.
"virtual" switch channels. Meaning they only exist in software and are not connected to a real switch.

Here is the block diagram showing how this is setup .
1754608801609.png


Notes:

Dosing 9 is set to be controlled by Switch 63
Dosing 10 is set to be controlled by Switch 64

Switch 63 is turned on and off by Programmable Logic 02
Switch 64 is turned on and off by Programmable Logic 03

The Schedule set on Dosing pump 31 is for Automatic Water changes. Example 4 x 1000 ml/day.
The Schedule set on Dosing pump 30 is for adding makeup water. Example 4x 40 ml/day to compensate for water removed during auto testing.
The Schedule set on Dosing pump 32 is for removing water from the sump. An example would be to gradually lower salinity if needed. This is not normally schedule.

The logic is simple. If the AWC schedule is active then the programmable logic 02 and 03 are both true, so switched 63 and 64 are "on" and this turns on dosing pumps 9 and 10.

Likewise, if the AWC schedule is not calling for AWC but the FILL schedule is, then programmable logic 02 is true and turns on switch 63. This turns on dosing pump 9.

Lastly, , if the AWC schedule is not calling for AWC but the DRIN schedule is, then programmable logic 03 is true and turns on switch 64. This turns on dosing pump 10.

Flow Rate:
Dosing pump 9 and 10 have different tube lengths so do not pump the same amount per time. In my case the fill pump can do 300 ml/min and the drain pump can only do 240 ml/m.

So that they match, we will set the "desired" flow rate on both pumps to be 240 ml/min. This is VERY important because during an Automatic Water Change both are being run for the same amount of time by a single "virtual" dosing pump.

That means that we also need to set the flow rates on that virtual dosing pump to 240 ml/min. That way their schedules will run the actual dosing pumps for the proper amount of time for the amount of fluid desired.

I hope that makes sense!


Happy Reefing

-BeanAnimal


P.S. -- if there is interest, I can show my actual set that is a bit more complicated. It incorporates several more logical steps to include push buttons to start an AWC, drain 500 ml or add 500 ml as well as a toggle switch that disables AWC (manual override) so I don't have to disable it from the dashboard if I don't want it to run).


P.P.S. -- I would not be the Profilux man that I am without @Lasse and his inspirational Sweedish twerking
Thanks for sharing, this is great!

I’d love to see how would you implement the push buttons to start/stop AWC.
 
OP
OP
B

BeanAnimal

7500 Club Member
View Badges
Joined
Jul 16, 2009
Messages
9,262
Reaction score
15,533
Rating - 0%
0   0   0
Thanks for sharing, this is great!

I’d love to see how would you implement the push buttons to start/stop AWC.
I don't have buttons to "start" or "stop" the AWC. I have a manual dose 500ml and a manual drain 500ml button.

1754951199020.png



While “cancel” is possible, I don’t really have a need for it.

You could do it with simple AND logic and a toggle switch, which would disable AWC completely but would need to be manually re-enabled.

For a momentary “cancel” button, it’s more complex. The SR-FlipFlop can’t be used directly, because the AWC schedule stays high even after triggering the flip-flop to cancel. The solution is to use the FlipFlop together with an AND gate:
  • The schedule signal feeds the normal AWC logic and also triggers a single pulse into the Set input of the SR-FlipFlop.
  • The FlipFlop output is ANDed with the schedule signal to run the AWC.
  • Pressing the cancel button sends a signal to the Reset input, turning the FlipFlop output off. The AND condition is now false, stopping the AWC until the next schedule start.

1754953625525.png


Please note -- I HAVE NOT tested this in software, but the logic is sound.

@Lasse I blame you for planting these seeds in my head about advanced uses of logic gates. I feel like I am back in the 80's playing with TTL gate designs.
 
OP
OP
B

BeanAnimal

7500 Club Member
View Badges
Joined
Jul 16, 2009
Messages
9,262
Reaction score
15,533
Rating - 0%
0   0   0
Only if you wrote code in assembler.

Yes VAX/VMS assembler.

Code:
        .TITLE  DIVIDE
        .LIBRARY /SYS$LIBRARY:STARLET.MLB/
; Prototype:
;   status = DIVIDE( LONG *dividend, LONG *divisor, LONG *p_quot, LONG *p_rem )
; Usage (CALLS): push addresses (by reference)

        .PSECT  CODE,PIC,USR,REL,CON,SHR
         .ENTRY  DIVIDE,^M<R2,R3,R4,R5>     ; save regs we use

; Fetch args (by-reference)
; AP +0 = arg count (long)
; AP +4 = ^dividend, +8 = ^divisor, +12 = ^p_quot, +16 = ^p_rem

        MOVL    @4(AP),  R2                ; R2 = dividend value
        MOVL    @8(AP),  R3                ; R3 = divisor value
        BEQL    DIVZ                        ; if divisor == 0 → error

; Quotient and remainder:
; q = dividend / divisor  (signed)
; r = dividend - q*divisor

        DIVL3   R3, R2, R4                 ; R4 = q = R2 / R3
        MULL3   R4, R3, R5                 ; R5 = q * divisor
        SUBL3   R5, R2, R5                 ; R5 = r

; Store results
        MOVL    R4,  @12(AP)               ; *p_quot = q
        MOVL    R5,  @16(AP)               ; *p_rem  = r
        MOVL    #S[HASH=114608]#SS$_NORMAL[/HASH]R0
        RET

       DIVZ:   MOVL    #S[HASH=114609]#SS$_BADPARAM[/HASH]R0          ; or use a preferred status
       RET
    
       .PSECT  CODE,PIC,USR,REL,CON,SHR
       .ENTRY  CALLDIV,^M<R2>

        MOVL    #4#42    R2
        MOVL    R2,      DIVIDEND
        MOVL    #5#5,    DIVISOR

        PUSHL   #R[HASH=114610]#REMAINDER[/HASH]                ; arg4: &remainder
        PUSHL   #Q[HASH=114611]#QUOTIENT[/HASH]                 ; arg3: &quotient
        PUSHL   #D[HASH=114612]#DIVISOR[/HASH]                  ; arg2: &divisor
        PUSHL   #D[HASH=114613]#DIVIDEND[/HASH]                 ; arg1: &dividend
        CALLS   #4#4,G^DIVIDE

        ; R0 has status
        ; QUOTIENT/REMAINDER hold results
        RET
    
       .PSECT  DATA,NOEXE,REL,CON,SHR

DIVIDEND:       .LONG   0
DIVISOR:        .LONG   0
QUOTIENT:       .LONG   0
REMAINDER:      .LONG   0

Macro-32 code --- I can't remember if it assembled correctly or not... Makes me want to fire up an emulator and see! That was an assignment to divide two long numbers... Circa 1990

As odd as it is, I had not looked at any of that stuff in decades and recently found a PILE of old 3.5 and 5.25 disks with that stuff on them. I started to throw them away, but went down the rabbit hole of copying them to an HDD so that they can go another few decades before the digital dustbin. And look -- they came in handy today!
 
Last edited:
OP
OP
B

BeanAnimal

7500 Club Member
View Badges
Joined
Jul 16, 2009
Messages
9,262
Reaction score
15,533
Rating - 0%
0   0   0
Of course - I can also give you a simple divide function in COBOL

Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLDIV.

DATA DIVISION.
WORKING-STORAGE SECTION.
01  DIVIDEND   PIC S9(9) COMP VALUE 42.
01  DIVISOR    PIC S9(9) COMP VALUE 5.
01  QUOTIENT   PIC S9(9) COMP.
01  REMAINDER  PIC S9(9) COMP.

PROCEDURE DIVISION.
    CALL "DIVIDE"
         USING BY REFERENCE DIVIDEND
                       BY REFERENCE DIVISOR
                       BY REFERENCE QUOTIENT
                       BY REFERENCE REMAINDER.
    DISPLAY "Q=" QUOTIENT " R=" REMAINDER.
    STOP RUN.
 

aalbanez

New Member
View Badges
Joined
Mar 4, 2024
Messages
15
Reaction score
7
Location
United States
Rating - 0%
0   0   0
I don't have buttons to "start" or "stop" the AWC. I have a manual dose 500ml and a manual drain 500ml button.

1754951199020.png



While “cancel” is possible, I don’t really have a need for it.

You could do it with simple AND logic and a toggle switch, which would disable AWC completely but would need to be manually re-enabled.

For a momentary “cancel” button, it’s more complex. The SR-FlipFlop can’t be used directly, because the AWC schedule stays high even after triggering the flip-flop to cancel. The solution is to use the FlipFlop together with an AND gate:
  • The schedule signal feeds the normal AWC logic and also triggers a single pulse into the Set input of the SR-FlipFlop.
  • The FlipFlop output is ANDed with the schedule signal to run the AWC.
  • Pressing the cancel button sends a signal to the Reset input, turning the FlipFlop output off. The AND condition is now false, stopping the AWC until the next schedule start.

1754953625525.png


Please note -- I HAVE NOT tested this in software, but the logic is sound.

@Lasse I blame you for planting these seeds in my head about advanced uses of logic gates. I feel like I am back in the 80's playing with TTL gate designs.
Thank you @BeanAnimal, this is very detailed. I just have in follow up question: what kind of hardware do you suggest for the toggle switch / button and how do you connect it to the ProfiLux?

Thanks again!
 

TOP 10 Trending Threads

WHAT AMOUNT OF LIVE ROCK AND SAND SHOULD BE PRIORITIZED FOR OPTIMAL BIODIVERSITY/FILTRATION?

  • 100% live rock + bagged sand

    Votes: 34 28.1%
  • 100% dry rock + 100% live sand

    Votes: 41 33.9%
  • 50/50 live/dry rock, 50/50 live/bagged sand

    Votes: 27 22.3%
  • 75% live rock, 25% live sand

    Votes: 11 9.1%
  • 25% live rock, 75% live sand

    Votes: 8 6.6%
Back
Top