Where did I mess up this Programming?

trumpetr

Member
I have a UPB outlet that controls a deicing pump at a lake house. Using the external temp it should be cycling on and off based on temp and time and logging those actions. It's not happening as far as I can tell.

I can turn it on manually, and see it working over the network cams so I know that it's not a comm issue to the relay/plug, but probabally in my programming. Where have I gone wrong?

Here are the lines of code that are supposed to be doing this.

[codebox]17. // Temp Flagging
18. WHEN Extreme Cold Flag OFF
AND IF Exterior Temp CURRENT READING IS LESS THAN Auto Pump Extreme Temp Definitio
THEN Extreme Cold Flag ON
THEN LOG Temps Dropped Below Extreme Cold
19. WHEN Extreme Cold Flag ON
AND IF Exterior Temp CURRENT READING IS GREATER THAN Auto Pump Extreme Temp Definitio
THEN Extreme Cold Flag OFF
20. // De-Icer Pump Control Code
21. WHEN Override Automatic Dock Pump
THEN Pump Override Flag ON
THEN LOG Dock Pump Auto Operation OFF
22. WHEN Enable Automatic Dock Pump
THEN Pump Override Flag OFF
THEN LOG Dock Pump Auto Operation Enabled
23. WHEN Pump Timer Delay Flag OFF
AND IF Pump Override Flag OFF
AND IF Exterior Temp CURRENT READING IS LESS THAN 28
AND IF Extreme Cold Flag OFF
THEN Pump Timer Delay Flag ON FOR 90 MINUTES
THEN De-Icer Pump ON FOR 45 MINUTES
24. WHEN Pump Timer Delay Flag OFF
AND IF Pump Override Flag OFF
AND IF Exterior Temp CURRENT READING IS LESS THAN Auto Pump Temp Definition
AND IF Extreme Cold Flag ON
THEN Pump Timer Delay Flag ON FOR 60 MINUTES
THEN De-Icer Pump ON FOR 50 MINUTES
25. // Pump Operation Logging
26. EVERY HOUR
AND IF Exterior Temp CURRENT READING IS LESS THAN 32
THEN LOG Temps Drop Below Freezing
27. WHEN De-Icer Pump ON
THEN LOG Pump ON
28. WHEN De-Icer Pump OFF
THEN LOG Pump OFF
29. EVERY 5 MINUTES
AND IF Pump ON/OFF Status Flag ON
THEN De-Icer Pump REQUEST STATUS[/codebox]
 
Trumpetr,

While I don't fully understand everything you are trying to accomplish, I think you have some things as triggers (WHEN) when they should be conditions (AND IF). I would probably set up a program block to periodically monitor the outdoor temperature and perform the pump control as desired. For example, you may want to check the temperature every minute and run the pump for 45 minutes out of each hour. Perhaps something like this:

[codebox]
EVERY MINUTE
AND IF Exterior Temp CURRENT READING IS LESS THAN 28
AND IF Pump Override Flag OFF
AND IF Pump Timer Delay Flag OFF
THEN De-Icer Pump ON FOR 45 MINUTES
THEN Pump Timer Delay Flag ON FOR 1 HOUR
[/codebox]
 
Trumpetr,

While I don't fully understand everything you are trying to accomplish, I think you have some things as triggers (WHEN) when they should be conditions (AND IF). I would probably set up a program block to periodically monitor the outdoor temperature and perform the pump control as desired. For example, you may want to check the temperature every minute and run the pump for 45 minutes out of each hour. Perhaps something like this:

[codebox]
EVERY MINUTE
AND IF Exterior Temp CURRENT READING IS LESS THAN 28
AND IF Pump Override Flag OFF
AND IF Pump Timer Delay Flag OFF
THEN De-Icer Pump ON FOR 45 MINUTES
THEN Pump Timer Delay Flag ON FOR 1 HOUR
[/codebox]


Looks like a good plan, I'll give it a try.

Basically what I am trying to accompish is to run a dock de-icing pump (brings up warmer water from the bottom of the lake) for a certain number of minutes every hour. Also if it's very cold (the "Extreme" portion of the programming) then run it more often and for a longer period of time. The trigger vs condition make sense. I also have a button to make it easy for the end user to override the automatic operation. Many times the air temp can be 20 but the water temp is 40 in the first part of the winter.

Stinks when I program this during non-freezing conditions and can't test until it's needed.... I'll give it a try tonight and let you know if it works. Thanks for the help.
 
One thing I see is that your blocks 18 and 19 won't work the way I think you want them to work. Blocks that trigger on units, flags, or zones are only entered when the zone changes state; they aren't checked continuously. So if "Extreme Cold Flag" is on, and you force it off, it will enter block 18 once. If the Exterior Temp reading is less than the value you're comparing it to, it will set Extreme Cold Flag on. At that block 19 will be entered, one time. It will check to see if Exterior Temp is greater than the value -- of course, it isn't, because we just made the opposite comparison. At that point you're stuck; Extreme Cold Flag will not change state again. The reverse is also true; either way, Extreme Cold Flag will change state at most once, and then it won't change again.

What you need to do is trigger on the temperature sensor. You may wonder how to do that. The trick is that a temperature sensor is treated like a zone, and it has a "Secure / Not Ready" status like any other zone. Fire up PC Access, connect to your system, go to the Status tab, and select "Temperature Sensors". You'll notice that your temperature sensor has a "low" and a "high" setting, which you can set by double-clicking on the sensor name. You then set the low value to the temperature you want the Extreme Cold flag to change at. Now you can write:

Code:
WHEN Exterior Temp NOT READY
	THEN Extreme Cold Flag ON
	THEN LOG Temps Dropped Below Extreme Cold

WHEN Exterior Temp SECURE
	THEN Extreme Cold Flag OFF
 
One thing I see is that your blocks 18 and 19 won't work the way I think you want them to work. Blocks that trigger on units, flags, or zones are only entered when the zone changes state; they aren't checked continuously. So if "Extreme Cold Flag" is on, and you force it off, it will enter block 18 once. If the Exterior Temp reading is less than the value you're comparing it to, it will set Extreme Cold Flag on. At that block 19 will be entered, one time. It will check to see if Exterior Temp is greater than the value -- of course, it isn't, because we just made the opposite comparison. At that point you're stuck; Extreme Cold Flag will not change state again. The reverse is also true; either way, Extreme Cold Flag will change state at most once, and then it won't change again.

What you need to do is trigger on the temperature sensor. You may wonder how to do that. The trick is that a temperature sensor is treated like a zone, and it has a "Secure / Not Ready" status like any other zone. Fire up PC Access, connect to your system, go to the Status tab, and select "Temperature Sensors". You'll notice that your temperature sensor has a "low" and a "high" setting, which you can set by double-clicking on the sensor name. You then set the low value to the temperature you want the Extreme Cold flag to change at. Now you can write:

Code:
WHEN Exterior Temp NOT READY
	THEN Extreme Cold Flag ON
	THEN LOG Temps Dropped Below Extreme Cold

WHEN Exterior Temp SECURE
	THEN Extreme Cold Flag OFF

Thanks for the hints. I'll give them a try.

Matt
 
Back
Top