Page 1 of 1

Are there inconsistencies in the Vensim DLL ?

Posted: Wed Oct 29, 2014 12:35 pm
by gwr
Hello,

I am using the VensimDLL to analyze Vensim models in Mathematica. Doing this I will build a model graph using the adjacency information provided by listing the causes and uses of a variable (e.g. a graph-vertex) when applying the DLL function VensimGetVarAttrib. I just noted that there seems to be an inconsistency with this function when Macros are envolved.

I have enclosed a very simple model to demonstrate this. In that model there are three variables:

Code: Select all

someFractionalRate =	0.1 ~	~|
modelFractionalRate = CONTINUOUSRATE(someFractionalRate) ~ ~|
stockToGrow = INTEG ( modelFractionalRate * stockToGrow, 100) ~~|
Essentially some rate is turned into a continuous rate by applying a Macro (e.g. CONTINUOUSRATE( . ) ). That rate is then used to exponentially grow a stock. The dependencies (uses) are thus:

someFractionalRate -> modelFractionalRate -> stockToGrow

Indeed that is what, asking for the causes , is reported by the DLL, e.g. VensimGetVarAttrib[ "modelFractionalRate", 4] returns a list of string containing only the variable someFractionalRate (the macro variable is not showing here).

But if you are inquiring about the uses of the variable someFractionalRate a different picture is drawn: Here VensimGetVarAttrib[ "someFractionalRate", 4] will return the macro variable #modelFractionalRate>CONTINUOUSRATE# and not modelFractional Rate as the simple minded user would expect. Interestingly the uses of that variable will list modelFractionalRate also, but it never appears in the causes list for modelFractionalRate as shown above.

I do find this behavior inconsistent: Either the causal chains reported will always include the macro variables or they should never report them. The asymmetric behavior in my case leads to a broken causal chain in the model graph.

Or am I missing something here?

Best regards,

Guido

Re: Are there inconsistencies in the Vensim DLL ?

Posted: Wed Oct 29, 2014 5:14 pm
by tomfid
You might try including an .ini file in the .vpm that you're feeding to the .dll, with Tools>Options>Settings>Show Macro Variables set. My first guess would be that it's set to Hide (which is the default), but the Uses call is forgetting to check the attribute. Otherwise I'll have to take a look in the debugger.

Re: Are there inconsistencies in the Vensim DLL ?

Posted: Thu Oct 30, 2014 9:16 am
by gwr
Hi Tom,

I am having trouble following your advice: I have checked that the Options for Macro variables in the Tools-Menu are set to "hide" and I have checked the settings to be included when publishing the .vpm-file. Unfortunately that does not alleviate the problem.

The follwing also did not work out:

Code: Select all

VensimCommand[ "SETTING>SHOWMACRO|0" ]
Would I have to change settings in the .ini-file itself (where to find and how to do this?) and will I have to activate its being included by SPECIAL>READINI|filename ?

Best,
Guido

Re: Are there inconsistencies in the Vensim DLL ?

Posted: Thu Oct 30, 2014 3:12 pm
by tomfid
I'd try SHOWMACRO|1 - in the meantime I'll take a look in the debugger.

Re: Are there inconsistencies in the Vensim DLL ?

Posted: Fri Oct 31, 2014 7:25 pm
by tomfid
FWIW, with SHOWMACRO|1 I do get consistent behavior (showing "#modelFractionalRate>CONTINUOUSRATE#" from either end).

There is an inconsistency for SHOWMACRO|0 - for some reason it doesn't suppress the macro variable in the uses direction.

Re: Are there inconsistencies in the Vensim DLL ?

Posted: Sun Nov 02, 2014 2:34 am
by tomfid
I think I've found the bug - should be OK in the next release.

Re: Are there inconsistencies in the Vensim DLL ?

Posted: Sun Nov 02, 2014 10:28 pm
by gwr
Great to hear and thanks for the advice so far which should help to circumvent difficulties til then.

Best,
Guido