spa temperature email help

pittom

Active Member
Hi,i am new and need help with email. I don't know how to do this,
1-when t3(pipe temp)goes above 80f email em1
2-when t5(water temp)goes above 105f email em2
3-when t3 (pipe temp)goes below 60f email em3
4-when t5(water temp)goes below 90f email em4
 
the code i have now works like this and test good
-if op1 is on (manual)op7(pump)on and if water is below103.5f turn op8(heater)on
 
-if op1 off(manual off)check water temp below 100f turn on pump and heat
 
-and safety if t3(pipe) over 80f turn all off
 
-and safety if t5(water)over 105 turn all off
 
 
 
  
START
       
    TSTEQ OP1 1  
    CALLSUB MANUAL_ON
        TSTGE T3 800
        callsub ph_off
        tstge t5 1050  
    CALLSUB PH_OFF   
    TSTLE T5 1000  
    CALLSUB HEAT_ON   
    TSTGE T5 1040  
    CALLSUB HEAT_OFF   
    END    
 
MANUAL_ON:
    SET OP7 1  
    TSTLE T5 1035  
    SET OP8 1  
    TSTGE T5 1040  
    SET OP8 0     
    RET    
 
HEAT_ON:
    SET OP7 1  
    SET OP8 1  
    RET    
 
HEAT_OFF:
    SET OP8 0  
    DELAY 10000   
    SET OP7 0  
    RET    
 
PH_OFF:
    SET OP1 0  
    SET OP7 0  
    SET OP8 0  
    RET
 
 
To receive one email only for the event, you will need to use flags to indicate email being sent. Then you will need to define at what condition you allow the flags to be clear so that it can send email again later.
 
Assume you have 3.02.16x firmware, email setup first go to "notification setup". In earlier firmware, that is "email setup".  You can setup email account and nofification mesage. Test that working fine.
 
In the PLC code simply do
email emx
where x is 1 to 8. to send out proper message.  Try not to send too many emails in a row, not only that could overrun the email queue buffer inside WebControl, a lot of ISP or Yahoo mail server will not like being flooded with similar email in short period time.  To prevent that, you need to set a flag bit for each email sent.  The same email only can be send again when the flag is cleared.
 
When email queue buffer overrun, there is not harm to WebControl, however, newer email will overwrite the previous queued email.
 
i have 3.02.15 firmware i am new and don't know how to use flags is there an example to learn from
 
Basically, you pick a VAR or RAM to be your flag variable. 3.02.15 firmware supports bitwise operands. For example, you pick VAR8 as your flag, then you can define bit 1 for em1 sent, bit2 for em2 sent, bit 3 for em3 sent, and bit4 for em4 sent.
 
The reason I select VAR vs RAM is that during debugging, you can see VAR value on the browser screen, helping seeing the state of PLC running.
When you sent an email, say EM1, you can do
ORB VAR8 1 VAR8
next time when you try to send email again on EM!, your logic can check
ANDB VAR8 1 RAM8
Using RAM8 not change the value of VAR8 during testing.  Then BZ or BNZ to your logic flow to bypass sending or not.
 
When condition met for clear the flag, you can do
XORB VAR8 1 VAR8
that will flip the bit 1 value, assume it was 1 before, after this operation, it will be changed to zero.
To make sure not flip zero back to 1, you can add checking ANDB VAR8 1 RAM8 before to make sure only flip flag to zero when bit 1 is 1.
 
Thanks I am trying but no luck.Does anyone have a email simple sample when temp gets to high it will email 1 time 
 
This one is when the temp gets to low, but same idea.
 
START
LOOP:
    TSTLT T2 650
    CALLSUB TEMPALERT
    CALLSUB RESETS
    GOTO LOOP   
    END
TEMPALERT:
    ANDB RAM1 1 RAM2
    TSTEQ 0 RAM2
    EMAIL EM1
    ORB RAM1 1 RAM1
    RET
RESETS:
    TSTGT T2 660
    CALLSUB RESET4
    RET    
RESET4:
    ANDB RAM1 1
    BNZ SET4ZERO
    RET
SET4ZERO:
    XORB RAM1 1 RAM1
    RET
 
The code you posted does not have email functions. Could you please paste in your code with email function, so that we can take a look where could go wrong?
 
here it is,like i said i am new so don't laugh 
 
  
START
        set ram1 0
        set ram2 0
        loop:
        callsub resetrams
        delay 1000
        tstge t3 800
        callsub send_em1
        delay 1000
        tstle 1050
        callsub send_em1
        delay 1000
        goto loop
    TSTEQ OP1 1  
    CALLSUB MANUAL_ON
        tstge t5 1050  
    CALLSUB PH_OFF   
    TSTLE T5 1000  
    CALLSUB HEAT_ON   
    TSTGE T5 1040  
    CALLSUB HEAT_OFF   
    END 
 
resetrams:
        tstle t3 790
        set ram1 0
        tstle t5 1048
        set ram2 0
        ret
send_em1:
        tsteq ram1 0
        email em1
        set ram1 1
        delay 2000
        ret
send_em2:
        tsteq ram2 0
        email em2
        set ram2 1
        delay 2000
        ret
 
MANUAL_ON:
    SET OP7 1  
    TSTLE T5 1035  
    SET OP8 1  
    TSTGE T5 1040  
    SET OP8 0     
    RET    
 
HEAT_ON:
    SET OP7 1  
    SET OP8 1  
    RET    
 
HEAT_OFF:
    SET OP8 0  
    DELAY 10000   
    SET OP7 0  
    RET    
 
PH_OFF:
    SET OP1 0  
    SET OP7 0  
    SET OP8 0  
        email em1
    RET
 
Your main program ended with these two lines:
CALLSUB HEAT_OFF
END
 
Try to add
goto loop
before END
that way, your will not always initialize RAM0 and RAM1 to zero, which means email not sent yet in your logic.
 
In your main program body, there are also lines like thiese:
 callsub send_em1
delay 1000
goto loop
 
That goto loop should prevent any logic after that being executed.  Is that something you wanted?  If this is the code you are running, it should only send EM1 once.
 
Ok here is new code,
 
 I tried with T5 going over temp and sent email 2 but keeps sending until T5 goes below set temp, i want only 1 email when temp goes over set point
                         
 
 
START
        set ram1 0
        set ram2 0
        loop:
        callsub resetrams
        delay 1000
        tstle t3 800
        callsub send_em1
        delay 1000
        goto loop
        tstge t5 1050
        callsub send_em2
        delay 1000
        goto loop
    TSTEQ OP1 1  
    CALLSUB MANUAL_ON
        tstge t5 1050  
    CALLSUB PH_OFF   
    TSTLE T5 1000  
    CALLSUB HEAT_ON   
    TSTGE T5 1040  
    CALLSUB HEAT_OFF   
    END 
 
resetrams:
        tstle t3 790
        set ram1 0
        tstle t5 1048
        set ram2 0
        ret
send_em1:
        tsteq ram1 0
        email em1
        set ram1 1
        delay 2000
        ret
send_em2:
        tsteq ram2 0
        email em2
        set ram2 1
        delay 2000
        ret
 
MANUAL_ON:
    SET OP7 1  
    TSTLE T5 1035  
    SET OP8 1  
    TSTGE T5 1040  
    SET OP8 0     
    RET    
 
HEAT_ON:
    SET OP7 1  
    SET OP8 1  
    RET    
 
HEAT_OFF:
    SET OP8 0  
    DELAY 10000   
    SET OP7 0  
    RET    
 
PH_OFF:
    SET OP1 0  
    SET OP7 0  
    SET OP8 0  
        email em1
    RET
 
Back
Top