Contents - Index


$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 is 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.  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 step size and integration variables will be reported in the Integral Table at the specified step size.  The output step size 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 step size used to report integration results is totally independent of the step size of used in the numerical integration.  If the numerical integration step size and output step size are not factors, linear regression will be used to determine the integrated quantities at the specified steps.   If an output step size is not specified, EES will output all specified variables at every time step. If the automatic integration step size algorithm is used, the output step size 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 directive 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

 

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

 

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,T=70,P=14.7)   "density of 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"