Please enable JavaScript to view this site.

Vensim Help

In order to specify the curves to be used for supply and demand we need to tell Vensim the type of curve, the center, the width or truncation point and in the case of the constant elasticity curves, the elasticity.  Adding to this list the quantity, we could have up to 5 parameters for each curve.  To prevent the resulting explosion of arguments, Vensim uses a Subscript convention to specify the shapes of the curves.  Curves are specified by first a quantity argument, and second a priority argument that characterizes the curve.  The four different attributes of the curve (shape, center, width and sometimes elasticity), are contained in the final subscript of the priority argument.

This is most clearly shown by example:

buyer : us,them

pprofile : ptype, ppriority, pwidth, pextra

demand[buyer] = 20,40 

Units: Widget/Month

priority[us,pprofile] = 3,5,2,0

priority[them,pprofile] = 3,7,4,0

Units: Dmnl

We would then use demand and priority to specify the demand curve for us and them.  Though you can use any Subscript Range to represent the priority profile it is probably easiest to use the one defined above.  We have labeled the last element pextra.  For the constant elasticity case it will be the elasticity, but a more general name is used here because we may introduce additional shapes.

The pprofile Subscript must always be the last Subscript.  In addition, the Subscript just before it must be the same as the last Subscript for the quantity argument.  During simulation, Vensim will check to see that this is the case.  If it is not a floating point exception will be generated referring you to the offending equation.  This checking is not done during the regular model check.

The type of curve is specified by ptype, and the meaning of the remaining elements depend on this type.  The types are:

ptype 0 – Fixed Quantity

The quantity specified is constant for all priorities (a horizontal line as in the examples above).  The remaining elements are ignored.  This may be useful for very special cases but needs to be used with care as it can easily defeat the purpose of the allocation logic.  

ptype 1 – Rectangular

The curve will be shaped as the integral of a rectangle. The ppriority element specifies the midpoint of the curve and the pwidth element determines the speed with which the curve goes from 0 to the specified quantity. pextra is ignored. Use 11 to allocate integer amounts with ALLOCATE AVAILABLE only.

ptype 2 – Triangular

The curve will be shaped as the integral of a triangle. The ppriority element specifies the midpoint of the curve and the pwidth element determines the speed with which the curve goes from 0 to the specified quantity. pextra is ignored. Use 12 to allocate integer amounts with ALLOCATE AVAILABLE only.

ptype 3 – Normal

The curve will be shaped as the integral of a normal distribution. The ppriority element specifies the midpoint of the curve (the mean of the underlying distribution) and the pwidth element is the standard deviation of the underlying distribution. pextra is ignored. Use 13 to allocate integer amounts with ALLOCATE AVAILABLE only.

ptype 4 – Exponential

The curve will be shaped as the integral of an exponential distribution that is symmetric around its mean (0.5*exp(-ABS(x-ppriority)/pwidth) on -∞∞ to ∞∞). The ppriority element specifies the midpoint of the curve (the mean of the underlying distribution) and the pwidth element is a multiplier on x in the underlying distribution. pextra is ignored. Use 14 to allocate integer amounts with ALLOCATE AVAILABLE only.

ptype 5 – Constant Elasticity

The curve will be a constant elasticity curve.  Letting qo be the quantity passed we would have, for a demand curve:

q(x) = q0 * (x/ppriority)^(-pextra) if x > pwidth

q(x) = q0 * (pwidth/ppriority)^(-pextra)if x <= pwidth

Whereas for a supply curve we would have (see below for more discussion on supply/demand):

q(x) = q0 * (x/ppriority)^(pextra) if x < pwidth

q(x) = q0 * (pwidth/ppriority)^(pextra)if x >= pwidth

The important thing to note is that pextra is always a positive number.  Passing anything less than or equal to 0 results in a completely flat curve, that is the same as ptype 0. Use 15 to allocate integer amounts with ALLOCATE AVAILABLE only.

Positive Values in Priority Profiles

All of the elements of the priority profile should be positive, though the ptype element can be 0.  The only potential exception to this is pprioroty, which can be negative (except for ptype 5) but even for this negative values are unlikely to make sense.  

Supply versus demand

Supply curves slope up, while demand curves slope down, but you pass Vensim the same type of information for both supply and demand curves.  Vensim determines which type of curve it is from the function it is passed to.  For many-to-many allocation problem, you pass the demand curve, then the supply curve.  For the one-to-many allocation problem the curve passed is always downward sloping, though it may not always be interpreted strictly as a demand curve.