In order to make some diagrams look "pretty", I'm wondering if there is a way to define analytic functions like we can define lookup tables. For instance, it is rather easy to:
TableFunction1 = [set of points defined by user in Vensim Equation Editor]
TableFunction2 = [set of points defined by user in Vensim Equation Editor]
Variable1 = IF THEN ELSE (switch = 1, TableFunction1(input), TableFunction2(input))
Note: Variable1 only has three arrows coming into it. Clean diagram.
Is there away to have to substitute analytic functions in place of the Table functions? I tried Macros but I would like to use SyntheSim on some of the function parameters.
Example (if this exists, it might like):
Function1 (input)= Input * param1 + param2^param3
Function2 (input)= Input * param1 + param4^param5
Variable1 = IF THEN ELSE (switch = 1, Function1(input), Function2(input))
The key would be that param1, param2, could be manipulated in a Sketch view. And Variable1 still only has three arrows coming into it because the Functions are defined in a sketch elsewhere. I think PowerSim can do this easily. Can Vensim?
Analytic lookups? (Functions)
-
- Super Administrator
- Posts: 4838
- Joined: Wed Mar 05, 2003 3:10 am
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
I created a little test model and wasn't able to get the functionality I wanted. Maybe I am doing it wrong. What I did (with liberal syntax):
:MACRO:
Function1 (input)= Input * param1 + param2^param3
Now, if I want to change Param3 in Synthesim so that it changes the macro value, param3 needs to be in a sketch and it needs to be passed a parameter in the macro. The macro call now becomes "Function1(input, param3)". I tried leaving it out of the declaration and (of course) got an error about param3 being an unknown local variable.
If the macro becomes "Function1(input, param3)", then the sketch has more arrows and I'm back to the same problem as before.
Maybe hiding arrows is the easiest, or am I missing something?
[Edited on 7-16-2008 by Travis]
:MACRO:
Function1 (input)= Input * param1 + param2^param3
Now, if I want to change Param3 in Synthesim so that it changes the macro value, param3 needs to be in a sketch and it needs to be passed a parameter in the macro. The macro call now becomes "Function1(input, param3)". I tried leaving it out of the declaration and (of course) got an error about param3 being an unknown local variable.
If the macro becomes "Function1(input, param3)", then the sketch has more arrows and I'm back to the same problem as before.
Maybe hiding arrows is the easiest, or am I missing something?
[Edited on 7-16-2008 by Travis]
-
- Senior Member
- Posts: 1107
- Joined: Wed Mar 12, 2003 2:46 pm
From the docs: The one exception to the local nature of macro variables is that you may specify a model variable by following its name with a dollar sign $. For example you can use TIME STEP$ inside of a macro to refer to the model variable TIME STEP. Only unsubscripted variables may be referred to in this manner.