YuParse

YuParse is a lightweight and efficient ASCII/text parser designed for real-time data extraction on the edge. It is a core component of the YuDash Axon processing engine and is optimized for structured sensor output from industrial instruments such as weather stations, weighing scales, and transmitters.

YuParse uses a pattern-matching approach where users define a template string with token identifiers (like #D1, #I2, #T, #A1, etc.) to extract specific fields from continuous or formatted ASCII inputs. It is tolerant to inconsistent whitespace and supports both data capture and structural matching.

YuParse simplifies the challenge of parsing vendor-specific ASCII formats by providing a flexible yet deterministic framework that decouples pattern logic from parsing code. It enables high-throughput, low-overhead data structuring — critical for scalable IIoT deployments.

The values extracted by YuParse can be directly utilized in various downstream pipelines. Parsed fields can be published to MQTT or HTTP endpoints. Additionally, these values can be fed into YuDash’s built-in Modbus RS485 or TCP/IP server, enabling seamless SCADA or PLC integration. This makes YuDash a powerful edge converter — capable of translating vendor-specific ASCII outputs into json payloads or Modbus-readable registers.

Following are the steps to use YuParse Engine:

1) Reading text data from RS485/RS232 device

The reading of text data from RS485 (or RS232) port is handled as custom "Modbus" registers, as explained here. Refer to documentation of String Read in RS485/RS232. The string is provided as input (inputVar) to YuParse engine which will be matched with "pattern" string.

2) YuParse Pattern

This the pattern string which will be used to parse the inputVar.

  • YuParse matches the inputVar (ASCII string) against the provided pattern.

  • By default, whitespace is ignored during matching for both inputVar and pattern. Extra spaces, tabs, or inconsistent spacing do not affect parsing. For strict parsing of inputVar, there is an option (described later).

  • The pattern is composed of:

    • Tokens (e.g., #D1, #A2) used to capture values.

    • Tokens without a numeric index (e.g., #D, #S) are treated as match-only and not stored in the output.

    • Static strings (e.g., TEMP=, RH=, (Gross)) that must match exactly

  • Matching is case-sensitive for static strings (TEMPtemp).

  • YuParse performs a best effort left-to-right match, allowing partial parsing when some fields are missing or invalid.

  • Parsing stops when:

    • The pattern is fully matched

    • Or the input string ends unexpectedly or mismatches

Pattern Element

Type

Stored?

Description

#D1, #D2

Decimal/Float

✅ Yes

Parsed as float

#I1, #I2

Integer

✅ Yes

Parsed as integer

#T1

Timestamp

✅ Yes

Epoch timestamp

#S1, #S2

String

✅ Yes

Any text until next whitespace

#A1, #A2

Alphanumeric

✅ Yes

Strictly alphanumeric (letters and digits only)

#Sx

String ending with fixed character

❌ No

Any text until a known character (x).

x may be mostly a "," or "=" etc.

#D, #S, #A

Match-only

❌ No

Used for pattern alignment; parsed but not stored

#N

New line

❌ No

Match a new line (\n) or carriage return (\r).

Non-token word

Literal Match

❌ No

Must exactly match input, ignoring extra whitespace

Input String (inputVar)

YuParse Pattern (pattern)

Parsed Values

TEMP=23.4 RH=65.2

TEMP=#D1 RH=#D2

D1=23.4, D2=65.2

STATUS=(OK) VALUE=99.8

STATUS=(#A1) VALUE=#D1

A1=OK, D1=99.8

Device=ABC TEMP=45.0 UNIT=C

Device=#A TEMP=#D1 UNIT=#S

D1=45.0

Device=ABC TEMP=45.0 UNIT=C

#S=#A1 TEMP=#D1 UNIT=#A2

A1=ABC, D1=45.0 A2=C

t=21.5 , humid=(64.2)%

t=#D1 , humid=(#D2)%

D1=21.5, D2=64.2

(Gross) 125.67 kg (Tare) 5.00 kg

(Gross) #D1 kg (Tare) #D2 kg

D1=125.67, D2=5.00

TEMP:23.4,HUMIDITY:55.6

TEMP:#D1,HUMIDITY:#D2

D1=23.4, D2=55.6

S/N=SNX123 Value=7.89

S/N=#A1 Value=#D1

A1=SNX123, D1=7.89

Sensor1=OK Pressure=102.56 mbar

Sensor1=#A1 Pressure=#D1 mbar

A1=OK, D1=102.56

DATA: A23 B56 C99

DATA: #A1 #A2 #A3

A1=A23, A2=B56, A3=C99

WSpd=5.2 Dir=NW Temp=21.3

WSpd=#D Dir=#A1 Temp=#D2

A1=NW, D2=21.3

3) Mapping Tags to Variable Names

After parsing the input string using the pattern, YuParse assigns values to temporary tags such as D1, A2, S1, etc. These tags must then be mapped to user-defined variable names to make them meaningful and usable in further processing.

  • Mapping is defined using the tagArray field in your configuration.

  • Each entry maps a token tag (e.g., "D1") to a custom variable name (e.g., "temperature").

  • These variable names are similar to other variables read by YuDash devices. They can be published to MQTT/HTTP or used in Modbus server (only for numeric numbers)

YuDash JSON APIs for Axon

1) Enabling YuDash Axon

  • Axon must be explicitly enabled using "axon": 1

  • The axonSettings block is ignored unless Axon is active

  • Axon is supported only on selected YuDash models

"dotFourSettings": {
  ...
  "axon": 1,
  ...
}

2) YuParse Settings within axonSettings

