GA ramp issue

Discussion in 'C-Bus Automation Controllers' started by kojobomb, Oct 29, 2023.

  1. kojobomb

    kojobomb

    Joined:
    May 27, 2019
    Messages:
    76
    Likes Received:
    6
    Location:
    Possum Brush
    With the below resident script I'm getting the correct actions with GA '0,56,5' ramping up over 17 minutes and down over 5 minutes but when level is at 255 and the script runs again it resets level to 255 over another 17minutes and the level sits in a looped state neither "on" or "off".and the level is unreadable.
    How do I get it to not loop but still reset the ramp up if level is anything other than true "less than 255"

    Code:
    SOC= GetCBusMeasurement( 0, 50, 48)
    
    discharge = GetCBusMeasurement( 0, 50, 50)
    
    level = GetCBusLevel(0, 56, 5)
    
    if  ( SOC>92) and ( discharge<300)
            then
    
                    -- Set '0/56/5' to "ON" over 17 minutes
                            SetCBusLevel(0, 56, 5, 255, 1020)
    
    log (SOC,discharge,level, state)
     
                                        elseif ( SOC<90) or ( discharge>1000)
                                            then
     
                                                    -- Set '0/56/5' to "OFF" over 5 minutes
                                                            SetCBusLevel(0, 56, 5, 0, 300)
    
    log (SOC,discharge,level)
     
    end
    
    
     
    kojobomb, Oct 29, 2023
    #1
  2. kojobomb

    kojobomb

    Joined:
    May 27, 2019
    Messages:
    76
    Likes Received:
    6
    Location:
    Possum Brush
    I think I've sorted it out.

    Code:
    SOC= GetCBusMeasurement( 0, 50, 48)
    
    discharge = GetCBusMeasurement( 0, 50, 50)
    
    level = GetCBusLevel(0, 56, 5)
    
    -- Get state of application 56 group 1 on the local network
    state = GetCBusState(0, 56, 5)
    
    
    if  ( SOC>92) and ( discharge<300) and (level<250)
    
    
            then
    
                    -- Set '0/56/5' to "ON" over 17 minutes
                            SetCBusLevel(0, 56, 5, 255, 1020)
    
    log (SOC,discharge,level, state)
     
                                        elseif ( SOC<90) or ( discharge>1000)
                                            then
     
                                                    -- Set '0/56/5' to "OFF" over 5 minutes
                                                            SetCBusLevel(0, 56, 5, 0, 300)
    
    log (SOC,discharge,level, state)
     
    end
    
    
     
    kojobomb, Oct 29, 2023
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.