Strange result with a constant in Vensim

Use this forum to post Vensim related questions.
Post Reply
billh
Member
Posts: 45
Joined: Tue Jan 10, 2017 11:48 pm
Vensim version: DSS

Strange result with a constant in Vensim

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

Re: Strange result with a constant in Vensim

Post 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.)
Administrator
Super Administrator
Posts: 4573
Joined: Wed Mar 05, 2003 3:10 am

Re: Strange result with a constant in Vensim

Post by Administrator »

Are you using external functions?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391

Units are important!
http://www.bbc.co.uk/news/magazine-27509559
billh
Member
Posts: 45
Joined: Tue Jan 10, 2017 11:48 pm
Vensim version: DSS

Re: Strange result with a constant in Vensim

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

Re: Strange result with a constant in Vensim

Post by tomfid »

Cool. That was too easy.
Post Reply