App Developer/ SCADA Question

For general Flowcode discussion that does not belong in the other sections.
steve001
Valued Contributor
Posts: 185
http://meble-kuchenne.info.pl
Joined: Wed Jan 13, 2021 7:15 pm
Has thanked: 81 times
Been thanked: 30 times

App Developer/ SCADA Question

Post by steve001 »

Afternoon All,

Re The app developer / SCADA using Modbus RTU looking at integrating a Mains harmonic meter for a test application

The data formats are :

32-bit float format - bit float type data follows IEEE 754 format.
16 bit integer format - Byte sequence of data adopts big endian mode.
32 bit long integer format - Byte sequence of data adopts big end mode.

Dose the Modbus component cope with these or do i have to get creative and read registers and put them back together ? :?

Steve
Attachments
RI-F500 register table.pdf
(3.05 MiB) Downloaded 160 times

BenR
Matrix Staff
Posts: 1733
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 439 times
Been thanked: 602 times

Re: App Developer/ SCADA Question

Post by BenR »

Hi Steve,

The Modbus components deal with single bits or 16-bit registers.

If you use the Type conversion component then this works with App Dev and Embedded and will efficiently convert between 16-bit and Long or Float values hopefully saving you some headaches.

steve001
Valued Contributor
Posts: 185
Joined: Wed Jan 13, 2021 7:15 pm
Has thanked: 81 times
Been thanked: 30 times

Re: App Developer/ SCADA Question

Post by steve001 »

Hi Ben,

How do deal with the 32 bit registers ? - these are big endian and integers
These have caused big headaches and nightmares in the past

Steve

BenR
Matrix Staff
Posts: 1733
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 439 times
Been thanked: 602 times

Re: App Developer/ SCADA Question

Post by BenR »

Hi Steve,

That should be fine.

Simply use two registers and use the type conversion component to convert your 32-bit value into the two 16-bit register values.

Then at the other end do the opposite take the two 16-bit register values and use the type conversion to convert back into a 32-bit value.

Also works for IEEE 754 floats.

Let us know if you have any problems or want an example putting together.

steve001
Valued Contributor
Posts: 185
Joined: Wed Jan 13, 2021 7:15 pm
Has thanked: 81 times
Been thanked: 30 times

Re: App Developer/ SCADA Question

Post by steve001 »

Hi Ben,

Are there any examples on implementing a Modbus Master system for the app developer ?
The ones i have found use Nano as the master i would like to use a pc or laptop.

On having a play tonight - is it possible to be able to set the coms port parameters via the app you are developing - as your device may not be on that particular com port or may have different addresses (i may have got this wrong as i am am still finding my feet with the SCADA)

Could i take you up on your offer of an example for a convertor as i wasn't sure where to start

using winbus to read L1 Volts

period 500
send 2 3 0x00 0x06 0x00 0x02

Date: 04/03/2021 18:45:28:877 Tx: 0x02 0x03 0x00 0x06 0x00 0x02 0x24 0x39
Date: 04/03/2021 18:45:29:378 Rx: 0x02 0x03 0x04 0x43 0x6D 0x05 0x1F 0x0F 0xF2

using - 43 6D 05 1F = 237.02

scadacore's online convertor confirmed that the value is correct

Steve

steve001
Valued Contributor
Posts: 185
Joined: Wed Jan 13, 2021 7:15 pm
Has thanked: 81 times
Been thanked: 30 times

Re: App Developer/ SCADA Question

Post by steve001 »

Hi Ben,

Could you please put an example together for me ?
Can you put comments in also please so i know what is happening and why.

Looking to read L1 Volts for now :?

Regards

Steve

:Edit - my attempt added - didnt work, tried to follow an example i was looking at and modify it to suit.

Float Big endian result is correct

not sure how 240.49 was obtained as adding the results together in HEX, then converting back to DEC gives 415 (on a calculator)
and adding 43 70 & 7d 71 together in HEX, then converting back to DEC gives 49,377 (on a calculator)
Attachments
scadacore conversion.JPG
scadacore conversion.JPG (53.86 KiB) Viewed 4179 times
Registers read by Winbus.JPG
Registers read by Winbus.JPG (88.88 KiB) Viewed 4179 times
Modbus Test RI-F550 Read Voltage.fcsx
(14.8 KiB) Downloaded 130 times

BenR
Matrix Staff
Posts: 1733
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 439 times
Been thanked: 602 times

Re: App Developer/ SCADA Question

Post by BenR »

Hi Steve,

Try this and I'll keep my fingers crossed :D .
Modbus Test RI-F550 Read Voltage.fcsx
(15.82 KiB) Downloaded 145 times

steve001
Valued Contributor
Posts: 185
Joined: Wed Jan 13, 2021 7:15 pm
Has thanked: 81 times
Been thanked: 30 times

Re: App Developer/ SCADA Question

Post by steve001 »

Hi Ben,

This is the result i get ?

Volts =245.7

Steve
Attachments
Capture - volts.JPG
Capture - volts.JPG (44.77 KiB) Viewed 4096 times

BenR
Matrix Staff
Posts: 1733
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 439 times
Been thanked: 602 times

Re: App Developer/ SCADA Question

Post by BenR »

Hi Steve,

If you look at the console window it should show you the data that is being received. We can then try ad figure out what isn't quite right. Maybe we aren't assembling the float quite correctly? the ints or bytes within the ints might need to be rearranged?

User avatar
p.erasmus
Valued Contributor
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: App Developer/ SCADA Question

Post by p.erasmus »

Hi All,

To determine the problem here (as Ben indicated) we need to see the MODBUS device protocol for the Voltage data - lengh,byte order scaling factors these are all things the User of the Modus compoment needs to apply to get the correct value .

Steve to help you you need to supply these info's with out it we all will be chaseing our tails around something that we do not know.
Regards Peter - QME Electronics

Post Reply