Page 1 of 1

Strange result with a constant in Vensim

Posted: Fri Nov 30, 2018 10:43 pm
by billh
I'm developing a model that I can't share publicly at this stage, but it's giving seemingly-strange results (probably PEBKAC, but I don't see it yet).

I defined a subscripted variable (Dmnl) called Light Extinction Ratio and defined it as a Normal Constant with value 0.1 (as a placeholder) for each of its five subscript values. That is, there are five equations, because this variable might eventually have different values for different subscripts.

Ctrl-t says the model is good.

I can run the model and then look the results using the Table tool:
  • Light Extinction Ratio(1) is 24.9599 for every time step.
    Light Extinction Ratio(2-4) is 1e-06 for every time step.
The Equation Editor still shows 0.1 for each equation.

Has anyone ever seen something like this? Better yet, does anyone have an idea why it's happening or what I should look for?

In case it helps, here are the first few lines of the model, which include the definition of this variable:

Code: Select all

{UTF-8}
:MACRO: 
TEMP2HEAT(temperature,specificheath2o,literspercufooth2o,densityh2o)
TEMP2HEAT = (temperature+273)*densityh2o*specificheath2o*literspercufooth2o
	~	kJ/(ft*ft*ft)
	~	The heat in water per ft^3 at a specific temperature in deg. C.
	|

:END OF MACRO:
:MACRO:
HEAT2TEMP(heat,water,specificheath2o,literspercufooth2o,densityh2o)
HEAT2TEMP = heat / (water * specificheath2o * densityh2o * literspercufooth2o) - 273
	~	C
	~	Heat contained in a stock or flow of water
	|

:END OF MACRO:

Light Extinction Ratio["Reach 3.1"]=
	0.1 ~~|
Light Extinction Ratio["Reach 3.2"]=
	0.1 ~~|
Light Extinction Ratio["Reach 3.3"]=
	0.1 ~~|
Light Extinction Ratio["Reach 3.4"]=
	0.1 ~~|
Light Extinction Ratio["Reach 3.5"]=
	0.1
	~	Dmnl
	~		|

I'm running DSS 7.3.4.

Re: Strange result with a constant in Vensim

Posted: Fri Nov 30, 2018 11:08 pm
by tomfid
Could a .cin file be overriding the values?

When all the values are the same, you only need one equation. You could supply the distinct values by .cin override. (This is surely not the cause though.)

Re: Strange result with a constant in Vensim

Posted: Fri Nov 30, 2018 11:18 pm
by Administrator
Are you using external functions?

Re: Strange result with a constant in Vensim

Posted: Fri Nov 30, 2018 11:36 pm
by billh
Thanks! The .cin file is the answer. I had apparently run the optimizer a couple of weeks ago to adjust those values, and that's what it had come up with. (They are really bad values, but that's my problem.)

I should probably learn how to create external functions some day, but I'm not using them here.

Re: Strange result with a constant in Vensim

Posted: Sat Dec 01, 2018 12:19 am
by tomfid
Cool. That was too easy.