29  Integrating complex submodels

Finally, after much of the modelling equivalent of blood and sweat, we reach the point where we can combine the contribution of all our modules with the full implementation of the Pond Trade model (step 13).

29.1 Integrating module 4 (ARID) and 5 (routes)

We use module 4 (ARID) as the starting template and add import-routes-from-file and all route-related procedures. We should be able to import the route data saved before and load it during setup, as the last step before setup-patches:

29.2 Integrating Pond Trade (step 13)

Next, bring in all the extra code and interface objects from Pond Trade (step 13). Most procedures require no modifications. The exceptions are:

  • There is no isLand variable here and, given that there are no water patches, we should simply erase the code that distinguishes it.
  • Since there are only land patches and we are using the standard deviation of elevations to assign pathCost, there are no relativePathCostInLand or relativePathCostInPort. We can remove all references to these two parameters, leaving the corresponding cultural traits of transport technology as the sole modifiers of pathCost.

We carefully organise the scheduling of calls in setup and go:

29.3 ARID as a factor of settlement productivity

Finally, we connect ARID to settlement productivity.

First, we calculate two new settlement variables: catchmentArea and ARIDinCatchmentArea. The latter is the average ARID within the settlement catchment area. In turn, the catchment area is calculated using a gradient decay function, dependent on sizeLevel and two parameters, catchmentSlope and catchmentRadiusMaximum. This is a very preliminary solution, but will suffice for us to observe the dynamics of Pond Trade playing out over the Messara Valley.

And voilà! We can now run our boosted Pond Trade model within the context of our case study.

29.4 Checking the milestone File (module 6)

View of MesaraTrade after set up
View of MesaraTrade after setup

View of MesaraTrade interface
View of MesaraTrade interface

Run the model for a few years using the default configuration. Observe trader behaviour and the overall dynamics of settlement size and trade between them. Is there something off about how the new version is running?

Think about the case study and the mechanisms targeted by the original Pond Trade model. What aspects do you find problematic?