Are there inconsistencies in the Vensim DLL ?

Use this forum to post Vensim related questions.
Post Reply
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Are there inconsistencies in the Vensim DLL ?

Post 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
Attachments
MacroDependencies.zip
SimpleModel with a Macro
(8.96 KiB) Downloaded 244 times
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Are there inconsistencies in the Vensim DLL ?

Post 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.
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: Are there inconsistencies in the Vensim DLL ?

Post 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
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Are there inconsistencies in the Vensim DLL ?

Post by tomfid »

I'd try SHOWMACRO|1 - in the meantime I'll take a look in the debugger.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Are there inconsistencies in the Vensim DLL ?

Post 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.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Are there inconsistencies in the Vensim DLL ?

Post by tomfid »

I think I've found the bug - should be OK in the next release.
gwr
Senior Member
Posts: 209
Joined: Sun Oct 04, 2009 8:40 pm
Vensim version: DSS

Re: Are there inconsistencies in the Vensim DLL ?

Post by gwr »

Great to hear and thanks for the advice so far which should help to circumvent difficulties til then.

Best,
Guido
Post Reply