How to perform arithmetic with OBD2 parameters?

HI all,

I’m new here.

I was configuring my own OBD2 .xml config file and in the rotation section was wondering whether there was a way to evaluate an arithmetic expression against two returned values:

<?xml version="1.0" encoding="utf-8"?> ....

So I have assigned two returned values to RealDash Dummy variables and was wondering how to go about evaluating the required arithmetic expression and perhaps return to a 3rd dummy value?
So:
= (VAL{MG2 torque} * VAL{MG2 RPM} / 5252
Where MG2 torque and MG2 RPM are stored in two separate targetId dummy variables?

Any Ideas?

Many thanks, A.

This cannot be done in XML file. You need to use Gauge Math, or triggers-actions to achieve this within RealDash.

Many thanks.

Any links to docs / links on guage math syntax? Especially referencing get/set dummy variables? As these float / double, etc and what are the valid operators?

No docs, but Gauge Math is quite straight forward:

example:
=ID64*1.04+V

Would result to Vehicle Speed (ID64) * 1.04 + gauge current value.

See targetIds here: http://realdash.net/manuals/targetid.php

Great thanks!

Can you do global var assignment operations to a dummy var in Gauge Math e.g.

ID63 = ID64*1.04+V

Thanks, A

Gauge Math is not able to set value to targetIds, only read them to set value for that specific gauge. To change the values, use triggers and actions instead.

Got it. Thanks.

So to make use of an assignment is the XML (see below) do I …

INPUT& VALUE- = None, or INPUT&VALUE->OTHER->[Dummy ]
or
LOOK&FEEL->SPECIAL->GAUGE MATH (ID296)
or
Both of the above?

I’ve assigned the PID below to ID296 in the xml. How to I reference this in the dash.

targetId 296 goes to Dummy 36. Add a text gauge and link it to Dummy 36 to see the value.

There is an error on your XML conversion. If you use ABC…, use conversionABC. Otherwise change A to B0.

Many thanks again! I did use a syntax checker on the XML, but was unaware of the requirement - so thank you.

Does Gauge Math permit the use if min(x,y) and max(x,y) math functions?

[quote=Garch2022 post_id=7200 time=1647075348 user_id=1011]
[quote=Garch2022 post_id=7199 time=1647075290 user_id=1011]
[quote=Garch2022 post_id=7198 time=1647075117 user_id=1011]




Does Gauge Math support the use of min(x,y) and max(x,y) math functions, asking as some values of the Prius can be negative (motors charging the HV battery) and positive (HV battery driving the motors)?

or, logical IF/THEN?



if neither, can gauges be set so that they do not try to render negative values?

[/quote]
[/quote]

[quote=Garch2022 post_id=7200 time=1647075348 user_id=1011]
[quote=Garch2022 post_id=7199 time=1647075290 user_id=1011]
[quote=Garch2022 post_id=7198 time=1647075117 user_id=1011]




Does Gauge Math support the use of min(x,y) and max(x,y) math functions, asking as some values of the Prius can be negative (motors charging the HV battery) and positive (HV battery driving the motors)?

or, logical IF/THEN?



if neither, can gauges be set so that they do not try to render negative values?

[/quote]
[/quote]

Does Gauge Math support the use of min(x,y) and max(x,y) math functions, asking as some values of the Prius can be negative (motors charging the HV battery) and positive (HV battery driving the motors)?

Unfortunately no, there is no min/max functions on conversions or gauge math.

Any thoughts on why the below works inconsistently?

Dummy [32] & [27] works just fine, Dummy [20] & [26] I’ve not been able to get to work - even after extensive trial-and-error.

These are legitimate PIDs and Formulas as I have seen these work in the Torque App and I have literally copy-pasted into the below XML?

[20] & [26] I have tried Text Gauge and Bar Gauge and both register no values (0.0), whilst the same PIDs and Formulas are returning valid values in the Torque App?

\

<?xml version="1.0" encoding="UTF-8"?>

These are next to impossible troubleshoot remotely.

BTW, next release of RealDash will have min and max functions on conversion.

Great news about the max(), Min(). An Abs() would also be helpful!

I have two dummy variables. One is always positive and the other can be positive or negative sign. When I use Gauge Math to multiply these values it always returns a zero - both on a bar gauge and a text gauge. I have used two text gauges to view these two dummy variable values and I can see properly formed numbers (floats). When I use a third text gauge with the result of multiplying these together, it always shows a zero value. But as I said, one of the dummy variables I am multiplying can be in the range -400 to +400. and the other 0 to 8000.

Any ideas?

abs function is already there.