Announcement

Collapse
No announcement yet.

Logic questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Logic questions

    I have created this to load different heating schedules depending on outside and inside temperatures, I just wanted to make sure some things will work, for example


    Case 19 To 19.5
    If Tempoutside < 14 Then
    hs.TriggerEvent("Load Heating mornings and evenings")
    End If
    If Tempoutside > 14 Then
    hs.TriggerEvent("Load Heating mornings only")
    End If


    do I need the End If at all ? Can I have multiple If... for each case ? What happens if Tempoutside is exactly 14, which event will it trigger ?


    Just in case this is the full script (work in progress...)




    Sub Main(ByVal Parms As Object)

    Dim Halltemp As Double = hs.DeviceValueEx(308)
    Dim Tempoutside As Double = hs.DeviceValueEx(14)



    Select Case Halltemp

    Case < 18.5
    If Tempoutside < 4 Then
    hs.TriggerEvent("Load Heating very cold")

    Case 18.5 To 19
    hs.TriggerEvent("Load Heating cold")

    Case 19 To 19.5
    If Tempoutside < 14 Then
    hs.TriggerEvent("Load Heating mornings and evenings")
    End If
    If Tempoutside > 14 Then
    hs.TriggerEvent("Load Heating mornings only")
    End If

    Case > 19.5
    hs.TriggerEvent("Load Heating off")


    End Select
    End Sub
Working...
X