Loxone Modbus TCP, int64 datatypes?

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • sjef86
    Azubi
    • 23.08.2018
    • 4

    Loxone Modbus TCP, int64 datatypes?

    Hi,

    I'm struggling with polling some data from my Schneider Smartlink system. I currently poll voltage and current data in float32 datatype. But the total energy is int64 datatype.
    I try to set up 4x int16 registers and combine the results via a formula, but none of the registers are getting data. This solution is working just fine with openhab2 system, but not on the loxone :S
    Anyone have an idea of a solution?

    thanks
    Christian
  • Tico
    Lox Guru
    • 31.08.2016
    • 1035

    #2
    I don't have a complete answer for you but I can successfully pull the first half of a 64bit value from a Fronius energy counter.

    In my situation, the Modbus address is published as registers 510-513, uint64 (ie. 4 x 16bit blocks). I have set the following parameters -

    IO address: 511
    Command: 3 - Read holding register (4x)
    Data type: 32-bit unsigned integer

    In return, I receive the value in Wh. It is currently only at 30,340,887 Wh.

    If I have calculated correctly, it won't start to overflow into the second 32bits until it reaches 4,294,967,295 Wh (ie. a very long time....)

    When it gets close, I will create a 2nd Modbus analogue input -

    IO address: 513
    Command: 3 - Read holding register (4x)
    Data type: 32-bit unsigned integer

    I think I am correct in suggesting the formula will then be AI1 + AI2 + 4,294,967,295 = Total energy Wh (Hopefully someone can confirm this).
    Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

    Kommentar

    • sjef86
      Azubi
      • 23.08.2018
      • 4

      #3
      Thanks for your reply Tico!
      I have already tried this, And just can't figure out why I don't recieve any data! :/
      See attachment..

      Found this formula, for combining 4x 16-bit registers:
      Angehängte Dateien

      Kommentar

      • Tico
        Lox Guru
        • 31.08.2016
        • 1035

        #4
        Thanks for the formula. I'm sure you've tried multiple combinations, but the attached is what worked for mine (albeit just the first 32bits). This also converts Wh to kWh to avoid using a formula block (using Correction 1000 to 1).

        Have you tried address 3256 and 3258 just to check where the modbus offset might be? Also un-check 'Byte order' and try with a check against 'Combine 2 registers'.
        Zuletzt geändert von Tico; 28.08.2018, 04:56.
        Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

        Kommentar

        • Tico
          Lox Guru
          • 31.08.2016
          • 1035

          #5
          I've now split mine into 4 x 16bits and get the same value.

          The Fronius published modbus registers are 510-513. I've created 4 registers with address 509, 510, 511 and 512.

          Probably significant is that your register is published as int64 (signed?). Mine is published as uint64 (unsigned).

          I don't know enough about binary to help with how this affects decomposing/recomposing using 16bits.
          Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

          Kommentar

          • MaxMoritz
            Smart Home'r
            • 27.11.2015
            • 40

            #6
            Hi Tico,

            you seem to be the Modbus Specialist of this forum. I´ve read many entries of you, all very useful. Thanks a lot for your support to anyone.
            I now have a similar question like the one above, but it seems that since year 2018 some Modbus settings in Loxone have changed.

            I need to read a sensor value of my Alfen Wallbox (EV-charger) .

            Start Adress: 374
            End Adresss: 377
            Number of 16 Bit Registers: 4
            Read or Write: R
            Data Type: Float 64
            step size & units: 1 Wh

            64 Float data type is not available in Loxone.
            You suggest to devide it into 4x16 bit.
            Which Data type in Loxone do i need to use.? 16 Bit unsigned integer???

            Can you maybe educate me and tell me the meaning behind the numbers (284174976710656.... ) you are calculating in your formula.
            Klicke auf die Grafik für eine vergrößerte Ansicht

Name: image.png
Ansichten: 358
Größe: 12,8 KB
ID: 435447
            Maybe there is in the meantime an easier way available to solve my problem?

            Thanks in advance for your support.
            Michael

            Kommentar

            • Tico
              Lox Guru
              • 31.08.2016
              • 1035

              #7
              Thanks for the kind words. To briefly explain the meaning behind the numbers -

              Klicke auf die Grafik für eine vergrößerte Ansicht

