Page 792 - ExtendSim User Guide
P. 792

766 Data Management and Exchange
Other internal data storage and management methods
• Youjustwantasimplearraystructureofasingledatatype.Forinstance,tocreateaninteger array with 10 columns and 20 rows of data for use in a model.
• You program blocks that can use a more simple data structure than a database requires, and you don’t need or want the data storage to be visible to the block user.
Creating a global array
There are three ways to create a global array:
1) UsetheDataSourceCreateblock(Valuelibrary)asillustratedlaterinthischapter.
2) Throughglobalarrayfunctionsinanequation-basedblockfromtheValueorItemlibrary. These blocks are discussed in “Equation-based blocks” on page 695.
3) ProgramingwithModLcode.Formoreinformation,seetheDeveloperReference.
You can name a global array anything you want as long as the name is fewer than 32 characters and it does not begin with the underscore character (_). Global array names are not case sensi- tive; spaces between characters are allowed.
A global array can only be of one data type - either integer or real (if the data type is selected through the user interface), or integer, real, or string (if the data type is selected through ModL code.) Each model can have one or more global arrays associated with it and each global array can have multiple rows and columns. Global arrays are stored and saved with the model, even if the Data Source Create block that created the array is deleted.
Following the standard conventions, ExtendSim databases are organized by field and record (similar to being organized by column and row.) However, arrays are organized by row and column. This is important to consider when transferring data between databases and global arrays.
How to create and use a global array
The example that follows uses the Data Source Create block to create a global array for the Reservoir 1 model. As illustrated below, the steps are:
1) PlaceaDataSourceCreateblockinamodel.
2) BuildtheglobalarrayintheDataSourceCreateblock.
3) Populatethearraywithdata.
4) Determine how the model exchanges data with the array.
Using an example model
Open the model Reservoir 1 from the \Examples\Tutorials folder.
So that you don’t overwrite the original file, give the command File > Save Model As and save the model as ReservoirGA.
How To


































































































   790   791   792   793   794