Set Global Variables

The first section of every PIN file begins with a global declaration section. In this section you must include the definition of the planning horizon, and names of required input files. You may also change the settings of Patchworks control variables (for example, to change the background colour of the map display window).

[Tip]Tip

The initial section is also a good location for comments and meta-data that describe the parameters in the analysis. Keep track of the assumptions used in the analysis in order to remind yourself of the steps and to help others follow in your footsteps.

The global variable section of the sample data set is as follows.

        /* Set global variables */ 
                      
        1
        int periods = 40;
        Horizon.setHorizon(periods, 5);
        
        2
        boolean useRoutes = true;
        boolean usePatches = true;

        3
        String path_prefix = "../tracks/";

        4
        blocks        = path_prefix+"blocks.csv";
        curves        = path_prefix+"curves.csv";
        features      = path_prefix+"features.csv";
        products      = path_prefix+"products.csv";
        tracknames    = path_prefix+"tracknames.csv";
        treatments    = path_prefix+"treatments.csv";
        accounts      = path_prefix+"accounts.csv";

        5
        block_shape   = "../blocks/gamma2.shp";
        block_key     = "GRIDCODE";
        
        6
        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";
                       }
      

1

You must specify the time horizon of the model, and the width of the planning periods. In this example we hve stored the number of periods as an integer variable, thus the variable name periods can be referenced elsewhere in the PIN file. This allows easy changes to the time horizon in just one location, instead of searching through the entire file for every instance of the number of planning periods. The planning horizon has been set at 40 periods, 5 years each for this sample dataset.

2

The use of roading has been given the variable name useRoutes, and patching the name usePatches. Later in the file, and for any other scripts, these variable names can be used. The "true" can be toggled to "false" when roading and/or patching is not used.

3

This statement creates a variable named path_prefix which identifies a directory location for the data input files. In this particular data set all the input files are held in a sibling folder named "tracks". In subsequent statements the data files can be refered to using a relative location. This technique is a time saving feature that reduces the number of changes needed to be made if files are moved or renamed.

4

These statements identify the core files that make up the Patchworks data model. These files were generated by the ForestModel XML and Matrix Builder. By using the path prefix variable this section never has to be changed, it can be cut and pasted between PIN files. The content of these files and their relationships to one another and the model are explained in excruiating detail in the section Patchworks Data Model chapter.

5

This statement identifies the block spatial data file. This block file is located in a separate folder and does not use the variable path_prefix. 'Block_key' is the name of the data column in the block spatial data file that provides the block identification label.

6

These statements identify the core files that make up the Patchworks road model. These files were generated by the Build Road Segments tool. By using the path prefix variable this section never has to be changed, it can be cut and pasted between PIN files. Note the first use of the boolean "useRoutes". These files will only be loaded if useRoutes is "true". The content of these files and their relationships to one another and the model are explained in detail in the section called “Road model data files”. chapter.