TREND function --> Units Check

Use this forum to post Vensim related questions.
Post Reply
mkunovja
Junior Member
Posts: 6
Joined: Wed May 31, 2017 6:38 am
Vensim version: PLE+

TREND function --> Units Check

Post by mkunovja »

Hello fellow Vensimers,

I am stuck with the problem of WHAT UNIT to use when using the TREND function.

Whatever I try I will always fail the Units Check with my model.

I went through STERMANs chapter 16 of course, and also consulted the Vensim Help section. In the Vensim Help (under Dynamic Functions --> TREND) section an example file (TREND.mdl) is provided, but unfortunately it also fails the Units Check on Vensim.

I then took a step back and created a very simple mock population growth model including a TREND function (TREND( {input} , {avgtime} , {initrend} ) and tried to fix it. The only thing I found out is that when I use either dmnl or 1 as a unit Vensim only returns one error. In all other cases it returns two.

1/Time as usually recommended does also not work in either case.

Cheers,
Max

Here when using 1/Year:

***********************************************
Error in units for the following equation:
#Materials Trend>TREND>avval# =
INTEG( ( Material Usage per Unit
- #Materials Trend>TREND>avval# )
/ ( 1) ,
Material Usage per Unit
/ ( 1
+ ( 0)
* ( 1) ) )
#Materials Trend>TREND>avval# --> Material/Widget
Material Usage per Unit --> Material/Widget

Analysis of units error:
Units missmatch in INTEG
( Material Usage per Unit
- #Materials Trend>TREND>avval# )
/ ( 1)
Has Units: Material*Year/Widget
Material Usage per Unit
/ ( 1
+ ( 0)
* ( 1) )
Has Units: Material/Widget
***********************************************
Error in units for the following equation:
Materials Trend =
TREND ( Material Usage per Unit ,
1,
0)
Materials Trend --> 1/Year
Material Usage per Unit --> Material/Widget

Analysis of units error:
Right hand and left hand units do not match
Materials Trend
Has Units: Dimensionless/Year
TREND ( Material Usage per Unit ,
1,
0)
Has Units: Dimensionless
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: TREND function --> Units Check

Post by Administrator »

Materials Trend =
TREND ( Material Usage per Unit ,
1,
0)
Materials Trend --> 1/Year
Material Usage per Unit --> Material/Widget

Analysis of units error:
Right hand and left hand units do not match
Materials Trend
Has Units: Dimensionless/Year
TREND ( Material Usage per Unit ,
1,
0)
Has Units: Dimensionless

Instead of having "TREND(Material Usage per Unit , 1, 0)" , try creating two new variables,
avgtime = 1 (make sure you use the correct units for avgtime)
initrend = 0 (make sure you use the correct units for initrend)
Then change ""TREND(Material Usage per Unit , 1, 0) " to "TREND(Material Usage per Unit , avgtime , initrend)"

And it should be ok.

Embedding numbers into equations is bad practice, and Vensim interprets these as dimensionless numbers. Putting them in separate equations makes the model easier to read and understand, and allows you to experiment by changing these constants.
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
mkunovja
Junior Member
Posts: 6
Joined: Wed May 31, 2017 6:38 am
Vensim version: PLE+

Re: TREND function --> Units Check

Post by mkunovja »

Thank you for this quick and insightful reply.

It did not provide the solution to the problem directly but it certainly tipped me off into the right direction.

In case somebody else should ever face that problem:

In my case Initial Time has "Fraction/Year" as a Unit. This will lead to "1/Year" as a Unit for the TREND variable.
Administrator
Super Administrator
Posts: 4589
Joined: Wed Mar 05, 2003 3:10 am

Re: TREND function --> Units Check

Post by Administrator »

In my case Initial Time has "Fraction/Year" as a Unit. This will lead to "1/Year" as a Unit for the TREND variable.
I don't think I've ever come across a model that has a time unit of "fraction/year".
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
tomfid
Administrator
Posts: 3808
Joined: Wed May 24, 2006 4:54 am

Re: TREND function --> Units Check

Post by tomfid »

Check the usage in the TREND model in the help system for further usage hints.
Post Reply