TIMER for electrical floor heating

cristibadcristibad Junior MemberPosts: 69
Hello guys.
i need to use a timer for controlling electrical floor heating.
I need the heating to run 30 min, 30 min break, run 30 min, 30 min break and so on, as long as the client wants.
i don't know how to program a timer.
i was thinking to use something like this :
while heat_desire=1 and heater_on and 30 min have not past, keep the heating running
if 30 min have past, stop heating for 30 min.

this cycle must repeat forever

Comments

  • DHawthorneDHawthorne Junior Member Posts: 4,584
    Make a timeline with two events, your on and off. Set the increments to your 30 minute interval, create the timeline when your device controller comes online, and set it to repeat. Particulars are in the NS help under timelines.
  • Joe HebertJoe Hebert Junior Member Posts: 2,154
    Here is an example using a couple of WAITs. You can also do as Dave suggested and use TIMELINEs instead.
    DEFINE_DEVICE
    
    dvTP = 10001:1:0
    
    DEFINE_VARIABLE
    
    // we'll setup 2 different wait times so we can adjust the modulation if need be
    VOLATILE INTEGER nHeatCycleOnTime 	= 18000 // 30 minute 
    VOLATILE INTEGER nHeatCycleOffTime	= 18000 // 30 minute
    
    VOLATILE INTEGER nHeatCycleEnable	// 1 = heat cycle is enabled
    
    DEFINE_FUNCTION fnHeatOn() {
    
       // do whatever to turn the heat on
    }
    
    DEFINE_FUNCTION fnHeatOff() {
    
       // do whatever to turn the heat off
    }
    
    DEFINE_FUNCTION fnHeatCycleOn() {
      
       fnCancelHeatWaits()
       
       fnHeatOn()
    
       IF (nHeatCycleEnable) {
          WAIT nHeatCycleOnTime 'HEAT OFF' {
    	 fnHeatCycleOff()
          }
       }
    
    }
    
    DEFINE_FUNCTION fnHeatCycleOff() {
    
       fnCancelHeatWaits()
       
       fnHeatOff()
       
       IF (nHeatCycleEnable) {
          WAIT nHeatCycleOffTime 'HEAT ON' {
    	 fnHeatCycleOn()
          }
       }
    
    }
    
    DEFINE_FUNCTION fnCancelHeatWaits() {
    
       CANCEL_WAIT 'HEAT ON'
       CANCEL_WAIT 'HEAT OFF'
          
    }
    
    
    DEFINE_EVENT
    
    BUTTON_EVENT[dvTP,1] { // heat cycle enable/disable
    
       PUSH: {
       
          nHeatCycleEnable = !nHeatCycleEnable
                
          IF (nHeatCycleEnable) {      
    	 fnHeatCycleOn()
          }
          ELSE {
    	 fnCancelHeatWaits()
          }
          
          [dvTP,1] = nHeatCycleEnable
       }
    
    }
    
    
  • viningvining X Member Posts: 4,346
    cristibad wrote: »
    Hello guys.
    i need to use a timer for controlling electrical floor heating.
    I need the heating to run 30 min, 30 min break, run 30 min, 30 min break and so on, as long as the client wants.
    i don't know how to program a timer.
    i was thinking to use something like this :
    while heat_desire=1 and heater_on and 30 min have not past, keep the heating running
    if 30 min have past, stop heating for 30 min.

    this cycle must repeat forever
    Why does he what to do this, did they forget the slab sensor or they didn't put a t-stat in to control it? If he really needs this then you might what to make the on and off timers variable so he can adjust from the TP as needed to achieve a comfortable floor temp. 15 on 15 off or maybe 10 on 20 off otherwise if you make it hard coded with out the ability for the user to adjust you may have to modify the waits or timelines multiple times before he gets it where he will ultimately be happy with it and that may change seasonally.
Sign In or Register to comment.