Vensim can find iterative solutions to some simultaneous equations. There are a limited number of situations where such solutions can be helpful. The first, and simplest solution is to use the SIMULTANEOUS function which effectively tells Vensim to try running around the loop until nothing in the loop changes any more. The second approach uses the FIND ZERO function and is somewhat more difficult to set up.
Example: SIMULTANEOUS Function
Suppose that you have the equations:
phone calls = Customers * normal call rate * |
effect qualit function(quality) |
quality = quality function(capacity utilization)
capacity utilization = phone calls/Capacity
As these equations stand, phone calls depends on quality which depends on capacity utilization which depends on phone calls. The logic is circular and Vensim will report a simultaneous active equation error. These equations are aimed at the minute to minute and day to day response of people to slow dial tone responses, busy circuits and bad connections. If you pick up a phone it takes a couple of seconds for you to realize the dial tone is slow. You need to dial to hit a busy circuit. You have to start talking to get a bad connection. You could create a well formed cause and effect model of this, but the time scale is very, very short. In a model aimed at understanding how Capacity, Customers and other things interact over several years such short time scales are not helpful and are likely to cause integration problems.
Vensim will report the error messages:
ERROR: Simultaneous equations involving: capacity utilization
: quality
: phone calls
: capacity utilization
Vensim has detected this error in attempting to compute capacity utilization. This can be removed by adding a SIMULTANEOUS function to the variable as in:
capacity_utilization = SIMULTANEOUS(phone_calls/Capacity,.8)
The SIMULTANEOUS function must appear first on the right hand side as a defining function. The first argument is the expression you would like to be computed. The second argument is an initializing expression, which is usually just a constant. The initializing expressions cannot, themselves, contain any simultaneous equations. At the initial time Vensim will initialize the variable using the second argument and then compute all the equations in the loop iteratively until the values of the loop variables no longer change significantly. At other times Vensim will compute iteratively starting from the values at the previous time step.
There is no guarantee that the iterative computation will converge. If it fails to do so you will receive a warning message and intermediate variable values will be used. You can often adjust equations, even introducing a pseudo integration step, in order to get convergence. The model kidney.mdl that ships with the sample models gives an example of how to do this.