• Recent
    • Tags
    • Popular
    • Register
    • Login

    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.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Serial Data Source, trouble to show value from COM port

    Scheduled Pinned Locked Moved User help
    6 Posts 2 Posters 2.7k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      pfranc
      last edited by

      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 point

      Data 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: 1000

      DATA 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

      1 Reply Last reply Reply Quote 0
      • phildunlapP Offline
        phildunlap
        last edited by

        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: Yes

        DATA 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: 1

        Data Type: Alphanumeric
        Point Identifier: 0001
        Value Group: 1
        Value Regex: 0001(.*)

        1 Reply Last reply Reply Quote 0
        • P Offline
          pfranc
          last edited by

          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: 100ms

          Log 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

          1 Reply Last reply Reply Quote 0
          • phildunlapP Offline
            phildunlap
            last edited by

            Hi Paolo,

            Can you post a section of your modbus IO log and I can try to help you form a regex for it?

            1 Reply Last reply Reply Quote 0
            • P Offline
              pfranc
              last edited by

              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 30313033303030303b30313034303030303b30313035303030303b30313036303030303b30313037303331303b30313131303030303b30313132303030303b30313032303030303b30313230303030323b30313231303030373b30313234303030303b30313434393233333b30333031303030313b30333032383139323b30333033363430333b30333034313032383b30333035303030303b30333036303030303b30333037303030303b30333038303030303b30333039303030303b30313236303030303b30313330303036323b30313332333933383b30313039303030303b39393133303030313b30313630303031333b30313238343030303b30303030303030303b30303030303030300a

              that 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;00000000

              Message terminator is: 0x0a
              Every value has the format: aaaa bbbb;
              aaaa = ID point
              bbbb = value point

              In total, I have 30 values to visualize, but I'm not be able to do this.

              Thanks

              1 Reply Last reply Reply Quote 0
              • phildunlapP Offline
                phildunlap
                last edited by phildunlap

                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});.*
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post