5500NAC2 Modbus Gateways

Discussion in 'General Discussion' started by LighthouseAutomation, Feb 19, 2025.

  1. LighthouseAutomation

    LighthouseAutomation

    Joined:
    Feb 19, 2025
    Messages:
    3
    Likes Received:
    0
    Location:
    Darwin
    Hey guys,

    I am programming up a 5500NAC2 with the new v2.0.0 firmware, I am trying to integrate in a bunch of Schneider PowerTags via a Schneider PAS600 Modbus gateway. I have them talking to the gateway OK and set up virtual modbus addresses for each PowerTag, however when I try to add in a modbus TCP/IP connection with the PAS600 as the IP address, and address 1 for example as the 1st powerTag address, it's offline. Can't see a way to add a gateway vs. a modbus device

    I know this is probably pretty niche but if anyone can help with mapping Modbus TCP/IP gateways in as there isn't a lot of information out there on this (and I am pretty fresh to C-Bus, I have just moved over from BMS engineering land) I am familiar with Modbus and Schneider products just not sure on correct way to integrate into C-Bus.
     
    LighthouseAutomation, Feb 19, 2025
    #1
  2. LighthouseAutomation

    LighthouseAutomation

    Joined:
    Feb 19, 2025
    Messages:
    3
    Likes Received:
    0
    Location:
    Darwin
    right may as well follow up, this was actually pretty easy in the end. Modbus in the NAC2 does not poll until you link it to a C-Bus object first - so I needed to create the 6 or so points as C-Bus objects, then link them in the Modbus mapping section. The built in profile for the Schneider PowerTags has the correct registers, there is an offset of -1 applied , I am assuming that is just how C-Bus handles 32-Bit words (swapped). Ended up modifying the LUA script to delete out irrelevant registers (3 phase points) as it's just a single phase PowerTag.

    Now I need to figure out how to trigger the relay output (outside air fan) when the current exceeds a setpoint, its for a laundry. Struggling to figure out how to drive outputs from LUA script, if anyone has good resource for learning ins and outs of LUA for C-Bus , I'm all ears

    Below is screen shot from early testing

    [​IMG]
     
    LighthouseAutomation, Feb 20, 2025
    #2
  3. LighthouseAutomation

    Diggerz

    Joined:
    Jan 24, 2017
    Messages:
    66
    Likes Received:
    10
    Location:
    Australia, Vic, Melbourne
    Try something like this, change the threshold value and the application / group address to what you need:

    -- Event Script tied to the current object with group address or keyword --

    Code:
    value = event.getvalue()
    threshold = 10 -- change this to your threshold value
    log("the current value is: " ..value)
    
    if value > threshold then
    log("The value is greater than the threshold. The Current Value is: "..value )
    grp.checkwrite("0/56/1", 255) -- network 0 / application 56 / group address 1 - value 255
    elseif value < threshold then
    log("The value is less than the threshold. The Current Value is: "..value )
    grp.checkwrite("0/56/1", 0) -- network 0 / application 56 / group address 1 - value 0
    end
     
    Diggerz, Feb 22, 2025
    #3
    LighthouseAutomation likes this.
  4. LighthouseAutomation

    LighthouseAutomation

    Joined:
    Feb 19, 2025
    Messages:
    3
    Likes Received:
    0
    Location:
    Darwin
    This is what I ended up with for 2 x Power meter values, more or less accomplished what I wanted, however on loss of comms I'm not sure if it will stop it from working as intended. But because it's tied to a C-Bus object the value will most likely stick as last known value?


    Code:
    -- Resident script to monitor power meter current values
    -- and activate a relay output when either exceeds the threshold
    
    -- Define addresses
    local power_meter_network = 0
    -- Using predefined application address, so setting group and channel directly
    local power_meter1_group = 0
    local power_meter1_channel = 1
    local power_meter2_group = 1
    local power_meter2_channel = 1
    local relay_network = 0
    local relay_app = 56
    local relay_group = 16
    local threshold = 0.50  -- Threshold current in Amps
    
    -- Function to check current and control relay
    function monitor_power_meter()
        if not GetCBusMeasurement then
            log("Error: GetCBusMeasurement function is not available.")
            return
        end
        
        local success1, current_value1_or_error = pcall(GetCBusMeasurement, power_meter_network, power_meter1_group, power_meter1_channel)
        local success2, current_value2_or_error = pcall(GetCBusMeasurement, power_meter_network, power_meter2_group, power_meter2_channel)
        
        if not success1 then
            log("Error reading power meter 1 measurement: " .. tostring(current_value1_or_error))
            return
        end
        if not success2 then
            log("Error reading power meter 2 measurement: " .. tostring(current_value2_or_error))
            return
        end
        
        local current_value1 = tonumber(current_value1_or_error)
        local current_value2 = tonumber(current_value2_or_error)
        
        if not current_value1 or not current_value2 then
            log("Error: Received invalid data from one or both power meters.")
            return
        end
        
        if current_value1 > threshold or current_value2 > threshold then
            SetCBusState(relay_network, relay_app, relay_group, true)  -- Turn relay ON
            log("Current exceeded threshold: Meter1 = " .. current_value1 .. " A, Meter2 = " .. current_value2 .. " A. Relay ON.")
        else
            SetCBusState(relay_network, relay_app, relay_group, false) -- Turn relay OFF
            log("Current below threshold: Meter1 = " .. current_value1 .. " A, Meter2 = " .. current_value2 .. " A. Relay OFF.")
        end
    end
    
    -- Schedule the script to run periodically
    while true do
        monitor_power_meter()
        sleep(5) -- Wait for 5 seconds before next check
    end
     
    LighthouseAutomation, Feb 24, 2025
    #4
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.