Please enable JavaScript to view this site.

Vensim Help

C/C++int VEFCC vensim_synthesim_vals(unsigned long offset, float *vval, float *tval, int maxn) ;

int VEFCC VensimCSynthesimVals(int threadcontext,VAL_OFF offset,float *y,float *x, int maxn) ;

JavaNot applicable
VBNot applicable
PascalNot applicable

This is a specialized function that gives access to values while SyntheSim is active.  Because it depends on native data formats it is available only in C.  For other programming languages use vensim_get_data with a null or empty filename.

Arguments

offset        the offset of the variable to get data for as returned by vensim_get_varoff.

vval        the vector of values for the variable.  This is a single precision vector of numbers.

tval        the vector of values for the designated time axis.  It is important to remember that these numbers will not necessarily be evenly spaced.

maxnthe maximum number of values that can be filled in.  Use this to prevent any overruns on the vval and tval vectors.  If this value is 0 the function will return the required buffer size for any variable.  In this case the values specified for varname and tname do not matter.

Returns

The number of values retrieved or, if maxn is 0, the required buffer size to fetch values from the dataset.  A return value of 0 indicates that Vensim was not in SyntheSim mode, the arrays are null, or the offset was not valid.  If the return value is the same as maxn and maxn is positive there may be insufficient room to return all values.

Notes

This function gives fast access to model results.

If a floating point error occurs during simulation older values will be left in the later parts of the returned arrays.

The first time you call this function the results will be those stored in the current run file.  Subsequent calls will return the results of the last simulation whether it was saved or not. Therefore it is good practice to call this for all the offsets for which data is desired upon entering SyntheSim mode.

See Also

vensim_get_data