Pi Toolset - Math Channels

Cosworth Electronics Limited
Brookfield Technology Centre, Twentypence Road, Cottenham, Cambridge CB24 8PS, UK
Tel: +44 (0)1954 253600 Fax: +44 (0)1954 253601 www.cosworth.com
Registered in England No: 5276665. VAT Reg No: GB 927 1888 86.
Registered address: The Octagon, 44 St James Mill Road, Northampton, NN5 5RA
Pi Toolset - Math Channels
Author: Max Norguet
Email:
[email protected]
Date:
12 February 2013
Math Channels
The math channel node can be accessed either via the home node or the quick "f(x)" button on the left.
On the left handside, you can review every Math Channel present on the box, stored into Folder or not. The top
buttons gives you the ability to create a new Math Channel ("+" button), Import or Export one or more Math
channels, creates a new folder or delete the selected math channel(s).
Create a new Math Channel
When you create a math channel, you need to define the channel Name and Equation first. The Channel name
will the name of the created Channel after equation. The Equation can take the following syntax:
Cosworth User Guide Page 1
will the name of the created Channel after equation. The Equation can take the following syntax:
Operator
Description
+
x + y. Returns the sum of 'x' and 'y'.
-
x - y. Returns 'y' subtracted from 'x'.
*
x * y. Returns 'x' multiplied by 'y'.
/*
x / y. Returns 'x' divided by 'y'.
!
!x. Returns 0 if u32('x') is nonzero, else returns 1.
~
!x. ~x. Returns u32('x') with each bit inverted.
==
x == y. Returns 1 if 'x' is equal to 'y', else returns 0.
!=
x != y. Returns 1 if 'x' is not equal to 'y', else returns 0.
>
x > y. Returns 1 if 'x' is greater than 'y', else returns 0.
<
x < y. Returns 1 if 'x' is smaller than 'y', else returns 0.
>=
x >= y. Returns 1 if 'x' is greater than or equal to 'y', else returns 0.
<=
x <= y. Returns 1 if 'x' is smaller than or equal to 'y', else returns 0.
>>
x >> y. Returns u32('x') shifted right by u32('y') bits with zeroes
inserted to the left.
<<
x << y. Returns u32('x') shifted left by u32('y') bits with zeroes
inserted to the right.
&
x & y. Returns u32('x') ANDed with u32('y').
^
x ^ y. Returns u32('x') XORed with u32('y').
|
x | y. Returns u32('x') ORed with u32('y').
&&
x && y. Returns 1 if both u32('x') and u32('y') are nonzero, else
returns 0.
^^
x ^^ y. Returns 1 if u32('x') != u32('y'), else returns 0.
||
x || y. Returns 1 if u32('x') or u32('y') are nonzero, else returns 0.
asin
asin(x). Returns the arcsin of 'x' in the range 0 to pi radians.
acos
acos(x). Returns the arccos of 'x' in the range 0 to pi radians.
atan
atan(x). Returns the arctangent of 'x' in the range -pi/2 to +pi/2.
atan2
atan2(x, y). Returns the arctangent of 'x'/'y'.
sin
sin(x). Returns the sine of 'x'.
cos
cos(x). Returns the cosine of 'x'.
tan
tan(x). Returns the tangent of 'x'.
hypot
hypot(x, y). Returns the hypotenuse of the right-angled triangle
Cosworth User Guide Page 2
You can then add a Comment if you would like to (will not have any influence on the math channel).
The next important bit will be the rate and channel Output settings. The rate settings will influence the channel
calculation frequency. You can choose to use a fix rate (for example if you choose Fixed rate to 1 Hz, the math
channel will be updated every 1 s) or if your math channel is dependant on another one, you can calculate the
math channel at the same rate than the "Input channel". You can then set the Output Quantity, Unit and Data
Type. The two first are easily configurable and for the Data Type, please put F32 if you don't have any idea on the
Data Type or ask for Cosworth Support.
The following is an example of the math channel "RPM Qualifier" that will be calculated at the same rate than
the channel "RPM_Engine_ECU", will be without unit and will be equal to 1 when "RPM_Engine_ECU" is above
2000 rpm, else it will be 0:
Cosworth User Guide Page 3