Hi everyone! I have a t3000 that I have set up a 4-20ma pressure transducer scaled for PSI, it works perfectly.
My client has requested a warning light system based on pressure with three outputs:
When pressure is equal or greater than 110, output 1 should be on
When pressure is between 100 and 110, output 1 should be off and output 2 should be on
When pressure is below 100, output 1 and 2 should be off, and output three should be on.
I have tried with IF and ELSE statements with the < and > operators, but I seem to be missing something. Could you help please?
Thanks!
Show us a few screen shots and perhaps we can pick something up.
Do check out the posts related to ācustom analogā input tables. If you get that working the rest will fall into place.
Create a setpoint for the system, also in PSI.
REM ***** STAGING *********
IF PRESSURE > SETPOINT THEN START STAGE1
IF PRESSURE < SETPOINT - 1 THEN STOP STAGE1
IF PRESSURE > SETPOINT + 10 THEN START STAGE2
IF PRESSURE < SETPOINT - 1 THEN STOP STAGE2
REM **** P1 ***********
IF STAGE1 OR STAGE2 THEN START PUMP1
IF NOT STAGE1 AND NOT STAGE2 THEN STOP PUMP1
REM **** P2 ***********
IF STAGE2 THEN START PUMP2
IF NOT STAGE1 AND NOT STAGE2 THEN STOP PUMP2
Looks about right to meā¦!
My 2-cents worth.
my suggested code is
10 OUT1 = 0
20 OUT2 = 0
30 OUT3 = 0
40 IF PRESS >= 110 THEN OUT1 = 1
50 IF PRESS < 110 AND PRESS > 100 THEN OUT2 = 1
60 IF PRESS <= 100 THEN OUT3 = 1
I have had trouble with multiple IF because the redundant outputs do not āresetā for the next scan - hence the forced resets in lines 10, 20, 30.
Alternatively, expand the end of each IF, eg
10 IF PRESS >= 110 THEN OUT1 = 1 , OUT2 = 0 , OUT3 =0
20 IF PRESS < 110 AND PRESS > 100 THEN OUT1 = 0 , OUT2 = 1 , OUT3 = 0
30 IF PRESS <= 100 THEN OUT1 = 0 , OUT2 = 0 , OUT3 =1
I have not tested this but expect it will work ok.
Typically you would test by varying the pressure (or manually adjusting the input value).
So, starting low you would see OP3 and then OP2 and then OP1 come on in order. But if you dont reset the redundant OPs they will stay active, and by the time pressure has risen above 110, ALL the outputs will be on.
Hope that helps
1 Like
Maurice, Brian, thank you so much! They both work well, but I used Brians code as it seems to be quicker to respond. I am hoping I can give a bit back to the form here, but I come from a Sedona and N4 Background, so Iām still getting used to the Basic concept⦠especially after years of Ladder Logic!
Thank you so much!