Converting Modbus register values to 4-20mA
Converting Modbus register values to 4-20mA
(OP)
Hello,
Can someone provide me please with some pointers on how to convert Modbus analog input signal (Analog read from input register at specified address) to a 4-20mA value.
Modbus protocol can be RTU or TCP/IP.
Thanks in advance
Can someone provide me please with some pointers on how to convert Modbus analog input signal (Analog read from input register at specified address) to a 4-20mA value.
Modbus protocol can be RTU or TCP/IP.
Thanks in advance
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.
RE: Converting Modbus register values to 4-20mA
https://www.datexel.com/rs485-4-20ma-analogue-outp....
https://www.scadalink.com/wp-content/uploads/an112...
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Converting Modbus register values to 4-20mA
Thanks for the links, what I need in fact is not hardware but the (software) methodology to do a conversion.
I just found this document which seems interesting:
https://www.emerson.com/documents/automation/manua...
Apparently this procedure is called "integer scaling".
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.
RE: Converting Modbus register values to 4-20mA
RE: Converting Modbus register values to 4-20mA
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Converting Modbus register values to 4-20mA
cswilson,
Does it make sense to work on basis 0 to 100% (or 0 to 1) instead of 4-20mA
So we could consider two ranges to configure (assuming unsigned 16-bit value):
Range#1: percentage units (data signal)
Min: 0 (corresponds to 0)
Max: 100% (corresponds to 65535)
Range#2: engineering units (e.g. Temperature in Kelvin)
Min: 290 K
Max: 300 K
So we interpolate between 0:65535 to obtain a value within the 290:300 K range.
Now back to the case you mentioned of (0mA - 24mA) range, so we have (20mA-4mA) / (24mA-0mA) = 0.667 => 66.7%
Min: 0 (corresponds to 0)
Max: 66.7% (corresponds to 43690)
So we interpolate between 0:43690 to obtain a value within the 290:300 K range.
The part between 43690 and 65535 being not utilized (or left for overflow)
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.
RE: Converting Modbus register values to 4-20mA
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Converting Modbus register values to 4-20mA
I think the document link you have attached shows an example of a component that converts SPI data (can be for example from an instrument whose output is SPI serial communication) to inject into a 4-20mA loop. The functional block diagram shows that the loop is a 0-24mA. So if the measured parameter exceeds the low- or high limit by a small amount the 4-20 mA output will still be proportional giving one the ability to log values slightly above or slightly below. I understand that probably not all instruments offer that ability but it may be common practice.
1/- My question is, if - for some reason- I use the full span of 65535 levels of resolution, I will not be able to benefit from this ability, is this correct?
2/- However since I will likely have 53521 levels or resolution, the range from 53522 to 65535 could be anyhow leveraged to exploit the ability, is this correct? When you mention 53521 levels or resolution, is it because it is common industry practice?
I think bottom line when you say it does not matter, is that irrespective of the considerations in 1/ and 2/ I would in all cases need an ICD document that describes what any value of measured current between 4 to 20 mA represents and implement as per Nlo ~ 4ma, Nhi ~ 20mA , Nmid ~ ((Nmid-Nlo)/(Nhi-Nlo))*16mA + 4mA
Is the above correct understanding?
Thanks
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.
RE: Converting Modbus register values to 4-20mA
RE: Converting Modbus register values to 4-20mA
Now, you could modify the reference design from the datasheet so that the entire 16-bits falls into 4-20 mA.
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Converting Modbus register values to 4-20mA
Does the Modicon input card have 16 bits of resolution?
I doubt it until proven otherwise.
Also, if the analog card is only 12 or 14 bits is the least significant bit bit 0?
I always want the most significant bit to be bit 15 no matter how many bits there really are.
In the case of a 12 bit AtoD the lower 4 bits would be tied low.
This way I can write software and always treat the analog data as 16 bit data.
Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com
http://forum.deltamotion.com/
RE: Converting Modbus register values to 4-20mA
In the modbus list specification, it says 16 bit unsigned integer and scaling 65535.
Nevertheless, I looked at float32 and integer 32 and it looks a bit complicated because of all those big-endian/little-endian with or without byte swap. I saw water burning...
PNachtwey,
The architecture is as follows: Field transmitters (analog signals) wired to machine control system (4-20mA). Machine control system is normally a PLC (Allen Bradley, Siemens, or equivalent) and it communicates analog signals to DCS/SCADA via Modbus. That is the Modbus data I am reading. By the way, I would expect any of the major PLC brand to have I/O 16 bit cards, nowadays but also up to ~2 decades back. Correct me if I am wrong?
Otherwise when it is 12 bit, I would need to change scaling accordingly (2^12) for sure, but If I understand well the problem is when reading 12 bit as 16 bit analog data, that would require a special program, is this what you mean?
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.
RE: Converting Modbus register values to 4-20mA
TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg
FAQ731-376: Eng-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://www.eng-tips.com/forumlist.cfm
RE: Converting Modbus register values to 4-20mA
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.
RE: Converting Modbus register values to 4-20mA
Not necessarily. The PLC market has low end, mid grade and high end AI cards; you have what was paid for.
What does the spec sheet for the AI card say its resolution is?
A Modbus register is by definition 16 bits. A 10, 12 or 14 bit value would take up as much of the 16 bits as needed, but sometimes a Modbus Holding Register is used that is populated with a scaled value in engineering units, rather than an Modbus Input Register with its raw value.
RE: Converting Modbus register values to 4-20mA
See page 43-44 for a discussion of data format as related to resolution and scaling
Link
Whatever PLC is involved should have similar documentation.
RE: Converting Modbus register values to 4-20mA
It makes a difference how the 12 bits are read into a 16 bit registers and whether the analog inputs are uni-polar or bi-polar.
Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com
http://forum.deltamotion.com/
RE: Converting Modbus register values to 4-20mA
RE: Converting Modbus register values to 4-20mA
RE: Converting Modbus register values to 4-20mA
Appreciated.
If you plan an escape, you must succeed as if you fail, you will be punished for trying. Never say or write down your plan. Heart is the only place where secrecy is granted.