Particle Models

A particle model track is a mathematical model of a point mass. The step positions of the particle are determined by the parameters of the model rather than being marked with the mouse.

There are two types of models: analytic and dynamic. An analytic model defines position functions of time, while a dynamic model defines force functions and initial conditions for numerical ODE solvers.

A particle model has a settable mass and generates motion data and vectors just like any other point mass. See point mass for additional information.

1. Building models

Particle model properties are displayed and edited using the Model Builder tool. To use the builder, choose Model Builder... from the model's track menu.

Fig. 1 Model Builder with a dynamic model of a simple projectile

Functions and parameters are defined by entering expressions that are "parsed" (interpreted) by the OSP parser. The values of parameters are constants while those of functions depend on input variables such as x, y, t, etc. The parser recognizes the following elements:

- Numbers in decimal or scientific notation (e.g., 1.0E-3)
- Names of parameters, functions and other input variables
- Constants e and pi
- Arithmetic operators + - * / ^
- Boolean operators = > < <= >= <> & | !
- Parentheses to control order of operation
- Mathematical functions shown in Table 1
- If statements in the form if(conditional statement, expression1, expression2). Expression1 is evaluated if the conditional statement is true and expression2 is evaluated if it is false. For example, if (x < 0, x^2, -x^2) is a valid function expression.

abs(x) | acos(x) | acosh(x) | asin(x) | asinh(x) | atan(x) | atanh(x) | atan2(x,y) | ceil(x) | cos(x)
cosh(x) | exp(x) | frac(x) | floor(x) | int(x) | log(x) | max(x,y) | min(x,y) | mod(x,y) | random(x)
round(x) | sign(x) | sin(x) | sinh(x) | sqr(x) | sqrt(x) | step(x) | tan(x) | tanh(x) |

Table 1 Mathematical functions recognized by the OSP Parser

Model Builder displays model functions along with associated parameters and initial conditions in tables with Name and Expression columns as shown in Fig. 1. The name of the fit is shown in bold font in the function table.

To edit a name or expression, double-click its table cell (gray cells cannot be edited). Names must be unique and can contain no spaces or mathematical symbols. Expressions must be valid mathematical expressions parsable by the OSP parser.

To create a new parameter or function, click the appropriate Add button.

When editing an expression, the names of all available variables are listed in blue in the status bar as shown in Fig. 2. To insert a variable directly from the list, move the mouse cursor over it until it turns red and then click.

Variables for parameter expressions include only other parameters, while variables for function expressions include independent variables (e.g., x, y, t, etc), parameters and support function names. In the example shown, the "fy" function may depend on any or all of the variables x, vx, y, vy, t, m, g. The entry "-m*g" is thus a valid expression.

Fig. 2 Editing an expression

If an invalid expression is entered into a cell the cell turns red and an error message is displayed in the status bar. In Figure 3, the expression "-mg" is invalid since the multiplication operator (*) has been omitted. Circular references also result in an error condition.

Fig. 3 Invalid expression

Model Builder includes several features designed to help build, modify and compare models quickly:

1. Complex expressions can be simplified by defining one or more support functions. For example, the analytic model of a damped oscillator shown in Fig. 4 defines the support function "amp" that represents the exponentially decaying amplitude. This makes the y position function easier to write and understand.
2. All edits are undoable and redoable making it easy to quickly flip back and forth between two function expressions or parameter values.
3. Single or multiple table rows can be copied or cut to the clipboard for pasting into other tables.

Fig. 4 Using a support function to simplify expressions