STEM help / Training

Exercise 43: Aggregating the output of a template

The preceding exercises have replicated more or less the whole model to avoid complications with dependencies in a model. Suppose we wanted to add a single transformation to the model to pick up the number of DSL access subscribers to drive another calculation. The trouble is that the transformation won’t know which copy of the DSL access service to refer to in the replicated model.

Save the model as WiMAX-DSL43

  1. Create a new transformation called DSL access subscribers, and define its input as connections from the DSL access service.
  2. Create a ‘dummy’ resource for it to drive and create a requirement linking the two elements in order to avoid a spurious warning about the transformation having no requirements.

  1. Try running the model. You should get this error:
    Template "City" replicates "DSL access" but not "DSL access subscribers"
  2. Try copying the service manually.

You will see that any copies of the original service will not inherit the link to the transformation. This is because a single transformation input can only refer to one element.

Although you could use an expression transformation to get round this with a number of manually copied elements, this technique is not very extensible and cannot be automated for template replication. Instead you can use the elegant solution of an ‘aggregator’ resource.

  1. Delete the manually copied service before proceeding.
  2. Create another new resource called DSL access aggregator and then create a requirement for this resource from the service.
  3. Then set this aggregator resource as the input to the DSL access subscribers transformation, as shown below:

  1. Now try manually copying the DSL access service. As many services can have separate requirements for a resource, each copy inherits its own requirement for the resource.
  2. Again, please delete this manually copied service before proceeding.
  3. Double-click the link between DSL access aggregator and DSL access subscribers and change the basis to Used Capacity.

The total used capacity of the aggregator resource is precisely the total of the connections from all copies of the DSL access service.

Save and run the model

The model should replicate safely now and you should be able to verify that the output of the DSL access subscribers transformation is the desired total.

  1. Go back to the Editor, look at the replicated model and see if you can locate all the separate requirements for the DSL access aggregator resource!

Things that you should have seen and understood

Aggregator resource
Basis, Used capacity

 

© Implied Logic Limited