Modbus profile builder

Discussion in 'C-Bus Automation Controllers' started by kojobomb, Jan 1, 2022.

  1. kojobomb

    kojobomb

    Joined:
    May 27, 2019
    Messages:
    71
    Likes Received:
    6
    Location:
    Possum Brush
    I'm trying to find out what is the easiest way to build a modbus profile to upload to SHAC.
    I have the SMA inverter register documentation but am trying to find a simple program to help with building this profile so I can upload and start communicating with inverter to increase self consumption of energy during the day.
    I know I've got to build an XML file but surely there is a easy way since this modbus has been around for such a long time.
    Ash
     
    kojobomb, Jan 1, 2022
    #1
  2. kojobomb

    Pie Boy

    Joined:
    Nov 21, 2012
    Messages:
    248
    Likes Received:
    31
    Location:
    New Zealand
    SHAC Modbus profiles are in .json format, not xml.
    Eaisest way is to download one from the SHAC, and open it with a txt editor, notepad++ or similar, have a poke around and duplicate, then upload to the shac.

    There is a Schneider white paper somewhere on what is required, eg some parameters in the json are required like name, type etc etc.

    I would start off with a manual read test on the modbus to see if you have connectivity and the expected value received from the modbus register you interrogated.
    sometimes the registers are out by 1.

    Once you have that then look at making a small profile
    With say 1or 2 registers then test that for poc before going all out.
     
    Pie Boy, Jan 2, 2022
    #2
  3. kojobomb

    Shiney2512

    Joined:
    Apr 26, 2016
    Messages:
    39
    Likes Received:
    4
    Location:
    Melbourne
    Shiney2512, Jan 4, 2022
    #3
  4. kojobomb

    kojobomb

    Joined:
    May 27, 2019
    Messages:
    71
    Likes Received:
    6
    Location:
    Possum Brush
    Thank you both very much for your information, The battery inverters don't run/manage modbus protocol directly but communicate via a proprietary sma com1 communication, fortunately a (SMA data manager) converts comms into modbus protocol but is a master/client and now my dilemma is trying to read data between SMA modbus master and SHAC modbus master.
    I had previously read the logicmachine thread that you have linked to.
    Ash
     
    kojobomb, Jan 4, 2022
    #4
  5. kojobomb

    Pie Boy

    Joined:
    Nov 21, 2012
    Messages:
    248
    Likes Received:
    31
    Location:
    New Zealand
    What other options for integration dose SMA power manager have? Ethernet http api?
     
    Pie Boy, Jan 4, 2022
    #5
  6. kojobomb

    kojobomb

    Joined:
    May 27, 2019
    Messages:
    71
    Likes Received:
    6
    Location:
    Possum Brush
    Success, I've managed to make contact with the battery inverter.
    I have been profile building and have managed to make probably 30 or more profiles to try every combination.
    I've managed to poll (battery SOC) and i am over the moon about this.
    Under "mapping parameters" in the modbus section of the SHAC manual it states a minimum of 4 parameters to build a modbus profile.

    "Name" (This can be any nominated descriptive name)
    "Bus_Datatype" (seems like unless its "float32" once loaded i cant allocate to a group)
    "Type" (Register type)
    "Address" (Register address)

    I'm trying to poll 2 more registers 30849 "Battery Temp" 30851 "Battery Voltage" and for some reason I cant quite get the configuration correct.

    Does anyone have more info on "Bus Datatypes" that are acceptable configurations?
    Pie Boy thank you so much with your help in learning how to build the profiles, without you i wouldn't of just had the biggest boost in believing this will all be worth the time and effort.
     
    kojobomb, Jan 5, 2022
    #6
  7. kojobomb

    gte242

    Joined:
    Apr 7, 2017
    Messages:
    31
    Likes Received:
    5
    Location:
    Poland
    In the SHAC manual there is a good section on modbus. Including mapping and data types This helped me generate a json for Stiebel Eltron Heat Pump.

    The "bus_datatype" has the same options as "datatype" in the table below.

    Weirdly Schneiders info below helped me out around datatypes
    https://www.productinfo.schneider-electric.com/powertaglinkuserguide/powertag-link-user-guide/English/BM_PowerTag Link D User Manual_4af62430_T000501355.xml/$/TPC_ModbusTableFormatandDataTypes_4af62430_T000501590

    Did find that if I want to read bits I would import the register in floating point and then do a bit of Lua Scripting to get what I want and output descriptive text. Example below:

    Code:
    status = event.getvalue()
    
    
    if bit.band(status, 1) ~= 0 then
      Bit0 = "HC1 pump on, "
      else
      Bit0 = ""
    end
    
    if bit.band (status, 2) ~= 0 then
        Bit1 = "HC2 pump on, "
      else
      Bit1 = ""
    end
    
    if bit.band (status, 4) ~= 0 then
        Bit2 = "Heat up Program, "
      else
      Bit2 = ""
    end
    if bit.band (status, 8) ~= 0 then
      Bit3 = "NHZ stages running, "
      else
      Bit3 = ""
    end
    if bit.band (status, 16) ~= 0 then
        Bit4 = "Heat Pump in Heating mode, "
      else
      Bit4 = ""
    end
    if bit.band (status, 32) ~= 0 then
        Bit5 = "Heat Pump in DHW mode, "
      else
      Bit5 = ""
    end
    if bit.band (status, 64) ~= 0 then
        Bit6 = "Compressor Running, "
      else
      Bit6 = ""
    end
    if bit.band (status, 128) ~= 0 then
        Bit7 = "Summer Mode Active, "
      else
      Bit7 = ""
    end
    if bit.band (status, 256) ~= 0 then
        Bit8 = "Cooling Mode Active, "
      else
      Bit8 = ""
    end
    if bit.band (status, 512) ~= 0 then
        Bit9 = "Min one IWS in defrost mode, "
      else
      Bit9 = ""
    end
    if bit.band (status, 1024) ~= 0 then
        Bit10 = "Silent mode 1 Active, "
      else
      Bit10 = ""
    end
    if bit.band (status, 2048) ~= 0 then
        Bit11 = "Silent mode 2 Active, "
      else
      Bit11 = ""
    end
    
    output = table.concat({Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6, Bit7, Bit8, Bit9, Bit10, Bit11})
    SetUserParam(0, 60, output)
    upload_2022-2-1_10-57-18.jpeg
    upload_2022-2-1_11-6-9.jpeg
     
    gte242, Feb 1, 2022
    #7
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.