The Macro Structure feature allows for a module to be chosen from a group of modules at execution time. An example of its useage is an area which is a wetland in wet years and a grassland during dry periods. The module used to represent the area can be chosen from the structure selection by another module setting the "HRU_struct" parameter for the structure module.
The first line of the macro is the module or structure name. In this case MyStructA, MyStructB and MyStructC.
The following lines up to the command token, list the modules making up the structure. They can be arranged in any order and are addressed as 1, 2, etc. to n.
The tokens command and end complete the definition of the group.There should not be any lines between command and end.
Multiple macro groups/structures and macros can be defined together.
MyMacro1 // executed when "MyStructaA HRU_struct" = 1
Module Naming Convention.
Group variable names cannot use the original variable name otherwise their would be a naming conflict. To avoid this problem, the first macro structure defined has the suffix "@a" the next "@b", "@c" etc. Because of this the search order defined in a following section has been adopted. N.B. uppercase designates a group and lowercase designates a structure.
Since a structure can contain a diverse collection of modules having different parameters the structure will have all of these parameters. However, for any HRU only the parameters used by the module selected need to be defined. Any others can be left at their default values for that HRU.
Module Linking Order.
Modules can use "*" or explicitly specify the source module name, e.g. *.hru_t and Obs.hru_t for the linking to work correctly. Obs.hru_t can only link to the module"Obs" and no other module or group.
The module linking search order is as follows.
- Specific module, e.g. Obs.hru_t. Will only match Obs.hru_t.
- Wild root module or group, e.g. *.hru_t and *[email protected] *.hru_t would match any module with an output hru_t. *[email protected] will only match the hru_t output of the first group defined i.e. with suffix @a
- Wild group module stripped of its group suffix. *[email protected] is reduced to *.hru_t before searching. *[email protected] will match any module with an output hru_t.
- Wild group module stripped of its group suffix and a search is made of any groups after their group suffix has been removed. *[email protected] is reduced to *.hru_t before searching all groups for *.hru_t, i.e. after their suffix has been removed.