{
  "dotFourSettings": {
    // ... other flags and features
    "axon": 1
  },

  "axonSettings": {
    "parseArray": [
      {
        "inputVar": "sensor_string",
        "pattern": "TEMP=#D1 RH=#D2",
        "tagArray": [
          { "tagName": "D1", "varName": "temperature" },
          { "tagName": "D2", "varName": "humidity" }
        ]
      }
    ]
  },

  // ... other settings like mqttSettings
}

Syntax of the Json blocks

Key
Type
Description

inputVar

string

Name of the input variable holding the ASCII string to be parsed. This is typically read through Modbus module.

pattern

string

YuParse-compatible pattern using tokens like #D1, #A1, etc. This will be matched with the inputVar.

tagArray

array

List of mappings between token tags and output variable names.

tagName

string

The token ID from the pattern (e.g., "D1", "A2", "T")

varName

string

Custom variable name to use in downstream logic, MQTT, Modbus, etc.

Explanation of the json

  • sensor_string is assumed to be an ASCII input like:

    TEMP=23.4 RH=56.2
  • The pattern uses tokens #D1 and #D2 to extract two decimal numbers

  • These are mapped to final variable names temperature and humidity via tagArray

  • These variables can then be used in the payload.

Whitespace-Sensitive Parsing

By default, YuParse ignores all whitespace (spaces, tabs, etc.) in the input string when matching against a pattern.

To enable strict whitespace matching, set "whiteSpace": 1 inside a parseArray block.

🔖 Special Token for Whitespace-Sensitive Mode

Token
Meaning
Notes

#W

Match any number of whitespace characters

Required only when whiteSpace is 1

📌 Note: The #N (newline) token can be used in both whitespace-sensitive and default modes. Newlines are not ignored, even when general whitespace is ignored.

🧾 Example of Whitespace Matching

{
  "parseArray": [
    {
      "inputVar": "sensor_data",
      "pattern": "VOLT=#D1 #W UNIT=V",
      "whiteSpace": 1,
      "tagArray": [
        { "tagName": "D1", "varName": "voltage" }
      ]
    }
  ]
}

YuParse Examples

1) Example#1

Input String:

tT=(24.5C) RH=(64.3)%

YuParse JSON Configuration


  "axonSettings": {
    "parseArray": [
      {
        "inputVar": "env_data",
        "pattern": "T=(#D1C) RH=(#D2)%",
        "tagArray": [
          { "tagName": "D1", "varName": "temperature_c" },
          { "tagName": "D2", "varName": "humidity_percent" }
        ]
      }
    ]
  }

2) Example#2

Input String:

TEMP=22.3 RH=48.2 STATUS=OK

YuParse JSON Configuration



  "axonSettings": {
    "parseArray": [
      {
        "inputVar": "sensor_raw",
        "pattern": "TEMP=#D1 RH=#D2 STATUS=#A1",
        "tagArray": [
          { "tagName": "D1", "varName": "temperature" },
          { "tagName": "D2", "varName": "humidity" },
          { "tagName": "A1", "varName": "status" }
        ]
      }
    ]
  }

3) Example: Parsing Vaisala WXT530 Output

🧾 Sample Input String:

Ta=24.7C RH=53.2% P=1007.3hPa Ws=2.3m/s Wd=180D

⚙️ Expected Output Variables:

{
  "temperature": 24.7,
  "humidity": 53.2,
  "pressure": 1007.3,
  "windspeed": 2.3,
  "winddir": 180
}

YuParse JSON Configuration


  "axonSettings": {
    "parseArray": [
      {
        "inputVar": "vaisala_string",
        "pattern": "Ta=#D1C RH=#D2% P=#D3hPa Ws=#D4m/s Wd=#D5D",
        "tagArray": [
          { "tagName": "D1", "varName": "temperature" },
          { "tagName": "D2", "varName": "humidity" },
          { "tagName": "D3", "varName": "pressure" },
          { "tagName": "D4", "varName": "windspeed" },
          { "tagName": "D5", "varName": "winddir" }
        ]
      }
    ]
  }
}

4) Example:

YuParse supports parsing multiple input strings simultaneously, each potentially coming from different sensors or serial sources. To enable this, the configuration uses a parseArray array, where:

  • Each item in the array defines a separate parsing block

  • Each block specifies:

    • An inputVar (input string source)

    • A pattern to match

    • A tagArray to map captured values to usable variable names

This design allows you to process multiple ASCII inputs in parallel, even if they come from different instruments or formats.


🧾 Input Strings

  • env1_string:

    TEMP=23.4 RH=56.2
  • env2_string:

    Ta=24.7C RH=53.2% P=1007.3hPa

JSON Configuration


  "axonSettings": {
    "parseArray": [
      {
        "inputVar": "env1_string",
        "pattern": "TEMP=#D1 RH=#D2",
        "tagArray": [
          { "tagName": "D1", "varName": "temperature1" },
          { "tagName": "D2", "varName": "humidity1" }
        ]
      },
      {
        "inputVar": "env2_string",
        "pattern": "Ta=#D1C RH=#D2% P=#D3hPa",
        "tagArray": [
          { "tagName": "D1", "varName": "temperature2" },
          { "tagName": "D2", "varName": "humidity2" },
          { "tagName": "D3", "varName": "pressure2" }
        ]
      }
    ]
  }
}

Resulting Output Variables

{
  "temperature1": 23.4,
  "humidity1": 56.2,
  "temperature2": 24.7,
  "humidity2": 53.2,
  "pressure2": 1007.3
}

Last updated