Problem Reading Swapped Byte Float Data

Hi,
We have L&T's Series 4000 Energy Meters wherein the Data is available in Float Data Type with Swapped Byte. We have Tried using FloatMode = 1 in Modbus Parameters and We need to read data from 2 registers 40159 & 40160 the Variable type created is Real still we are unable to get the data which otherwise is easily available on ModScan and other such softwares.
Software Version Vijeo Citect 2018
  • Example of what value you read from the Meter and what value you were seeing in Citect? 

  • On Energy Meter and other Software the value shows as 84065980

    In Scada we are getting #BAD while other temperature controllers devices are being read

    Modscan setting

    Start Addres 40159

    No of Registers 2

    Data Type Float

     

  • Because you mentioned you entered FloatMode=1 in MODBUS parameter section, I assume this is the serial Modbus protocol, using MODBUS driver in Citect. If you are using ethernet modbus with driver MODNET, you should place the parameters in the MODNET section. Can you explain which protocol you use in your I/O device configuration?

    Have you tried all possible FloatMode modes (0 to 3) yet?

    Do you have success with single register values, like integers? Or do you experience an address shift (1 address higher or lower than your device documentation)?

    Are you sure it is a floating point number? For double-integers (type LONG in Citect) you can adjust another parameter called LongDataType.

  • OK, just found a product sheet of the meter that answers some of my questions.

    It is a modbus RTU device, so you do not need the MODNET driver.

    And there are only float registers that you can read, so I would experiment with:

    a) the protocol variant: MODBUS or MODBUS1. MODBUS protocol in Citect means first available modbus address is 1, MODBUS1 means first address is 0. If you have success in reading values when your variable address is 1 lower or higher than the documentation, please switch to the other driver variant.

    b) the FloatMode parameter: try modes 0 to 3 for each protocol variant.

  • Yes it is a Modbus RTU device using serial communication. I ahve used Modbus Protocol in configuration of device.

    Yes I have tried all the FloatModes(0-3) and with all of them the result is same.

    Integer was the first thing I had tried as we have used other device which responded with integers.

    Yes I have tried the register shift also +1 & -1 from the documented 40159 but in vein

    Yes I am sure it is a floating point number as I am getting the perfect result in float data type in other software such as ModScan32 MBtester etc.

    Long has also been tried out.

    I have done all the above things. If you have any other suggestions also please do help.

    Thanks though for the above suggestions.

    Also there was s no response from Aveva Support team even after mailing them twice.

    Looking forward to have the solution from this forum.

  • Hi  ;
    Can you please indicate how you raised your support request?
    Which email address did you use to send the question?

  • There are several Serial Modbus Drivers, and which one is the right one is not always logical. However the first problem I see in the addressing. I believe most Citect modbus drivers read 32 bit registers by combining 2 16 bit registers. I don't believe citect can scan 40159 and 40160 in consecutive 32 bit values. It should be 40159 and 40161 or 40158 and 40160. My experience with modbus RTU is limited to a few brands so I could be wrong. If your device has individual 32 bit registers at 159 and 160, citect still reads each part of the 32 register as 2 16's, values from your device would be seen by citect as shown in this example

    Device Citect
    0 0
    0 1
    1 2
    1 3
    2 4
    2 5

    So to capture register 1 from your device you would put address 2 in citect and to capture reg 2 you would use reg 4.

    the exact register numbers, how they start how they end would depend on which driver your using.

    I hope this helps

  • Ok

    Thats something new I have come across.

    Will definitely try that out.

  • Having addresses offset by 1 is a common Modbus problem. There are different mode numbers in the Citect MODBUS driver to correct for that. See the help page: MODBUS Driver > Non-standard Devices > Protocol variants

    However, I have never seen a device where each Modbus address referred to 32 bits. The Modbus standard requires every address to represent 16 bits. So, if you store a 32-bit long integer or floating point value, it must take up 2 16-bit registers, like 40159 and 40160. In Citect you would create a tag with the address 40159, and use a 32-bit data type, like LONG, ULONG, or REAL, which forces it to read the second register (40160) as well. Some devices will have their own internal addressing (which could go by 32-bit registers), but they normally give you a Modbus address translation table.

    You can check if the [MODBUS] FloatMode parameter is working. Check what value is displayed in Citect, then change the FloatMode value and restart the runtime. You should see a different value displayed for each float mode. If you don't see different tag values in the runtime, then there may be a typo in the citect.ini parameter. Make sure you're saving the parameter in citect.ini, not in the Project Parameters table...some drivers don't work with that.

    I don't have a serial device handy, so I tested with ModSim and ModScan using Modbus TCP. I verified that if you can read the float in ModScan as "Floating Pt", then you would need FloatMode=0 in Citect. If ModScan reads the value as "Swapped FP", then in Citect you would use FloatMode=1.