Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.
Serial Data Source, trouble to show value from COM port
-
Hi,
I have some trouble with "Serial Data Source".
I have a simple data receive from COM port with the following format:Byte 1, 2 data point identificator
Byte 3, 4 Value of Data pointData is trasmitted by other device on COM port to MANGO at random time.
DATA SOURCE is configured as follow:
Read Timeout (ms): 1000
Use terminator?: NO
Message regex: ([0-9]{2})(.*)
Point identifier group: 1
Configuration is in hex: YES
Maximum size of message: 1000DATA POINT is configured as follow:
Data type: Numeric
Point identifier: 1
Value group: 2
Value regex: .*An example of data trasmitted by the device is: 00 01 03 02 (HEX)
00 01 = data point 1
03 02 = value 770 (dec)In no way, I can to show the value of data in WATCH LIST (n/a).
Where is the mistake?
Thanks
Paolo -
Hi Paolo,
There are a few things we may need to check on. When I'm setting up a new source for a new device, it is often helpful for me to use some parameters that will catch all the data, and then I can set up the regex later. A catchall configuration may look like (knowing that a ' ' is not going to arrive)...:
DATA SOURCE:
Use terminator: No
Message Regex: ()[^ ]+
Point Identifier Group: 1
Configuration in Hex: YesDATA POINT:
Data Type: Alphanumeric
Point Identifier:
Value Group: 0
Value Regex [^ ]+The trick is having an empty point identifier with an empty group in the data source's regex.
But I think the answer to your question may reside in the HEX encoding being applicable to turning "00" into 0b00000000 and back again. So, presuming the message is entering as you describe, a byte of 0 and a byte of 1, then it will be decoded into 0001 as a string, and would need to match the string given as the Point Identifier, so the Point Identifier would need to be "0001". It being of type numeric, I do think a parse call will be made for the second two bytes, but as it would be Double.parseDouble("0302") you'd be more likely to get 302 and error should a-f come through. You would probably need to manually decode this in a meta point to get the decimal value. The Value Group is read from matching the Value Regex, not taken from the Message Regex.
As your configuration currently is, I would expect the data source to attempt to match "00" to "1" and seeing that data point is not the point identified, it does not get a value. Your situation sounds like you can try:
MessageRegex: ([0-9]{4}).*
PointIdentifier Group: 1Data Type: Alphanumeric
Point Identifier: 0001
Value Group: 1
Value Regex: 0001(.*) -
Thanks for your previous response, but I am not be able again to visualize results of data received by serial port.
I changed the format of data, but I don't resolve the trouble.I explain my situation in the better way I can to do.
I have a PLC that send a string of value in the following format:aaaabbbb;ccccdddd;eeeeffff;...etc
aaaa,cccc,eeee are the Point ID (ex 0103, 0107,0106)
bbbb,dddd,ffff are values to display(If necessary, I don't have any problem to insert a char terminator or use a time delay from one transmission and other)
Serial port has the following parameters
9600 8N1 and no has any flow control, it's a USB to DB9 converter.Data from PLC to PC, flow correctly (I have verified with a Serial sniffer)
MANGO Data point configuration:
Bit Rate: 9600
Flow control in: None
Flow control out: None
Data bits: 8
Stop bits: 1
Parity: None
Read Timeout: 100msLog I/O in serial data source is correct (I read data in Hex format in SerialIO-1.log file)
I think the problem is in Regex parameters, but I don't know where.
What's correct sintax of these fields?
Have you any ideas on other possible troubles?Thank you again
Paolo -
Hi Paolo,
Can you post a section of your modbus IO log and I can try to help you form a regex for it?
-
Hi Phil,
This is a part of my log file in Hex (extract from MANGO/logs/SerialIO-1.log)
2016/06/20-07:58:57,479 I 30313033303030303b30313034303030303b30313035303030303b30313036303030303b30313037303331303b30313131303030303b30313132303030303b30313032303030303b30313230303030323b30313231303030373b30313234303030303b30313434393233333b30333031303030313b30333032383139323b30333033363430333b30333034313032383b30333035303030303b30333036303030303b30333037303030303b30333038303030303b30333039303030303b30313236303030303b30313330303036323b30313332333933383b30313039303030303b39393133303030313b30313630303031333b30313238343030303b30303030303030303b30303030303030300athat correspond to:
01030000;01040000;01050000;01060000;01070310;01110000;01120000;01020000;01200002;01210007;01240000;01449233;03010001;03028192;03036403;03041028;03050000;03060000;03070000;03080000;03090000;01260000;01300062;01323938;01090000;99130001;01600013;01284000;00000000;00000000Message terminator is: 0x0a
Every value has the format: aaaa bbbb;
aaaa = ID point
bbbb = value pointIn total, I have 30 values to visualize, but I'm not be able to do this.
Thanks
-
Hi Paolo,
It looks to me like you should uncheck 'configuration is in hex'. If you are translating a 30 into a 0 and 33 into a 3, you are not transporting in hex, you are transporting in UTF-8 or ASCII or some such. And '0x0a' is \n
You may be able to get this to work via regex like...
DATA SOURCE: Use terminator: Yes Terminator: \n Message Regex: (\d+;)*([0-9]{4})[0-9]{4}.* Point Identifier Group: 1 Configuration in Hex: No DATA POINT: Data Type: Alphanumeric Point Identifier: 0103 Value Group: 1 Value Regex .*0103([0-9]{4});.*