Unit Check problem

Use this forum to post Vensim related questions.
Post Reply
jmu
Member
Posts: 21
Joined: Fri Nov 14, 2008 12:32 pm

Unit Check problem

Post by jmu »

Hi,
I have a stock variable named "Content" (unit "Euro") and want to know, if it currently increases or decrease.

To calculate this I created a variable
IncrDecr = Content-DELAY1(Content, 1)

As far as I see IncrDecr is < 0, 0 or >0 as I need it.

But what is the correct unit? I alsways get an Unit Check error because DELAY1(Content, 1) has unit "Euro*Year" while Content has unit "Euro". How to overcome this?

Or is there another way to determine if a stock variable is increasing or decreasing?

Thanks for any help,
jmu
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post by LAUJJL »

Build a new level called old content
old content = integ(content - oldcontent) / time step
unit Euros initialised at 0
IncrDecr = content - oldcontent unit Euros
Regards.
JJ

[Edited on 28-4-2010 by LAUJJL]
jmu
Member
Posts: 21
Joined: Fri Nov 14, 2008 12:32 pm

Post by jmu »

Thanks for the help.

Meanwhile I come up with a different idea:

incrdecr = (sum of all inflows to content) - (sum of all outflows of content)

That should also work.

Thank you,
jmu
jmu
Member
Posts: 21
Joined: Fri Nov 14, 2008 12:32 pm

Post by jmu »

What I wanted do add:
The unit-problem with delay is still here (in other situations).

The manuals says:

Units: DELAY1(units,time) --> units

If I understand it right then the output unit is the same as the input unit. But I always see the time unit involved. This bothers me and causes some unit checking problems.

Best regards,
jmu
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post by LAUJJL »

Your definition of the incrdecr is the initial definition of the variation of a level and it is evident. Is il like writing that X = X. this variation has units Euros / time unit and it is right. One can consider that the difference between two levels is expressed in Euros / month For instance
if at time 10, the level equals 10 and at time 11 the level equals 12. you will say that the level has increased with a speed of 2 Euros by month.
But if you compare the two levels in my initial formulation, you get a difference between 12 Euros and 10 Euros, which is expressed in Euros, which is right too. Units checking is not only a pure mathematical system but it must always makes sense with reality and be intuitively understandable.
Otherwise if you want absolutely to use the delay1 function which is not necessary in this case, post the model.
I do not see what could be wrong in the DELAY1(units,time) --> units. Look at the exact definition of the DELAY1 in the Vensim guide. You will understand how it works.
Regards.
JJ
jmu
Member
Posts: 21
Joined: Fri Nov 14, 2008 12:32 pm

Post by jmu »

Thanks for the discussion and your patience.

Concerning X = X:
Ok, but this allows me in advance to determine, if a stock variable will increase / decrease in the next time step. And when I use a delay I can simulate some adaption actions. But you already showed me a different way.

Concerning the unit check problem:
I played arround, implemented the delay1 as described in the manual and suddenly I saw the problem.

When I type DELAY1(input, 1) I have the error.
But when I type DELAY1(input, del-time) and del-time is defined as 1 unit Year then all is fine.

I find this a little bit annoying because I have to clutter my model with varibales (constant) just to avoid unit check errors.

Greetings,
jmu
LAUJJL
Senior Member
Posts: 1427
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

Post by LAUJJL »

When Vensim sees a number it is more or less automatically assigned a dmnl dimension, 'no dimension'. This is why it sometimes does not generate any error when using stand alone value. It is a better practice not to use any value at all and consider it as a constant, which it is. It makes it possible to make the value vary with different simulations, study its sensibility etc..
System dynamics is an extremely demanding method where some rules must be followed strictly, otherwise beware!
Regards.
JJ
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Post by tomfid »

One option is to use the TREND function.

Another option is:

ContentChangeRate = ( Content - SMOOTH(Content,horizon) )/horizon Unit: Euro/year
Horizon = ... (years)

If you want the instantaneous rate of change, you can set Horizon = TIME STEP; otherwise you can use a longer horizon.

What you find annoying (making constants to avoid units check errors) is actually an essential modeling practice. If you leave parameters hidden in your equations, there's no way to test them for sensitivity. You can always hide them to declutter your diagram. Also, for your model to be robust to changes in the TIME STEP, you may want to set del-time = TIME STEP, as for Horizon above.

Tom
jmu
Member
Posts: 21
Joined: Fri Nov 14, 2008 12:32 pm

Post by jmu »

... hidden in your equations, there's no way to test them for sensitivity

That's an argument !!!!

Thanks,
jmu
Post Reply