ULTRAMEGA
← HomeProducts

Expression Parser

A .NET library for evaluating formulas as text. Change the calculations in test systems and simulations without recompiling the application.

Formulas · variables · evaluation

Change the calculation, not the application

Load the formula as text, bind the variables it uses and call the evaluator. The same test step can then apply different calculations to different product variants. In a simulation, you can compare models against the same inputs.

The library provides mathematical functions, unit conversions and physical constants. Your .NET application controls where formulas live, who can change them and what checks they must pass before use.

The evaluator takes a formula and variables and returns a numberFORMULA FROM CONFIGURATION x^2 + y^2 APPLICATION INPUTS x = 5, y = 3 Expression Parser RESULT34
functions
440+
units
80+
physical constants
47
library for your application
.NET
Why switch

Keep calculation rules separate from application code

Formula changes

TodayChanging how a test calculates a value requires a new build, even if the measurement sequence stays the same.

With Expression ParserLoad the calculation from your configuration. An approved formula change does not require recompiling the application.

Readings in different units

TodayConversion factors are scattered across test steps and simulations, each of which needs maintenance.

With Expression ParserUse the library’s unit conversions to put a reading and its limit in the same units before comparing them.

In-house calculation rules

TodayThe same calibration rule gets implemented in multiple places when different formulas need it.

With Expression ParserExpose one function from your application. Different formulas can call it without duplicating the logic.

Checks before activation

TodayA faulty expression only comes to light when the affected variant reaches the test station.

With Expression ParserValidate the expression and run it against known inputs. Have the application reject it if the syntax or the reference result is wrong.

Features

From general mathematics to your own functions

Mathematics and statistics

120+ functions for algebra, trigonometry, calculus, statistics and probability, including Bessel and gamma functions.

ExampleEvaluate sin(pi/4) in a signal calculation. The result is approximately 0.7071.

Physical models

50+ physics calculations covering mechanics, thermodynamics, electromagnetism, quantum mechanics and optics.

ExampleCompare beam deflection under two load cases with the same material and geometry.

Electronics

35+ calculations for circuit analysis, power, impedance, filter design and digital logic.

ExampleCalculate the power dissipated in a resistor from the measured current and its known resistance.

Logic and comparisons

45+ logical operations, including Boolean algebra, bitwise operations, set theory, fuzzy logic and comparisons.

ExampleCheck a status bit in an integer and use it in the expression for a test’s pass criteria.

Unit conversion

Convert between 80+ units, including length, mass, temperature, energy, pressure and frequency.

ExampleConvert 2.4 bar to 240 kPa before comparing the reading with a limit in kPa.

Physical constants

47 built-in constants, including the speed of light and the Planck, gravitational and Avogadro constants.

ExampleUse G directly in a model that calculates orbital period from mass and orbital radius.

Runtime formulas and variables

Supply the expression as text. Bind readings, coefficients or model parameters to named variables in the application.

ExampleSet x = 5 and y = 3, then evaluate x^2 + y^2. The result is 34.

Custom functions

Expose your own calculation functions in expressions and combine them with built-in functions and standard operators.

ExampleCall your calibration function to turn a raw count into pressure, then apply an offset.

Validation and diagnostics

Validate expressions and surface detailed error messages in your approval workflow. Use known inputs and expected results to test the calculation itself.

ExampleShow a syntax error in the configuration workflow so an incomplete formula never reaches the test station.

Examples

Four calculations you can verify

01 / Measurement · units

Compare pressure in the same unit

A pressure transmitter gives readings in bar. The test specification sets an upper limit of 250 kPa.

  1. Load the reading of 2.4 bar with its unit.
  2. Use the library’s unit conversion to obtain 240 kPa.
  3. Evaluate the limit check 240 ≤ 250. Also try 2.50 bar and 2.51 bar to verify the boundary.

Outcome 2.4 bar and 2.50 bar pass; 2.51 bar exceeds the limit. The comparison does not depend on the input unit.

Convert the reading to the same unit as the limitREADING 2.4 bar CONVERTED 240 kPa 240 kPa 250 kPa Upper test limit 240 ≤ 250 · PASS
02 / Simulation · formula from configuration

Switch beam models without recompiling

You want to compare a simply supported beam with a centre load and a cantilever with an end load. The models use the same inputs but different formulas.

  1. Set F = 1,000 N, L = 6 m, E = 200 GPa and I = 8.33 × 10⁻⁶ m⁴. Supply E in pascals for the calculation.
  2. Load F * L^3 / (48 * E * I) from configuration. The first model gives approximately 2.70 mm deflection.
  3. Switch to F * L^3 / (3 * E * I) and evaluate with the same inputs. That gives approximately 43.2 mm at the free end.

Outcome You get two model results from the same application without recompiling it.

Two load cases with the same inputs and different formulasCENTRE LOAD END LOAD F * L^3 / (48 * E * I) F * L^3 / (3 * E * I) ≈ 2.70 mm≈ 43.2 mm Same F, L, E and I in both models
03 / Calibration · custom function

Reuse your calibration in multiple formulas

Two test sequences use the same pressure sensor but need to apply different offsets after calibration.

  1. Define the linear calibration once in the application: raw counts of 1,000 and 5,000 correspond to 0 and 400 kPa.
  2. Expose the function to the evaluator as calibrate and use it in the expression calibrate(raw) + offset.
  3. Test raw = 3,000 and offset = 5 kPa. The function returns 200 kPa before the formula applies the offset.

Outcome The result is 205 kPa. Both sequences can share the calibration and still choose their own corrections.

A custom function turns counts into pressure before applying a correctionYOUR CALIBRATION kPa 200 3 000 FORMULA calibrate(raw) + offset RESULT 200 + 5 = 205 kPa
04 / Validation · known results

Reject an incorrect formula before the test runs

You need to approve a force calculation before it is used in a test. A formula can be valid syntax and still calculate the wrong quantity.

  1. Validate the expression. Try mass * as a negative test and surface the evaluator’s error message.
  2. Set mass = 2 and acceleration = 3 in SI units. Expect 6 N from mass * acceleration; mass + acceleration returns the number 5 and must be rejected.
  3. Repeat with a boundary case: zero acceleration must give zero force. Activate the formula only once your checks pass.

Outcome Syntax validation catches the incomplete formula; the reference test catches the wrong calculation.

Check syntax and result before activating the formulaFORMULA CHECK VERDICT mass * acceleration6 N Pass mass *Syntax error Reject mass + acceleration5 ≠ 6 Reject Reference: 2 kg and 3 m/s² must give 6 N
Specifications

Compatibility, calculation coverage and performance

Performance figures are internal measurements, not guaranteed limits. Results depend on the expressions, hardware and workload. Measure under the conditions in which your application will run.

Supported .NET versions

.NET Framework
4.7.2+
.NET Core
3.1+
.NET
5, 6, 7, 8

Calculation library

Built-in functions
440+ in total, including 120+ for mathematics, 50+ for physics, 35+ for electronics and 45+ for logic
Units and constants
80+ units and 47 physical constants
Expressions and extensions
Variables, custom functions, expression validation and detailed error messages

Performance

Evaluation time
< 1 ms
Memory use
< 5 MB
Thread-safe
Yes
Your project

Which formula do you need to change?

Bring an example from your .NET application. We can discuss which parts of the calculation belong in a formula and which should stay in code.

  1. Choose a formula from a test or simulation. Note the inputs, units and expected result.
  2. Describe who changes the formula and how you approve a change before it goes into production.
  3. Tell us which .NET version you use and how often the calculation needs to run.