The segment types you can select from the Function Builder are functions of the independent variable. You can piece together the segment type functions to define a piecewise continuous motor or force profile. Each segment type you select defines the profile function on a continuous range of independent variable values. You can create custom Function Builder segment types in a file named SegmentTypes.txt. You can define a segment type function with basic programming commands within the segment type syntax.
Syntax
Begin each segment type definition with SegmentType("Type_Name", independent_variable, param_2, … param_n) and end each segment type definition with the command endSegmentType. You must include a return statement within the definition. Use mathematical operators to define the segment type function between these two commands.
|
Commands and Variables |
Description |
|
SegmentType("Type_Name", independent_variable, arg2, … argn) |
Begins the segment type function definition. |
|
"Type_Name" |
String variable in quotes specifying a unique name for the segment type function. |
|
independent_variable |
Variable representing the function independent variable. |
|
param_2, … param_n |
Variables representing any number of parameters you require to define the function. The number of required parameters depends on the function you define.
|
|
return |
Returns the segment type function value computed from the input arguments. |
|
endSegmentType |
Ends the segment type function definition. |
|
' |
Comment. |
Cubic Segment Type Example
'
'------------- Cubic -------------------
'
SegmentType("Cubic", x, x1, y1, x2, y2)
xbar = (x-x1)/(x2-x1);
ybar = 3*xbar^2-2*xbar^3;
y = y1+(y2-y1)*ybar;
return y;
endSegmentType
See Default Segment Type Function Definitions for more segment type function definitions.