Name: image_16820.png
Ansichten: 291
Größe: 22,6 KB
ID: 435465

              I1, I2, I3 and I4 represent the components of a single value spread across 4 modbus registers. In this case it is the Lifetime Energy Production of a new inverter and the value is still small. It's only filling up the last two registers (the smallest end of the value).

              The maximum value of a 16bit binary number is 65535 (Binary 1111111111111111). Similar to how we count in decimal (ie. 999 to 1000), when we get to the maximum binary value, all the bits go to zero and the 17th bit goes to 1. The input I4 is the first 16 bits and represents the 'least significant' end of the value.

              65536 = 10000000000000000 (16 zero's)

              So the next 16 bits (I3) represent how many times we've counted through 65535. And on it goes through the bigger end of the value for the rest of the 16bit registers.

              65536 multplied by 65536 = 4,294,967,296 (which is the number we're multplying I2 by).

              4,294,967,296 multiplied by 65536 = 281,474,976,710,656 (which is the number we're multplying I1 by).

              What I've written above is probably the most basic way binary can be used to represent a value. Your Float 64 data type is a different way to interpret the 64 bits, significantly different to the above.

              https://en.wikipedia.org/wiki/Double...0radix%20point.

              You need to use 16bit unsigned integer as a starting point. That will produce 4 decimals values in Loxone that will then need to be decomposed back to their basic bits.

              This thread below starting at Post #13 is a starting point. You should consider that what you have is 64bits (divided into 4 x 16bits) that need to be re-arranged in this order -

              Klicke auf die Grafik für eine vergrößerte Ansicht

Name: Expponent Fraction.png
Ansichten: 255
Größe: 7,9 KB
ID: 435466

              Hallo Leute, ich bekomme über einen HTTP-Eingang folgenden Quellcode geliefert. {"cid":-1,"data":{"value":"0001FC000008FF000002FF000157FF000022FF03"},"code":200} Hierbei handelt es sich um einen Sensor, welchen ich über einen IO-Link Master ( IFM AL1350 ) auslese. Es
              Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

              Kommentar

              • Tico
                Lox Guru
                • 31.08.2016
                • 1035

                #8
                I see Loxone now has a facility for 64bit double (still learning...not an expert yet). What is returned with the following parameters selected?


                Klicke auf die Grafik für eine vergrößerte Ansicht  Name: 64-bit double.png Ansichten: 0 Größe: 34,7 KB ID: 435496
                Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

                Kommentar

                • MaxMoritz
                  Smart Home'r
                  • 27.11.2015
                  • 40

                  #9
                  Hi Tico, I had trouble with my Alfen Wallbox and an Alfen support guy replaced the Connection Board today. Will be able to test everything in 1-2 days. Will get back to you asap.
                  Thanks a lot for your support so far!

                  Kommentar


                  • MaxMoritz
                    MaxMoritz kommentierte
                    Kommentar bearbeiten
                    Hello Tico,

                    sorry for replying late.
                    I was only now able to test your setting.
                    a) Register Setting = 373 (your request) generated value = nan-nan; you might have mixed "373 with 374", See post No 6
                    b) Register Setting = 374 (Register based on Wallbox documentation) generated value = 3460759,000
                    all direct value reading, without formula behind.. Setting = 64 double instead of in Loxone not existing "Float 64".

                    Is there a way to further work with the "64 bit double" to get correct kWh value?
                    Zuletzt geändert von MaxMoritz; 27.07.2024, 15:49.

                  • Tico
                    Tico kommentierte
                    Kommentar bearbeiten
                    Hello MaxMoritz. I’m away from the computer for the next week. In the interim, do you know the expected kWh value that should be returned? That will help correlate what is presented by Loxone versus what needs to be modified.
                    Can you also try different variations on the properties of the analog sensor. ie. -

                    1. 16-bit register and Order of Registers checked, then the corresponding value returned,
                    2. 16-bit register, Order of Registers and Byte Order all checked, then the corresponding value returned.
                    3. 16-bit register and Byte Order checked, then the corresponding value returned.
                    4. Nothing checked, then the corresponding value returned.

                    In all cases, also provide the expected kWh value that should be returned if you know it.
                • MaxMoritz
                  Smart Home'r
                  • 27.11.2015
                  • 40

                  #10
                  Hello Tico.

                  based on your comment, I have now tried different configs and I think we are getting closer to the solution.
                  see results in attached *.pdf below
                  The correct setting is most probably the one at the end, I need to divide the value by 1000 later using the divider function in Loxone.

                  Thanks again for your help. It was great!
                  May I contact you for 2 more topics about Modbus via Loxone?
                  Angehängte Dateien

                  Kommentar

                  • MaxMoritz
                    Smart Home'r
                    • 27.11.2015
                    • 40

                    #11
                    Hello Tico ,
                    If I may ask you for an advice again. here is the first one of my 2 additional problems mentioned in post #10.
                    I have created the following sensors according to the register settings defined by the wallbox provider Alfen. Strangely, I get the values of the individual phases displayed for one sensor, but not the total.
                    With another sensor, it is exactly the opposite. I don't see the phase values, but I do see the total.
                    What does the result mean: nan-> nan? How do I get real values instead of this nan -> nan

                    see settings and results in the attached PDF.
                    Angehängte Dateien

                    Kommentar

                    • Tico
                      Lox Guru
                      • 31.08.2016
                      • 1035

                      #12
                      Hello MaxMoritz. I've just got around to looking at this. 'nan' means 'not a number'. The Data type might be set incorrectly.

                      Have you made any progress?
                      Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

                      Kommentar

                      • MaxMoritz
                        Smart Home'r
                        • 27.11.2015
                        • 40

                        #13
                        Dear Tico
                        thanks for replying and explaining „nan“ meaning.
                        yes, problem still exists, wasn’t able so far to receive correct values.
                        i, ve checked again the data type in the original modus register listing.
                        All 4 values (Single phases 1-3 and the corresponding sum do have same data-type), so I do not have an explanation why I am getting „nan“ return.
                        see orinigal settings
                        Klicke auf die Grafik für eine vergrößerte Ansicht

Name: image.jpg
Ansichten: 141
Größe: 473,2 KB
ID: 439783

                        Kommentar

                        • Tico
                          Lox Guru
                          • 31.08.2016
                          • 1035

                          #14
                          I can't see anything obviously wrong with your settings. A possible reason for the NaN value is that the device is being overwhelmed with the rate of requests at those particular registers.

                          I suggest setting every sensor in Loxone relevant to the Alfen charger to a consistent polling interval. Perhaps start with 30 seconds polling cycle and see whether that makes a difference.
                          Ich spreche kein Deutsch. Gib Google Translate die Schuld, wenn ich unverständlich bin.

                          Kommentar

                          Lädt...