# Vensim Help

 VMIN Function

The last equation also requires some explanation.  In order to start a task, any prerequisite task must first be finished.  We could write a set of 9 equations, "hard-wiring" the relationships that define the prerequisites.  A shorter method allows us to specify the relationships in one equation.

 Ø Click on task has started, write the equation as below, then click OK.
 VMIN( IF THEN ELSE(
 1))

Units: Drawing

This equation uses the VMIN function, which operates on subscripts marked with an exclamation mark  !.  Because there are 3 tasks and 3 prerequisite tasks, this equation takes on 9 separate values.

For example, let us look at the design task.  Design has no prerequisites, the value for:

is a prerequisite[design,prereqtask] = 0,0,0

is zero for all the prerequisite tasks.  The IF THEN ELSE function evaluates the 3 values of is a prerequisite[design] and returns zero, so it fails the logical test and moves to the ELSE statement, which returns a value of 1.  This means that the design task can start as soon as the model simulates, it has no prerequisite tasks.

On the other hand, let us look at build.  Build has both design and prototype as prerequisite tasks, as in:

is a prerequisite[build,prereqtask] = 1,1,0

The IF THEN ELSE function evaluates is a prerequisite[build,prereqtask] for the three prerequisites and returns 1 in two cases.  For each case, it moves to the THEN statement where it looks at task is done[prereqtask] for the particular prereqtask (let's say prototype).  If the prototype work is finished, the task is done variable returns 1, otherwise it returns 0.  If it returns 0 for any of the prerequisite tasks, the VMIN function also returns 0, which prevents that task from starting.  Once all the prerequisite tasks return 1, VMIN will return 1 and the task can finally start.

 Ø Select Model>Check Model (Ctrl + T).
 Ø Select Model>Units Check… (Ctrl + U).

Your model should check out OK.  If not, compare equations (and structure) to the equations above.