How to use the new Serial Data Source in Mango Automation 2.1
-
Hi mebius,
I recompiled the module with debug logging statements.
- Backup your serial data source module ([Mango Home]/web/modules/serial) and your log4j configuration files ([Mango Home]/classes debug-log4j.xml and log4j.xml).
- Place the attached zip into your modules folder
- Place the attached log4j into your classes folder, overwrite the version already in the folder (you should have it backed up).
Now if you start Mango with a serial source, it should log all traffic in both directions on your serial data source. Remember, all regular expressions need to match a whole message (terminator and all)!
Attachment: download link
-
Bingo!
I replaced log4j and loaded the new serial module, it works this time.
please see attached screenshot.
Thank you. Phildunlap .
Attachment: download link
-
Does that mean if you put your old log4j file back, it stops working? That seems unlikely to me, but would be most disturbing.
-
-
It seems that a new log4j.xml was created automatically after debug-log4j.xml was put into the classes folder.
-
When the old log4j file was put back to replace the new log4j.xml, it stops working.
-
when put the new log4j.xml back, it works again.
-
-
That is not what happened when I tested it on my machine. On my machine it is definitely easier to configure, but the data source still works without the debug-style log4j
-
It's same on my machine.
Just now I removed the debug-log4j.xml which you gave to me from the folder and left the new created log4j.xml still there, it still works.
I think this problem is solved, isn't it?
-
..
-
Hello, Terry and Phil, this is Marc.
Same problem happened while I was trying it on another COM port: the receiving data point showed nothing.
Since we have upgraded to Mango core 2.2, the logging mod cannot be used. I've tried changing the log4j.xml alone, and still no luck.The command message is ~10012A410000FDA6\r . And response message is a long one with more than 100 characters, which starts with ~10012A00 ,and ends with a \r.
Data Source Settings
'Message Terminator' - \r
'Message Regex' - (.*)
'Point Identifier Index' - 0Receiving Point
'Data Type' - Alphanumeric
'Point Identifier' - .
'Value Index' - 0
'Value Regex' - (.*)Sending Point
'Data Type' - Alphanumeric
'Point Identifier' - ~10012A410000FDA (Just to make it easy when I set the point value manually)
'Value Index' - 0
'Value Regex' - (.*)With the configuration above, every time I set the value of the sending point to 6, a command message is sent to the COM port, and a response message is returned.
Both messages can be seen from a serial monitoring tool. But the receiving point in Mango gets no value.
I've changed all the regex to (.*) , so it should show anything received from the COM port.
The wiki pages do not seem available now, so I'm not sure if there's anything wrong about that configuration. Can you guys give me some tips?@phildunlap said:
Hi mebius,
I recompiled the module with debug logging statements.
- Backup your serial data source module ([Mango Home]/web/modules/serial) and your log4j configuration files ([Mango Home]/classes debug-log4j.xml and log4j.xml).
- Place the attached zip into your modules folder
- Place the attached log4j into your classes folder, overwrite the version already in the folder (you should have it backed up).
Now if you start Mango with a serial source, it should log all traffic in both directions on your serial data source. Remember, all regular expressions need to match a whole message (terminator and all)!
-
Can you ensure that the message being received by Mango is terminated by \r
Mango will not start parsing the message until it receives the terminator character.
-
It looks to me like the configuration is a bit off...
On the data source,
-
Point identifier index 0 means regular expression match index 0, which will be your entire match (specified match groups start at 1). So, if your response is 100 characters that whole 100 characters would need to be the Point Identifier of the receiving point. So, for testing, let's capture an easy point identifier,
Data Source Settings:
'Message Terminator' - \r
'Message Regex' - (~).*\r
'Point Identifier Index' - 1 -
The Point Identifier must match the capture through exact comparison, not regex. So,
Receiving Point
'Data Type' - Alphanumeric
'Point Identifier' - ~
'Value Index' - 1
'Value Regex' - ~(.*)\r
-
-
hi Phil. We tried as your instruction but failed to received anything. But the return message can be monitored by a monitoring tool on the same machine.
I did that successfully before in Mango 2.1 by replaced the original log4j with a new one which you gave me.
I know that was disturbed but it can work. Could you please help us out again? We are in late deployment phase of a real customer case.
BTW, Marc is my colleague. Thanks.
-
I think that's a yes, Terry.
I should have posted the log of COM monitoring tool. It shows clearly that mango receives the message which terminated by \r.
Since Philips've given a set of new configurations, it's better that I offer you new logs. Will do that as soon as I get those logs.@terrypacker said:
Can you ensure that the message being received by Mango is terminated by \r
Mango will not start parsing the message until it receives the terminator character.
-
Hi,Philips. We followed your instruction but Mango showed no value of the receiving point.
The attachment is the log from COM monitoring tool, as same as last time with my configuration.
Both sending and receiving messages can be seen. The "java.exe" means those are from and to the Mango thread. The suffix "." is the printable form of "\r", as the hexadecimal form of the message shows that's a "0D" charactor.I've also set ```
<category name="com.infiniteautomation"><level value="all"/></category>Could you guys have a look and find what's wrong there? @phildunlap said: > It looks to me like the configuration is a bit off... > >On the data source, >1. Point identifier index 0 means regular expression match index 0, which will be your entire match (specified match groups start at 1). So, if your response is 100 characters that whole 100 characters would need to be the Point Identifier of the receiving point. So, for testing, let's capture an easy point identifier, >Data Source Settings: >'Message Terminator' - \r >'Message Regex' - (~).*\r >'Point Identifier Index' - 1 > >2. The Point Identifier must match the capture through exact comparison, not regex. So, >Receiving Point >'Data Type' - Alphanumeric >'Point Identifier' - ~ >'Value Index' - 1 >'Value Regex' - ~(.*)\r Attachment: [download link](http://archive.infiniteautomation.com/forum/posts/downloadAttach/276.page)
-
Okay, let's be sure of things like what version you're using. On the modules page, what's your core version? What's the version of the serial module? In your mango/lib folder, do you have A. RXTX jar file B. JSSC jar file?
As far as further tests, let's change your message terminator in all relevant spots to '2', point identifier to '1' and see if it is getting values then.
-
Hello, Philips.
There are two machines: a working machine with mango core 2.2.2, serial 1.1.0, and with commercial mango license; the other is a notebook for testing, with the same version of mango but a free license.
In the lib folder, no rxtx jar file, but a jssc-2.8.0.jar. I assume that's what it should be.The test results were confusing, but some things came out, I'll describe that in the next post.
@phildunlap said:
Okay, let's be sure of things like what version you're using. On the modules page, what's your core version? What's the version of the serial module? In your mango/lib folder, do you have A. RXTX jar file B. JSSC jar file?
As far as further tests, let's change your message terminator in all relevant spots to '2', point identifier to '1' and see if it is getting values then.
-
The tests on the working machine got nothing as before.
But with the same configuration running on the testing notebook, it succeeded at the first time, as the receiving point had a value of "1001". Unfortunately, on every try after that we got only an event instead.In the test, we changed the message terminator to '2'. That made the sending message become "~10012A410000FDA62".
And the response changed to "~10012A050000FDA6", which was actually a message telling us the sending message was malformatted. But it was good for the test.At the first time, we got a match, "1001", from the response, which became the point value. We could not tell if there was an event at that time.
After that, we got no point values, but events saying "Recieved message: (~).*2 does not match pattern: A050000FDA6 ~10012".
It seems the places of the received message and the pattern were switched in the event message.The serial port monitoring logs, screenshots of data source/points configuration and events are archived and attached. Please let us know if there's anything wrong. Thanks.
@Marc said:Hello, Philips.
There are two machines: a working machine with mango core 2.2.2, serial 1.1.0, and with commercial mango license; the other is a notebook for testing, with the same version of mango but a free license.
In the lib folder, no rxtx jar file, but a jssc-2.8.0.jar. I assume that's what it should be.The test results were confusing, but some things came out, I'll describe that in the next post.
@phildunlap said:
Okay, let's be sure of things like what version you're using. On the modules page, what's your core version? What's the version of the serial module? In your mango/lib folder, do you have A. RXTX jar file B. JSSC jar file?As far as further tests, let's change your message terminator in all relevant spots to '2', point identifier to '1' and see if it is getting values then.
Attachment: download link
-
I'm not surprised. Unconsumed characters are lingering in the serial stream, and it isn't configured to discard anything. This is causing it to gunk up, but it's getting one value so we can be sure now that Mango is getting the data we're expecting...
Which means the \r terminator character is likely incorrect on one of our ends... Ah, it appears we needed to unescape our terminator field in the code... Give this version a shot:
Edit: Switched versions on ya... give this one a shot
Attachment: download link
-
Hi, Philips. Is there anything we should take notice of when using serial-1.1.2 ?
When we tried to add a serial data source, there was a verification failure on the "message terminator" field. We inputted \r , yet it acted like there was no input value.@phildunlap said:
I'm not surprised. Unconsumed characters are lingering in the serial stream, and it isn't configured to discard anything. This is causing it to gunk up, but it's getting one value so we can be sure now that Mango is getting the data we're expecting...
Which means the \r terminator character is likely incorrect on one of our ends... Ah, it appears we needed to unescape our terminator field in the code... Give this version a shot:
Edit: Switched versions on ya... give this one a shot
Attachment: download link
-
My bad... fixed that, hopefully this one works for ya.
Attachment: download link
-
It worked. Thanks, Philips.
Now we have to work on the issue of multiple response messages from the same serial port.
Let's say there're two sets of messages:- If we send the command "~10012A410000FDA6\r" , the response will be "~10012A00xxxxxx\r" .
- If we send the command "~10012AE100003D9E\r" , the response will be "~10012A00xxxxxx\r" .
We are trying meta data points to make automatic and periodic sending.
One sending point can be used for two commands, but both responses will appear in the same receiving point.
How can we differentiate them, or how can we connect one response to its command?
@phildunlap said:My bad... fixed that, hopefully this one works for ya.