**$IntegralTable**

The $IntegralTable directive is used in conjunction with the equation-based Integral function. It can be used in Subprograms or in the main program.

The equation-based Integral function does not employ the Parametric table to specify the values of the integration variable, as does the table-based Integral function. Rather, the lower and upper limits and optionally, the step size of the integration variable, are specified as arguments within the Integral function, e.g.,

F = INTEGRAL(*Integrand, VarName, LowerLimit, UpperLimit, StepSize*) {StepSize is optional}

Normally, EES does not keep intermediate values of any variable used during the numerical integration using the equation-based integral function. Such information is needed if you wish to know the trajectory or path of variables as well as their values at a specified time. The $IntegralTable directive instructs EES to store the intermediate values in an Integral Table. The values can then can be plotted, printed, or copied to another application.

The format of the $IntegralTable directive is:

$IntegralTable t:0.1 x y z

where

t is the integration variable. It of course can have any legal EES variable name. t is used here as an example. This variable must appear in one or more equation-based Integral functions within the Equations window. The first column in the Integral Table will hold values of this variable.

The colon and number (or variable name) following the integration variable are optional. If a number is supplied, this number will be taken to be the output interval and integration variables will be reported in the Integral Table at this interval. The output interval may be a variable name, rather than a number, provided that the variable has been set to a constant value preceding the $IntegralTable directive. Note that the output interval used to report integration results is totally independent of the step size used in the numerical integration. If the numerical integration step size and output interval differ, linear regression will be used to determine the integrated quantities at the intervals. If an output interval is not specified, EES will output all specified variables at every time step. If the automatic integration step size algorithm is used, the output interval may vary for different rows in the table.

x y z ... are the names of variables in the EES main program or Subprogram that the $IntegralTable directive is located in. Algebraic equations involving variables are not accepted. A separate column will be created in the Integral Table for each specified variable. Array range notation, e.g., X[1..5] can be used. The variables must be separated by a space or list delimiter (comma or semicolon)

When calculations are initiated, EES will first check to ensure that all variables in the $IntegralTable command are used in the equations. If no errors are found, an Integral Table will be created and filled with intermediate values results from the numerical integration. Only one IntegralTable directive can appear within each Subprogram or the main program. A separate tabbed Integral table will be created for each Subprogram that contains an IntegralTable directive, in addition to the table for the main program. Values from the Integral table(s) can then be plotted, printed, and copied, in exactly the same manner as for other tables.

Integral Tables are saved with when the EES file is saved and the tables are restored by when the EES file is loaded for versions 9.125 and later. EES files that are saved with version 9.125 or later that contain Integral tables cannot be read by EES versions previous to 9.125.

The Integral tables that exist when calculations are initiated will be deleted and replaced with the newer tables.

A short program illustrating the application of the $IntegralTable and other directives in the main EES program appears below.

______________________________________________________________________

"This program demonstrates the use of the Integral function. Here it is used to

calculate the velocity and position of a freely falling object, subject to aerodynamic

drag.

This example illustrates

1. The use of the Integral Function to solve coupled differential equations

2. The use of the Convert Function.

3. The use of the $IntegralTable directive to store intermediate results during numerical integration

4. The use of the $VarInfo directive to set units of variables.

The following directive instructs EES to store values of v (velocity) and z (elevation) as a function of t (time) at increments of 0.2 sec."

$integraltable t:0.2 v z

$UnitSystem Eng F psia mass

$varinfo a units=[ft/s^2]

$varinfo t units=[s]

$varinfo v units=[ft/s]

$varinfo z units=[ft]

$varInfo F units=[lb_f]

$varinfo F_d units=[lb_f]

$varinfo rho units=[lb_m/ft^3]

F=M*g***convert**(lbm-ft/s^2,lbf) "Newton's Law - the Convert function replaces g_c"

M*a***convert**(lbm-ft/s^2,lbf)=F-F_d "force balance"

Area=1 [ft^2] "cross-sectional area"

F_d=C_d*Area*(1/2*rho*v^2)***convert**(lbm-ft/s^2,lbf) "definition of drag coefficient"

C_d=0.2 "drag coefficient"

M=1.0 [lbm] "mass of object"

rho=**density**(** Air**,

g=32.17 [ft/s^2] "gravitational acceleration"

v_0=0 [ft/s]; z_0=0 [ft] "initial velocity and elevation"

v=v_0+**integral**(a,t,0,5) "velocity as a function of t between 0 and 5 seconds"

z=z_0+**integral**(v,t,0,5) "vertical position as a function of t between 0 and 5 seconds"

______________________________________________________________________

See also: $IntegralStop