Post programming questions in the most suitable programming-related sub-forum please. The Neptune Cafe is not one of them. I'll move this thread for you to the Miscellaneous Programming & Usage area.
In the Apex, programming for an output is evaluated top to bottom, and the last TRUE statement determines the outcome of a output program and pouts the output in the state specified in that last true statement. The program you have is not right. The last two lines are in total control of the output, and the previous lines are totally ignored. You are over-complicating it by using If statements for the float switch and leak sensor to cover both possible conditions, e.g you are using both If Leak_1 CLOSED Then OFF and If Leak_1 OPEN Then ON; that is not needed and also makes your program not work right.
In general, use a Set statement to define the default, normal state you want to the output to be in. Then add program statements which cover exceptions to that. In this case, the need is to have the outlet ON, unless the float switch is closed or the leak detector is wet (closed). This is all you need to do what you described:
Set ON
If Refugs CLOSED Then OFF
If Leak_1 CLOSED Then OFF
The outlet is now normally ON due to the Set ON, but will be shut off if the float switch is high or a leak is detected.
Then we add in the desired Fallback state to get your final program:
Fallback OFF
Set ON
If Refugs CLOSED Then OFF
If Leak_1 CLOSED Then OFF
I recommend that you read this sticky post to learn more about the proper use of Set and conditional ("If") statements: https://forum.neptunesystems.com/sho...l=1#post114462
Bookmarks