model check - variable not defined

Use this forum to post Vensim related questions.
Post Reply
schalkj
Junior Member
Posts: 13
Joined: Thu Jul 28, 2011 11:19 am
Vensim version: PRO

model check - variable not defined

Post by schalkj » Fri Aug 09, 2013 8:34 am

Hi all,
I am a novice modeller in Vensim, and are rebuilding models I find in articles and books to learn how to model. I have Vensim 6.1C Professional, and run it on Windows 7 Professional and Windows 7 Home.

I used the Text Editor to enter a model developed by Nicole Zimmerman in her book Dynamics of Drivers of Organisational Change ( I found it a great exposition on organisational inertia and change wrought by external factors. She uses System Dynamics to develop a model of the dynamics of organisational change).

This is my second attempt at using the Text Editor to enter a model. I ran Model Check after each variable to ensure there are no syntax errors (the only way that I could learn how Vensim interpretes text and commands!)

After completing model entry, Model Check threw out the following errors:

NOT DEFINED: -change in cust.orient.- not defined - assumed exogenous.
NOT DEFINED: -NYSE Fraction of Floor Trade'- not defined - assumed exogenous.
NOT DEFINED: -REF.LIQUIDITY ALGORITHMS- not defined - assumed exogenous.

I deleted the variables, and re-entered them ,yet it had no effect. Changing the view to As Sketch, and running Model Check again had the same effect (obviously). What is interesting is that is clear from the Equation Editor that Vensim did not pick up the linked variables I entered as an equation when defining the variable in Text Editor.

I know from searching the topics in this forum that checking the Supplementary box in the Equation Editor apparently solves the problem. However, I dislike using an override to fix a problem, and would rather learn how not to make the same mistake again.

I've attached the model, and would really appreciate it if someone could tell me what I am doing wrong.

Thanks a lot

Schalk
Attachments
Dynamics of Organisational Change.mdl
Vensim model from Dynamics of Drivers of Organisational Change
(36.4 KiB) Downloaded 67 times

tomfid
Administrator
Posts: 2393
Joined: Wed May 24, 2006 4:54 am

Re: model check - variable not defined

Post by tomfid » Fri Aug 09, 2013 5:44 pm

First of all, I applaud your efforts to replicate a model from the lit. I do this quite a bit myself, and find that I learn a lot more about a model by hand coding it.

If you look closely at the error message, it indicates that "change in cust.orient." is undefined - you have two instances of "change in cust. orient." and one without the space.

Similarly, you have NYSE Fraction of Floor Trade' and NYSE Fraction of Floor Trade (with and without the ' ) and "REF. LIQUIDITY ALGORITHMS" with and without a space.

Here's a fixed version:
Dynamics of Organisational Change 2.mdl
(36.46 KiB) Downloaded 77 times
It runs now (might still be wrong of course).

Two things might make this easier in the future:
- Avoid punctuation and special characters in variable names, so that you can skip the "" syntax. It's easier to type, and you can always use the sketch or equation editor to rename things later - that way renaming is managed globally.
- If you're typing in the listing, build it with the sketch & equation editors, even if there's no diagram. That way you can choose existing variables from the editor's list (avoids typos). Also, you can add new variables by writing them in an equation, and Vensim will volunteer to add them to the model diagram for you (Pro/DSS only).

schalkj
Junior Member
Posts: 13
Joined: Thu Jul 28, 2011 11:19 am
Vensim version: PRO

Re: model check - variable not defined

Post by schalkj » Fri Aug 09, 2013 8:10 pm

Hello Tom,
Thanks for the quick reply and excellent advice. I really feel the fool now - did not expect of you to pick up my errors. And I felt so good using the Find function to fix all my errors :oops: But the model seems fine now, except for three variables apparently not used in the model.

Must say I learned a lot using the Text Editor - and next time I'll use the>Var function to avoid typos. And will ignore fancy punctuation.

Nicole Zimmerman also created a generic model for organizational change - I'll use the As Sketch view when I replicate that model, and probably pester you again with questions. :D

A quick question if you don't mind. It concerns checking for units consistency. Firstly, I am not mathematically proficient, and have forgotten most of what I learned about differentiation and integration. When it comes to checking units consistency I can figure out multiplication/division, etc. But I have a problem when it comes to Flows and Levels. Flows are unit/time period, and Levels are only units. So how does one work out units consistency? Same with lookup tables - they are Dmnl, but I get inconsistency errors linking with flows/variables. There are quite a bit of information out there on building SD models, but I haven't yet found something that teaches me how to do units consistency checking (probably too basic?). I would appreciate if you could refer me to something that will help me.

Thanks again for the excellent help, and the great advice. Certainly keeps me motivated to keep on trying.

Regards
Schalk

tomfid
Administrator
Posts: 2393
Joined: Wed May 24, 2006 4:54 am

Re: model check - variable not defined

Post by tomfid » Sun Aug 11, 2013 2:53 pm

If you write out the integral, it's

stock = { flow*dt + initial stock

So the flow has to have the same units as the stock, with a time unit in the denominator. Then the flow's time cancels with dt (TIME STEP).

Lookups can have units, though typical practice is to make things dimensionless, which suppresses warnings and makes it easier to scale the shape of the relationship. For example:

y = normal y * lookup( x / normal x )

where normal y and normal x are constants with units matching x and y, and lookup() is dimensionless.

Tom

schalkj
Junior Member
Posts: 13
Joined: Thu Jul 28, 2011 11:19 am
Vensim version: PRO

Re: model check - variable not defined

Post by schalkj » Mon Aug 12, 2013 6:57 am

Thanks Tom,
This helps a lot.
Thanks for your patience and clear answers. By the way, I enjoyed and benefitted from your videopresentation on lookup tables (picked up the reference from one of the posts)

Regards
schalk

Post Reply