Add route account code to the PIN file


If you are not familiar with the PIN file thus far, read the section called “The PIN file” to get a basic understanding or explore the sample PIN file that was included with your software in a text editor.

Once all the destinations have been assigned the necessary products and the transportation cost accounts have been edited to summarize information specific to your model you are ready to add this information to the PIN file. There are three main sections of the PIN file which we will be referring to in this section (xref the Basic PIN sections diagram or add the diagram again):

By default the PIN builder will have included road network definitions in the global variables section that look like the following:

 * Locate road network files (if required).
String roads_path_prefix = "../roads/";
roadShapeFile = roads_path_prefix+"access.shp";
roadShapeKey = "ACCESS_";
if (useRoutes) {
   vertices = roads_path_prefix+"vertices.csv";
   segments = roads_path_prefix+"segments.csv";
   destinations = roads_path_prefix+"destinations.csv";
   linkages = roads_path_prefix+"linkages.csv";

Review these path, file and field names and adjust as required to suit your files. At the top of the PIN file there will also be a flag to indicate if the road model should be used:

 * These variables can turn patch and route accounts off or on
boolean useRoutes = true;
boolean usePatches = true;

Edit these lines to set the useRoutes flag to true.

Use the 'Show Code' button on the bottom of the 'Road Accounts' wizard in the PIN Builder. This will translate all of your route account definitions into the correct PIN file code. This code can then be copied and pasted into the appropriate sections of your current PIN file.

There are three sections of code generated from the Road Accounts PIN Builder:

This section deals primarily with Route Account explanations however more information is available in the section called “The PIN file” regarding pasting the map and report definitions in the appropriate sections.

The following is an example of the beanshell code generated to define route accounts for the sample dataset using the PIN Builder.

 * Add the following to the TargetInit() function
       * Add road account for destination.Kapuskasing
      control.addExclusiveAccount("product.Yield.managed.SpeciesGroup.SPF", "destination.Kapuskasing");
      control.addRouteHaulAccount("destination.Kapuskasing", "route.Kapuskasing.haul");
      control.addRouteBuildAccount("destination.Kapuskasing", "");
      control.addRouteRepairAccount("destination.Kapuskasing", "");
      control.addRouteProductAccount("destination.Kapuskasing", "route.Kapuskasing.product");

       * Add road account for destination.Timmins
      control.addExclusiveAccount("product.Yield.managed.SpeciesGroup.IntHdwd", "destination.Timmins");
      control.addRouteHaulAccount("destination.Timmins", "route.Timmins.haul");
      control.addRouteBuildAccount("destination.Timmins", "");
      control.addRouteRepairAccount("destination.Timmins", "");
      control.addRouteProductAccount("destination.Timmins", "route.Timmins.product");

       * Add road account for product.unutilized.birch
      control.addExclusiveAccount("product.Yield.managed.Species.Bw", "product.unutilized.birch");


This code should be copied and pasted into the TargetInit() section of the PIN file so that these definitions are loaded each time you start your model.