General steps
When merging two separate configurations for two models in one region it is necessarry to go through the following 10 steps. It is best to start with the configuration of one of the two models to be merged and add one model to the configuration of the other model. The basic configuration files which are not going to be changed (like ModuleDescriptors, DisplayDescriptors, Parameters, etc) are already available and up to date (if not use the most recent version of the files).
Before you start to manually amend all the files please note that there is a tool available to simplify the merge activity
The merge models tool has been developed which carries out most of the following ten steps automatically. For more information see below.
- merge Locations and LocationSets (can be done with the mergemodels tool, see below)
- merge ModuleInstanceDescriptors (can be done with the mergemodels tool, see below)
- merge WorkflowDescriptors (can be done with the mergemodels tool, see below)
- merge ModuleInstanceSets (can be done with the mergemodels tool, see below)
- merge IdMapDescriptors (can be done with the mergemodels tool, see below)
- merge Branches and Grids (Grids can be merged with the mergemodels tool, see below, branches.xml has to be merged manually!)
- edit ScenarioEditor (can be done with the mergemodels tool, see below)
- edit TimeSeriesDisplayConfig and Explorer (can be done with the mergemodels tool, see below)
- create Filters, GridDisplay, DisplayGroups (Filters and GridDisplay can be merged with the mergedmodels tool, but it is advisable to also merge the display generator spreadhsheets, DisplayGroups.xml has to be merged manually!)
- copy IdMapFiles, MapLayerFiles, ModuleConfigFiles, ModuleDataSetFiles, ModuleParFiles, WorkFlowFiles, ColdStates and Modules (has to be done manually!)
Merging using the 'MergeModels' Tool
Part of the work in the steps as described on the right side of this page can now be done with a 'merge models' tool. The 'merge models' tool merges the following configuration files of two separate NGMS models for the same region into one new file for that region:
- Griddisplay.xml
- Grids.xml
- ScenarioEditor.xml
- TimeSeriesDisplayConfig.xml
- Branches.xml
- Filters.xml
- IdMapDescriptors.xml
- ModuleInstanceSets.xml
- Explorer.xml
- Locations.xml
- LocationSets.xml
- ModuleInstanceDescriptors.xml
- WorkflowDescriptors.xml
This means that the merge tool performs steps 1 to 9 (apart from the DisplayGroups) from the above list. The DisplayGroups xml file can be updated using the original Displays generation spreadsheet as provided as part of the configuration (in the ModuleDataSetfiles folder).
The last steps to complete the merge activity are:
- merging the DisplayGroups.xml files by using the two display generation spreadsheets of the original models. The contents of the sheets DisplayGroups_plotdef and DisplayGroups_folders have to be merged into one, by adding the information from one spreadsheet into the other one (see Merge DisplayGroups ). More information on how to to fill in the colums and rows in the spreadsheet can be found in Step 9. Displays above.
- copy all remaining model specific files of one of the two NGMS model configurations into the folder structure of the other NGMS model configuration (see step 10)
- copy the model data (folder with model abbreviation) from the Modules folder into the Modules folder of the other model configuration.(see step 10)
How to use the mergemodels tool?
- Download the most recent mergemodels tool here MergeModels Tool and copy all the files of the zip file to the directory, in which you want to carry out the merge activity (e.g. D:\temp\NGMS)
- this file is the location of the configuration files of the model you want to add to the first model (referencing the Config folder).Change the input file (mergemodels.inp) to reflect the structure of the two configuration directories of the models to be merged. In this file, the first line must be the location of the configuration files of the first model to merge (referencing the Config folder). The second line in
Example of mergemodels.inp:
D:\temp\NGMS\Southern_SA\config
D:\temp\NGMS\Southern_NK\config
- Run the merge program by double-clicking on the file mergemodels.bat. This batch file starts the fortran program with the input file as an argument.This tool produces a Config folder with merged configuration files. The first line in the input file refers to the directory where the merged files are produced.
Contents of mergemodels.bat:
rem lf90 mergemodels
mergemodels <mergemodels.inp
Source: Fortran code is available in the Mergemodels.f90 file and is compiled with Lahey.
- after merging the files with the merged models tool don't forget to manually merge the DisplayGroups (see step 9) and copy all other relevant files to the merged application (see step 10)
What is next?
The next step is to check the merged configuration in a Stand Alone system of the region in question. Check if the NGMS Stand Alone application starts without errors and then run through the tests as described in the document 'UK Memo 080919 NGMS test scripts for
testing new model.pdf'.