Download EES User`s Manual

Transcript
Chapter 5
Functions, Procedures, Modules, and Subprograms
that appear in the Equations window by selecting the 'Show function/procedure/module
variables' control in the Options tab of the Preferences dialog.
So should you use a Module or a Subprogram? Limited tests thus far indicate that a Module
tends to solve a problem more efficiently than a Subprogram, although you may wish to test
both forms to determine which is better for your application. A major advantage of a
Subprogram is that it can be called from a Function or Procedure. Conditional statements, such
as the IF THEN ELSE, GOTO, and REPEAT - UNTIL are only supported in Functions and
Procedures. If your application requires integration with conditional statements, you will
necessarily have to use a Subprogram. Shown below is a short program which calls a Function
that uses an IF THEN ELSE statement to call one of two Subprograms, one of which calls
another function. Subprograms can call and be called by Functions and Procedures and that is
their most significant difference from Modules.
If automatic unit checking is enabled, EES will check the unit consistency of all equations in
Subprograms and Modules. It will further check to see that the units variables provided in the
Call statement match those in the Module or Subprogram statement.
216