DNP3 analog input
-
Hi guys,
I am working on a project including a voltage regulator that communicates with mango by DNP3 protocol and send the values to an arduino by modbus protocol.
For that I configured some point links aiming to transfer the analog values from the voltage regulator to arduino, using mango as a gateway.
On point link configuration I used the following script:
return source.value;
Problem: It is possible to read the voltage regulator analog values on data point but it does not send the correct values to arduino.Additional information:
I tried to write and read integer values on arduino Modbus registers using mango modbus configuration interface, and it is works fine.
The arduino modbus library is Modbusino.h which allocates the registers on type uint16_t.Can someone help me?
Best Regards,
Felipe
-
Just my random thought...
Are you using modbus because you're going to be using multiple devices in a system and thus modbus works best?
Alternaively if you're just implementing sending information to the Arduino and nothing else, why not use the built in Serial (UART) and send data that way rather than relying on a third party library on top and then in turn another layer of complexity for you to have to fix/debug when something goes wrong.Just my ten cents.
Fox
-
Hi decarli.f,
I agree with Fox that using a simple protocol on the UART may be easier.
From your description, you make it sound like a value is set but that it is the incorrect value when you check it in the Arduino. I can only thing of a few things that could cause that,
- Wrong data type for setting the value. Perhaps you should try the two byte unsigned swapped instead of two byte unsigned?
- Wrong offset. Some libraries / devices base their register range offsets of 1 instead of 0. Mango uses a zero index.
- Some communication error. Usually would have a protocol level failure and not a wrong value, but it is possible. If you're reading the right values from the modbus device then this is almost certainly not the cause.
-
Hi Phil and Fox
I tried to use two byte unsigned swapped and it did not worked.
I checked and tested the offset value. It is correct.
I think the protocol works because i successfully tested the communication using the modbus configuration interface (using two byte integer).Considering all tests and results, I think the problem is that the float values (regulator outputs) are not compatible with the 2 byte integer data, which is the type that Arduino can read and process.
At this point, i am trying to convert the float values to short or two byte integer in the point link script. The lack of number precision is not an issue for this project.If you know any script which convert this data.
Best Regards,
Felipe
-
Hi Felipe,
I'm not sure what you mean. The Modbus4J library will already handle the conversion from a numeric point value (a double) in Mango to whatever data type it needs to be. You can see the exact code for this here: https://github.com/infiniteautomation/modbus4j/blob/50d7dfe6c0330bf720ae97492c9213c21fdb8d5f/Modbus4J/src_cdc/com/serotonin/cdc/modbus4j/locator/NumericLocator.java#L201
I can assure you many people have set values to integer registers through the Mango interface. I am not sure what this means,
Considering all tests and results, I think the problem is that the float values (regulator outputs) are not compatible with the 2 byte integer data, which is the type that Arduino can read and process.