executive_control modify sensor
Allows you to modify a sensor. You may reverse this creation at a later time with an UNDO command.
Sensors are contained in a model. Before creating sensors, you must use the 'MODEL CREATE' command to create a model.
A SENSOR monitors the Adams simulation for a user-defined event and effects a set of simulation controls when the event occurs. The simulation controls and modifies the integration and the output step sizes, to output additional diagnostic information, and to alter the simulation end time.
You define the event by creating a function and comparing it against a given value. The function the SENSOR uses may depend on distance, velocity, acceleration, and force between markers, on user-defined variables, and on simulation time. Adams evaluates the function after every successful integration step when doing dynamic analysis, and after every successful solution step when doing other types of analysis. To define the function, use a FUNCTION expression or a user-written subroutine.
Format:
executive_control modify sensor |
|---|
sensor_name= | String |
new_sensor_name = | string |
adams_id = | geom._id |
comments = | string |
compare = | GE/EQ/LE |
codgen = | on/off |
dt = | real |
halt = | on/off |
bisection= | real |
time_error= | real |
value= | real |
error = | real |
angular_value= | real |
angular_error= | real |
print= | on/off |
restart= | on/off |
return= | on/off |
stepsize= | real |
yydump= | on/off |
function= | Function |
user_function= | real |
routine= | string |
evaluate= | Run time function |
user_evaluate= | real |
evaluate_routine= | string |
Example:
executive_control modify sensor & |
|---|
sensor_name = | MY_SENSOR & |
new_sensor_name = | HALT_WHEN_F1_REACHED& |
function = | "1E2+3.4+6" & |
comments = | "Example Sensor" & |
compare = | ge& |
codgen = | on & |
halt = | on & |
value = | 50.9 |
Description:
Parameter | Value Type | Description |
|---|
sensor_name | String | Specifies the name of the sensor you wish to modify |
New_sensor_name | String | Specifies the name of the new sensor. You may use this name later to refer to this sensor. |
adams_id | Adams_id | Specifies an integer used to identify this element in the Adams data file. |
comments | String | Specifies comments for the object being created or modified |
compare | GE, EQ, LE | Specifies what kind of comparison is to be made to initiate the action by the SENSOR. |
codgen | ON/OFF | Specifies that Adams is to generate a new pivot sequence for matrix factorization when the event that Adams is sensing has the specified relationship to VALUE. |
Dt | Real | Specifies that the time between consecutive output steps should be redefined. This is done when Adams first senses that the FUNCTION specified has the same relationship as specified to VALUE. Adams uses this value until it is changed. |
halt | On/OFF | Specifies that execution should be terminated when the FUNCTION that Adams is sensing has the specified relationship to VALUE. |
value | Real | Specifies the non-angular VALUE you want to relate to the FUNCTION that Adams is sensing. |
error | Real | Specifies the absolute non-angular value of allowable error between VALUE and the value of the FUNCTION that Adams is sensing. |
angular_value | Real | Specifies the angular VALUE you want to relate to the FUNCTION that Adams is sensing. |
angular_error | Real | Specifies the absolute angular value of allowable error between VALUE and the value of the FUNCTION that Adams is sensing. |
Print | On/OFF | Specifies that Adams should write data to the request, graphics, and output files when the FUNCTION that Adams is sensing has the specified relationship to VALUE. |
restart | On/OFF | Specifies that Adams should restart the integration when the FUNCTION that Adams is sensing has the specified relationship to VALUE. Adams reinitializes the integration step size to HINIT and reduces the integration order to one. |
return | On/OFF | Specifies that Adams should stop the simulation and return to the command level when the FUNCTION that Adams is sensing has the specified relationship to VALUE. |
stepsize | Real | Specifies that Adams should redefine the trial integration step size when the FUNCTION that Adams is sensing has the specified relationship to VALUE. This change is temporary and lasts only for the next step. If this step size is unsatisfactory for convergence or if it generates too much error, Adams tries one or more different step sizes. |
Yydump | On/OFF | Specifies that Adams should dump the state variable vector when the FUNCTION that Adams is sensing has the specified relationship to VALUE. |
function | Function | Specifies a FUNCTION expression to define the sensor. |
user_function | Real | Specifies a list of constants that are to be passed to a user-written subroutine to define the sensor. |
Extended Definition:
1. Adams View will not allow you to have two sensors with the same name, so you must provide a unique name.
Normally, entity names are composed of alphabetic, numeric, or '_' (underscore) characters, and start with an alphabetic or '_' character. They may be of any length. For more information, see
Using Extended Names.
By enclosing the name in double quotes, you may use other printable characters, or start the name with a numeral. If a name contains characters, or starts with a numeral, you must always quote the name when entering it.
Note that you can specify the parentage of an entity (e.g. what part "owns" a marker or a geometry element) when you CREATE it by changing the name. If you enter just the entity name, then the default parent will be assigned by Adams View. If you type in the full name, then you may override the default parent. In most cases, when creating an entity, Adams View will provide a default name. The default name that Adams View provides will specify the parentage that it has assumed. You may, of course, delete this name and use your own. The form of a full name is:
"...._NAME.GRAND_PARENT_NAME.PARENT_NAME.ENTITY_NAME"
The number of levels used varies from case to case and the parentage must exist before an entity can be assigned to it.
2. When you use the FILE ADAMS_DATA_SET WRITE command, Adams View writes an Adams data file for your model. Adams requires that each modeling element be identified by a unique integer identifier. If you use this parameter to specify a non-zero identifier, Adams View will use it in the corresponding statement in the Adams data file.
You may also enter zero as an identifier, either explicitly or by default. The next time you write an Adams file, Adams View will replace the zero with a unique, internally-generated identifier. Adams View will permanently store this identifier with the element just as if you had entered it yourself.
Normally, you would let all identifiers default to zero, and Adams View would generate the identifiers for you. You are never required to enter a non-zero identifier. You only need to specify it if, for some reason, you wish to control the Adams file output.
3. The COMPARE type can take on the values EQ, GE, or LE:
EQ initiates action when the FUNCTION that Adams is sensing is from (VALUE - ERROR) to (VALUE + ERROR).
GE initiates action when the FUNCTION that Adams is sensing is greater than VALUE - ERROR.
LE initiates action when the FUNCTION that Adams is sensing is less than VALUE + ERROR.
4. The Codgen parameter may help the integrator to produce more accurate data or to proceed more smoothly at troublesome points in time. Adams generates a pivot sequence for matrix factorization before starting the simulation. Then Adams does not generate a new pivot sequence unless the CODGEN argument is used or it is necessary to reach convergence.
5. The easiest way to enter a function expression in Adams View is to use the text editor in combination with the function builder. To invoke the text editor for entering a function expression, highlight the function field and then either pick the "EDIT" button at the top of the panel or type a ^t (control-t). The Adams View "function builder" is discussed below.
The syntactical correctness of a function expression can be investigated by using the "VERIFY" button at the upper right side of the text editor. If there is a syntax error, a message is printed and the cursor is put near the problem. Proper unit consistency is not checked during function expression verification.
The remainder of this explanation will cover the components of FUNCTION expressions as summarized in the following table:
Components | Examples |
|---|
Numbers | FUNCTION = 1E2 + 3.4 + 6 |
Operators | FUNCTION = 3*6/2 + 3 - 2**2 |
System Constants | FUNCTION = PI + 20 |
System Variables | FUNCTION = AX(1040, 2010) |
Arithmetic Ifs | FUNCTION = IF(DX(3, 5): -1, 0, 1) |
Fortran-77 Functions | FUNCTION = ABS(NUM) - 6 |
Blanks | FUNCTION = 1 + 2 |
Continuation Commas | FUNCTION = 1 + 1 + 1 + 1 + 1 + 1 , + 1 + 1 + 1 + 1 + 1 + 1 + 1 |
Adams Functions | FUNCTION = POLY(0, 0, 6.28) |
NUMBERS
FUNCTION expressions can include integers, real numbers, and exponents. In other words, any numbers that are legal in Adams are legal in a FUNCTION expression.
OPERATORS
In a FUNCTION expression, Adams allows any of the operators **, *, /, +, and -. Adams executes these operators according to the following precedence rules:
■From greatest to the least, the operators have the following priorities. ** then * / then + -. In other words, Adams executes exponentiation (**) before all other operators and executes multiplication (*) and division (/) before addition (+) and subtraction (-).
■When a statement has operators of the same priority, Adams executes them from left to right.
■You can use parentheses to alter the precedence of operators. For example, in the equation,
FUNCTION = (1-TIME)*30/PI
Adams subtracts TIME from one before it performs multiplication and division.
SYSTEM CONSTANTS
You can include the following system constants in a FUNCTION expression:
■ PI Value of pi (to eighteen significant digits)
■DTOR Value of pi/180 for converting degrees to radians
■RTOD Value of 180/pi for converting radians to degrees
The following example of a FUNCTION with a system constant multiplies the system constant PI by the displacement of marker 10 with respect to marker 14:
FUNCTION = PI*DM(10,14)
BLANKS
A FUNCTION expression can contain any number of blank spaces. Five consecutive blank spaces in an expression do not terminate input of the expression (by indicating that what follows is a comment) as they do in an Adams statement. However, you should remember these two restrictions.
■ You cannot put a blank space in the middle of a number.
■Adams does not accept a blank space between a function and its left bracket. (This is true for both, FORTRAN-77 functions and Adams functions.)
CONTINUATION COMMAS
You can use a comma to continue FUNCTION expressions. You can break the expression anywhere except in the middle of a number, in the middle of a name, or between a function and its left bracket. Put a continuation comma in column one of the following line before the rest of the expression. If you break the expression at a comma that is part of the expression, you must use both, the expression comma and the continuation comma. You may use more than one continuation comma to extend an expression over several lines.
FUNCTION BUILDER
The FUNCTIONS button at the right side of the Adams View text editor provides a means for constructing an Adams function string. These functions are briefly described below. Upon picking the FUNCTIONS button, you will be presented with the list of available functions in the "selection window". After you select the desired function, a panel will appear with fields representing the various parameters for the function. You will have full access to on-line help with this panel just like you have with regular panels. After you have completed the panel and selected the DONE button on the panel, the function string will be constructed and inserted at the current text cursor location in the text edit window.
SYSTEM VARIABLES
A FUNCTION expression may access the current value of a system variable and use the value in computations. These values are accessed through a collection of functions. The accessible system variables include the following: Time, Mode, Displacements (Translational and Rotational), Velocities (Translational and Rotational), Accelerations (Translational and Rotational), Forces (Translational and Rotational), and User-defined variables. Invoke the text edit window and pick the FUNCTIONS button to get a list of functions that can be accessed.
In general, you use a function character string (such as DM, VX, or FZ) and a list of values (e.g. i1, i2, and i3) to access a system variable in an expression. For example, the value i1 may be the name of the marker for which you want to measure a quantity (such as displacement, velocity, acceleration, or force), i2 is the name of the marker with respect to which you want to measure the quantity, and i3 is the name of the marker you want to use to resolve the components of the quantity. If you do not specify marker i3, Adams computes the result in the ground reference frame.
ARITHMETIC IFS
Arithmetic IFs allow you to conditionally define FUNCTION. The format for arithmetic IFs follows.
IF (expression 1: expression 2, expression 3, expression 4)
Adams evaluates expression 1. If expression 1 is less than zero, the arithmetic IF equals expression 2; if expression 1 equals zero, the arithmetic IF equals expression 3; and if expression 1 is greater than zero, the arithmetic IF equals expression 4.
A FUNCTION expression with an arithmetic IF and its four expressions is as given below:
FUNCTION = 6 * IF(VR(10,31): 0 , 0 , 100)
If the radial velocity between markers 10 and 31 is less than or equal to zero, the value of the FUNCTION expression is zero; but if the radial velocity between markers 10 and 31 is greater than zero, the value of the FUNCTION expression is six hundred.
In some ways, you may treat IF as a variable. For example, you can place it anywhere in the expression. In addition, you can nest arithmetic IFs nine levels deep.
FORTRAN-77 FUNCTIONS
You can use the FORTRAN functions ABS, ATAN, ATAN2, COS, EXP, LOG, LOG10, MIN, MAX, SIN, SQRT, and TAN in your expression. For more information about these functions, see a FORTRAN reference manual. Invoke the text edit window and pick the FUNCTIONS button to get a list of functions that can be accessed.
ADAMS FUNCTIONS
In general, an Adams function evaluates a mathematical equation and returns a value to your FUNCTION expression. The following table lists all the Adams functions and their purposes. Invoke the text edit window and pick the FUNCTIONS button to make a list of functions that can be accessed.
Names | Purposes |
|---|
AKISPL | Accesses the data in a SPLINE statement and uses the Akima cubic method to fit a cubic curve(a spline) to the data. |
BISTOP | Evaluates a force restricting displacement of a part in two opposite directions |
CHEBY | Evaluates a Chebyshev polynomial |
CUBSPL | Accesses the data in a SPLINE statement and uses the traditional cubic method to fit a cubic curve (a spline) to the data. |
FORCOS | Evaluates a Fourier cosine series |
FORSIN | Evaluates a Fourier sine series |
HAVSIN | Evaluates a haversine function |
IMPACT | Evaluates a force restricting displacement of a part in one direction. |
POLY | Evaluates a polynomial |
SHF | Evaluates a simple harmonic function |
STEP | Approximates a step function with a cubic polynomial |
6. To define the sensor with a user-written subroutine, enter the values (r1[,...,r30]) that you want Adams to pass to the user-written subroutine SENSUB. The Adams Users Manual discusses more details about the use of the "SENSUB" subroutine.
Cautions:
1. The SENSOR function must be continuous because Adams tries to adjust the step size to find the exact time the sensor becomes active. This process is inaccurate and time consuming when the function is discontinuous. For that reason, functions of time or displacements work best for sensors; functions of velocities, accelerations, and forces are less desirable.
Any sensor will set the simulation control each time Adams tests the sensor and finds it to be active. Adams tests the sensor after every successful time step. If the sensor becomes active, Adams sets the simulation control and does not test the sensor again until it has taken three successful time steps. Then Adams again tests the sensor after every successful time step.
If you want Adams to take an action, you should be sure to include one of the action arguments (CODGEN, DT, HALT, PRINT, RESTART, RETURN, STEPSIZE, and YYDUMP) in the SENSOR definition. The sensor can become active even if one of the action arguments is not included. However, Adams does not, of course, take any action unless one is specified.