The Formulas
The key computation in this model is:
! For each part P and period T, the total demand =
external demand + demand generated by parents
one lead time in the future;
@FOR( PXT( P, T) | T + LT( P) #LE# NP:
TD( P, T) = ED( P, T + LT( P)) +
@SUM( USES( P2, P): TD( P2, T + LT( P)) *
NEEDS( P2, P));
);
For each part in each time period, the amount of that part we must begin producing in the period is the amount we will need one lead time away to satisfy, 1) external demand, and 2) internal production requirements. The subexpression that gives external demand is simply:
ED( P, T + LT( P))
The remainder of the expression:
@SUM( USES( P2, P): TD( P2, T + LT( P)) *
NEEDS( P2, P));
sums up the amount of the part needed for internal production of all other parts one lead time away. Note we place a logical condition on the outer @FOR loop in this calculation (shown here in bold):
@FOR( PXT( P, T) | T + LT( P) #LE# NP:
Without this condition, the calculation would extend beyond the final period in the TIME set.