If you want to view your the settings during a simulation run (with ED Developer, ED Builder or ED Runtime), you can 'open' the table atom. However, if your using the ED Viewer to run the model, you are not able to modify atoms or to 'open a table'. Also, the speed of your simulation model can decrease when the table is open and frequently used by the model.
There is another option to view your model settings without having to open the table atom (for this option, you must use ED developer. Your model with the table view functionality can be opened in ED Developer, ED Builder, ED Runtime and ED Viewer):
- Drawing the table with help of 2dDraw!
Say your settings table is named 'Settings'. It's atom reference (alias) is then refSettings. In the Atom Editor, you then create a new atom in your model tree named, for example, ShowSettings (tip: put this atom in a seperate layer, in this way, you can easily turn on/off the table information). In the 2D tab of the atom ShowSettings, make sure to set the setting '2D Draw' to 'Yes'.
Now you must place some code on the 2dDraw event handler:
Code: Select all
Do(
{first, declare some help variables}
var([atmTable], vbAtom, refSettings),
var([valStartX], vbvalue,0),
var([valStartY], vbvalue,0),
var([valColWidth], vbvalue,30),
var([valRowHeight], vbvalue,1.6),
var([valNrRows], vbvalue, nrows(atmTable)),
var([valNrCols], vbvalue, ncols(atmTable)),
var([valColCount], vbvalue, 1),
var([valRowCount], vbvalue, 1),
{if you want a show a title for your table, the do the following:}
{* Title *}
diText(valStartX, valStartY - 3*valRowHeight, name(atmTable), colorblack, ColorTransparent, 2, [arial]),
{then draw the headers of the table:}
{* Header *}
repeat(
valNrCols,
do(
{* draw text *}
dishape(valStartX + ((count-1)*valColWidth), valStartY - valRowHeight, valColWidth, valRowHeight,0, ColorBlack, ColorRed),
{* draw lines *}
diText(valStartX+valTextSpace + ((count-1)*valColWidth), valStartY - valRowHeight, string(cell(0,count,atmTable)), Colorblack, ColorRed, 1, [arial])
)
),
{now draw the body, or the actual information, of the table:}
{* Body *}
Repeat(
valNrRows,
do(
valColCount := 1,
repeat(
valNrCols,
do(
{* draw lines *}
dishape(valStartX + ((valColCount-1)*valColWidth), valStartY+ ((valRowCount-1)*valRowHeight), valColWidth, valRowHeight,0, ColorBlack, ColorTransparent),
{* draw text *}
diText(valStartX+ valTextSpace + ((valColCount-1)*valColWidth), valStartY+ ((valRowCount-1)*valRowHeight),
do(
{is this example, certain '0' values in the table (places in the table with no entry) are not displayed as '0'!}
if(
And(
CompareText(String(cell(valRowCount,valColCount,atmTable)), [0]),
Or(
valColCount = 1,
valColCount = 2,
And(
valColCount = 3,
CompareText(String(cell(valRowCount,valColCount-1,atmTable)), [0])
)
)
),
[],
String(cell(valRowCount,valColCount,atmTable))
)
),
colorblack, ColorTransparent, 1, [arial]),
inc(valColCount)
)
),
inc(valRowCount)
)
)
)