The definition of the formula (Expression) is found in the properties window.
An expression can contain random , tools and constants. It can also reference table values or be defined as a function of internal variables here. In addition, special internal functions can be used. It is also possible to refer to other defined formulas within a formula.
Below is an overview of some important expressions for defining formulas, their syntax and use:
Syntax |
Description |
Mathematical operators, functions and constants (based on Tcl)*) |
|
+, -, *, / |
Mathematical operators ("plus, minus, multiply, divide") |
pow(x,y) |
Power ("x to the power of y") |
$x**$y |
Power ("x to the power of y") [alternative approach] |
sqrt(x) |
Square root |
sin(x), cos(x), tan(x) |
Angular functions |
arcsin(x), arccos(x), arctan(x) |
Inverse trigonometric functions |
lg(x) |
Logarithm |
ln(x) |
Natural logarithm |
abs(x) |
Absolute value |
max(x1,x2,x3,...), min(x1,x2,x3,...) |
Maximum / minimum (largest or smallest value of all specified numbers) |
floor(x), ceil(x) |
Rounding down/up (rounding to the nearest integer that is not larger or not smaller) - see also examples 6 and 7 |
$pi |
Pi (3.141…) |
$e |
Euler's number (2.718…) |
Reference to tables |
|
Tab1(x) |
Reference to the Y value of a defined table Tab1, where x indicates the station value (X value) |
Internal variables |
|
$s |
Global stationing |
$sl |
Local stationing |
$sr |
Relative stationing |
$se |
Stationing, local end |
$sf, $sfl |
Global/local stationing of the reference axis for transverse axes |
Special functions |
|
$_spx_, $_spy_, $_spz_ |
Global X/Y/Z coordinates at the station point |
$_sdx_, $_sdy_, $_sdz_ |
Global X/Y/Z direction (vector) at the station point |
$_alphap_, $_alphae_ |
Global floor plan or elevation angle of the axis at the station point |
cd2ax, cdh2ax, cdh2profile, cd2g |
For the distance from one axis to a second axis, between two gradients of the same axis and between the axes of a panel and a link girder see Special tools cd2ax, cdh2ax, cdh2profile, cd2g |
Use of a formula |
|
Form1() |
Use of a formula when assigning an expression to a variable in the Structure components menu or when used within other formulas |
*) A complete list and description of all mathematical functions in Tcl can be found here: Mathematical functions in Tcl
Example 1: Mathematical expression
Formula (name) |
Form1 |
Expression |
sin($pi) + 3.5/10.0 + ln(3) |
Use |
Form1() |
|
|
Example 2: Reference to a table value at a specific station
Formula (name) |
Form1 |
Expression |
Tab1(30)+3.5 |
Use |
Form1() |
|
|
Example 3: Reference to the table values along the global stationing
Formula (name) |
Form1 |
Expression |
Tab1($s)*0.5 |
Use |
Form1() |
|
|
Example 4: Mathematically described curve along the local stationing
Formula (name) |
Form1 |
Expression |
arccos ((128-$sl)/2057)) |
Use |
Form1() |
Example 5: Use of one formula within another formula
Formula (name) |
Form1 |
Expression |
1.75 + Form2() |
Use |
Form1() |
Example 6: Use of the mathematical functions floor and ceil
x |
floor(x) |
ceil(x) |
3 |
3 |
3 |
3.4 |
3 |
4 |
3.8 |
3 |
4 |
-3.6 |
-4 |
-3 |
-3 |
-3 |
-3 |
Example 7: Special application example for floor and ceil
Function |
floor(x), ceil(x), |
Example |
floor(x/5)*5, ceil(x/0.25)*0.25 |
Explanation |
Calculates the number nearest and not larger (or not lower) than x that can be divided by 5 (or 0.25) |
|
(C) ALLPLAN GmbH |
Privacy policy |