|
Tutorial (TOC) > TEST-Codes |
|
Whenever the Super-Calculate button is pressed during any stage of a TEST solution, a lengthy output is generated on the I/O panel. The first part of that output contains a few lines of instructions or macros that we call TEST-codes. They succinctly describe the solution procedure by listing the known state properties (values and units), and device or process variables. However, the most important use of TEST-codes is to recreate the original visual solution. For that, the codes are copied into the I/O panel of the appropriate daemon, loaded using the Load button, and the solution is propagated using the Super-Calculate (followed by Super-Iterate, if necessary) button. TEST-codes can be used to store a completed or partially-completed solution, share solutions through emails, and create a baseline case for further parametric study. The syntax used in TEST-codes is intuitive, similar to those used in C++ or Java. There are two logical blocks - states and analysis. The states block consists of all the computed states, each state listing the working fluid and the input properties. The analysis block consists of all the computed devices (or processes). Each device (or process) lists the inlet (or begin) and exit (or finish) states, and device (or process) variables such as heat or external work transfer. Note that there are no TEST-codes for exergy and cycle panels, which are updated from the information contained within the states and analysis blocks. The Problems module contains hundreds of problem statements along with TEST-codes. We use one problem to highlight the use of TEST-codes to recreate a solution.
|
|
Ex-1: A rigid container of volume 1 m3 contains ammonia at 100 kPa and 90% quality. If 200 kJ of heat is transferred to the tank, (a) determine the final pressure. Solution The unsteady closed system goes through a process from a begin-state to a finish-state. Launch the appropriate closed-process daemon by navigating to TEST. Daemons. Systems. Closed. Process. Generic. Uniform. Phase-Change page. In this problem the uniform closed system, which can be represented by a single state at any given instant, executes a closed process going from a clearly defined b-State (State-1) to an unique f-Staten (State-2). State-1: Enter Vol1, p1, x1 and Calculate. State-2: Enter Vol2 ('=Vol1'), and Calculate. On Process Panel, load State-1 as the b-State and State-2 as the f-State. Enter the known process variables W_O(=0) and Q (=200 kJ). Calculate and then Super-Calculate to produce the final pressure p2 as 135 kPa. The Super-Calculate operation produces the following TEST-codes. |
|
|
|
Solution Using TEST-codes
Notice how similar the TEST-codes are to the step-by-step instructions for the TEST solution. On the primary window launch the process daemon by selecting PC-Model. The daemon header contains the complete path, compare it with the one given on TEST-codes listed above. To copy the code, select the block of code
by dragging the mouse, use Ctrl_C to copy, move the mouse to I/O Panel of
the daemon, click at the bottom of the text box, and press Ctrl_V to paste
the codes. At the end of this operation the I/O panel should look as in Fig.
1. |
|
| Fig. 1 Image of the I/O panel after the TEST-codes has been pasted. |
|
Now click the Load button. TEST-codes
are parsed and the messages are displayed on a floating window (Fig. 2).
The parser looks for the 'States' keyword, matches starting and ending braces,
and starts reading the individual states. If error is encountered at any
step, appropriate error message is generated. If the material listed on the
codes does not exist, the daemon simply selects the first substance on the
list. If any unexpected error is encountered (for instance, State is misspelled),
the parsing stops with the output showing the line number (including any
comment line). Comments line in a TEST code is preceded by the pound (#) sign. Loading simply means placing the variables in appropriate addresses - p2 in State-2, Vel4 in State-4, etc. Notice that even if the problem is solved in mixed or English units, TEST-codes are in SI. The Analysis block is similarly loaded to appropriate devices or processes. |
|
| Fig. 2 Image of the Loading Message Window. |
|
If the loading window does not
show any error message, click the Super-Calculate button to update all calculations with the loaded information.
The resulting solution in this particular problem can be found to be identical
to the visual solution discussed in the Manual page. The image of State-2
is reproduced in Fig. 3 and the final pressure can be seen to be 135 kPa as expected.
Super-Calculate also generates the TEST-codes on the I/O panel. This allows one to quickly change a parameter on the TEST-codes, Load and Super-Calculate to update all calculations. Calculations, thus, can be repeated without leaving the I/O panel. |
|
| Fig. 3 Image of State-2 after the Super-Calculate operation. |
| Any time the Super-Calculate button
is pressed, TEST-codes for the visual solution is generated on I/O
Panel in addition to detailed output, spreadsheet friendly property table,
etc. To save the solution all you need to do is to copy the TEST-codes to
any word processor (such as Notepad) and save it as a text file using selection
by mouse drag, copy by Ctrl_C, and paste by Ctrl_D. Note that the Copy and Paste items may be disabled in your browser's
Edit menu. |
| Copyright 1998-: Subrata Bhattacharjee |