Page 765 - ExtendSim User Guide
P. 765

In the popup menu that appears below the Link popup, select the database named Example Database. (The Reservoir 1 model already had a database, so you can concen- trate on learning how to create a dynamic link. For information on creating a database, see “How to create an ExtendSim database” on page 748.)
Select the table named Example Data 1.
The field “Initial Values” is selected by default in the Field Name popup menu, because there is only one field in this data- base table.
Notice that the table viewer in the lower sec- tion of the Link dialog displays two records containing initial values.
Do one of the following:
Enter Record #: 2.
Data Management and Exchange 739
User interfaces for data exchange
Link dialog for Database Table
Or, select the initial value of 25.00 by
clicking on that cell in the table viewer; the setting is in the second row of the table viewer.
Click the Link button to close the dialog and establish the link. Save the model.
In the Holding Tank’s dialog there is now a light blue frame around the “Initial contents” parameter, indicating that the field is dynamically linked. Mousing over the parameter field displays the source and location of the linked cell. To open the Link dialog for viewing or changing the linked settings, click in the parameter field and give the command Edit > Create/ Edit Dynamic Link.
When the simulation is run the Reservoir will start with an initial contents of 25 inches; it gets that value from a live link with the database.
☞ Since the link is a live link, changing the value of the “Initial contents” parameter in the Hold- ing Tank will change its record in the database table, and vice versa. If you do not want that behavior, select the Read Only option in the Link dialog.
How to link a parameter to a global array
The following example uses the Reservoir 1 model from the Tutorial module. It describes how to dynamically link the Holding Tank’s “Initial Contents” parameter to a cell in a global array.
Open an existing model and save it under a different name:
Open the Reservoir 1 model located in the folder \Examples\Tutorials.
So that you don’t overwrite the original file, save the model as ReservoirGALink.
In the ReservoirGALink model, open the Holding Tank dialog. Open the Link dialog by doing one of the following:
How To

   763   764   765   766   767