Sensor

Overview

Sensors monitor a simulation for a specified event and changes a set of simulation controls when the event occurs.

You can use sensors to trigger actions during simulations when a specified event occurs. The actions you can trigger include:

Stopping the simulation completely

You might want to monitor the vertical distance between a wheel center and the ground and stop the simulation when it exceeds the un-deformed radius of the tire.

Changing the parameters controlling the solution

You might want to monitor the distance between two objects that are expected to collide during a simulation. Just before the objects collide, you reduce the solution step size to avoid convergence problems and reduce the output step size to capture the magnitude of the contact force.

Changing inputs to the simulation

Sensors are often used in vehicle applications to transition between different maneuvers, such as from a controlled, straight-line movement to a J-turn. Any characteristic of the vehicle's movement that you can measure in Adams Modeler, you can monitor through a sensor and trigger a change in simulation conditions. For vehicles, these include the yaw, lateral, or longitudinal velocity; the yaw or slip angle; the engine or wheel speed; and so on.

Changing the model topology

You can create a sensor that monitors the reaction force in a connection and then deactivates the connection when the force exceeds a specified value.

 

Defining Events for Sensors to Detect

You define the event that a sensor is to detect by creating a function, which can depend on:

  • Distance, velocity, acceleration, or force between interfaces/markers.

  • User-defined variables

  • Simulation time

You can also reference object data, such as measures. 

When performing a Dynamic Simulation, Adams Modeler evaluates the function after every successful Integration Step.  When performing other types of simulations, it evaluates the function after every successful solution step. To define the function, you can use a run-time expression or a user-written subroutine.

The sensor function should be continuous because Adams Solver 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.

Generally, Adams Solver tests sensors after every successful integration step. If the triggering condition or event that the sensor is monitoring occurs and persists, you may have to turn off the sensor, so it doesn't continue to trigger. You can turn off a sensor using the DEACTIVATE simulation script command. To help reduce the possibility of the continuous triggering effect, once the sensor triggers the first time, Adams Solver does not test the sensor again until after three subsequent successful integration steps.

Triggering the Action of a Sensor

You set the value to trigger the sensor by specifying a target value, providing an allowable tolerance from the target value, and then setting a comparison for the sensor to evaluate.

Error Tolerance

Because a function rarely equals a target value exactly, you can specify the allowable error tolerance between the target value and the actual value of the function. Adams Solver compares the function’s instantaneous value to the target value +/- the error tolerance at each integration step according to the comparison that you specify. Note that the sensor error tolerance must be a positive number.

Setting Comparisons

Specifies what kind of comparison Adams Solver should make to determine if it should initiate the sensor action. The comparisons can be one of those in the following table.

Comparison Initiates the action when the function value is:
Equal From (Target - Error) to (Target + Error).
Greater than or equal Greater than or equal to (Target - Error).
Less than or equal Less than or equal to (Value + Error).

Types of Actions for Sensors

There are several actions a sensor can trigger. These are grouped into:

  • Standard Actions - Commonly used actions.
  • Special Actions - Actions used to assist in debugging your model.

Standard Actions

You can specify one or more of the following standard actions to occur when Adams Modeler senses the event.

  • Generate additional output step - Creates an extra Output Step when Adams Solver triggers the sensor so you can capture the action.

  • Set output step size - Redefines the time between consecutive output steps. Adams Solver uses this value until it is changed. The default is the current time between output steps for the simulation.

  • Terminate current step and stop or continue with a simulation script - Stops simulation or stops current command in simulation script and continues with next command.

Special Actions

  • Set integration step size - Redefines the next Integration Step size. This change is temporary and lasts only for the next solution step.

The default is an integrator-determined value except when you’ve included restarting the integrator as part of the sensor action as explained next. In this case, the step size defaults to the integrator step size.

  • Restart integrator - Restarts integration and reduces the integration order to one. If you also set integration step size as explained above, Adams Solver reinitializes the integration step size to the specified value. If you do not specify the step size, Adams Solver reinitializes the integration step size to the integrator step size.

  • Refactorize Jacobian - Causes Adams Solver to generate a new pivot sequence for matrix factorization. This can help the integrator produce more accurate data or proceed more robustly through the simulation. Adams Solver generates a pivot sequence for matrix factorization before starting the simulation. Adams Solver does not generate a new pivot sequence unless you specify to refactorize the Jacobian or it is necessary to refactorize to reach convergence.

  • Dump state variable vector - Writes the entire array of state variable values to a text file in your current working directory.

 

Creating a Sensor

From the the Simulation Tool Palette, select the Sensor Tool:

The Sensor tool properties appears:

 

The Sensor properties are described in the table below.

Feature

Description

Event Definition
Expression Defines the triggering event using a run-time function expression.
Event Evaluation
Evaluation

Choose either:

  • None
  • Run-Time Expression - Specifies an expression that is evaluated when the event Adams Modeler is monitoring becomes true. You can obtain the scalar value of the expression using the SENVAL function expression.

Example:

If you set the following values, you can retrieve the distance between two markers. You use the SENVAL function to retrieve the distance.

  • Event Definition: Run-time Expression
    • Expression: MOD (time, .5)
  • Event Evaluation: Run-Time Expression
    • Expression: DY(3,2)
Condition
Condition Select one of the following:
  • Equal - From (Target - Error) to (Target + Error).
  • Greater than or equal - Greater than or equal to (Target - Error).
  • Less than or equal - Less than or equal to (Target + Error).
Value Enter the target value that triggers an action.
Error Tolerance Enter the absolute value of allowable error between the targeted value and the actual sensed value.
Time Error Specifies the temporal error with which the activation time of the sensor is isolated.
Bisection Specifies that a bisection search algorithm will be used to isolate the activation time of the sensor. When not present the default, secant-type root-finding algorithm is used.
Standard Actions
Generate additional Output Step at event

Select to create an extra Output Step when Adams Solver triggers the sensor so you can capture the action.

Set Output Step Size Select to redefine the time between consecutive output steps. Adams Solver uses this value until it is changed. The default is the current time between output steps for the simulation.
Terminate current simulation step and Select to:
  • Stop the simulation.
  • Stop the current command in the Simulation Script and continue with the next command.
Special Actions

Set Integration Step Size

Select to redefine the next integration step size. This change is temporary and lasts only for the next solution step.
Integration Step Size The default is an integrator-determined value except when you’ve included restarting the integrator as part of the sensor action as explained next. In this case, the step size defaults to the integrator step size.
Restart Integrator Select to restart integration and reduce the integration order to one. If you also set integration step size as explained above, Adams Solver reinitializes the integration step size to the specified value. If you do not specify the step size, Adams Solver reinitializes the integration step size to the integrator's default step size.
Refactorize Jacobian Select to cause Adams Solver to generate a new pivot sequence for matrix factorization. This can help the integrator produce more accurate data or proceed more robustly through the simulation. Adams Solver generates a pivot sequence for matrix factorization before starting the simulation. Adams Solver does not generate a new pivot sequence unless you specify to refactorize the Jacobian or it is necessary to refactorize to reach convergence.
Dump State Variable Vector Select to write the entire array of state variable values to the simulation message file.

 

Editing a Sensor

Adams Sensors do not have graphical representation in Graphics. To edit a Sensor, select it from the Model Browser and either double-click or RMB and select Properties.

Simulating with a Sensor

Select an action from the Standard or Special Actions areas of the Sensor and then select Simulation. Define the simulation and select Simulate.

If you select to "Terminate Current Simulation Step and ...", you must run with a Scripted Simulation.