Exception equations allow you to write different equations for different subscript elements without needing to define Subranges or write an excessively large number of equations. For example, suppose that you are tracking inventory by store and product, but that one product at one store has an extra outflow. In this case rather than writing one equation for each product and store combination you could write:
product: (p1-p50)
store: (s1-s8)
inventory[store,product] :EXCEPT: [s3,p5] = INTEG(
receipts[store,product] - sales[store,product],
init inventory[store,product])
inventory[s3,p5] = INTEG(
receipts[s3,p5] – sales[s3,p5] – special giveaways,
init inventory[s3,p5])
You create exception just as you would create any other equations but with the :EXCEPT: keyword and a sequence of exceptions following the equation subscript. This must appear just after the closing bracket ] and before the equal sign =. When working in the Equation Editor this needs to be entered on the same line as the variable name appear (again before the equal sign). Follow the :EXCEPT: keyword with one or more set of subscripts that have alternative equations defined. These exceptions are enclosed in square brackets [] and separated by commas as in:
Inventory[store,product] :EXCEPT: [s1,p1], [s2,p2], [s3,p3]
You can use the :EXCEPT: formulation in more than one equation. When Vensim checks the model it will go through all of the equations to determine what has been defined. Equations for excepted subscript combinations will not be executed.
While :EXCEPT: can be used in most equations, it cannot be used in Data equations or in Constant (or Unchangeable Constant) equations that assign more than one value. Including redundant exceptions such as :EXCEPT: [sub,t1],[s1,t1] is benign, but does have a small computational overhead so should be avoided. The same is true for irrelevant exceptions such as inv[s1,t1] :EXCEPT: [s2,t1]. When Subranges are being used to specify different equations it is not necessary to use Exception Equations.
Both the number of Subscripts and their order after :EXCEPT: must be appropriate for the variable being defined. It they are not an error message will be given.
The order of equations does not matter. Vensim will check to be sure that all values for all subscript elements that are used are computed, and that no values are computed by more than one equation. If only a subset of values are computed for a variables the undefined elements will not display in graphs and will show as a double dash -- in tables.